diff --git a/build.gradle b/build.gradle index c63e37090..b7c0796e1 100644 --- a/build.gradle +++ b/build.gradle @@ -73,11 +73,12 @@ license { group = 'TechReborn' dependencies { - minecraft "com.mojang:minecraft:1.14.2" - mappings "net.fabricmc:yarn:1.14.2+build.7" + minecraft "com.mojang:minecraft:1.14.3" + mappings "net.fabricmc:yarn:1.14.3+build.9" modCompile "net.fabricmc:fabric-loader:0.4.8+build.155" - modCompile "net.fabricmc.fabric-api:fabric-api:0.3.0+build.184" + //Fabric api + modCompile "net.fabricmc.fabric-api:fabric-api:0.3.0+build.187" modCompile "io.github.prospector.modmenu:ModMenu:1.5.4-85" @@ -85,7 +86,7 @@ dependencies { // transitive = false // } - compile 'RebornCore:RebornCore-1.14.2:4.0.0.14' + compile 'RebornCore:RebornCore-1.14.3:4.0.0.14' compileOnly "com.google.code.findbugs:jsr305:+" } diff --git a/settings.gradle b/settings.gradle index 5e4a221ec..f63c2e9c4 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1 +1 @@ -rootProject.name = "TechReborn-1.14.2" \ No newline at end of file +rootProject.name = "TechReborn-1.14.3" \ No newline at end of file diff --git a/src/main/java/techreborn/blocks/BlockAlarm.java b/src/main/java/techreborn/blocks/BlockAlarm.java index ce85d5982..5eec04d26 100644 --- a/src/main/java/techreborn/blocks/BlockAlarm.java +++ b/src/main/java/techreborn/blocks/BlockAlarm.java @@ -24,7 +24,9 @@ package techreborn.blocks; -import net.minecraft.ChatFormat; +import net.minecraft.text.Text; +import net.minecraft.text.TranslatableText; +import net.minecraft.util.Formatting; import net.minecraft.block.Block; import net.minecraft.block.BlockRenderType; import net.minecraft.block.BlockState; @@ -34,8 +36,6 @@ import net.minecraft.client.item.TooltipContext; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemPlacementContext; import net.minecraft.item.ItemStack; -import net.minecraft.network.chat.Component; -import net.minecraft.network.chat.TranslatableComponent; import net.minecraft.state.StateFactory; import net.minecraft.state.property.BooleanProperty; import net.minecraft.state.property.DirectionProperty; @@ -162,8 +162,8 @@ public class BlockAlarm extends BaseTileBlock { @Override - public void buildTooltip(ItemStack stack, @Nullable BlockView worldIn, List tooltip, TooltipContext flagIn) { - tooltip.add(new TranslatableComponent("techreborn.tooltip.alarm").applyFormat(ChatFormat.GRAY)); + public void buildTooltip(ItemStack stack, @Nullable BlockView worldIn, List tooltip, TooltipContext flagIn) { + tooltip.add(new TranslatableText("techreborn.tooltip.alarm").formatted(Formatting.GRAY)); } } diff --git a/src/main/java/techreborn/blocks/BlockSupercondensator.java b/src/main/java/techreborn/blocks/BlockSupercondensator.java index f77092756..3031b1ae1 100644 --- a/src/main/java/techreborn/blocks/BlockSupercondensator.java +++ b/src/main/java/techreborn/blocks/BlockSupercondensator.java @@ -24,12 +24,12 @@ package techreborn.blocks; -import net.minecraft.ChatFormat; +import net.minecraft.util.Formatting; import net.minecraft.block.Material; import net.minecraft.client.item.TooltipContext; import net.minecraft.item.ItemStack; -import net.minecraft.network.chat.Component; -import net.minecraft.network.chat.TextComponent; +import net.minecraft.text.Text; +import net.minecraft.text.LiteralText; import net.minecraft.world.BlockView; import reborncore.api.tile.IMachineGuiHandler; import reborncore.common.blocks.BlockMachineBase; @@ -43,8 +43,8 @@ public class BlockSupercondensator extends BlockMachineBase { } @Override - public void buildTooltip(ItemStack stack, @Nullable BlockView worldIn, List tooltip, TooltipContext flagIn) { - tooltip.add(new TextComponent("WIP Coming Soon").applyFormat(ChatFormat.RED)); + public void buildTooltip(ItemStack stack, @Nullable BlockView worldIn, List tooltip, TooltipContext flagIn) { + tooltip.add(new LiteralText("WIP Coming Soon").formatted(Formatting.RED)); // TODO // Remember to remove WIP override and imports once complete } diff --git a/src/main/java/techreborn/blocks/generator/BlockFusionCoil.java b/src/main/java/techreborn/blocks/generator/BlockFusionCoil.java index 8a382b57d..1b8e8413c 100644 --- a/src/main/java/techreborn/blocks/generator/BlockFusionCoil.java +++ b/src/main/java/techreborn/blocks/generator/BlockFusionCoil.java @@ -34,10 +34,10 @@ import net.minecraft.block.Material; import net.minecraft.client.item.TooltipContext; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; -import net.minecraft.network.chat.Component; -import net.minecraft.network.chat.TextComponent; import net.minecraft.sound.BlockSoundGroup; import net.minecraft.sound.SoundCategory; +import net.minecraft.text.LiteralText; +import net.minecraft.text.Text; import net.minecraft.util.Hand; import net.minecraft.util.hit.BlockHitResult; import net.minecraft.util.math.BlockPos; @@ -83,10 +83,10 @@ public class BlockFusionCoil extends Block { @Environment(EnvType.CLIENT) @Override - public void buildTooltip(ItemStack stack, @Nullable BlockView worldIn, List tooltip, + public void buildTooltip(ItemStack stack, @Nullable BlockView worldIn, List tooltip, TooltipContext flagIn) { super.buildTooltip(stack, worldIn, tooltip, flagIn); // TODO: Translate - tooltip.add(new TextComponent("Right click Fusion Control computer to auto place")); + tooltip.add(new LiteralText("Right click Fusion Control computer to auto place")); } } \ No newline at end of file diff --git a/src/main/java/techreborn/blocks/generator/BlockMagicEnergyAbsorber.java b/src/main/java/techreborn/blocks/generator/BlockMagicEnergyAbsorber.java index ed9ee1bde..a1eeaaabc 100644 --- a/src/main/java/techreborn/blocks/generator/BlockMagicEnergyAbsorber.java +++ b/src/main/java/techreborn/blocks/generator/BlockMagicEnergyAbsorber.java @@ -24,11 +24,11 @@ package techreborn.blocks.generator; -import net.minecraft.ChatFormat; +import net.minecraft.text.LiteralText; +import net.minecraft.text.Text; +import net.minecraft.util.Formatting; import net.minecraft.client.item.TooltipContext; import net.minecraft.item.ItemStack; -import net.minecraft.network.chat.Component; -import net.minecraft.network.chat.TextComponent; import net.minecraft.world.BlockView; import reborncore.api.tile.IMachineGuiHandler; import reborncore.client.models.ModelCompound; @@ -47,8 +47,8 @@ public class BlockMagicEnergyAbsorber extends BlockMachineBase { } @Override - public void buildTooltip(ItemStack stack, @Nullable BlockView worldIn, List tooltip, TooltipContext flagIn) { - tooltip.add(new TextComponent("WIP Coming Soon").applyFormat(ChatFormat.RED)); + public void buildTooltip(ItemStack stack, @Nullable BlockView worldIn, List tooltip, TooltipContext flagIn) { + tooltip.add(new LiteralText("WIP Coming Soon").formatted(Formatting.RED)); // TODO // Remember to remove WIP override and imports once complete } diff --git a/src/main/java/techreborn/blocks/generator/BlockMagicEnergyConverter.java b/src/main/java/techreborn/blocks/generator/BlockMagicEnergyConverter.java index c594d4826..5c09c8d23 100644 --- a/src/main/java/techreborn/blocks/generator/BlockMagicEnergyConverter.java +++ b/src/main/java/techreborn/blocks/generator/BlockMagicEnergyConverter.java @@ -24,11 +24,11 @@ package techreborn.blocks.generator; -import net.minecraft.ChatFormat; +import net.minecraft.util.Formatting; import net.minecraft.client.item.TooltipContext; import net.minecraft.item.ItemStack; -import net.minecraft.network.chat.Component; -import net.minecraft.network.chat.TextComponent; +import net.minecraft.text.Text; +import net.minecraft.text.LiteralText; import net.minecraft.world.BlockView; import reborncore.api.tile.IMachineGuiHandler; import reborncore.client.models.ModelCompound; @@ -47,8 +47,8 @@ public class BlockMagicEnergyConverter extends BlockMachineBase { } @Override - public void buildTooltip(ItemStack stack, @Nullable BlockView worldIn, List tooltip, TooltipContext flagIn) { - tooltip.add(new TextComponent("WIP Coming Soon").applyFormat(ChatFormat.RED)); + public void buildTooltip(ItemStack stack, @Nullable BlockView worldIn, List tooltip, TooltipContext flagIn) { + tooltip.add(new LiteralText("WIP Coming Soon").formatted(Formatting.RED)); // TODO // Remember to remove WIP override and imports once complete } diff --git a/src/main/java/techreborn/blocks/tier1/BlockPlayerDetector.java b/src/main/java/techreborn/blocks/tier1/BlockPlayerDetector.java index 3ef55cc68..3f3ca82d0 100644 --- a/src/main/java/techreborn/blocks/tier1/BlockPlayerDetector.java +++ b/src/main/java/techreborn/blocks/tier1/BlockPlayerDetector.java @@ -25,7 +25,8 @@ package techreborn.blocks.tier1; import com.google.common.collect.Lists; -import net.minecraft.ChatFormat; +import net.minecraft.text.LiteralText; +import net.minecraft.util.Formatting; import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.block.Blocks; @@ -35,7 +36,6 @@ import net.minecraft.client.resource.language.I18n; import net.minecraft.entity.LivingEntity; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; -import net.minecraft.network.chat.TextComponent; import net.minecraft.state.StateFactory; import net.minecraft.util.Hand; import net.minecraft.util.hit.BlockHitResult; @@ -57,7 +57,6 @@ import techreborn.TechReborn; import techreborn.tiles.machine.tier1.TilePlayerDectector; import techreborn.utils.MessageIDs; -import javax.annotation.Nullable; import java.util.List; public class BlockPlayerDetector extends BlockMachineBase { @@ -101,7 +100,7 @@ public class BlockPlayerDetector extends BlockMachineBase { String type = state.get(TYPE); String newType = type; - ChatFormat color = ChatFormat.GREEN; + Formatting color = Formatting.GREEN; if (!stack.isEmpty() && ToolManager.INSTANCE.canHandleTool(stack)) { if (ToolManager.INSTANCE.handleTool(stack, pos, worldIn, playerIn, hitResult.getSide(), false)) { @@ -122,10 +121,10 @@ public class BlockPlayerDetector extends BlockMachineBase { } else { if (type.equals("all")) { newType = "others"; - color = ChatFormat.RED; + color = Formatting.RED; } else if (type.equals("others")) { newType = "you"; - color = ChatFormat.BLUE; + color = Formatting.BLUE; } else if (type.equals("you")) { newType = "all"; } @@ -135,8 +134,8 @@ public class BlockPlayerDetector extends BlockMachineBase { } if (worldIn.isClient) { - ChatUtils.sendNoSpamMessages(MessageIDs.playerDetectorID, new TextComponent( - ChatFormat.GRAY + I18n.translate("techreborn.message.detects") + " " + color + ChatUtils.sendNoSpamMessages(MessageIDs.playerDetectorID, new LiteralText( + Formatting.GRAY + I18n.translate("techreborn.message.detects") + " " + color + StringUtils.toFirstCapital(newType))); } return true; diff --git a/src/main/java/techreborn/client/container/ContainerDestructoPack.java b/src/main/java/techreborn/client/container/ContainerDestructoPack.java index 8ebba71c8..154e5bfc9 100644 --- a/src/main/java/techreborn/client/container/ContainerDestructoPack.java +++ b/src/main/java/techreborn/client/container/ContainerDestructoPack.java @@ -27,7 +27,7 @@ package techreborn.client.container; import net.minecraft.container.Slot; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; -import net.minecraft.network.chat.TextComponent; +import net.minecraft.text.LiteralText; import reborncore.client.gui.slots.SlotFilteredVoid; import reborncore.common.container.RebornContainer; import reborncore.common.util.Inventory; @@ -39,7 +39,7 @@ public class ContainerDestructoPack extends RebornContainer { private Inventory inv; public ContainerDestructoPack(PlayerEntity player) { - super(null, new TextComponent("destructopack")); + super(null, new LiteralText("destructopack")); this.player = player; inv = new Inventory<>(1, "destructopack", 64, null); buildContainer(); diff --git a/src/main/java/techreborn/client/gui/GuiAlloyFurnace.java b/src/main/java/techreborn/client/gui/GuiAlloyFurnace.java index 55e705d17..214a39b7c 100644 --- a/src/main/java/techreborn/client/gui/GuiAlloyFurnace.java +++ b/src/main/java/techreborn/client/gui/GuiAlloyFurnace.java @@ -28,7 +28,7 @@ import com.mojang.blaze3d.platform.GlStateManager; import net.minecraft.client.gui.screen.ingame.AbstractContainerScreen; import net.minecraft.client.resource.language.I18n; import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.network.chat.TextComponent; +import net.minecraft.text.LiteralText; import net.minecraft.util.Identifier; import techreborn.tiles.machine.iron.TileIronAlloyFurnace; @@ -40,7 +40,7 @@ public class GuiAlloyFurnace extends AbstractContainerScreen { TileIronAlloyFurnace alloyfurnace; public GuiAlloyFurnace(final PlayerEntity player, final TileIronAlloyFurnace alloyFurnace) { - super(alloyFurnace.createContainer(player), player.inventory, new TextComponent("techreborn.alloy_furnace")); + super(alloyFurnace.createContainer(player), player.inventory, new LiteralText("techreborn.alloy_furnace")); this.containerWidth = 176; this.containerHeight = 167; this.alloyfurnace = alloyFurnace; diff --git a/src/main/java/techreborn/client/gui/GuiChunkLoader.java b/src/main/java/techreborn/client/gui/GuiChunkLoader.java index 83fbb89e7..17bc8c4b6 100644 --- a/src/main/java/techreborn/client/gui/GuiChunkLoader.java +++ b/src/main/java/techreborn/client/gui/GuiChunkLoader.java @@ -29,7 +29,7 @@ import net.minecraft.client.gui.screen.ingame.AbstractContainerScreen; import net.minecraft.client.gui.widget.ButtonWidget; import net.minecraft.client.resource.language.I18n; import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.network.chat.TextComponent; +import net.minecraft.text.LiteralText; import net.minecraft.util.Identifier; import reborncore.client.gui.builder.widget.GuiButtonSimple; import techreborn.tiles.machine.tier3.TileChunkLoader; @@ -45,7 +45,7 @@ public class GuiChunkLoader extends AbstractContainerScreen { private ButtonWidget minusTenButton; public GuiChunkLoader(final PlayerEntity player, final TileChunkLoader chunkLoader) { - super(chunkLoader.createContainer(player), player.inventory, new TextComponent("techreborn.chunkloader")); + super(chunkLoader.createContainer(player), player.inventory, new LiteralText("techreborn.chunkloader")); this.containerWidth = 176; this.containerHeight = 167; this.chunkloader = chunkLoader; diff --git a/src/main/java/techreborn/client/gui/GuiDestructoPack.java b/src/main/java/techreborn/client/gui/GuiDestructoPack.java index 11e0097d7..a1b8c3209 100644 --- a/src/main/java/techreborn/client/gui/GuiDestructoPack.java +++ b/src/main/java/techreborn/client/gui/GuiDestructoPack.java @@ -29,7 +29,7 @@ import net.minecraft.client.MinecraftClient; import net.minecraft.client.gui.screen.ingame.AbstractContainerScreen; import net.minecraft.client.resource.language.I18n; import net.minecraft.container.Container; -import net.minecraft.network.chat.TextComponent; +import net.minecraft.text.LiteralText; import net.minecraft.util.Identifier; public class GuiDestructoPack extends AbstractContainerScreen { @@ -38,7 +38,7 @@ public class GuiDestructoPack extends AbstractContainerScreen { "textures/gui/destructopack.png"); public GuiDestructoPack(Container container) { - super(container, MinecraftClient.getInstance().player.inventory, new TextComponent("techreborn.destructopack")); + super(container, MinecraftClient.getInstance().player.inventory, new LiteralText("techreborn.destructopack")); this.containerWidth = 176; this.containerHeight = 166; } diff --git a/src/main/java/techreborn/client/gui/GuiManual.java b/src/main/java/techreborn/client/gui/GuiManual.java index 79e9af382..1e00a6692 100644 --- a/src/main/java/techreborn/client/gui/GuiManual.java +++ b/src/main/java/techreborn/client/gui/GuiManual.java @@ -27,7 +27,7 @@ package techreborn.client.gui; import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.resource.language.I18n; import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.network.chat.TextComponent; +import net.minecraft.text.LiteralText; import net.minecraft.util.Identifier; import techreborn.items.ItemManual; @@ -45,7 +45,7 @@ public class GuiManual extends Screen { private static final String text3 = I18n.translate("techreborn.manual.refund"); public GuiManual(PlayerEntity player) { - super(new TextComponent("gui.manual")); + super(new LiteralText("gui.manual")); this.player = player; } diff --git a/src/main/java/techreborn/entities/EntityNukePrimed.java b/src/main/java/techreborn/entities/EntityNukePrimed.java index 3147e14d5..990576ac2 100644 --- a/src/main/java/techreborn/entities/EntityNukePrimed.java +++ b/src/main/java/techreborn/entities/EntityNukePrimed.java @@ -98,7 +98,7 @@ public class EntityNukePrimed extends TntEntity { explodeNuke(); } } else { - this.method_5713(); + this.checkWaterState(); this.world.addParticle(ParticleTypes.SMOKE, this.x, this.y + 0.5D, this.z, 0.0D, 0.0D, 0.0D); } } diff --git a/src/main/java/techreborn/events/StackToolTipHandler.java b/src/main/java/techreborn/events/StackToolTipHandler.java index 9e274dcb6..f65a2c9e3 100644 --- a/src/main/java/techreborn/events/StackToolTipHandler.java +++ b/src/main/java/techreborn/events/StackToolTipHandler.java @@ -24,7 +24,7 @@ package techreborn.events; -import net.minecraft.ChatFormat; +import net.minecraft.util.Formatting; import net.minecraft.block.Block; import net.minecraft.block.BlockEntityProvider; import net.minecraft.block.BlockWithEntity; @@ -35,8 +35,8 @@ import net.minecraft.client.item.TooltipContext; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.CompoundTag; -import net.minecraft.network.chat.Component; -import net.minecraft.network.chat.TextComponent; +import net.minecraft.text.Text; +import net.minecraft.text.LiteralText; import net.minecraft.util.registry.Registry; import reborncore.api.IListInfoProvider; import reborncore.api.events.ItemTooltipCallback; @@ -56,27 +56,27 @@ public class StackToolTipHandler implements ItemTooltipCallback { } @Override - public void getTooltip(ItemStack stack, TooltipContext tooltipContext, List components) { + public void getTooltip(ItemStack stack, TooltipContext tooltipContext, List components) { Item item = stack.getItem(); if (item instanceof IListInfoProvider) { ((IListInfoProvider) item).addInfo(components, false, false); } else if (stack.getItem() instanceof IEnergyItemInfo) { ItemPowerManager itemPowerManager = new ItemPowerManager(stack); - TextComponent line1 = new TextComponent(PowerSystem.getLocaliszedPowerFormattedNoSuffix(itemPowerManager.getEnergyStored() / RebornCoreConfig.euPerFU)); + LiteralText line1 = new LiteralText(PowerSystem.getLocaliszedPowerFormattedNoSuffix(itemPowerManager.getEnergyStored() / RebornCoreConfig.euPerFU)); line1.append("/"); line1.append(PowerSystem.getLocaliszedPowerFormattedNoSuffix(itemPowerManager.getMaxEnergyStored() / RebornCoreConfig.euPerFU)); line1.append(" "); line1.append(PowerSystem.getDisplayPower().abbreviation); - line1.applyFormat(ChatFormat.GOLD); + line1.formatted(Formatting.GOLD); components.add(1, line1); if (Screen.hasShiftDown()) { int percentage = percentage(itemPowerManager.getMaxEnergyStored(), itemPowerManager.getEnergyStored()); - ChatFormat color = StringUtils.getPercentageColour(percentage); - components.add(2, new TextComponent(color + "" + percentage + "%" + ChatFormat.GRAY + " Charged")); + Formatting color = StringUtils.getPercentageColour(percentage); + components.add(2, new LiteralText(color + "" + percentage + "%" + Formatting.GRAY + " Charged")); // TODO: show both input and output rates - components.add(3, new TextComponent(ChatFormat.GRAY + "I/O Rate: " + ChatFormat.GOLD + PowerSystem.getLocaliszedPowerFormatted(((IEnergyItemInfo) item).getMaxInput()))); + components.add(3, new LiteralText(Formatting.GRAY + "I/O Rate: " + Formatting.GOLD + PowerSystem.getLocaliszedPowerFormatted(((IEnergyItemInfo) item).getMaxInput()))); } } else { try { @@ -88,14 +88,14 @@ public class StackToolTipHandler implements ItemTooltipCallback { CompoundTag tileData = stack.getTag().getCompound("tile_data"); tile.fromTag(tileData); hasData = true; - components.add(new TextComponent("Block data contained").applyFormat(ChatFormat.DARK_GREEN)); + components.add(new LiteralText("Block data contained").formatted(Formatting.DARK_GREEN)); } if (tile instanceof IListInfoProvider) { ((IListInfoProvider) tile).addInfo(components, false, hasData); } } } catch (NullPointerException e) { - TechReborn.LOGGER.debug("Failed to load info for " + stack.getCustomName()); + TechReborn.LOGGER.debug("Failed to load info for " + stack.getName()); } } } diff --git a/src/main/java/techreborn/init/TRTileEntities.java b/src/main/java/techreborn/init/TRTileEntities.java index 7a40e1b0d..78357e4a1 100644 --- a/src/main/java/techreborn/init/TRTileEntities.java +++ b/src/main/java/techreborn/init/TRTileEntities.java @@ -24,6 +24,7 @@ package techreborn.init; +import net.minecraft.block.Block; import net.minecraft.block.entity.BlockEntity; import net.minecraft.block.entity.BlockEntityType; import net.minecraft.util.Identifier; @@ -97,7 +98,7 @@ public class TRTileEntities { public static final BlockEntityType FUSION_CONTROL_COMPUTER = register(TileFusionControlComputer.class, "fusion_control_computer"); public static final BlockEntityType LIGHTNING_ROD = register(TileLightningRod.class, "lightning_rod"); public static final BlockEntityType INDUSTRIAL_SAWMILL = register(TileIndustrialSawmill.class, "industrial_sawmill"); - public static final BlockEntityType GRINDER = register(TileGrinder.class, "grinder"); + public static final BlockEntityType GRINDER = register(TileGrinder.class, "grinder", TRContent.Machine.GRINDER.block); public static final BlockEntityType SOLID_FUEL_GENEREATOR = register(TileSolidFuelGenerator.class, "solid_fuel_generator"); public static final BlockEntityType EXTRACTOR = register(TileExtractor.class, "extractor"); public static final BlockEntityType COMPRESSOR = register(TileCompressor.class, "compressor"); @@ -125,15 +126,16 @@ public class TRTileEntities { - public static BlockEntityType register(Class tClass, String name) { - return register(new Identifier(TechReborn.MOD_ID, name).toString(), BlockEntityType.Builder.create(() -> { - //TODO clean this up - try { - return tClass.newInstance(); - } catch (InstantiationException | IllegalAccessException e) { - throw new RuntimeException("Failed to create tile", e); - } - })); + public static BlockEntityType register(Class tClass, String name, Block... blocks) { + return register(new Identifier(TechReborn.MOD_ID, name).toString(), BlockEntityType.Builder.create(() -> createBlockEntity(tClass), blocks)); + } + + private static T createBlockEntity(Class tClass){ + try { + return tClass.newInstance(); + } catch (InstantiationException | IllegalAccessException e) { + throw new RuntimeException("Failed to createBlockEntity tile", e); + } } public static BlockEntityType register(String id, BlockEntityType.Builder builder) { diff --git a/src/main/java/techreborn/items/ItemFrequencyTransmitter.java b/src/main/java/techreborn/items/ItemFrequencyTransmitter.java index 18fa80e84..ea508fe26 100644 --- a/src/main/java/techreborn/items/ItemFrequencyTransmitter.java +++ b/src/main/java/techreborn/items/ItemFrequencyTransmitter.java @@ -26,7 +26,8 @@ package techreborn.items; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; -import net.minecraft.ChatFormat; +import net.minecraft.text.LiteralText; +import net.minecraft.util.Formatting; import net.minecraft.client.item.TooltipContext; import net.minecraft.client.resource.language.I18n; import net.minecraft.entity.LivingEntity; @@ -36,12 +37,8 @@ import net.minecraft.item.ItemPropertyGetter; import net.minecraft.item.ItemStack; import net.minecraft.item.ItemUsageContext; import net.minecraft.nbt.CompoundTag; -import net.minecraft.network.chat.Component; -import net.minecraft.network.chat.TextComponent; -import net.minecraft.util.ActionResult; -import net.minecraft.util.Hand; -import net.minecraft.util.Identifier; -import net.minecraft.util.TypedActionResult; +import net.minecraft.text.Text; +import net.minecraft.util.*; import net.minecraft.util.math.BlockPos; import net.minecraft.util.registry.Registry; import net.minecraft.world.World; @@ -85,15 +82,15 @@ public class ItemFrequencyTransmitter extends Item { stack.getTag().putInt("dim", world.getDimension().getType().getRawId()); if (!world.isClient) { - ChatUtils.sendNoSpamMessages(MessageIDs.freqTransmitterID, new TextComponent( - ChatFormat.GRAY + I18n.translate("techreborn.message.setTo") + " X: " + - ChatFormat.GOLD + pos.getX() + - ChatFormat.GRAY + " Y: " + - ChatFormat.GOLD + pos.getY() + - ChatFormat.GRAY + " Z: " + - ChatFormat.GOLD + pos.getZ() + - ChatFormat.GRAY + " " + I18n.translate("techreborn.message.in") + " " + - ChatFormat.GOLD + getDimName(world.getDimension().getType()) + ChatUtils.sendNoSpamMessages(MessageIDs.freqTransmitterID, new LiteralText( + Formatting.GRAY + I18n.translate("techreborn.message.setTo") + " X: " + + Formatting.GOLD + pos.getX() + + Formatting.GRAY + " Y: " + + Formatting.GOLD + pos.getY() + + Formatting.GRAY + " Z: " + + Formatting.GOLD + pos.getZ() + + Formatting.GRAY + " " + I18n.translate("techreborn.message.in") + " " + + Formatting.GOLD + getDimName(world.getDimension().getType()) + " (" + getDimName(world.getDimension().getType()) + ")")); } return ActionResult.SUCCESS; @@ -106,9 +103,9 @@ public class ItemFrequencyTransmitter extends Item { if (player.isSneaking()) { stack.setTag(null); if (!world.isClient) { - ChatUtils.sendNoSpamMessages(MessageIDs.freqTransmitterID, new TextComponent( - ChatFormat.GRAY + I18n.translate("techreborn.message.coordsHaveBeen") + " " - + ChatFormat.GOLD + I18n.translate("techreborn.message.cleared"))); + ChatUtils.sendNoSpamMessages(MessageIDs.freqTransmitterID, new LiteralText( + Formatting.GRAY + I18n.translate("techreborn.message.coordsHaveBeen") + " " + + Formatting.GOLD + I18n.translate("techreborn.message.cleared"))); } } @@ -117,20 +114,20 @@ public class ItemFrequencyTransmitter extends Item { @Environment(EnvType.CLIENT) @Override - public void appendTooltip(ItemStack stack, @Nullable World worldIn, List tooltip, TooltipContext flagIn) { + public void appendTooltip(ItemStack stack, @Nullable World worldIn, List tooltip, TooltipContext flagIn) { if (stack.hasTag() && stack.getTag() != null && stack.getTag().containsKey("x") && stack.getTag().containsKey("y") && stack.getTag().containsKey("z") && stack.getTag().containsKey("dim")) { int x = stack.getTag().getInt("x"); int y = stack.getTag().getInt("y"); int z = stack.getTag().getInt("z"); int dim = stack.getTag().getInt("dim"); - tooltip.add(new TextComponent(ChatFormat.GRAY + "X: " + ChatFormat.GOLD + x)); - tooltip.add(new TextComponent(ChatFormat.GRAY + "Y: " + ChatFormat.GOLD + y)); - tooltip.add(new TextComponent(ChatFormat.GRAY + "Z: " + ChatFormat.GOLD + z)); - tooltip.add(new TextComponent(ChatFormat.DARK_GRAY + getDimName(Registry.DIMENSION.get(dim)).toString())); + tooltip.add(new LiteralText(Formatting.GRAY + "X: " + Formatting.GOLD + x)); + tooltip.add(new LiteralText(Formatting.GRAY + "Y: " + Formatting.GOLD + y)); + tooltip.add(new LiteralText(Formatting.GRAY + "Z: " + Formatting.GOLD + z)); + tooltip.add(new LiteralText(Formatting.DARK_GRAY + getDimName(Registry.DIMENSION.get(dim)).toString())); } else { - tooltip.add(new TextComponent(ChatFormat.GRAY + I18n.translate("techreborn.message.noCoordsSet"))); + tooltip.add(new LiteralText(Formatting.GRAY + I18n.translate("techreborn.message.noCoordsSet"))); } } @@ -146,8 +143,8 @@ public class ItemFrequencyTransmitter extends Item { @Override public String getText(ItemStack stack) { String text = ""; - ChatFormat gold = ChatFormat.GOLD; - ChatFormat grey = ChatFormat.GRAY; + Formatting gold = Formatting.GOLD; + Formatting grey = Formatting.GRAY; if (stack.getItem() instanceof ItemFrequencyTransmitter) { if (stack.hasTag() && stack.getTag() != null && stack.getTag().containsKey("x") && stack.getTag().containsKey("y") && stack.getTag().containsKey("z") && stack.getTag().containsKey("dim")) { int coordX = stack.getTag().getInt("x"); diff --git a/src/main/java/techreborn/items/tool/ItemDebugTool.java b/src/main/java/techreborn/items/tool/ItemDebugTool.java index 09915ba29..30c1a8672 100644 --- a/src/main/java/techreborn/items/tool/ItemDebugTool.java +++ b/src/main/java/techreborn/items/tool/ItemDebugTool.java @@ -24,15 +24,16 @@ package techreborn.items.tool; -import net.minecraft.ChatFormat; import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.block.entity.BlockEntity; import net.minecraft.item.Item; import net.minecraft.item.ItemUsageContext; -import net.minecraft.network.chat.TextComponent; import net.minecraft.state.property.Property; +import net.minecraft.text.LiteralText; +import net.minecraft.text.Text; import net.minecraft.util.ActionResult; +import net.minecraft.util.Formatting; import net.minecraft.util.SystemUtil; import net.minecraft.util.registry.Registry; import reborncore.api.power.IEnergyInterfaceTile; @@ -57,21 +58,21 @@ public class ItemDebugTool extends Item { if (block == null) { return ActionResult.FAIL; } - sendMessage(context, new TextComponent(getRegistryName(block))); + sendMessage(context, new LiteralText(getRegistryName(block))); for (Entry, Comparable> entry : blockState.getEntries().entrySet()) { - sendMessage(context, new TextComponent(getPropertyString(entry))); + sendMessage(context, new LiteralText(getPropertyString(entry))); } BlockEntity tile = context.getWorld().getBlockEntity(context.getBlockPos()); if (tile != null) { - sendMessage(context, new TextComponent(getTileEntityType(tile))); + sendMessage(context, new LiteralText(getTileEntityType(tile))); if (tile instanceof IEnergyInterfaceTile) { - sendMessage(context, new TextComponent(getRCPower((IEnergyInterfaceTile) tile))); + sendMessage(context, new LiteralText(getRCPower((IEnergyInterfaceTile) tile))); } } return ActionResult.SUCCESS; } - private void sendMessage(ItemUsageContext context, TextComponent string) { + private void sendMessage(ItemUsageContext context, Text string) { if (!context.getWorld().isClient) { context.getPlayer().sendMessage(string); } @@ -82,36 +83,36 @@ public class ItemDebugTool extends Item { Comparable comparable = entryIn.getValue(); String s = SystemUtil.getValueAsString(iproperty, comparable); if (Boolean.TRUE.equals(comparable)) { - s = ChatFormat.GREEN + s; + s = Formatting.GREEN + s; } else if (Boolean.FALSE.equals(comparable)) { - s = ChatFormat.RED + s; + s = Formatting.RED + s; } return iproperty.getName() + ": " + s; } private String getRegistryName(Block block) { - String s = "" + ChatFormat.GREEN; + String s = "" + Formatting.GREEN; s += "Block Registry Name: "; - s += ChatFormat.BLUE; + s += Formatting.BLUE; s += Registry.BLOCK.getId(block); return s; } private String getTileEntityType(BlockEntity tile) { - String s = "" + ChatFormat.GREEN; + String s = "" + Formatting.GREEN; s += "Tile Entity: "; - s += ChatFormat.BLUE; + s += Formatting.BLUE; s += tile.getType().toString(); return s; } private String getRCPower(IEnergyInterfaceTile tile) { - String s = "" + ChatFormat.GREEN; + String s = "" + Formatting.GREEN; s += "Power: "; - s += ChatFormat.BLUE; + s += Formatting.BLUE; s += PowerSystem.getLocaliszedPower(tile.getEnergy()); s += "/"; s += PowerSystem.getLocaliszedPower(tile.getMaxPower()); diff --git a/src/main/java/techreborn/items/tool/industrial/ItemIndustrialChainsaw.java b/src/main/java/techreborn/items/tool/industrial/ItemIndustrialChainsaw.java index 3a6f8f6d7..f13c956fd 100644 --- a/src/main/java/techreborn/items/tool/industrial/ItemIndustrialChainsaw.java +++ b/src/main/java/techreborn/items/tool/industrial/ItemIndustrialChainsaw.java @@ -26,7 +26,6 @@ package techreborn.items.tool.industrial; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; -import net.minecraft.ChatFormat; import net.minecraft.block.BlockState; import net.minecraft.block.Blocks; import net.minecraft.client.item.TooltipContext; @@ -39,13 +38,10 @@ import net.minecraft.item.ItemStack; import net.minecraft.item.Items; import net.minecraft.item.ToolMaterials; import net.minecraft.nbt.CompoundTag; -import net.minecraft.network.chat.Component; -import net.minecraft.network.chat.TextComponent; import net.minecraft.tag.BlockTags; -import net.minecraft.util.ActionResult; -import net.minecraft.util.DefaultedList; -import net.minecraft.util.Hand; -import net.minecraft.util.TypedActionResult; +import net.minecraft.text.LiteralText; +import net.minecraft.text.Text; +import net.minecraft.util.*; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Direction; import net.minecraft.world.World; @@ -128,9 +124,9 @@ public class ItemIndustrialChainsaw extends ItemChainsaw { final ItemStack stack = player.getStackInHand(hand); if (player.isSneaking()) { if (new ItemPowerManager(stack).getEnergyStored() < cost) { - ChatUtils.sendNoSpamMessages(MessageIDs.nanosaberID, new TextComponent( - ChatFormat.GRAY + I18n.translate("techreborn.message.nanosaberEnergyErrorTo") + " " - + ChatFormat.GOLD + I18n + ChatUtils.sendNoSpamMessages(MessageIDs.nanosaberID, new LiteralText( + Formatting.GRAY + I18n.translate("techreborn.message.nanosaberEnergyErrorTo") + " " + + Formatting.GOLD + I18n .translate("techreborn.message.nanosaberActivate"))); } else { if (!ItemUtils.isActive(stack)) { @@ -139,17 +135,17 @@ public class ItemIndustrialChainsaw extends ItemChainsaw { } stack.getTag().putBoolean("isActive", true); if (world.isClient) { - ChatUtils.sendNoSpamMessages(MessageIDs.nanosaberID, new TextComponent( - ChatFormat.GRAY + I18n.translate("techreborn.message.setTo") + " " - + ChatFormat.GOLD + I18n + ChatUtils.sendNoSpamMessages(MessageIDs.nanosaberID, new LiteralText( + Formatting.GRAY + I18n.translate("techreborn.message.setTo") + " " + + Formatting.GOLD + I18n .translate("techreborn.message.nanosaberActive"))); } } else { stack.getTag().putBoolean("isActive", false); if (world.isClient) { - ChatUtils.sendNoSpamMessages(MessageIDs.nanosaberID, new TextComponent( - ChatFormat.GRAY + I18n.translate("techreborn.message.setTo") + " " - + ChatFormat.GOLD + I18n + ChatUtils.sendNoSpamMessages(MessageIDs.nanosaberID, new LiteralText( + Formatting.GRAY + I18n.translate("techreborn.message.setTo") + " " + + Formatting.GOLD + I18n .translate("techreborn.message.nanosaberInactive"))); } } @@ -163,9 +159,9 @@ public class ItemIndustrialChainsaw extends ItemChainsaw { public void usageTick(World world, LivingEntity entity, ItemStack stack, int i) { if (ItemUtils.isActive(stack) && new ItemPowerManager(stack).getEnergyStored() < cost) { if(entity.world.isClient){ - ChatUtils.sendNoSpamMessages(MessageIDs.nanosaberID, new TextComponent( - ChatFormat.GRAY + I18n.translate("techreborn.message.nanosaberEnergyError") + " " - + ChatFormat.GOLD + I18n + ChatUtils.sendNoSpamMessages(MessageIDs.nanosaberID, new LiteralText( + Formatting.GRAY + I18n.translate("techreborn.message.nanosaberEnergyError") + " " + + Formatting.GOLD + I18n .translate("techreborn.message.nanosaberDeactivating"))); } stack.getTag().putBoolean("isActive", false); @@ -174,11 +170,11 @@ public class ItemIndustrialChainsaw extends ItemChainsaw { @Environment(EnvType.CLIENT) @Override - public void appendTooltip(ItemStack stack, @Nullable World worldIn, List tooltip, TooltipContext flagIn) { + public void appendTooltip(ItemStack stack, @Nullable World worldIn, List tooltip, TooltipContext flagIn) { if (!ItemUtils.isActive(stack)) { - tooltip.add(new TextComponent(ChatFormat.YELLOW + "Shear: " + ChatFormat.RED + I18n.translate("techreborn.message.nanosaberInactive"))); + tooltip.add(new LiteralText(Formatting.YELLOW + "Shear: " + Formatting.RED + I18n.translate("techreborn.message.nanosaberInactive"))); } else { - tooltip.add(new TextComponent(ChatFormat.YELLOW + "Shear: " + ChatFormat.GREEN + I18n.translate("techreborn.message.nanosaberActive"))); + tooltip.add(new LiteralText(Formatting.YELLOW + "Shear: " + Formatting.GREEN + I18n.translate("techreborn.message.nanosaberActive"))); } } diff --git a/src/main/java/techreborn/items/tool/industrial/ItemIndustrialDrill.java b/src/main/java/techreborn/items/tool/industrial/ItemIndustrialDrill.java index 5f7bb150f..9c977f3b8 100644 --- a/src/main/java/techreborn/items/tool/industrial/ItemIndustrialDrill.java +++ b/src/main/java/techreborn/items/tool/industrial/ItemIndustrialDrill.java @@ -26,7 +26,6 @@ package techreborn.items.tool.industrial; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; -import net.minecraft.ChatFormat; import net.minecraft.block.BlockState; import net.minecraft.block.Blocks; import net.minecraft.block.Material; @@ -40,16 +39,12 @@ import net.minecraft.item.ItemStack; import net.minecraft.item.Items; import net.minecraft.item.ToolMaterials; import net.minecraft.nbt.CompoundTag; -import net.minecraft.network.chat.Component; -import net.minecraft.network.chat.TextComponent; -import net.minecraft.util.ActionResult; -import net.minecraft.util.DefaultedList; -import net.minecraft.util.Hand; -import net.minecraft.util.TypedActionResult; +import net.minecraft.text.LiteralText; +import net.minecraft.text.Text; +import net.minecraft.util.*; import net.minecraft.util.hit.BlockHitResult; import net.minecraft.util.hit.HitResult; import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.BoundingBox; import net.minecraft.util.math.Direction; import net.minecraft.world.RayTraceContext; import net.minecraft.world.World; @@ -178,9 +173,9 @@ public class ItemIndustrialDrill extends ItemDrill { final ItemStack stack = player.getStackInHand(hand); if (player.isSneaking()) { if (new ItemPowerManager(stack).getEnergyStored() < cost) { - ChatUtils.sendNoSpamMessages(MessageIDs.nanosaberID, new TextComponent( - ChatFormat.GRAY + I18n.translate("techreborn.message.nanosaberEnergyErrorTo") + " " - + ChatFormat.GOLD + I18n + ChatUtils.sendNoSpamMessages(MessageIDs.nanosaberID, new LiteralText( + Formatting.GRAY + I18n.translate("techreborn.message.nanosaberEnergyErrorTo") + " " + + Formatting.GOLD + I18n .translate("techreborn.message.nanosaberActivate"))); } else { if (!ItemUtils.isActive(stack)) { @@ -189,17 +184,17 @@ public class ItemIndustrialDrill extends ItemDrill { } stack.getTag().putBoolean("isActive", true); if (world.isClient) { - ChatUtils.sendNoSpamMessages(MessageIDs.nanosaberID, new TextComponent( - ChatFormat.GRAY + I18n.translate("techreborn.message.setTo") + " " - + ChatFormat.GOLD + I18n + ChatUtils.sendNoSpamMessages(MessageIDs.nanosaberID, new LiteralText( + Formatting.GRAY + I18n.translate("techreborn.message.setTo") + " " + + Formatting.GOLD + I18n .translate("techreborn.message.nanosaberActive"))); } } else { stack.getTag().putBoolean("isActive", false); if (world.isClient) { - ChatUtils.sendNoSpamMessages(MessageIDs.nanosaberID, new TextComponent( - ChatFormat.GRAY + I18n.translate("techreborn.message.setTo") + " " - + ChatFormat.GOLD + I18n + ChatUtils.sendNoSpamMessages(MessageIDs.nanosaberID, new LiteralText( + Formatting.GRAY + I18n.translate("techreborn.message.setTo") + " " + + Formatting.GOLD + I18n .translate("techreborn.message.nanosaberInactive"))); } } @@ -213,9 +208,9 @@ public class ItemIndustrialDrill extends ItemDrill { public void usageTick(World world, LivingEntity entity, ItemStack stack, int i) { if (ItemUtils.isActive(stack) && new ItemPowerManager(stack).getEnergyStored() < cost) { if(entity.world.isClient){ - ChatUtils.sendNoSpamMessages(MessageIDs.nanosaberID, new TextComponent( - ChatFormat.GRAY + I18n.translate("techreborn.message.nanosaberEnergyError") + " " - + ChatFormat.GOLD + I18n + ChatUtils.sendNoSpamMessages(MessageIDs.nanosaberID, new LiteralText( + Formatting.GRAY + I18n.translate("techreborn.message.nanosaberEnergyError") + " " + + Formatting.GOLD + I18n .translate("techreborn.message.nanosaberDeactivating"))); } stack.getTag().putBoolean("isActive", false); @@ -224,11 +219,11 @@ public class ItemIndustrialDrill extends ItemDrill { @Environment(EnvType.CLIENT) @Override - public void appendTooltip(ItemStack stack, @Nullable World worldIn, List tooltip, TooltipContext flagIn) { + public void appendTooltip(ItemStack stack, @Nullable World worldIn, List tooltip, TooltipContext flagIn) { if (!ItemUtils.isActive(stack)) { - tooltip.add(new TextComponent(ChatFormat.YELLOW + "Shear: " + ChatFormat.RED + I18n.translate("techreborn.message.nanosaberInactive"))); + tooltip.add(new LiteralText(Formatting.YELLOW + "Shear: " + Formatting.RED + I18n.translate("techreborn.message.nanosaberInactive"))); } else { - tooltip.add(new TextComponent(ChatFormat.YELLOW + "Shear: " + ChatFormat.GREEN + I18n.translate("techreborn.message.nanosaberActive"))); + tooltip.add(new LiteralText(Formatting.YELLOW + "Shear: " + Formatting.GREEN + I18n.translate("techreborn.message.nanosaberActive"))); } } diff --git a/src/main/java/techreborn/items/tool/industrial/ItemNanosaber.java b/src/main/java/techreborn/items/tool/industrial/ItemNanosaber.java index 2284b6761..ac9b9650e 100644 --- a/src/main/java/techreborn/items/tool/industrial/ItemNanosaber.java +++ b/src/main/java/techreborn/items/tool/industrial/ItemNanosaber.java @@ -28,7 +28,6 @@ import com.google.common.collect.HashMultimap; import com.google.common.collect.Multimap; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; -import net.minecraft.ChatFormat; import net.minecraft.client.item.TooltipContext; import net.minecraft.client.resource.language.I18n; import net.minecraft.entity.Entity; @@ -39,9 +38,9 @@ import net.minecraft.entity.attribute.EntityAttributes; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.*; import net.minecraft.nbt.CompoundTag; -import net.minecraft.network.chat.Component; -import net.minecraft.network.chat.TextComponent; -import net.minecraft.network.chat.TranslatableComponent; +import net.minecraft.text.LiteralText; +import net.minecraft.text.Text; +import net.minecraft.text.TranslatableText; import net.minecraft.util.*; import net.minecraft.world.World; import reborncore.api.power.IEnergyItemInfo; @@ -124,9 +123,9 @@ public class ItemNanosaber extends SwordItem implements IEnergyItemInfo, ItemDur final ItemStack stack = player.getStackInHand(hand); if (player.isSneaking()) { if (new ItemPowerManager(stack).getEnergyStored() < cost) { - ChatUtils.sendNoSpamMessages(MessageIDs.nanosaberID, new TextComponent( - ChatFormat.GRAY + I18n.translate("techreborn.message.nanosaberEnergyErrorTo") + " " - + ChatFormat.GOLD + I18n + ChatUtils.sendNoSpamMessages(MessageIDs.nanosaberID, new LiteralText( + Formatting.GRAY + I18n.translate("techreborn.message.nanosaberEnergyErrorTo") + " " + + Formatting.GOLD + I18n .translate("techreborn.message.nanosaberActivate"))); } else { if (!ItemUtils.isActive(stack)) { @@ -135,17 +134,17 @@ public class ItemNanosaber extends SwordItem implements IEnergyItemInfo, ItemDur } stack.getTag().putBoolean("isActive", true); if (world.isClient) { - ChatUtils.sendNoSpamMessages(MessageIDs.nanosaberID, new TextComponent( - ChatFormat.GRAY + I18n.translate("techreborn.message.setTo") + " " - + ChatFormat.GOLD + I18n + ChatUtils.sendNoSpamMessages(MessageIDs.nanosaberID, new LiteralText( + Formatting.GRAY + I18n.translate("techreborn.message.setTo") + " " + + Formatting.GOLD + I18n .translate("techreborn.message.nanosaberActive"))); } } else { stack.getTag().putBoolean("isActive", false); if (world.isClient) { - ChatUtils.sendNoSpamMessages(MessageIDs.nanosaberID, new TextComponent( - ChatFormat.GRAY + I18n.translate("techreborn.message.setTo") + " " - + ChatFormat.GOLD + I18n + ChatUtils.sendNoSpamMessages(MessageIDs.nanosaberID, new LiteralText( + Formatting.GRAY + I18n.translate("techreborn.message.setTo") + " " + + Formatting.GOLD + I18n .translate("techreborn.message.nanosaberInactive"))); } } @@ -159,9 +158,9 @@ public class ItemNanosaber extends SwordItem implements IEnergyItemInfo, ItemDur public void inventoryTick(ItemStack stack, World worldIn, Entity entityIn, int itemSlot, boolean isSelected) { if (ItemUtils.isActive(stack) && new ItemPowerManager(stack).getEnergyStored() < cost) { if(worldIn.isClient){ - ChatUtils.sendNoSpamMessages(MessageIDs.nanosaberID, new TextComponent( - ChatFormat.GRAY + I18n.translate("techreborn.message.nanosaberEnergyError") + " " - + ChatFormat.GOLD + I18n + ChatUtils.sendNoSpamMessages(MessageIDs.nanosaberID, new LiteralText( + Formatting.GRAY + I18n.translate("techreborn.message.nanosaberEnergyError") + " " + + Formatting.GOLD + I18n .translate("techreborn.message.nanosaberDeactivating"))); } stack.getTag().putBoolean("isActive", false); @@ -218,11 +217,11 @@ public class ItemNanosaber extends SwordItem implements IEnergyItemInfo, ItemDur @Environment(EnvType.CLIENT) @Override - public void appendTooltip(ItemStack stack, @Nullable World worldIn, List tooltip, TooltipContext flagIn) { + public void appendTooltip(ItemStack stack, @Nullable World worldIn, List tooltip, TooltipContext flagIn) { if (!ItemUtils.isActive(stack)) { - tooltip.add(new TranslatableComponent("techreborn.message.nanosaberInactive").applyFormat(ChatFormat.GRAY)); + tooltip.add(new TranslatableText("techreborn.message.nanosaberInactive").formatted(Formatting.GRAY)); } else { - tooltip.add(new TranslatableComponent("techreborn.message.nanosaberActive").applyFormat(ChatFormat.GRAY)); + tooltip.add(new TranslatableText("techreborn.message.nanosaberActive").formatted(Formatting.GRAY)); } } diff --git a/src/main/java/techreborn/items/tool/industrial/ItemOmniTool.java b/src/main/java/techreborn/items/tool/industrial/ItemOmniTool.java index 3723af52c..9ed15e9e5 100644 --- a/src/main/java/techreborn/items/tool/industrial/ItemOmniTool.java +++ b/src/main/java/techreborn/items/tool/industrial/ItemOmniTool.java @@ -26,15 +26,15 @@ package techreborn.items.tool.industrial; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; -import net.minecraft.ChatFormat; +import net.minecraft.text.LiteralText; +import net.minecraft.text.Text; +import net.minecraft.util.Formatting; import net.minecraft.block.BlockState; import net.minecraft.client.item.TooltipContext; import net.minecraft.entity.LivingEntity; import net.minecraft.entity.damage.DamageSource; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.*; -import net.minecraft.network.chat.Component; -import net.minecraft.network.chat.TextComponent; import net.minecraft.util.ActionResult; import net.minecraft.util.DefaultedList; import net.minecraft.util.math.BlockPos; @@ -129,8 +129,8 @@ public class ItemOmniTool extends PickaxeItem implements IEnergyItemInfo, ItemDu } @Override - public void appendTooltip(ItemStack stack, @Nullable World worldIn, List tooltip, TooltipContext flagIn) { - tooltip.add(new TextComponent("WIP Coming Soon").applyFormat(ChatFormat.RED)); + public void appendTooltip(ItemStack stack, @Nullable World worldIn, List tooltip, TooltipContext flagIn) { + tooltip.add(new LiteralText("WIP Coming Soon").formatted(Formatting.RED)); // TODO // Remember to remove WIP override and imports once complete } diff --git a/src/main/java/techreborn/proxies/ClientProxy.java b/src/main/java/techreborn/proxies/ClientProxy.java index ae0ec603e..f70b05c80 100644 --- a/src/main/java/techreborn/proxies/ClientProxy.java +++ b/src/main/java/techreborn/proxies/ClientProxy.java @@ -24,7 +24,7 @@ package techreborn.proxies; -import net.minecraft.ChatFormat; +import net.minecraft.util.Formatting; import net.minecraft.client.MinecraftClient; import net.minecraft.item.ItemStack; import reborncore.api.tile.IUpgradeable; @@ -66,7 +66,7 @@ public class ClientProxy extends CommonProxy { GuiBase base = (GuiBase) MinecraftClient.getInstance().currentScreen; if (base.tile instanceof IUpgradeable) { if (((IUpgradeable) base.tile).canBeUpgraded()) { - return ChatFormat.LIGHT_PURPLE + "Right click to configure"; + return Formatting.LIGHT_PURPLE + "Right click to configure"; } } } diff --git a/src/main/java/techreborn/tiles/TileAlarm.java b/src/main/java/techreborn/tiles/TileAlarm.java index f7ac8b203..64fd64bdd 100644 --- a/src/main/java/techreborn/tiles/TileAlarm.java +++ b/src/main/java/techreborn/tiles/TileAlarm.java @@ -24,12 +24,12 @@ package techreborn.tiles; -import net.minecraft.ChatFormat; +import net.minecraft.util.Formatting; import net.minecraft.block.entity.BlockEntity; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; import net.minecraft.nbt.CompoundTag; -import net.minecraft.network.chat.TextComponent; +import net.minecraft.text.LiteralText; import net.minecraft.sound.SoundCategory; import net.minecraft.util.Tickable; import reborncore.api.IToolDrop; @@ -56,8 +56,8 @@ public class TileAlarm extends BlockEntity } else { selectedSound = 1; } - ChatUtils.sendNoSpamMessages(MessageIDs.alarmID, new TextComponent( - ChatFormat.GRAY + StringUtils.t("techreborn.message.alarm") + " " + "Alarm " + selectedSound)); + ChatUtils.sendNoSpamMessages(MessageIDs.alarmID, new LiteralText( + Formatting.GRAY + StringUtils.t("techreborn.message.alarm") + " " + "Alarm " + selectedSound)); } } diff --git a/src/main/java/techreborn/tiles/TileIndustrialCentrifuge.java b/src/main/java/techreborn/tiles/TileIndustrialCentrifuge.java index cce81dd35..dc1f48457 100644 --- a/src/main/java/techreborn/tiles/TileIndustrialCentrifuge.java +++ b/src/main/java/techreborn/tiles/TileIndustrialCentrifuge.java @@ -25,8 +25,8 @@ package techreborn.tiles; import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.network.chat.Component; -import net.minecraft.network.chat.TextComponent; +import net.minecraft.text.LiteralText; +import net.minecraft.text.Text; import reborncore.api.IListInfoProvider; import reborncore.client.containerBuilder.IContainerProvider; import reborncore.client.containerBuilder.builder.BuiltContainer; @@ -74,8 +74,8 @@ public class TileIndustrialCentrifuge extends TileGenericMachine implements ICon // IListInfoProvider @Override - public void addInfo(final List info, final boolean isRealTile, boolean hasData) { + public void addInfo(final List info, final boolean isRealTile, boolean hasData) { super.addInfo(info, isRealTile, hasData); - info.add(new TextComponent("Round and round it goes")); + info.add(new LiteralText("Round and round it goes")); } } \ No newline at end of file diff --git a/src/main/java/techreborn/tiles/TileTechStorageBase.java b/src/main/java/techreborn/tiles/TileTechStorageBase.java index 7217e8a45..fda1fdd2c 100644 --- a/src/main/java/techreborn/tiles/TileTechStorageBase.java +++ b/src/main/java/techreborn/tiles/TileTechStorageBase.java @@ -29,9 +29,8 @@ import net.minecraft.client.network.packet.BlockEntityUpdateS2CPacket; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; import net.minecraft.nbt.CompoundTag; -import net.minecraft.network.ClientConnection; -import net.minecraft.network.chat.Component; -import net.minecraft.network.chat.TextComponent; +import net.minecraft.text.LiteralText; +import net.minecraft.text.Text; import reborncore.api.IListInfoProvider; import reborncore.api.IToolDrop; import reborncore.api.tile.ItemHandlerProvider; @@ -221,19 +220,19 @@ public class TileTechStorageBase extends TileMachineBase // IListInfoProvider @Override - public void addInfo(List info, boolean isRealTile, boolean hasData) { + public void addInfo(List info, boolean isRealTile, boolean hasData) { if (isRealTile || hasData) { int size = 0; String name = "of nothing"; if (!storedItem.isEmpty()) { - name = storedItem.getCustomName().getString(); + name = storedItem.getName().getString(); size += storedItem.getCount(); } if (!inventory.getInvStack(1).isEmpty()) { - name = inventory.getInvStack(1).getCustomName().getString(); + name = inventory.getInvStack(1).getName().getString(); size += inventory.getInvStack(1).getCount(); } - info.add(new TextComponent(size + " " + name)); + info.add(new LiteralText(size + " " + name)); } } diff --git a/src/main/java/techreborn/tiles/cable/TileCable.java b/src/main/java/techreborn/tiles/cable/TileCable.java index 23c7af3d7..bff4cb7fa 100644 --- a/src/main/java/techreborn/tiles/cable/TileCable.java +++ b/src/main/java/techreborn/tiles/cable/TileCable.java @@ -24,15 +24,15 @@ package techreborn.tiles.cable; -import net.minecraft.ChatFormat; import net.minecraft.block.Block; import net.minecraft.block.entity.BlockEntity; import net.minecraft.client.network.packet.BlockEntityUpdateS2CPacket; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; import net.minecraft.nbt.CompoundTag; -import net.minecraft.network.chat.Component; -import net.minecraft.network.chat.TextComponent; +import net.minecraft.text.LiteralText; +import net.minecraft.text.Text; +import net.minecraft.util.Formatting; import net.minecraft.util.Tickable; import net.minecraft.util.math.Direction; import reborncore.api.IListInfoProvider; @@ -159,13 +159,13 @@ public class TileCable extends BlockEntity // IListInfoProvider @Override - public void addInfo(List info, boolean isRealTile, boolean hasData) { + public void addInfo(List info, boolean isRealTile, boolean hasData) { if (isRealTile) { - info.add(new TextComponent(ChatFormat.GRAY + StringUtils.t("techreborn.tooltip.transferRate") + ": " - + ChatFormat.GOLD + info.add(new LiteralText(Formatting.GRAY + StringUtils.t("techreborn.tooltip.transferRate") + ": " + + Formatting.GOLD + PowerSystem.getLocaliszedPowerFormatted(transferRate / RebornCoreConfig.euPerFU) + "/t")); - info.add(new TextComponent(ChatFormat.GRAY + StringUtils.t("techreborn.tooltip.tier") + ": " - + ChatFormat.GOLD + StringUtils.toFirstCapitalAllLowercase(cableType.tier.toString()))); + info.add(new LiteralText(Formatting.GRAY + StringUtils.t("techreborn.tooltip.tier") + ": " + + Formatting.GOLD + StringUtils.toFirstCapitalAllLowercase(cableType.tier.toString()))); } } diff --git a/src/main/java/techreborn/tiles/generator/TileSolarPanel.java b/src/main/java/techreborn/tiles/generator/TileSolarPanel.java index f186ede57..180b21674 100644 --- a/src/main/java/techreborn/tiles/generator/TileSolarPanel.java +++ b/src/main/java/techreborn/tiles/generator/TileSolarPanel.java @@ -24,13 +24,13 @@ package techreborn.tiles.generator; -import net.minecraft.ChatFormat; +import net.minecraft.text.LiteralText; +import net.minecraft.util.Formatting; import net.minecraft.block.Block; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; import net.minecraft.nbt.CompoundTag; -import net.minecraft.network.chat.Component; -import net.minecraft.network.chat.TextComponent; +import net.minecraft.text.Text; import net.minecraft.util.math.Direction; import reborncore.api.IToolDrop; import reborncore.api.power.EnumPowerTier; @@ -130,17 +130,17 @@ public class TileSolarPanel extends TilePowerAcceptor implements IToolDrop { // TODO: Translate @Override - public void addInfo(List info, boolean isRealTile, boolean hasData) { - info.add(new TextComponent(ChatFormat.GRAY + "Internal Energy Storage: " + ChatFormat.GOLD + public void addInfo(List info, boolean isRealTile, boolean hasData) { + info.add(new LiteralText(Formatting.GRAY + "Internal Energy Storage: " + Formatting.GOLD + PowerSystem.getLocaliszedPowerFormatted((int) getMaxPower()))); - info.add(new TextComponent(ChatFormat.GRAY + "Generation Rate Day: " + ChatFormat.GOLD + info.add(new LiteralText(Formatting.GRAY + "Generation Rate Day: " + Formatting.GOLD + PowerSystem.getLocaliszedPowerFormatted(panel.generationRateD))); - info.add(new TextComponent(ChatFormat.GRAY + "Generation Rate Night: " + ChatFormat.GOLD + info.add(new LiteralText(Formatting.GRAY + "Generation Rate Night: " + Formatting.GOLD + PowerSystem.getLocaliszedPowerFormatted(panel.generationRateN))); - info.add(new TextComponent(ChatFormat.GRAY + "Tier: " + ChatFormat.GOLD + info.add(new LiteralText(Formatting.GRAY + "Tier: " + Formatting.GOLD + StringUtils.toFirstCapitalAllLowercase(getTier().toString()))); } diff --git a/src/main/java/techreborn/tiles/machine/tier3/TileQuantumTank.java b/src/main/java/techreborn/tiles/machine/tier3/TileQuantumTank.java index 9773013ac..d6d1033b6 100644 --- a/src/main/java/techreborn/tiles/machine/tier3/TileQuantumTank.java +++ b/src/main/java/techreborn/tiles/machine/tier3/TileQuantumTank.java @@ -30,8 +30,8 @@ import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; import net.minecraft.nbt.CompoundTag; import net.minecraft.network.ClientConnection; -import net.minecraft.network.chat.Component; -import net.minecraft.network.chat.TextComponent; +import net.minecraft.text.LiteralText; +import net.minecraft.text.Text; import reborncore.api.IListInfoProvider; import reborncore.api.IToolDrop; import reborncore.api.tile.ItemHandlerProvider; @@ -133,15 +133,15 @@ public class TileQuantumTank extends TileMachineBase // IListInfoProvider @Override - public void addInfo(final List info, final boolean isRealTile, boolean hasData) { + public void addInfo(final List info, final boolean isRealTile, boolean hasData) { if (isRealTile | hasData) { if (this.tank.getFluid() != null) { - info.add(new TextComponent(this.tank.getFluidAmount() + " of " + this.tank.getFluidType().getName())); + info.add(new LiteralText(this.tank.getFluidAmount() + " of " + this.tank.getFluidType().getName())); } else { - info.add(new TextComponent("Empty")); + info.add(new LiteralText("Empty")); } } - info.add(new TextComponent("Capacity " + this.tank.getCapacity() + " mb")); + info.add(new LiteralText("Capacity " + this.tank.getCapacity() + " mb")); } // IContainerProvider diff --git a/src/main/java/techreborn/tiles/transformers/TileTransformer.java b/src/main/java/techreborn/tiles/transformers/TileTransformer.java index b33b0b0bf..a9a5c5e48 100644 --- a/src/main/java/techreborn/tiles/transformers/TileTransformer.java +++ b/src/main/java/techreborn/tiles/transformers/TileTransformer.java @@ -24,13 +24,13 @@ package techreborn.tiles.transformers; -import net.minecraft.ChatFormat; +import net.minecraft.text.LiteralText; +import net.minecraft.text.Text; +import net.minecraft.util.Formatting; import net.minecraft.block.Block; import net.minecraft.block.entity.BlockEntityType; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; -import net.minecraft.network.chat.Component; -import net.minecraft.network.chat.TextComponent; import net.minecraft.util.math.Direction; import reborncore.api.IListInfoProvider; import reborncore.api.IToolDrop; @@ -146,11 +146,11 @@ public class TileTransformer extends TilePowerAcceptor // IListInfoProvider @Override - public void addInfo(List info, boolean isRealTile, boolean hasData) { - info.add(new TextComponent(ChatFormat.GRAY + "Input Rate: " + ChatFormat.GOLD + PowerSystem.getLocaliszedPowerFormatted((int) getMaxInput()))); - info.add(new TextComponent(ChatFormat.GRAY + "Input Tier: " + ChatFormat.GOLD + StringUtils.toFirstCapitalAllLowercase(inputTier.toString()))); - info.add(new TextComponent(ChatFormat.GRAY + "Output Rate: " + ChatFormat.GOLD + PowerSystem.getLocaliszedPowerFormatted((int) getMaxOutput()))); - info.add(new TextComponent(ChatFormat.GRAY + "Output Tier: " + ChatFormat.GOLD + StringUtils.toFirstCapitalAllLowercase(ouputTier.toString()))); + public void addInfo(List info, boolean isRealTile, boolean hasData) { + info.add(new LiteralText(Formatting.GRAY + "Input Rate: " + Formatting.GOLD + PowerSystem.getLocaliszedPowerFormatted((int) getMaxInput()))); + info.add(new LiteralText(Formatting.GRAY + "Input Tier: " + Formatting.GOLD + StringUtils.toFirstCapitalAllLowercase(inputTier.toString()))); + info.add(new LiteralText(Formatting.GRAY + "Output Rate: " + Formatting.GOLD + PowerSystem.getLocaliszedPowerFormatted((int) getMaxOutput()))); + info.add(new LiteralText(Formatting.GRAY + "Output Tier: " + Formatting.GOLD + StringUtils.toFirstCapitalAllLowercase(ouputTier.toString()))); } } diff --git a/src/main/java/techreborn/utils/StackWIPHandler.java b/src/main/java/techreborn/utils/StackWIPHandler.java index 553751a73..d290932d2 100644 --- a/src/main/java/techreborn/utils/StackWIPHandler.java +++ b/src/main/java/techreborn/utils/StackWIPHandler.java @@ -24,13 +24,13 @@ package techreborn.utils; -import net.minecraft.ChatFormat; import net.minecraft.block.Block; import net.minecraft.item.ItemStack; import net.minecraft.item.Items; import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.StringTag; -import net.minecraft.network.chat.TextComponent; +import net.minecraft.text.LiteralText; +import net.minecraft.util.Formatting; import reborncore.api.events.ItemTooltipCallback; import reborncore.common.util.StringUtils; import techreborn.init.TRContent; @@ -57,11 +57,11 @@ public class StackWIPHandler { ItemTooltipCallback.EVENT.register((stack, tooltipContext, components) -> { Block block = Block.getBlockFromItem(stack.getItem()); if (block != null && wipBlocks.contains(block)) { - components.add(new TextComponent(ChatFormat.RED + StringUtils.t("techreborn.tooltip.wip"))); + components.add(new LiteralText(Formatting.RED + StringUtils.t("techreborn.tooltip.wip"))); } if (devHeads.contains(stack)) { - components.add(new TextComponent(ChatFormat.GOLD + "TechReborn Developer")); + components.add(new LiteralText(Formatting.GOLD + "TechReborn Developer")); } }); } diff --git a/src/main/resources/data/minecraft/tags/blocks/leaves.json b/src/main/resources/data/minecraft/tags_disabled/blocks/leaves.json similarity index 93% rename from src/main/resources/data/minecraft/tags/blocks/leaves.json rename to src/main/resources/data/minecraft/tags_disabled/blocks/leaves.json index 7ba528b4e..1a7eaf381 100644 --- a/src/main/resources/data/minecraft/tags/blocks/leaves.json +++ b/src/main/resources/data/minecraft/tags_disabled/blocks/leaves.json @@ -1,6 +1,6 @@ -{ - "replace": false, - "values": [ - "techreborn:rubber_leaves" - ] +{ + "replace": false, + "values": [ + "techreborn:rubber_leaves" + ] } \ No newline at end of file diff --git a/src/main/resources/data/minecraft/tags/blocks/logs.json b/src/main/resources/data/minecraft/tags_disabled/blocks/logs.json similarity index 93% rename from src/main/resources/data/minecraft/tags/blocks/logs.json rename to src/main/resources/data/minecraft/tags_disabled/blocks/logs.json index fe92d7e23..bdc045a66 100644 --- a/src/main/resources/data/minecraft/tags/blocks/logs.json +++ b/src/main/resources/data/minecraft/tags_disabled/blocks/logs.json @@ -1,6 +1,6 @@ -{ - "replace": false, - "values": [ - "techreborn:rubber_log" - ] +{ + "replace": false, + "values": [ + "techreborn:rubber_log" + ] } \ No newline at end of file diff --git a/src/main/resources/data/minecraft/tags/blocks/saplings.json b/src/main/resources/data/minecraft/tags_disabled/blocks/saplings.json similarity index 93% rename from src/main/resources/data/minecraft/tags/blocks/saplings.json rename to src/main/resources/data/minecraft/tags_disabled/blocks/saplings.json index 543641733..db314f7d1 100644 --- a/src/main/resources/data/minecraft/tags/blocks/saplings.json +++ b/src/main/resources/data/minecraft/tags_disabled/blocks/saplings.json @@ -1,6 +1,6 @@ -{ - "replace": false, - "values": [ - "techreborn:rubber_sapling" - ] +{ + "replace": false, + "values": [ + "techreborn:rubber_sapling" + ] } \ No newline at end of file diff --git a/src/main/resources/data/minecraft/tags/blocks/stairs.json b/src/main/resources/data/minecraft/tags_disabled/blocks/stairs.json similarity index 93% rename from src/main/resources/data/minecraft/tags/blocks/stairs.json rename to src/main/resources/data/minecraft/tags_disabled/blocks/stairs.json index 7409dafb3..9e5f0c9f6 100644 --- a/src/main/resources/data/minecraft/tags/blocks/stairs.json +++ b/src/main/resources/data/minecraft/tags_disabled/blocks/stairs.json @@ -1,6 +1,6 @@ -{ - "replace": false, - "values": [ - "techreborn:rubber_plank_stair" - ] +{ + "replace": false, + "values": [ + "techreborn:rubber_plank_stair" + ] } \ No newline at end of file