1.14.3 + more recipe fixes

This commit is contained in:
modmuss50 2019-07-01 00:24:12 +01:00
parent 5f134a7379
commit 18950e0b29
35 changed files with 240 additions and 251 deletions

View file

@ -73,11 +73,12 @@ license {
group = 'TechReborn' group = 'TechReborn'
dependencies { dependencies {
minecraft "com.mojang:minecraft:1.14.2" minecraft "com.mojang:minecraft:1.14.3"
mappings "net.fabricmc:yarn:1.14.2+build.7" mappings "net.fabricmc:yarn:1.14.3+build.9"
modCompile "net.fabricmc:fabric-loader:0.4.8+build.155" 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" modCompile "io.github.prospector.modmenu:ModMenu:1.5.4-85"
@ -85,7 +86,7 @@ dependencies {
// transitive = false // 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:+" compileOnly "com.google.code.findbugs:jsr305:+"
} }

View file

@ -1 +1 @@
rootProject.name = "TechReborn-1.14.2" rootProject.name = "TechReborn-1.14.3"

View file

@ -24,7 +24,9 @@
package techreborn.blocks; 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.Block;
import net.minecraft.block.BlockRenderType; import net.minecraft.block.BlockRenderType;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
@ -34,8 +36,6 @@ import net.minecraft.client.item.TooltipContext;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemPlacementContext; import net.minecraft.item.ItemPlacementContext;
import net.minecraft.item.ItemStack; 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.StateFactory;
import net.minecraft.state.property.BooleanProperty; import net.minecraft.state.property.BooleanProperty;
import net.minecraft.state.property.DirectionProperty; import net.minecraft.state.property.DirectionProperty;
@ -162,8 +162,8 @@ public class BlockAlarm extends BaseTileBlock {
@Override @Override
public void buildTooltip(ItemStack stack, @Nullable BlockView worldIn, List<Component> tooltip, TooltipContext flagIn) { public void buildTooltip(ItemStack stack, @Nullable BlockView worldIn, List<Text> tooltip, TooltipContext flagIn) {
tooltip.add(new TranslatableComponent("techreborn.tooltip.alarm").applyFormat(ChatFormat.GRAY)); tooltip.add(new TranslatableText("techreborn.tooltip.alarm").formatted(Formatting.GRAY));
} }
} }

View file

@ -24,12 +24,12 @@
package techreborn.blocks; package techreborn.blocks;
import net.minecraft.ChatFormat; import net.minecraft.util.Formatting;
import net.minecraft.block.Material; import net.minecraft.block.Material;
import net.minecraft.client.item.TooltipContext; import net.minecraft.client.item.TooltipContext;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.network.chat.Component; import net.minecraft.text.Text;
import net.minecraft.network.chat.TextComponent; import net.minecraft.text.LiteralText;
import net.minecraft.world.BlockView; import net.minecraft.world.BlockView;
import reborncore.api.tile.IMachineGuiHandler; import reborncore.api.tile.IMachineGuiHandler;
import reborncore.common.blocks.BlockMachineBase; import reborncore.common.blocks.BlockMachineBase;
@ -43,8 +43,8 @@ public class BlockSupercondensator extends BlockMachineBase {
} }
@Override @Override
public void buildTooltip(ItemStack stack, @Nullable BlockView worldIn, List<Component> tooltip, TooltipContext flagIn) { public void buildTooltip(ItemStack stack, @Nullable BlockView worldIn, List<Text> tooltip, TooltipContext flagIn) {
tooltip.add(new TextComponent("WIP Coming Soon").applyFormat(ChatFormat.RED)); tooltip.add(new LiteralText("WIP Coming Soon").formatted(Formatting.RED));
// TODO // TODO
// Remember to remove WIP override and imports once complete // Remember to remove WIP override and imports once complete
} }

View file

@ -34,10 +34,10 @@ import net.minecraft.block.Material;
import net.minecraft.client.item.TooltipContext; import net.minecraft.client.item.TooltipContext;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack; 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.BlockSoundGroup;
import net.minecraft.sound.SoundCategory; import net.minecraft.sound.SoundCategory;
import net.minecraft.text.LiteralText;
import net.minecraft.text.Text;
import net.minecraft.util.Hand; import net.minecraft.util.Hand;
import net.minecraft.util.hit.BlockHitResult; import net.minecraft.util.hit.BlockHitResult;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
@ -83,10 +83,10 @@ public class BlockFusionCoil extends Block {
@Environment(EnvType.CLIENT) @Environment(EnvType.CLIENT)
@Override @Override
public void buildTooltip(ItemStack stack, @Nullable BlockView worldIn, List<Component> tooltip, public void buildTooltip(ItemStack stack, @Nullable BlockView worldIn, List<Text> tooltip,
TooltipContext flagIn) { TooltipContext flagIn) {
super.buildTooltip(stack, worldIn, tooltip, flagIn); super.buildTooltip(stack, worldIn, tooltip, flagIn);
// TODO: Translate // 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"));
} }
} }

View file

@ -24,11 +24,11 @@
package techreborn.blocks.generator; 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.client.item.TooltipContext;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.world.BlockView; import net.minecraft.world.BlockView;
import reborncore.api.tile.IMachineGuiHandler; import reborncore.api.tile.IMachineGuiHandler;
import reborncore.client.models.ModelCompound; import reborncore.client.models.ModelCompound;
@ -47,8 +47,8 @@ public class BlockMagicEnergyAbsorber extends BlockMachineBase {
} }
@Override @Override
public void buildTooltip(ItemStack stack, @Nullable BlockView worldIn, List<Component> tooltip, TooltipContext flagIn) { public void buildTooltip(ItemStack stack, @Nullable BlockView worldIn, List<Text> tooltip, TooltipContext flagIn) {
tooltip.add(new TextComponent("WIP Coming Soon").applyFormat(ChatFormat.RED)); tooltip.add(new LiteralText("WIP Coming Soon").formatted(Formatting.RED));
// TODO // TODO
// Remember to remove WIP override and imports once complete // Remember to remove WIP override and imports once complete
} }

View file

@ -24,11 +24,11 @@
package techreborn.blocks.generator; package techreborn.blocks.generator;
import net.minecraft.ChatFormat; import net.minecraft.util.Formatting;
import net.minecraft.client.item.TooltipContext; import net.minecraft.client.item.TooltipContext;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.network.chat.Component; import net.minecraft.text.Text;
import net.minecraft.network.chat.TextComponent; import net.minecraft.text.LiteralText;
import net.minecraft.world.BlockView; import net.minecraft.world.BlockView;
import reborncore.api.tile.IMachineGuiHandler; import reborncore.api.tile.IMachineGuiHandler;
import reborncore.client.models.ModelCompound; import reborncore.client.models.ModelCompound;
@ -47,8 +47,8 @@ public class BlockMagicEnergyConverter extends BlockMachineBase {
} }
@Override @Override
public void buildTooltip(ItemStack stack, @Nullable BlockView worldIn, List<Component> tooltip, TooltipContext flagIn) { public void buildTooltip(ItemStack stack, @Nullable BlockView worldIn, List<Text> tooltip, TooltipContext flagIn) {
tooltip.add(new TextComponent("WIP Coming Soon").applyFormat(ChatFormat.RED)); tooltip.add(new LiteralText("WIP Coming Soon").formatted(Formatting.RED));
// TODO // TODO
// Remember to remove WIP override and imports once complete // Remember to remove WIP override and imports once complete
} }

View file

@ -25,7 +25,8 @@
package techreborn.blocks.tier1; package techreborn.blocks.tier1;
import com.google.common.collect.Lists; 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.Block;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks; 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.LivingEntity;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.state.StateFactory; import net.minecraft.state.StateFactory;
import net.minecraft.util.Hand; import net.minecraft.util.Hand;
import net.minecraft.util.hit.BlockHitResult; import net.minecraft.util.hit.BlockHitResult;
@ -57,7 +57,6 @@ import techreborn.TechReborn;
import techreborn.tiles.machine.tier1.TilePlayerDectector; import techreborn.tiles.machine.tier1.TilePlayerDectector;
import techreborn.utils.MessageIDs; import techreborn.utils.MessageIDs;
import javax.annotation.Nullable;
import java.util.List; import java.util.List;
public class BlockPlayerDetector extends BlockMachineBase { public class BlockPlayerDetector extends BlockMachineBase {
@ -101,7 +100,7 @@ public class BlockPlayerDetector extends BlockMachineBase {
String type = state.get(TYPE); String type = state.get(TYPE);
String newType = type; String newType = type;
ChatFormat color = ChatFormat.GREEN; Formatting color = Formatting.GREEN;
if (!stack.isEmpty() && ToolManager.INSTANCE.canHandleTool(stack)) { if (!stack.isEmpty() && ToolManager.INSTANCE.canHandleTool(stack)) {
if (ToolManager.INSTANCE.handleTool(stack, pos, worldIn, playerIn, hitResult.getSide(), false)) { if (ToolManager.INSTANCE.handleTool(stack, pos, worldIn, playerIn, hitResult.getSide(), false)) {
@ -122,10 +121,10 @@ public class BlockPlayerDetector extends BlockMachineBase {
} else { } else {
if (type.equals("all")) { if (type.equals("all")) {
newType = "others"; newType = "others";
color = ChatFormat.RED; color = Formatting.RED;
} else if (type.equals("others")) { } else if (type.equals("others")) {
newType = "you"; newType = "you";
color = ChatFormat.BLUE; color = Formatting.BLUE;
} else if (type.equals("you")) { } else if (type.equals("you")) {
newType = "all"; newType = "all";
} }
@ -135,8 +134,8 @@ public class BlockPlayerDetector extends BlockMachineBase {
} }
if (worldIn.isClient) { if (worldIn.isClient) {
ChatUtils.sendNoSpamMessages(MessageIDs.playerDetectorID, new TextComponent( ChatUtils.sendNoSpamMessages(MessageIDs.playerDetectorID, new LiteralText(
ChatFormat.GRAY + I18n.translate("techreborn.message.detects") + " " + color Formatting.GRAY + I18n.translate("techreborn.message.detects") + " " + color
+ StringUtils.toFirstCapital(newType))); + StringUtils.toFirstCapital(newType)));
} }
return true; return true;

View file

@ -27,7 +27,7 @@ package techreborn.client.container;
import net.minecraft.container.Slot; import net.minecraft.container.Slot;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.network.chat.TextComponent; import net.minecraft.text.LiteralText;
import reborncore.client.gui.slots.SlotFilteredVoid; import reborncore.client.gui.slots.SlotFilteredVoid;
import reborncore.common.container.RebornContainer; import reborncore.common.container.RebornContainer;
import reborncore.common.util.Inventory; import reborncore.common.util.Inventory;
@ -39,7 +39,7 @@ public class ContainerDestructoPack extends RebornContainer {
private Inventory<?> inv; private Inventory<?> inv;
public ContainerDestructoPack(PlayerEntity player) { public ContainerDestructoPack(PlayerEntity player) {
super(null, new TextComponent("destructopack")); super(null, new LiteralText("destructopack"));
this.player = player; this.player = player;
inv = new Inventory<>(1, "destructopack", 64, null); inv = new Inventory<>(1, "destructopack", 64, null);
buildContainer(); buildContainer();

View file

@ -28,7 +28,7 @@ import com.mojang.blaze3d.platform.GlStateManager;
import net.minecraft.client.gui.screen.ingame.AbstractContainerScreen; import net.minecraft.client.gui.screen.ingame.AbstractContainerScreen;
import net.minecraft.client.resource.language.I18n; import net.minecraft.client.resource.language.I18n;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.network.chat.TextComponent; import net.minecraft.text.LiteralText;
import net.minecraft.util.Identifier; import net.minecraft.util.Identifier;
import techreborn.tiles.machine.iron.TileIronAlloyFurnace; import techreborn.tiles.machine.iron.TileIronAlloyFurnace;
@ -40,7 +40,7 @@ public class GuiAlloyFurnace extends AbstractContainerScreen {
TileIronAlloyFurnace alloyfurnace; TileIronAlloyFurnace alloyfurnace;
public GuiAlloyFurnace(final PlayerEntity player, final 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.containerWidth = 176;
this.containerHeight = 167; this.containerHeight = 167;
this.alloyfurnace = alloyFurnace; this.alloyfurnace = alloyFurnace;

View file

@ -29,7 +29,7 @@ import net.minecraft.client.gui.screen.ingame.AbstractContainerScreen;
import net.minecraft.client.gui.widget.ButtonWidget; import net.minecraft.client.gui.widget.ButtonWidget;
import net.minecraft.client.resource.language.I18n; import net.minecraft.client.resource.language.I18n;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.network.chat.TextComponent; import net.minecraft.text.LiteralText;
import net.minecraft.util.Identifier; import net.minecraft.util.Identifier;
import reborncore.client.gui.builder.widget.GuiButtonSimple; import reborncore.client.gui.builder.widget.GuiButtonSimple;
import techreborn.tiles.machine.tier3.TileChunkLoader; import techreborn.tiles.machine.tier3.TileChunkLoader;
@ -45,7 +45,7 @@ public class GuiChunkLoader extends AbstractContainerScreen {
private ButtonWidget minusTenButton; private ButtonWidget minusTenButton;
public GuiChunkLoader(final PlayerEntity player, final TileChunkLoader chunkLoader) { 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.containerWidth = 176;
this.containerHeight = 167; this.containerHeight = 167;
this.chunkloader = chunkLoader; this.chunkloader = chunkLoader;

View file

@ -29,7 +29,7 @@ import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.screen.ingame.AbstractContainerScreen; import net.minecraft.client.gui.screen.ingame.AbstractContainerScreen;
import net.minecraft.client.resource.language.I18n; import net.minecraft.client.resource.language.I18n;
import net.minecraft.container.Container; import net.minecraft.container.Container;
import net.minecraft.network.chat.TextComponent; import net.minecraft.text.LiteralText;
import net.minecraft.util.Identifier; import net.minecraft.util.Identifier;
public class GuiDestructoPack extends AbstractContainerScreen { public class GuiDestructoPack extends AbstractContainerScreen {
@ -38,7 +38,7 @@ public class GuiDestructoPack extends AbstractContainerScreen {
"textures/gui/destructopack.png"); "textures/gui/destructopack.png");
public GuiDestructoPack(Container container) { 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.containerWidth = 176;
this.containerHeight = 166; this.containerHeight = 166;
} }

View file

@ -27,7 +27,7 @@ package techreborn.client.gui;
import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.resource.language.I18n; import net.minecraft.client.resource.language.I18n;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.network.chat.TextComponent; import net.minecraft.text.LiteralText;
import net.minecraft.util.Identifier; import net.minecraft.util.Identifier;
import techreborn.items.ItemManual; import techreborn.items.ItemManual;
@ -45,7 +45,7 @@ public class GuiManual extends Screen {
private static final String text3 = I18n.translate("techreborn.manual.refund"); private static final String text3 = I18n.translate("techreborn.manual.refund");
public GuiManual(PlayerEntity player) { public GuiManual(PlayerEntity player) {
super(new TextComponent("gui.manual")); super(new LiteralText("gui.manual"));
this.player = player; this.player = player;
} }

View file

@ -98,7 +98,7 @@ public class EntityNukePrimed extends TntEntity {
explodeNuke(); explodeNuke();
} }
} else { } 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); this.world.addParticle(ParticleTypes.SMOKE, this.x, this.y + 0.5D, this.z, 0.0D, 0.0D, 0.0D);
} }
} }

View file

@ -24,7 +24,7 @@
package techreborn.events; package techreborn.events;
import net.minecraft.ChatFormat; import net.minecraft.util.Formatting;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.BlockEntityProvider; import net.minecraft.block.BlockEntityProvider;
import net.minecraft.block.BlockWithEntity; import net.minecraft.block.BlockWithEntity;
@ -35,8 +35,8 @@ import net.minecraft.client.item.TooltipContext;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.chat.Component; import net.minecraft.text.Text;
import net.minecraft.network.chat.TextComponent; import net.minecraft.text.LiteralText;
import net.minecraft.util.registry.Registry; import net.minecraft.util.registry.Registry;
import reborncore.api.IListInfoProvider; import reborncore.api.IListInfoProvider;
import reborncore.api.events.ItemTooltipCallback; import reborncore.api.events.ItemTooltipCallback;
@ -56,27 +56,27 @@ public class StackToolTipHandler implements ItemTooltipCallback {
} }
@Override @Override
public void getTooltip(ItemStack stack, TooltipContext tooltipContext, List<Component> components) { public void getTooltip(ItemStack stack, TooltipContext tooltipContext, List<Text> components) {
Item item = stack.getItem(); Item item = stack.getItem();
if (item instanceof IListInfoProvider) { if (item instanceof IListInfoProvider) {
((IListInfoProvider) item).addInfo(components, false, false); ((IListInfoProvider) item).addInfo(components, false, false);
} else if (stack.getItem() instanceof IEnergyItemInfo) { } else if (stack.getItem() instanceof IEnergyItemInfo) {
ItemPowerManager itemPowerManager = new ItemPowerManager(stack); 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("/");
line1.append(PowerSystem.getLocaliszedPowerFormattedNoSuffix(itemPowerManager.getMaxEnergyStored() / RebornCoreConfig.euPerFU)); line1.append(PowerSystem.getLocaliszedPowerFormattedNoSuffix(itemPowerManager.getMaxEnergyStored() / RebornCoreConfig.euPerFU));
line1.append(" "); line1.append(" ");
line1.append(PowerSystem.getDisplayPower().abbreviation); line1.append(PowerSystem.getDisplayPower().abbreviation);
line1.applyFormat(ChatFormat.GOLD); line1.formatted(Formatting.GOLD);
components.add(1, line1); components.add(1, line1);
if (Screen.hasShiftDown()) { if (Screen.hasShiftDown()) {
int percentage = percentage(itemPowerManager.getMaxEnergyStored(), itemPowerManager.getEnergyStored()); int percentage = percentage(itemPowerManager.getMaxEnergyStored(), itemPowerManager.getEnergyStored());
ChatFormat color = StringUtils.getPercentageColour(percentage); Formatting color = StringUtils.getPercentageColour(percentage);
components.add(2, new TextComponent(color + "" + percentage + "%" + ChatFormat.GRAY + " Charged")); components.add(2, new LiteralText(color + "" + percentage + "%" + Formatting.GRAY + " Charged"));
// TODO: show both input and output rates // 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 { } else {
try { try {
@ -88,14 +88,14 @@ public class StackToolTipHandler implements ItemTooltipCallback {
CompoundTag tileData = stack.getTag().getCompound("tile_data"); CompoundTag tileData = stack.getTag().getCompound("tile_data");
tile.fromTag(tileData); tile.fromTag(tileData);
hasData = true; 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) { if (tile instanceof IListInfoProvider) {
((IListInfoProvider) tile).addInfo(components, false, hasData); ((IListInfoProvider) tile).addInfo(components, false, hasData);
} }
} }
} catch (NullPointerException e) { } catch (NullPointerException e) {
TechReborn.LOGGER.debug("Failed to load info for " + stack.getCustomName()); TechReborn.LOGGER.debug("Failed to load info for " + stack.getName());
} }
} }
} }

View file

@ -24,6 +24,7 @@
package techreborn.init; package techreborn.init;
import net.minecraft.block.Block;
import net.minecraft.block.entity.BlockEntity; import net.minecraft.block.entity.BlockEntity;
import net.minecraft.block.entity.BlockEntityType; import net.minecraft.block.entity.BlockEntityType;
import net.minecraft.util.Identifier; import net.minecraft.util.Identifier;
@ -97,7 +98,7 @@ public class TRTileEntities {
public static final BlockEntityType<TileFusionControlComputer> FUSION_CONTROL_COMPUTER = register(TileFusionControlComputer.class, "fusion_control_computer"); public static final BlockEntityType<TileFusionControlComputer> FUSION_CONTROL_COMPUTER = register(TileFusionControlComputer.class, "fusion_control_computer");
public static final BlockEntityType<TileLightningRod> LIGHTNING_ROD = register(TileLightningRod.class, "lightning_rod"); public static final BlockEntityType<TileLightningRod> LIGHTNING_ROD = register(TileLightningRod.class, "lightning_rod");
public static final BlockEntityType<TileIndustrialSawmill> INDUSTRIAL_SAWMILL = register(TileIndustrialSawmill.class, "industrial_sawmill"); public static final BlockEntityType<TileIndustrialSawmill> INDUSTRIAL_SAWMILL = register(TileIndustrialSawmill.class, "industrial_sawmill");
public static final BlockEntityType<TileGrinder> GRINDER = register(TileGrinder.class, "grinder"); public static final BlockEntityType<TileGrinder> GRINDER = register(TileGrinder.class, "grinder", TRContent.Machine.GRINDER.block);
public static final BlockEntityType<TileSolidFuelGenerator> SOLID_FUEL_GENEREATOR = register(TileSolidFuelGenerator.class, "solid_fuel_generator"); public static final BlockEntityType<TileSolidFuelGenerator> SOLID_FUEL_GENEREATOR = register(TileSolidFuelGenerator.class, "solid_fuel_generator");
public static final BlockEntityType<TileExtractor> EXTRACTOR = register(TileExtractor.class, "extractor"); public static final BlockEntityType<TileExtractor> EXTRACTOR = register(TileExtractor.class, "extractor");
public static final BlockEntityType<TileCompressor> COMPRESSOR = register(TileCompressor.class, "compressor"); public static final BlockEntityType<TileCompressor> COMPRESSOR = register(TileCompressor.class, "compressor");
@ -125,15 +126,16 @@ public class TRTileEntities {
public static <T extends BlockEntity> BlockEntityType<T> register(Class<T> tClass, String name) { public static <T extends BlockEntity> BlockEntityType<T> register(Class<T> tClass, String name, Block... blocks) {
return register(new Identifier(TechReborn.MOD_ID, name).toString(), BlockEntityType.Builder.create(() -> { return register(new Identifier(TechReborn.MOD_ID, name).toString(), BlockEntityType.Builder.create(() -> createBlockEntity(tClass), blocks));
//TODO clean this up }
try {
return tClass.newInstance(); private static <T extends BlockEntity> T createBlockEntity(Class<T> tClass){
} catch (InstantiationException | IllegalAccessException e) { try {
throw new RuntimeException("Failed to create tile", e); return tClass.newInstance();
} } catch (InstantiationException | IllegalAccessException e) {
})); throw new RuntimeException("Failed to createBlockEntity tile", e);
}
} }
public static <T extends BlockEntity> BlockEntityType<T> register(String id, BlockEntityType.Builder<T> builder) { public static <T extends BlockEntity> BlockEntityType<T> register(String id, BlockEntityType.Builder<T> builder) {

View file

@ -26,7 +26,8 @@ package techreborn.items;
import net.fabricmc.api.EnvType; import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment; 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.item.TooltipContext;
import net.minecraft.client.resource.language.I18n; import net.minecraft.client.resource.language.I18n;
import net.minecraft.entity.LivingEntity; import net.minecraft.entity.LivingEntity;
@ -36,12 +37,8 @@ import net.minecraft.item.ItemPropertyGetter;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemUsageContext; import net.minecraft.item.ItemUsageContext;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.chat.Component; import net.minecraft.text.Text;
import net.minecraft.network.chat.TextComponent; import net.minecraft.util.*;
import net.minecraft.util.ActionResult;
import net.minecraft.util.Hand;
import net.minecraft.util.Identifier;
import net.minecraft.util.TypedActionResult;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.registry.Registry; import net.minecraft.util.registry.Registry;
import net.minecraft.world.World; import net.minecraft.world.World;
@ -85,15 +82,15 @@ public class ItemFrequencyTransmitter extends Item {
stack.getTag().putInt("dim", world.getDimension().getType().getRawId()); stack.getTag().putInt("dim", world.getDimension().getType().getRawId());
if (!world.isClient) { if (!world.isClient) {
ChatUtils.sendNoSpamMessages(MessageIDs.freqTransmitterID, new TextComponent( ChatUtils.sendNoSpamMessages(MessageIDs.freqTransmitterID, new LiteralText(
ChatFormat.GRAY + I18n.translate("techreborn.message.setTo") + " X: " + Formatting.GRAY + I18n.translate("techreborn.message.setTo") + " X: " +
ChatFormat.GOLD + pos.getX() + Formatting.GOLD + pos.getX() +
ChatFormat.GRAY + " Y: " + Formatting.GRAY + " Y: " +
ChatFormat.GOLD + pos.getY() + Formatting.GOLD + pos.getY() +
ChatFormat.GRAY + " Z: " + Formatting.GRAY + " Z: " +
ChatFormat.GOLD + pos.getZ() + Formatting.GOLD + pos.getZ() +
ChatFormat.GRAY + " " + I18n.translate("techreborn.message.in") + " " + Formatting.GRAY + " " + I18n.translate("techreborn.message.in") + " " +
ChatFormat.GOLD + getDimName(world.getDimension().getType()) Formatting.GOLD + getDimName(world.getDimension().getType())
+ " (" + getDimName(world.getDimension().getType()) + ")")); + " (" + getDimName(world.getDimension().getType()) + ")"));
} }
return ActionResult.SUCCESS; return ActionResult.SUCCESS;
@ -106,9 +103,9 @@ public class ItemFrequencyTransmitter extends Item {
if (player.isSneaking()) { if (player.isSneaking()) {
stack.setTag(null); stack.setTag(null);
if (!world.isClient) { if (!world.isClient) {
ChatUtils.sendNoSpamMessages(MessageIDs.freqTransmitterID, new TextComponent( ChatUtils.sendNoSpamMessages(MessageIDs.freqTransmitterID, new LiteralText(
ChatFormat.GRAY + I18n.translate("techreborn.message.coordsHaveBeen") + " " Formatting.GRAY + I18n.translate("techreborn.message.coordsHaveBeen") + " "
+ ChatFormat.GOLD + I18n.translate("techreborn.message.cleared"))); + Formatting.GOLD + I18n.translate("techreborn.message.cleared")));
} }
} }
@ -117,20 +114,20 @@ public class ItemFrequencyTransmitter extends Item {
@Environment(EnvType.CLIENT) @Environment(EnvType.CLIENT)
@Override @Override
public void appendTooltip(ItemStack stack, @Nullable World worldIn, List<Component> tooltip, TooltipContext flagIn) { public void appendTooltip(ItemStack stack, @Nullable World worldIn, List<Text> 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")) { 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 x = stack.getTag().getInt("x");
int y = stack.getTag().getInt("y"); int y = stack.getTag().getInt("y");
int z = stack.getTag().getInt("z"); int z = stack.getTag().getInt("z");
int dim = stack.getTag().getInt("dim"); int dim = stack.getTag().getInt("dim");
tooltip.add(new TextComponent(ChatFormat.GRAY + "X: " + ChatFormat.GOLD + x)); tooltip.add(new LiteralText(Formatting.GRAY + "X: " + Formatting.GOLD + x));
tooltip.add(new TextComponent(ChatFormat.GRAY + "Y: " + ChatFormat.GOLD + y)); tooltip.add(new LiteralText(Formatting.GRAY + "Y: " + Formatting.GOLD + y));
tooltip.add(new TextComponent(ChatFormat.GRAY + "Z: " + ChatFormat.GOLD + z)); tooltip.add(new LiteralText(Formatting.GRAY + "Z: " + Formatting.GOLD + z));
tooltip.add(new TextComponent(ChatFormat.DARK_GRAY + getDimName(Registry.DIMENSION.get(dim)).toString())); tooltip.add(new LiteralText(Formatting.DARK_GRAY + getDimName(Registry.DIMENSION.get(dim)).toString()));
} else { } 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 @Override
public String getText(ItemStack stack) { public String getText(ItemStack stack) {
String text = ""; String text = "";
ChatFormat gold = ChatFormat.GOLD; Formatting gold = Formatting.GOLD;
ChatFormat grey = ChatFormat.GRAY; Formatting grey = Formatting.GRAY;
if (stack.getItem() instanceof ItemFrequencyTransmitter) { 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")) { 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"); int coordX = stack.getTag().getInt("x");

View file

@ -24,15 +24,16 @@
package techreborn.items.tool; package techreborn.items.tool;
import net.minecraft.ChatFormat;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.block.entity.BlockEntity; import net.minecraft.block.entity.BlockEntity;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemUsageContext; import net.minecraft.item.ItemUsageContext;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.state.property.Property; 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.ActionResult;
import net.minecraft.util.Formatting;
import net.minecraft.util.SystemUtil; import net.minecraft.util.SystemUtil;
import net.minecraft.util.registry.Registry; import net.minecraft.util.registry.Registry;
import reborncore.api.power.IEnergyInterfaceTile; import reborncore.api.power.IEnergyInterfaceTile;
@ -57,21 +58,21 @@ public class ItemDebugTool extends Item {
if (block == null) { if (block == null) {
return ActionResult.FAIL; return ActionResult.FAIL;
} }
sendMessage(context, new TextComponent(getRegistryName(block))); sendMessage(context, new LiteralText(getRegistryName(block)));
for (Entry<Property<?>, Comparable<?>> entry : blockState.getEntries().entrySet()) { for (Entry<Property<?>, Comparable<?>> entry : blockState.getEntries().entrySet()) {
sendMessage(context, new TextComponent(getPropertyString(entry))); sendMessage(context, new LiteralText(getPropertyString(entry)));
} }
BlockEntity tile = context.getWorld().getBlockEntity(context.getBlockPos()); BlockEntity tile = context.getWorld().getBlockEntity(context.getBlockPos());
if (tile != null) { if (tile != null) {
sendMessage(context, new TextComponent(getTileEntityType(tile))); sendMessage(context, new LiteralText(getTileEntityType(tile)));
if (tile instanceof IEnergyInterfaceTile) { if (tile instanceof IEnergyInterfaceTile) {
sendMessage(context, new TextComponent(getRCPower((IEnergyInterfaceTile) tile))); sendMessage(context, new LiteralText(getRCPower((IEnergyInterfaceTile) tile)));
} }
} }
return ActionResult.SUCCESS; return ActionResult.SUCCESS;
} }
private void sendMessage(ItemUsageContext context, TextComponent string) { private void sendMessage(ItemUsageContext context, Text string) {
if (!context.getWorld().isClient) { if (!context.getWorld().isClient) {
context.getPlayer().sendMessage(string); context.getPlayer().sendMessage(string);
} }
@ -82,36 +83,36 @@ public class ItemDebugTool extends Item {
Comparable<?> comparable = entryIn.getValue(); Comparable<?> comparable = entryIn.getValue();
String s = SystemUtil.getValueAsString(iproperty, comparable); String s = SystemUtil.getValueAsString(iproperty, comparable);
if (Boolean.TRUE.equals(comparable)) { if (Boolean.TRUE.equals(comparable)) {
s = ChatFormat.GREEN + s; s = Formatting.GREEN + s;
} else if (Boolean.FALSE.equals(comparable)) { } else if (Boolean.FALSE.equals(comparable)) {
s = ChatFormat.RED + s; s = Formatting.RED + s;
} }
return iproperty.getName() + ": " + s; return iproperty.getName() + ": " + s;
} }
private String getRegistryName(Block block) { private String getRegistryName(Block block) {
String s = "" + ChatFormat.GREEN; String s = "" + Formatting.GREEN;
s += "Block Registry Name: "; s += "Block Registry Name: ";
s += ChatFormat.BLUE; s += Formatting.BLUE;
s += Registry.BLOCK.getId(block); s += Registry.BLOCK.getId(block);
return s; return s;
} }
private String getTileEntityType(BlockEntity tile) { private String getTileEntityType(BlockEntity tile) {
String s = "" + ChatFormat.GREEN; String s = "" + Formatting.GREEN;
s += "Tile Entity: "; s += "Tile Entity: ";
s += ChatFormat.BLUE; s += Formatting.BLUE;
s += tile.getType().toString(); s += tile.getType().toString();
return s; return s;
} }
private String getRCPower(IEnergyInterfaceTile tile) { private String getRCPower(IEnergyInterfaceTile tile) {
String s = "" + ChatFormat.GREEN; String s = "" + Formatting.GREEN;
s += "Power: "; s += "Power: ";
s += ChatFormat.BLUE; s += Formatting.BLUE;
s += PowerSystem.getLocaliszedPower(tile.getEnergy()); s += PowerSystem.getLocaliszedPower(tile.getEnergy());
s += "/"; s += "/";
s += PowerSystem.getLocaliszedPower(tile.getMaxPower()); s += PowerSystem.getLocaliszedPower(tile.getMaxPower());

View file

@ -26,7 +26,6 @@ package techreborn.items.tool.industrial;
import net.fabricmc.api.EnvType; import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment; import net.fabricmc.api.Environment;
import net.minecraft.ChatFormat;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks; import net.minecraft.block.Blocks;
import net.minecraft.client.item.TooltipContext; import net.minecraft.client.item.TooltipContext;
@ -39,13 +38,10 @@ import net.minecraft.item.ItemStack;
import net.minecraft.item.Items; import net.minecraft.item.Items;
import net.minecraft.item.ToolMaterials; import net.minecraft.item.ToolMaterials;
import net.minecraft.nbt.CompoundTag; 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.tag.BlockTags;
import net.minecraft.util.ActionResult; import net.minecraft.text.LiteralText;
import net.minecraft.util.DefaultedList; import net.minecraft.text.Text;
import net.minecraft.util.Hand; import net.minecraft.util.*;
import net.minecraft.util.TypedActionResult;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction; import net.minecraft.util.math.Direction;
import net.minecraft.world.World; import net.minecraft.world.World;
@ -128,9 +124,9 @@ public class ItemIndustrialChainsaw extends ItemChainsaw {
final ItemStack stack = player.getStackInHand(hand); final ItemStack stack = player.getStackInHand(hand);
if (player.isSneaking()) { if (player.isSneaking()) {
if (new ItemPowerManager(stack).getEnergyStored() < cost) { if (new ItemPowerManager(stack).getEnergyStored() < cost) {
ChatUtils.sendNoSpamMessages(MessageIDs.nanosaberID, new TextComponent( ChatUtils.sendNoSpamMessages(MessageIDs.nanosaberID, new LiteralText(
ChatFormat.GRAY + I18n.translate("techreborn.message.nanosaberEnergyErrorTo") + " " Formatting.GRAY + I18n.translate("techreborn.message.nanosaberEnergyErrorTo") + " "
+ ChatFormat.GOLD + I18n + Formatting.GOLD + I18n
.translate("techreborn.message.nanosaberActivate"))); .translate("techreborn.message.nanosaberActivate")));
} else { } else {
if (!ItemUtils.isActive(stack)) { if (!ItemUtils.isActive(stack)) {
@ -139,17 +135,17 @@ public class ItemIndustrialChainsaw extends ItemChainsaw {
} }
stack.getTag().putBoolean("isActive", true); stack.getTag().putBoolean("isActive", true);
if (world.isClient) { if (world.isClient) {
ChatUtils.sendNoSpamMessages(MessageIDs.nanosaberID, new TextComponent( ChatUtils.sendNoSpamMessages(MessageIDs.nanosaberID, new LiteralText(
ChatFormat.GRAY + I18n.translate("techreborn.message.setTo") + " " Formatting.GRAY + I18n.translate("techreborn.message.setTo") + " "
+ ChatFormat.GOLD + I18n + Formatting.GOLD + I18n
.translate("techreborn.message.nanosaberActive"))); .translate("techreborn.message.nanosaberActive")));
} }
} else { } else {
stack.getTag().putBoolean("isActive", false); stack.getTag().putBoolean("isActive", false);
if (world.isClient) { if (world.isClient) {
ChatUtils.sendNoSpamMessages(MessageIDs.nanosaberID, new TextComponent( ChatUtils.sendNoSpamMessages(MessageIDs.nanosaberID, new LiteralText(
ChatFormat.GRAY + I18n.translate("techreborn.message.setTo") + " " Formatting.GRAY + I18n.translate("techreborn.message.setTo") + " "
+ ChatFormat.GOLD + I18n + Formatting.GOLD + I18n
.translate("techreborn.message.nanosaberInactive"))); .translate("techreborn.message.nanosaberInactive")));
} }
} }
@ -163,9 +159,9 @@ public class ItemIndustrialChainsaw extends ItemChainsaw {
public void usageTick(World world, LivingEntity entity, ItemStack stack, int i) { public void usageTick(World world, LivingEntity entity, ItemStack stack, int i) {
if (ItemUtils.isActive(stack) && new ItemPowerManager(stack).getEnergyStored() < cost) { if (ItemUtils.isActive(stack) && new ItemPowerManager(stack).getEnergyStored() < cost) {
if(entity.world.isClient){ if(entity.world.isClient){
ChatUtils.sendNoSpamMessages(MessageIDs.nanosaberID, new TextComponent( ChatUtils.sendNoSpamMessages(MessageIDs.nanosaberID, new LiteralText(
ChatFormat.GRAY + I18n.translate("techreborn.message.nanosaberEnergyError") + " " Formatting.GRAY + I18n.translate("techreborn.message.nanosaberEnergyError") + " "
+ ChatFormat.GOLD + I18n + Formatting.GOLD + I18n
.translate("techreborn.message.nanosaberDeactivating"))); .translate("techreborn.message.nanosaberDeactivating")));
} }
stack.getTag().putBoolean("isActive", false); stack.getTag().putBoolean("isActive", false);
@ -174,11 +170,11 @@ public class ItemIndustrialChainsaw extends ItemChainsaw {
@Environment(EnvType.CLIENT) @Environment(EnvType.CLIENT)
@Override @Override
public void appendTooltip(ItemStack stack, @Nullable World worldIn, List<Component> tooltip, TooltipContext flagIn) { public void appendTooltip(ItemStack stack, @Nullable World worldIn, List<Text> tooltip, TooltipContext flagIn) {
if (!ItemUtils.isActive(stack)) { 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 { } 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")));
} }
} }

View file

@ -26,7 +26,6 @@ package techreborn.items.tool.industrial;
import net.fabricmc.api.EnvType; import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment; import net.fabricmc.api.Environment;
import net.minecraft.ChatFormat;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks; import net.minecraft.block.Blocks;
import net.minecraft.block.Material; import net.minecraft.block.Material;
@ -40,16 +39,12 @@ import net.minecraft.item.ItemStack;
import net.minecraft.item.Items; import net.minecraft.item.Items;
import net.minecraft.item.ToolMaterials; import net.minecraft.item.ToolMaterials;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.chat.Component; import net.minecraft.text.LiteralText;
import net.minecraft.network.chat.TextComponent; import net.minecraft.text.Text;
import net.minecraft.util.ActionResult; import net.minecraft.util.*;
import net.minecraft.util.DefaultedList;
import net.minecraft.util.Hand;
import net.minecraft.util.TypedActionResult;
import net.minecraft.util.hit.BlockHitResult; import net.minecraft.util.hit.BlockHitResult;
import net.minecraft.util.hit.HitResult; import net.minecraft.util.hit.HitResult;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.BoundingBox;
import net.minecraft.util.math.Direction; import net.minecraft.util.math.Direction;
import net.minecraft.world.RayTraceContext; import net.minecraft.world.RayTraceContext;
import net.minecraft.world.World; import net.minecraft.world.World;
@ -178,9 +173,9 @@ public class ItemIndustrialDrill extends ItemDrill {
final ItemStack stack = player.getStackInHand(hand); final ItemStack stack = player.getStackInHand(hand);
if (player.isSneaking()) { if (player.isSneaking()) {
if (new ItemPowerManager(stack).getEnergyStored() < cost) { if (new ItemPowerManager(stack).getEnergyStored() < cost) {
ChatUtils.sendNoSpamMessages(MessageIDs.nanosaberID, new TextComponent( ChatUtils.sendNoSpamMessages(MessageIDs.nanosaberID, new LiteralText(
ChatFormat.GRAY + I18n.translate("techreborn.message.nanosaberEnergyErrorTo") + " " Formatting.GRAY + I18n.translate("techreborn.message.nanosaberEnergyErrorTo") + " "
+ ChatFormat.GOLD + I18n + Formatting.GOLD + I18n
.translate("techreborn.message.nanosaberActivate"))); .translate("techreborn.message.nanosaberActivate")));
} else { } else {
if (!ItemUtils.isActive(stack)) { if (!ItemUtils.isActive(stack)) {
@ -189,17 +184,17 @@ public class ItemIndustrialDrill extends ItemDrill {
} }
stack.getTag().putBoolean("isActive", true); stack.getTag().putBoolean("isActive", true);
if (world.isClient) { if (world.isClient) {
ChatUtils.sendNoSpamMessages(MessageIDs.nanosaberID, new TextComponent( ChatUtils.sendNoSpamMessages(MessageIDs.nanosaberID, new LiteralText(
ChatFormat.GRAY + I18n.translate("techreborn.message.setTo") + " " Formatting.GRAY + I18n.translate("techreborn.message.setTo") + " "
+ ChatFormat.GOLD + I18n + Formatting.GOLD + I18n
.translate("techreborn.message.nanosaberActive"))); .translate("techreborn.message.nanosaberActive")));
} }
} else { } else {
stack.getTag().putBoolean("isActive", false); stack.getTag().putBoolean("isActive", false);
if (world.isClient) { if (world.isClient) {
ChatUtils.sendNoSpamMessages(MessageIDs.nanosaberID, new TextComponent( ChatUtils.sendNoSpamMessages(MessageIDs.nanosaberID, new LiteralText(
ChatFormat.GRAY + I18n.translate("techreborn.message.setTo") + " " Formatting.GRAY + I18n.translate("techreborn.message.setTo") + " "
+ ChatFormat.GOLD + I18n + Formatting.GOLD + I18n
.translate("techreborn.message.nanosaberInactive"))); .translate("techreborn.message.nanosaberInactive")));
} }
} }
@ -213,9 +208,9 @@ public class ItemIndustrialDrill extends ItemDrill {
public void usageTick(World world, LivingEntity entity, ItemStack stack, int i) { public void usageTick(World world, LivingEntity entity, ItemStack stack, int i) {
if (ItemUtils.isActive(stack) && new ItemPowerManager(stack).getEnergyStored() < cost) { if (ItemUtils.isActive(stack) && new ItemPowerManager(stack).getEnergyStored() < cost) {
if(entity.world.isClient){ if(entity.world.isClient){
ChatUtils.sendNoSpamMessages(MessageIDs.nanosaberID, new TextComponent( ChatUtils.sendNoSpamMessages(MessageIDs.nanosaberID, new LiteralText(
ChatFormat.GRAY + I18n.translate("techreborn.message.nanosaberEnergyError") + " " Formatting.GRAY + I18n.translate("techreborn.message.nanosaberEnergyError") + " "
+ ChatFormat.GOLD + I18n + Formatting.GOLD + I18n
.translate("techreborn.message.nanosaberDeactivating"))); .translate("techreborn.message.nanosaberDeactivating")));
} }
stack.getTag().putBoolean("isActive", false); stack.getTag().putBoolean("isActive", false);
@ -224,11 +219,11 @@ public class ItemIndustrialDrill extends ItemDrill {
@Environment(EnvType.CLIENT) @Environment(EnvType.CLIENT)
@Override @Override
public void appendTooltip(ItemStack stack, @Nullable World worldIn, List<Component> tooltip, TooltipContext flagIn) { public void appendTooltip(ItemStack stack, @Nullable World worldIn, List<Text> tooltip, TooltipContext flagIn) {
if (!ItemUtils.isActive(stack)) { 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 { } 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")));
} }
} }

View file

@ -28,7 +28,6 @@ import com.google.common.collect.HashMultimap;
import com.google.common.collect.Multimap; import com.google.common.collect.Multimap;
import net.fabricmc.api.EnvType; import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment; import net.fabricmc.api.Environment;
import net.minecraft.ChatFormat;
import net.minecraft.client.item.TooltipContext; import net.minecraft.client.item.TooltipContext;
import net.minecraft.client.resource.language.I18n; import net.minecraft.client.resource.language.I18n;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
@ -39,9 +38,9 @@ import net.minecraft.entity.attribute.EntityAttributes;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.*; import net.minecraft.item.*;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.chat.Component; import net.minecraft.text.LiteralText;
import net.minecraft.network.chat.TextComponent; import net.minecraft.text.Text;
import net.minecraft.network.chat.TranslatableComponent; import net.minecraft.text.TranslatableText;
import net.minecraft.util.*; import net.minecraft.util.*;
import net.minecraft.world.World; import net.minecraft.world.World;
import reborncore.api.power.IEnergyItemInfo; import reborncore.api.power.IEnergyItemInfo;
@ -124,9 +123,9 @@ public class ItemNanosaber extends SwordItem implements IEnergyItemInfo, ItemDur
final ItemStack stack = player.getStackInHand(hand); final ItemStack stack = player.getStackInHand(hand);
if (player.isSneaking()) { if (player.isSneaking()) {
if (new ItemPowerManager(stack).getEnergyStored() < cost) { if (new ItemPowerManager(stack).getEnergyStored() < cost) {
ChatUtils.sendNoSpamMessages(MessageIDs.nanosaberID, new TextComponent( ChatUtils.sendNoSpamMessages(MessageIDs.nanosaberID, new LiteralText(
ChatFormat.GRAY + I18n.translate("techreborn.message.nanosaberEnergyErrorTo") + " " Formatting.GRAY + I18n.translate("techreborn.message.nanosaberEnergyErrorTo") + " "
+ ChatFormat.GOLD + I18n + Formatting.GOLD + I18n
.translate("techreborn.message.nanosaberActivate"))); .translate("techreborn.message.nanosaberActivate")));
} else { } else {
if (!ItemUtils.isActive(stack)) { if (!ItemUtils.isActive(stack)) {
@ -135,17 +134,17 @@ public class ItemNanosaber extends SwordItem implements IEnergyItemInfo, ItemDur
} }
stack.getTag().putBoolean("isActive", true); stack.getTag().putBoolean("isActive", true);
if (world.isClient) { if (world.isClient) {
ChatUtils.sendNoSpamMessages(MessageIDs.nanosaberID, new TextComponent( ChatUtils.sendNoSpamMessages(MessageIDs.nanosaberID, new LiteralText(
ChatFormat.GRAY + I18n.translate("techreborn.message.setTo") + " " Formatting.GRAY + I18n.translate("techreborn.message.setTo") + " "
+ ChatFormat.GOLD + I18n + Formatting.GOLD + I18n
.translate("techreborn.message.nanosaberActive"))); .translate("techreborn.message.nanosaberActive")));
} }
} else { } else {
stack.getTag().putBoolean("isActive", false); stack.getTag().putBoolean("isActive", false);
if (world.isClient) { if (world.isClient) {
ChatUtils.sendNoSpamMessages(MessageIDs.nanosaberID, new TextComponent( ChatUtils.sendNoSpamMessages(MessageIDs.nanosaberID, new LiteralText(
ChatFormat.GRAY + I18n.translate("techreborn.message.setTo") + " " Formatting.GRAY + I18n.translate("techreborn.message.setTo") + " "
+ ChatFormat.GOLD + I18n + Formatting.GOLD + I18n
.translate("techreborn.message.nanosaberInactive"))); .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) { public void inventoryTick(ItemStack stack, World worldIn, Entity entityIn, int itemSlot, boolean isSelected) {
if (ItemUtils.isActive(stack) && new ItemPowerManager(stack).getEnergyStored() < cost) { if (ItemUtils.isActive(stack) && new ItemPowerManager(stack).getEnergyStored() < cost) {
if(worldIn.isClient){ if(worldIn.isClient){
ChatUtils.sendNoSpamMessages(MessageIDs.nanosaberID, new TextComponent( ChatUtils.sendNoSpamMessages(MessageIDs.nanosaberID, new LiteralText(
ChatFormat.GRAY + I18n.translate("techreborn.message.nanosaberEnergyError") + " " Formatting.GRAY + I18n.translate("techreborn.message.nanosaberEnergyError") + " "
+ ChatFormat.GOLD + I18n + Formatting.GOLD + I18n
.translate("techreborn.message.nanosaberDeactivating"))); .translate("techreborn.message.nanosaberDeactivating")));
} }
stack.getTag().putBoolean("isActive", false); stack.getTag().putBoolean("isActive", false);
@ -218,11 +217,11 @@ public class ItemNanosaber extends SwordItem implements IEnergyItemInfo, ItemDur
@Environment(EnvType.CLIENT) @Environment(EnvType.CLIENT)
@Override @Override
public void appendTooltip(ItemStack stack, @Nullable World worldIn, List<Component> tooltip, TooltipContext flagIn) { public void appendTooltip(ItemStack stack, @Nullable World worldIn, List<Text> tooltip, TooltipContext flagIn) {
if (!ItemUtils.isActive(stack)) { 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 { } else {
tooltip.add(new TranslatableComponent("techreborn.message.nanosaberActive").applyFormat(ChatFormat.GRAY)); tooltip.add(new TranslatableText("techreborn.message.nanosaberActive").formatted(Formatting.GRAY));
} }
} }

View file

@ -26,15 +26,15 @@ package techreborn.items.tool.industrial;
import net.fabricmc.api.EnvType; import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment; 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.block.BlockState;
import net.minecraft.client.item.TooltipContext; import net.minecraft.client.item.TooltipContext;
import net.minecraft.entity.LivingEntity; import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.damage.DamageSource; import net.minecraft.entity.damage.DamageSource;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.*; 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.ActionResult;
import net.minecraft.util.DefaultedList; import net.minecraft.util.DefaultedList;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
@ -129,8 +129,8 @@ public class ItemOmniTool extends PickaxeItem implements IEnergyItemInfo, ItemDu
} }
@Override @Override
public void appendTooltip(ItemStack stack, @Nullable World worldIn, List<Component> tooltip, TooltipContext flagIn) { public void appendTooltip(ItemStack stack, @Nullable World worldIn, List<Text> tooltip, TooltipContext flagIn) {
tooltip.add(new TextComponent("WIP Coming Soon").applyFormat(ChatFormat.RED)); tooltip.add(new LiteralText("WIP Coming Soon").formatted(Formatting.RED));
// TODO // TODO
// Remember to remove WIP override and imports once complete // Remember to remove WIP override and imports once complete
} }

View file

@ -24,7 +24,7 @@
package techreborn.proxies; package techreborn.proxies;
import net.minecraft.ChatFormat; import net.minecraft.util.Formatting;
import net.minecraft.client.MinecraftClient; import net.minecraft.client.MinecraftClient;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import reborncore.api.tile.IUpgradeable; import reborncore.api.tile.IUpgradeable;
@ -66,7 +66,7 @@ public class ClientProxy extends CommonProxy {
GuiBase base = (GuiBase) MinecraftClient.getInstance().currentScreen; GuiBase base = (GuiBase) MinecraftClient.getInstance().currentScreen;
if (base.tile instanceof IUpgradeable) { if (base.tile instanceof IUpgradeable) {
if (((IUpgradeable) base.tile).canBeUpgraded()) { if (((IUpgradeable) base.tile).canBeUpgraded()) {
return ChatFormat.LIGHT_PURPLE + "Right click to configure"; return Formatting.LIGHT_PURPLE + "Right click to configure";
} }
} }
} }

View file

@ -24,12 +24,12 @@
package techreborn.tiles; package techreborn.tiles;
import net.minecraft.ChatFormat; import net.minecraft.util.Formatting;
import net.minecraft.block.entity.BlockEntity; import net.minecraft.block.entity.BlockEntity;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.chat.TextComponent; import net.minecraft.text.LiteralText;
import net.minecraft.sound.SoundCategory; import net.minecraft.sound.SoundCategory;
import net.minecraft.util.Tickable; import net.minecraft.util.Tickable;
import reborncore.api.IToolDrop; import reborncore.api.IToolDrop;
@ -56,8 +56,8 @@ public class TileAlarm extends BlockEntity
} else { } else {
selectedSound = 1; selectedSound = 1;
} }
ChatUtils.sendNoSpamMessages(MessageIDs.alarmID, new TextComponent( ChatUtils.sendNoSpamMessages(MessageIDs.alarmID, new LiteralText(
ChatFormat.GRAY + StringUtils.t("techreborn.message.alarm") + " " + "Alarm " + selectedSound)); Formatting.GRAY + StringUtils.t("techreborn.message.alarm") + " " + "Alarm " + selectedSound));
} }
} }

View file

@ -25,8 +25,8 @@
package techreborn.tiles; package techreborn.tiles;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.network.chat.Component; import net.minecraft.text.LiteralText;
import net.minecraft.network.chat.TextComponent; import net.minecraft.text.Text;
import reborncore.api.IListInfoProvider; import reborncore.api.IListInfoProvider;
import reborncore.client.containerBuilder.IContainerProvider; import reborncore.client.containerBuilder.IContainerProvider;
import reborncore.client.containerBuilder.builder.BuiltContainer; import reborncore.client.containerBuilder.builder.BuiltContainer;
@ -74,8 +74,8 @@ public class TileIndustrialCentrifuge extends TileGenericMachine implements ICon
// IListInfoProvider // IListInfoProvider
@Override @Override
public void addInfo(final List<Component> info, final boolean isRealTile, boolean hasData) { public void addInfo(final List<Text> info, final boolean isRealTile, boolean hasData) {
super.addInfo(info, isRealTile, hasData); super.addInfo(info, isRealTile, hasData);
info.add(new TextComponent("Round and round it goes")); info.add(new LiteralText("Round and round it goes"));
} }
} }

View file

@ -29,9 +29,8 @@ import net.minecraft.client.network.packet.BlockEntityUpdateS2CPacket;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.ClientConnection; import net.minecraft.text.LiteralText;
import net.minecraft.network.chat.Component; import net.minecraft.text.Text;
import net.minecraft.network.chat.TextComponent;
import reborncore.api.IListInfoProvider; import reborncore.api.IListInfoProvider;
import reborncore.api.IToolDrop; import reborncore.api.IToolDrop;
import reborncore.api.tile.ItemHandlerProvider; import reborncore.api.tile.ItemHandlerProvider;
@ -221,19 +220,19 @@ public class TileTechStorageBase extends TileMachineBase
// IListInfoProvider // IListInfoProvider
@Override @Override
public void addInfo(List<Component> info, boolean isRealTile, boolean hasData) { public void addInfo(List<Text> info, boolean isRealTile, boolean hasData) {
if (isRealTile || hasData) { if (isRealTile || hasData) {
int size = 0; int size = 0;
String name = "of nothing"; String name = "of nothing";
if (!storedItem.isEmpty()) { if (!storedItem.isEmpty()) {
name = storedItem.getCustomName().getString(); name = storedItem.getName().getString();
size += storedItem.getCount(); size += storedItem.getCount();
} }
if (!inventory.getInvStack(1).isEmpty()) { if (!inventory.getInvStack(1).isEmpty()) {
name = inventory.getInvStack(1).getCustomName().getString(); name = inventory.getInvStack(1).getName().getString();
size += inventory.getInvStack(1).getCount(); size += inventory.getInvStack(1).getCount();
} }
info.add(new TextComponent(size + " " + name)); info.add(new LiteralText(size + " " + name));
} }
} }

View file

@ -24,15 +24,15 @@
package techreborn.tiles.cable; package techreborn.tiles.cable;
import net.minecraft.ChatFormat;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.entity.BlockEntity; import net.minecraft.block.entity.BlockEntity;
import net.minecraft.client.network.packet.BlockEntityUpdateS2CPacket; import net.minecraft.client.network.packet.BlockEntityUpdateS2CPacket;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.chat.Component; import net.minecraft.text.LiteralText;
import net.minecraft.network.chat.TextComponent; import net.minecraft.text.Text;
import net.minecraft.util.Formatting;
import net.minecraft.util.Tickable; import net.minecraft.util.Tickable;
import net.minecraft.util.math.Direction; import net.minecraft.util.math.Direction;
import reborncore.api.IListInfoProvider; import reborncore.api.IListInfoProvider;
@ -159,13 +159,13 @@ public class TileCable extends BlockEntity
// IListInfoProvider // IListInfoProvider
@Override @Override
public void addInfo(List<Component> info, boolean isRealTile, boolean hasData) { public void addInfo(List<Text> info, boolean isRealTile, boolean hasData) {
if (isRealTile) { if (isRealTile) {
info.add(new TextComponent(ChatFormat.GRAY + StringUtils.t("techreborn.tooltip.transferRate") + ": " info.add(new LiteralText(Formatting.GRAY + StringUtils.t("techreborn.tooltip.transferRate") + ": "
+ ChatFormat.GOLD + Formatting.GOLD
+ PowerSystem.getLocaliszedPowerFormatted(transferRate / RebornCoreConfig.euPerFU) + "/t")); + PowerSystem.getLocaliszedPowerFormatted(transferRate / RebornCoreConfig.euPerFU) + "/t"));
info.add(new TextComponent(ChatFormat.GRAY + StringUtils.t("techreborn.tooltip.tier") + ": " info.add(new LiteralText(Formatting.GRAY + StringUtils.t("techreborn.tooltip.tier") + ": "
+ ChatFormat.GOLD + StringUtils.toFirstCapitalAllLowercase(cableType.tier.toString()))); + Formatting.GOLD + StringUtils.toFirstCapitalAllLowercase(cableType.tier.toString())));
} }
} }

View file

@ -24,13 +24,13 @@
package techreborn.tiles.generator; 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.block.Block;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.chat.Component; import net.minecraft.text.Text;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.util.math.Direction; import net.minecraft.util.math.Direction;
import reborncore.api.IToolDrop; import reborncore.api.IToolDrop;
import reborncore.api.power.EnumPowerTier; import reborncore.api.power.EnumPowerTier;
@ -130,17 +130,17 @@ public class TileSolarPanel extends TilePowerAcceptor implements IToolDrop {
// TODO: Translate // TODO: Translate
@Override @Override
public void addInfo(List<Component> info, boolean isRealTile, boolean hasData) { public void addInfo(List<Text> info, boolean isRealTile, boolean hasData) {
info.add(new TextComponent(ChatFormat.GRAY + "Internal Energy Storage: " + ChatFormat.GOLD info.add(new LiteralText(Formatting.GRAY + "Internal Energy Storage: " + Formatting.GOLD
+ PowerSystem.getLocaliszedPowerFormatted((int) getMaxPower()))); + 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))); + 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))); + 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()))); + StringUtils.toFirstCapitalAllLowercase(getTier().toString())));
} }

View file

@ -30,8 +30,8 @@ import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.ClientConnection; import net.minecraft.network.ClientConnection;
import net.minecraft.network.chat.Component; import net.minecraft.text.LiteralText;
import net.minecraft.network.chat.TextComponent; import net.minecraft.text.Text;
import reborncore.api.IListInfoProvider; import reborncore.api.IListInfoProvider;
import reborncore.api.IToolDrop; import reborncore.api.IToolDrop;
import reborncore.api.tile.ItemHandlerProvider; import reborncore.api.tile.ItemHandlerProvider;
@ -133,15 +133,15 @@ public class TileQuantumTank extends TileMachineBase
// IListInfoProvider // IListInfoProvider
@Override @Override
public void addInfo(final List<Component> info, final boolean isRealTile, boolean hasData) { public void addInfo(final List<Text> info, final boolean isRealTile, boolean hasData) {
if (isRealTile | hasData) { if (isRealTile | hasData) {
if (this.tank.getFluid() != null) { 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 { } 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 // IContainerProvider

View file

@ -24,13 +24,13 @@
package techreborn.tiles.transformers; 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.Block;
import net.minecraft.block.entity.BlockEntityType; import net.minecraft.block.entity.BlockEntityType;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.util.math.Direction; import net.minecraft.util.math.Direction;
import reborncore.api.IListInfoProvider; import reborncore.api.IListInfoProvider;
import reborncore.api.IToolDrop; import reborncore.api.IToolDrop;
@ -146,11 +146,11 @@ public class TileTransformer extends TilePowerAcceptor
// IListInfoProvider // IListInfoProvider
@Override @Override
public void addInfo(List<Component> info, boolean isRealTile, boolean hasData) { public void addInfo(List<Text> info, boolean isRealTile, boolean hasData) {
info.add(new TextComponent(ChatFormat.GRAY + "Input Rate: " + ChatFormat.GOLD + PowerSystem.getLocaliszedPowerFormatted((int) getMaxInput()))); info.add(new LiteralText(Formatting.GRAY + "Input Rate: " + Formatting.GOLD + PowerSystem.getLocaliszedPowerFormatted((int) getMaxInput())));
info.add(new TextComponent(ChatFormat.GRAY + "Input Tier: " + ChatFormat.GOLD + StringUtils.toFirstCapitalAllLowercase(inputTier.toString()))); info.add(new LiteralText(Formatting.GRAY + "Input Tier: " + Formatting.GOLD + StringUtils.toFirstCapitalAllLowercase(inputTier.toString())));
info.add(new TextComponent(ChatFormat.GRAY + "Output Rate: " + ChatFormat.GOLD + PowerSystem.getLocaliszedPowerFormatted((int) getMaxOutput()))); info.add(new LiteralText(Formatting.GRAY + "Output Rate: " + Formatting.GOLD + PowerSystem.getLocaliszedPowerFormatted((int) getMaxOutput())));
info.add(new TextComponent(ChatFormat.GRAY + "Output Tier: " + ChatFormat.GOLD + StringUtils.toFirstCapitalAllLowercase(ouputTier.toString()))); info.add(new LiteralText(Formatting.GRAY + "Output Tier: " + Formatting.GOLD + StringUtils.toFirstCapitalAllLowercase(ouputTier.toString())));
} }
} }

View file

@ -24,13 +24,13 @@
package techreborn.utils; package techreborn.utils;
import net.minecraft.ChatFormat;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.item.Items; import net.minecraft.item.Items;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.StringTag; 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.api.events.ItemTooltipCallback;
import reborncore.common.util.StringUtils; import reborncore.common.util.StringUtils;
import techreborn.init.TRContent; import techreborn.init.TRContent;
@ -57,11 +57,11 @@ public class StackWIPHandler {
ItemTooltipCallback.EVENT.register((stack, tooltipContext, components) -> { ItemTooltipCallback.EVENT.register((stack, tooltipContext, components) -> {
Block block = Block.getBlockFromItem(stack.getItem()); Block block = Block.getBlockFromItem(stack.getItem());
if (block != null && wipBlocks.contains(block)) { 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)) { if (devHeads.contains(stack)) {
components.add(new TextComponent(ChatFormat.GOLD + "TechReborn Developer")); components.add(new LiteralText(Formatting.GOLD + "TechReborn Developer"));
} }
}); });
} }

View file

@ -1,6 +1,6 @@
{ {
"replace": false, "replace": false,
"values": [ "values": [
"techreborn:rubber_leaves" "techreborn:rubber_leaves"
] ]
} }

View file

@ -1,6 +1,6 @@
{ {
"replace": false, "replace": false,
"values": [ "values": [
"techreborn:rubber_log" "techreborn:rubber_log"
] ]
} }

View file

@ -1,6 +1,6 @@
{ {
"replace": false, "replace": false,
"values": [ "values": [
"techreborn:rubber_sapling" "techreborn:rubber_sapling"
] ]
} }

View file

@ -1,6 +1,6 @@
{ {
"replace": false, "replace": false,
"values": [ "values": [
"techreborn:rubber_plank_stair" "techreborn:rubber_plank_stair"
] ]
} }