diff --git a/src/main/java/com/simibubi/create/Create.java b/src/main/java/com/simibubi/create/Create.java index bc15ddefa..85d499416 100644 --- a/src/main/java/com/simibubi/create/Create.java +++ b/src/main/java/com/simibubi/create/Create.java @@ -12,6 +12,7 @@ import com.simibubi.create.compat.Mods; import com.simibubi.create.compat.curios.Curios; import com.simibubi.create.content.CreateItemGroup; import com.simibubi.create.content.contraptions.TorquePropagator; +import com.simibubi.create.content.contraptions.fluids.tank.BoilerHeaters; import com.simibubi.create.content.curiosities.weapons.BuiltinPotatoProjectileTypes; import com.simibubi.create.content.logistics.RedstoneLinkNetworkHandler; import com.simibubi.create.content.logistics.block.display.AllDisplayBehaviours; @@ -139,6 +140,7 @@ public class Create { SchematicProcessor.register(); AllWorldFeatures.registerFeatures(); AllWorldFeatures.registerPlacementTypes(); + BoilerHeaters.registerDefaults(); }); } diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/AssemblyException.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/AssemblyException.java index 0374366bc..630d563b1 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/AssemblyException.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/AssemblyException.java @@ -1,11 +1,11 @@ package com.simibubi.create.content.contraptions.components.structureMovement; import com.simibubi.create.foundation.config.AllConfigs; +import com.simibubi.create.foundation.utility.Lang; import net.minecraft.core.BlockPos; import net.minecraft.nbt.CompoundTag; import net.minecraft.network.chat.Component; -import net.minecraft.network.chat.TranslatableComponent; import net.minecraft.world.level.block.state.BlockState; public class AssemblyException extends Exception { @@ -45,13 +45,12 @@ public class AssemblyException extends Exception { } public AssemblyException(String langKey, Object... objects) { - this(new TranslatableComponent("create.gui.assembly.exception." + langKey, objects)); + this(Lang.translateDirect("gui.assembly.exception." + langKey, objects)); } public static AssemblyException unmovableBlock(BlockPos pos, BlockState state) { AssemblyException e = new AssemblyException("unmovableBlock", pos.getX(), pos.getY(), pos.getZ(), - new TranslatableComponent(state.getBlock() - .getDescriptionId())); + state.getBlock().getName()); e.position = pos; return e; } diff --git a/src/main/java/com/simibubi/create/content/contraptions/fluids/actors/FillingRecipe.java b/src/main/java/com/simibubi/create/content/contraptions/fluids/actors/FillingRecipe.java index 1b04a1343..380945f5b 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/fluids/actors/FillingRecipe.java +++ b/src/main/java/com/simibubi/create/content/contraptions/fluids/actors/FillingRecipe.java @@ -15,7 +15,6 @@ import com.simibubi.create.foundation.utility.Lang; import net.minecraft.network.chat.Component; import net.minecraft.network.chat.TextComponent; -import net.minecraft.network.chat.TranslatableComponent; import net.minecraft.world.item.crafting.Ingredient; import net.minecraft.world.level.ItemLike; import net.minecraft.world.level.Level; @@ -73,10 +72,9 @@ public class FillingRecipe extends ProcessingRecipe implements IA if (matchingFluidStacks.size() == 0) return new TextComponent("Invalid"); return Lang.translateDirect("recipe.assembly.spout_filling_fluid", - new TranslatableComponent(matchingFluidStacks.get(0) - .getTranslationKey()).getString()); + matchingFluidStacks.get(0).getDisplayName().getString()); } - + @Override public void addRequiredMachines(Set list) { list.add(AllBlocks.SPOUT.get()); diff --git a/src/main/java/com/simibubi/create/content/contraptions/fluids/tank/BoilerData.java b/src/main/java/com/simibubi/create/content/contraptions/fluids/tank/BoilerData.java index b1263c661..d21ad5194 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/fluids/tank/BoilerData.java +++ b/src/main/java/com/simibubi/create/content/contraptions/fluids/tank/BoilerData.java @@ -333,12 +333,12 @@ public class BoilerData { for (int zOffset = 0; zOffset < controller.width; zOffset++) { BlockPos pos = controllerPos.offset(xOffset, -1, zOffset); BlockState blockState = level.getBlockState(pos); - float heat = BoilerHeaters.getActiveHeatOf(blockState); + float heat = BoilerHeaters.getActiveHeat(level, pos, blockState); if (heat == 0) { - passiveHeat |= BoilerHeaters.canHeatPassively(blockState); - continue; + passiveHeat = true; + } else if (heat > 0) { + activeHeat += heat; } - activeHeat += heat; } } diff --git a/src/main/java/com/simibubi/create/content/contraptions/fluids/tank/BoilerHeaters.java b/src/main/java/com/simibubi/create/content/contraptions/fluids/tank/BoilerHeaters.java index c2c21e583..a36ab5f30 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/fluids/tank/BoilerHeaters.java +++ b/src/main/java/com/simibubi/create/content/contraptions/fluids/tank/BoilerHeaters.java @@ -1,39 +1,90 @@ package com.simibubi.create.content.contraptions.fluids.tank; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.jetbrains.annotations.Nullable; + import com.simibubi.create.AllBlocks; import com.simibubi.create.AllTags.AllBlockTags; import com.simibubi.create.content.contraptions.processing.burner.BlazeBurnerBlock; import com.simibubi.create.content.contraptions.processing.burner.BlazeBurnerBlock.HeatLevel; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.state.BlockState; +import net.minecraftforge.registries.IRegistryDelegate; -public class BoilerHeaters { // API? +public class BoilerHeaters { + private static final Map, Heater> BLOCK_HEATERS = new HashMap<>(); + private static final List GLOBAL_HEATERS = new ArrayList<>(); - public static boolean canHeatPassively(BlockState state) { - if (AllBlocks.BLAZE_BURNER.has(state)) - return state.getValue(BlazeBurnerBlock.HEAT_LEVEL) != HeatLevel.NONE; - if (AllBlockTags.PASSIVE_BOILER_HEATERS.matches(state)) - return true; - return false; + public static void registerHeater(IRegistryDelegate block, Heater heater) { + BLOCK_HEATERS.put(block, heater); } - public static int getActiveHeatOf(BlockState state) { - if (AllBlocks.BLAZE_BURNER.has(state)) { - HeatLevel value = state.getValue(BlazeBurnerBlock.HEAT_LEVEL); - switch (value) { - case FADING: - case KINDLED: - return 1; - case SEETHING: - return 2; - default: - case SMOULDERING: - case NONE: - return 0; + public static void registerHeaterProvider(HeaterProvider provider) { + GLOBAL_HEATERS.add(provider); + } + + /** + * A return value of {@code -1} represents no heat. + * A return value of {@code 0} represents passive heat. + * All other positive values are used as the amount of active heat. + */ + public static float getActiveHeat(Level level, BlockPos pos, BlockState state) { + Heater heater = BLOCK_HEATERS.get(state.getBlock().delegate); + if (heater != null) { + return heater.getActiveHeat(level, pos, state); + } + + for (HeaterProvider provider : GLOBAL_HEATERS) { + heater = provider.getHeater(level, pos, state); + if (heater != null) { + return heater.getActiveHeat(level, pos, state); } } - return 0; + return -1; } + public static void registerDefaults() { + registerHeater(AllBlocks.BLAZE_BURNER.get().delegate, (level, pos, state) -> { + HeatLevel value = state.getValue(BlazeBurnerBlock.HEAT_LEVEL); + if (value == HeatLevel.NONE) { + return -1; + } + if (value == HeatLevel.SEETHING) { + return 2; + } + if (value.isAtLeast(HeatLevel.FADING)) { + return 1; + } + return 0; + }); + + registerHeaterProvider((level, pos, state) -> { + if (AllBlockTags.PASSIVE_BOILER_HEATERS.matches(state)) { + return (level1, pos1, state1) -> 0; + } + return null; + }); + } + + public interface Heater { + /** + * A return value of {@code -1} represents no heat. + * A return value of {@code 0} represents passive heat. + * All other positive values are used as the amount of active heat. + */ + float getActiveHeat(Level level, BlockPos pos, BlockState state); + } + + public interface HeaterProvider { + @Nullable + Heater getHeater(Level level, BlockPos pos, BlockState state); + } } diff --git a/src/main/java/com/simibubi/create/content/curiosities/armor/CopperBacktankTileEntity.java b/src/main/java/com/simibubi/create/content/curiosities/armor/CopperBacktankTileEntity.java index b05080193..da941de04 100644 --- a/src/main/java/com/simibubi/create/content/curiosities/armor/CopperBacktankTileEntity.java +++ b/src/main/java/com/simibubi/create/content/curiosities/armor/CopperBacktankTileEntity.java @@ -19,7 +19,6 @@ import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.ListTag; import net.minecraft.nbt.Tag; import net.minecraft.network.chat.Component; -import net.minecraft.network.chat.TranslatableComponent; import net.minecraft.util.Mth; import net.minecraft.world.Nameable; import net.minecraft.world.level.block.entity.BlockEntityType; @@ -141,8 +140,8 @@ public class CopperBacktankTileEntity extends KineticTileEntity implements Namea @Override public Component getName() { return this.customName != null ? this.customName - : new TranslatableComponent(AllItems.COPPER_BACKTANK.get() - .getDescriptionId()); + : AllItems.COPPER_BACKTANK.get() + .getDescription(); } public int getAirLevel() { diff --git a/src/main/java/com/simibubi/create/content/curiosities/toolbox/ToolboxTileEntity.java b/src/main/java/com/simibubi/create/content/curiosities/toolbox/ToolboxTileEntity.java index 1d0fed5a3..a44225964 100644 --- a/src/main/java/com/simibubi/create/content/curiosities/toolbox/ToolboxTileEntity.java +++ b/src/main/java/com/simibubi/create/content/curiosities/toolbox/ToolboxTileEntity.java @@ -22,7 +22,6 @@ import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.nbt.CompoundTag; import net.minecraft.network.chat.Component; -import net.minecraft.network.chat.TranslatableComponent; import net.minecraft.server.level.ServerPlayer; import net.minecraft.sounds.SoundEvents; import net.minecraft.sounds.SoundSource; @@ -392,9 +391,9 @@ public class ToolboxTileEntity extends SmartTileEntity implements MenuProvider, @Override public Component getDisplayName() { return customName != null ? customName - : new TranslatableComponent(AllBlocks.TOOLBOXES.get(getColor()) + : AllBlocks.TOOLBOXES.get(getColor()) .get() - .getDescriptionId()); + .getName(); } @Override diff --git a/src/main/java/com/simibubi/create/content/curiosities/tools/BlueprintEntity.java b/src/main/java/com/simibubi/create/content/curiosities/tools/BlueprintEntity.java index 43f97c05b..fafa00deb 100644 --- a/src/main/java/com/simibubi/create/content/curiosities/tools/BlueprintEntity.java +++ b/src/main/java/com/simibubi/create/content/curiosities/tools/BlueprintEntity.java @@ -29,7 +29,6 @@ import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.Tag; import net.minecraft.network.FriendlyByteBuf; import net.minecraft.network.chat.Component; -import net.minecraft.network.chat.TranslatableComponent; import net.minecraft.network.protocol.Packet; import net.minecraft.server.level.ServerPlayer; import net.minecraft.sounds.SoundEvents; @@ -544,8 +543,8 @@ public class BlueprintEntity extends HangingEntity @Override public Component getDisplayName() { - return new TranslatableComponent(AllItems.CRAFTING_BLUEPRINT.get() - .getDescriptionId()); + return AllItems.CRAFTING_BLUEPRINT.get() + .getDescription(); } @Override diff --git a/src/main/java/com/simibubi/create/content/curiosities/zapper/ZapperItem.java b/src/main/java/com/simibubi/create/content/curiosities/zapper/ZapperItem.java index 25164f9e3..43ddf5fe4 100644 --- a/src/main/java/com/simibubi/create/content/curiosities/zapper/ZapperItem.java +++ b/src/main/java/com/simibubi/create/content/curiosities/zapper/ZapperItem.java @@ -19,7 +19,7 @@ import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.NbtUtils; import net.minecraft.nbt.Tag; import net.minecraft.network.chat.Component; -import net.minecraft.network.chat.TranslatableComponent; +import net.minecraft.network.chat.MutableComponent; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; import net.minecraft.world.InteractionResultHolder; @@ -54,14 +54,14 @@ public abstract class ZapperItem extends Item { public void appendHoverText(ItemStack stack, Level worldIn, List tooltip, TooltipFlag flagIn) { if (stack.hasTag() && stack.getTag() .contains("BlockUsed")) { - String usedblock = NbtUtils.readBlockState(stack.getTag() + MutableComponent usedBlock = NbtUtils.readBlockState(stack.getTag() .getCompound("BlockUsed")) .getBlock() - .getDescriptionId(); + .getName(); ItemDescription.add(tooltip, Lang.translateDirect("terrainzapper.usingBlock", - new TranslatableComponent(usedblock).withStyle(ChatFormatting.GRAY)) - .withStyle(ChatFormatting.DARK_GRAY)); + usedBlock.withStyle(ChatFormatting.GRAY)) + .withStyle(ChatFormatting.DARK_GRAY)); } } diff --git a/src/main/java/com/simibubi/create/content/logistics/block/belts/tunnel/BrassTunnelTileEntity.java b/src/main/java/com/simibubi/create/content/logistics/block/belts/tunnel/BrassTunnelTileEntity.java index cc6c2a566..6651acef1 100644 --- a/src/main/java/com/simibubi/create/content/logistics/block/belts/tunnel/BrassTunnelTileEntity.java +++ b/src/main/java/com/simibubi/create/content/logistics/block/belts/tunnel/BrassTunnelTileEntity.java @@ -752,8 +752,8 @@ public class BrassTunnelTileEntity extends BeltTunnelTileEntity implements IHave .withStyle(ChatFormatting.WHITE)); for (ItemStack item : allStacks) { tooltip.add(componentSpacing.plainCopy() - .append(Lang.translateDirect("tooltip.brass_tunnel.contains_entry", new TranslatableComponent(item.getItem() - .getDescriptionId(item)).getString(), item.getCount())) + .append(Lang.translateDirect("tooltip.brass_tunnel.contains_entry", new TranslatableComponent(item.getDescriptionId()) + .getString(), item.getCount())) .withStyle(ChatFormatting.GRAY)); } tooltip.add(componentSpacing.plainCopy() diff --git a/src/main/java/com/simibubi/create/content/logistics/block/chute/ChuteTileEntity.java b/src/main/java/com/simibubi/create/content/logistics/block/chute/ChuteTileEntity.java index 656c5960d..b24733582 100644 --- a/src/main/java/com/simibubi/create/content/logistics/block/chute/ChuteTileEntity.java +++ b/src/main/java/com/simibubi/create/content/logistics/block/chute/ChuteTileEntity.java @@ -719,8 +719,8 @@ public class ChuteTileEntity extends SmartTileEntity implements IHaveGoggleInfor .withStyle(ChatFormatting.YELLOW))); if (!item.isEmpty()) { tooltip.add(componentSpacing.plainCopy() - .append(Lang.translateDirect("tooltip.chute.contains", new TranslatableComponent(item.getItem() - .getDescriptionId(item)).getString(), item.getCount())) + .append(Lang.translateDirect("tooltip.chute.contains", new TranslatableComponent(item.getDescriptionId()) + .getString(), item.getCount())) .withStyle(ChatFormatting.GREEN)); } return true; diff --git a/src/main/java/com/simibubi/create/content/logistics/item/LinkedControllerItem.java b/src/main/java/com/simibubi/create/content/logistics/item/LinkedControllerItem.java index 97d506f0f..9b3ae02e7 100644 --- a/src/main/java/com/simibubi/create/content/logistics/item/LinkedControllerItem.java +++ b/src/main/java/com/simibubi/create/content/logistics/item/LinkedControllerItem.java @@ -12,7 +12,6 @@ import com.simibubi.create.foundation.utility.Couple; import net.minecraft.core.BlockPos; import net.minecraft.nbt.CompoundTag; import net.minecraft.network.chat.Component; -import net.minecraft.network.chat.TranslatableComponent; import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; @@ -139,7 +138,7 @@ public class LinkedControllerItem extends Item implements MenuProvider { @Override public Component getDisplayName() { - return new TranslatableComponent(getDescriptionId()); + return getDescription(); } @Override diff --git a/src/main/java/com/simibubi/create/content/logistics/item/filter/FilterItem.java b/src/main/java/com/simibubi/create/content/logistics/item/filter/FilterItem.java index a055507ef..443529871 100644 --- a/src/main/java/com/simibubi/create/content/logistics/item/filter/FilterItem.java +++ b/src/main/java/com/simibubi/create/content/logistics/item/filter/FilterItem.java @@ -19,7 +19,6 @@ import net.minecraft.nbt.ListTag; import net.minecraft.nbt.Tag; import net.minecraft.network.chat.Component; import net.minecraft.network.chat.TextComponent; -import net.minecraft.network.chat.TranslatableComponent; import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; @@ -165,7 +164,7 @@ public class FilterItem extends Item implements MenuProvider { @Override public Component getDisplayName() { - return new TranslatableComponent(getDescriptionId()); + return getDescription(); } public static ItemStackHandler getFilterItems(ItemStack stack) { diff --git a/src/main/java/com/simibubi/create/content/logistics/item/filter/attribute/FluidContentsAttribute.java b/src/main/java/com/simibubi/create/content/logistics/item/filter/attribute/FluidContentsAttribute.java index 990daa034..7ba3997e9 100644 --- a/src/main/java/com/simibubi/create/content/logistics/item/filter/attribute/FluidContentsAttribute.java +++ b/src/main/java/com/simibubi/create/content/logistics/item/filter/attribute/FluidContentsAttribute.java @@ -19,64 +19,64 @@ import net.minecraftforge.fluids.capability.IFluidHandlerItem; import net.minecraftforge.registries.ForgeRegistries; public class FluidContentsAttribute implements ItemAttribute { - public static final FluidContentsAttribute EMPTY = new FluidContentsAttribute(null); + public static final FluidContentsAttribute EMPTY = new FluidContentsAttribute(null); - private final Fluid fluid; + private final Fluid fluid; - public FluidContentsAttribute(@Nullable Fluid fluid) { - this.fluid = fluid; - } + public FluidContentsAttribute(@Nullable Fluid fluid) { + this.fluid = fluid; + } - @Override - public boolean appliesTo(ItemStack itemStack) { - return extractFluids(itemStack).contains(fluid); - } + @Override + public boolean appliesTo(ItemStack itemStack) { + return extractFluids(itemStack).contains(fluid); + } - @Override - public List listAttributesOf(ItemStack itemStack) { - return extractFluids(itemStack).stream().map(FluidContentsAttribute::new).collect(Collectors.toList()); - } + @Override + public List listAttributesOf(ItemStack itemStack) { + return extractFluids(itemStack).stream().map(FluidContentsAttribute::new).collect(Collectors.toList()); + } - @Override - public String getTranslationKey() { - return "has_fluid"; - } + @Override + public String getTranslationKey() { + return "has_fluid"; + } - @Override - public Object[] getTranslationParameters() { - String parameter = ""; - if(fluid != null) - parameter = new TranslatableComponent(fluid.getAttributes().getTranslationKey()).getString(); - return new Object[] { parameter }; - } + @Override + public Object[] getTranslationParameters() { + String parameter = ""; + if (fluid != null) + parameter = new TranslatableComponent(fluid.getAttributes().getTranslationKey()).getString(); + return new Object[] { parameter }; + } - @Override - public void writeNBT(CompoundTag nbt) { - if (fluid == null) - return; - ResourceLocation id = ForgeRegistries.FLUIDS.getKey(fluid); - if (id == null) - return; - nbt.putString("id", id.toString()); - } + @Override + public void writeNBT(CompoundTag nbt) { + if (fluid == null) + return; + ResourceLocation id = ForgeRegistries.FLUIDS.getKey(fluid); + if (id == null) + return; + nbt.putString("id", id.toString()); + } - @Override - public ItemAttribute readNBT(CompoundTag nbt) { - return nbt.contains("id") ? new FluidContentsAttribute(ForgeRegistries.FLUIDS.getValue(ResourceLocation.tryParse(nbt.getString("id")))) : EMPTY; - } + @Override + public ItemAttribute readNBT(CompoundTag nbt) { + return nbt.contains("id") ? new FluidContentsAttribute(ForgeRegistries.FLUIDS.getValue(ResourceLocation.tryParse(nbt.getString("id")))) : EMPTY; + } - private List extractFluids(ItemStack stack) { - List fluids = new ArrayList<>(); + private List extractFluids(ItemStack stack) { + List fluids = new ArrayList<>(); - LazyOptional capability = - stack.getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY); + LazyOptional capability = + stack.getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY); - capability.ifPresent((cap) -> { - for(int i = 0; i < cap.getTanks(); i++) { - fluids.add(cap.getFluidInTank(i).getFluid()); - } - }); + capability.ifPresent((cap) -> { + for(int i = 0; i < cap.getTanks(); i++) { + fluids.add(cap.getFluidInTank(i).getFluid()); + } + }); - return fluids; - } + return fluids; + } } diff --git a/src/main/java/com/simibubi/create/content/logistics/trains/management/schedule/ScheduleItem.java b/src/main/java/com/simibubi/create/content/logistics/trains/management/schedule/ScheduleItem.java index fe18bf36b..9698773e3 100644 --- a/src/main/java/com/simibubi/create/content/logistics/trains/management/schedule/ScheduleItem.java +++ b/src/main/java/com/simibubi/create/content/logistics/trains/management/schedule/ScheduleItem.java @@ -19,7 +19,6 @@ import net.minecraft.core.NonNullList; import net.minecraft.network.chat.Component; import net.minecraft.network.chat.MutableComponent; import net.minecraft.network.chat.TextComponent; -import net.minecraft.network.chat.TranslatableComponent; import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; @@ -167,7 +166,7 @@ public class ScheduleItem extends Item implements MenuProvider { @Override public Component getDisplayName() { - return new TranslatableComponent(getDescriptionId()); + return getDescription(); } @Override diff --git a/src/main/java/com/simibubi/create/content/schematics/MaterialChecklist.java b/src/main/java/com/simibubi/create/content/schematics/MaterialChecklist.java index 00d4e5835..8c4fd1ec8 100644 --- a/src/main/java/com/simibubi/create/content/schematics/MaterialChecklist.java +++ b/src/main/java/com/simibubi/create/content/schematics/MaterialChecklist.java @@ -88,9 +88,9 @@ public class MaterialChecklist { List keys = new ArrayList<>(Sets.union(required.keySet(), damageRequired.keySet())); Collections.sort(keys, (item1, item2) -> { Locale locale = Locale.ENGLISH; - String name1 = new TranslatableComponent(item1.getDescriptionId()).getString() + String name1 = item1.getDescription().getString() .toLowerCase(locale); - String name2 = new TranslatableComponent(item2.getDescriptionId()).getString() + String name2 = item2.getDescription().getString() .toLowerCase(locale); return name1.compareTo(name2); }); diff --git a/src/main/java/com/simibubi/create/content/schematics/ServerSchematicLoader.java b/src/main/java/com/simibubi/create/content/schematics/ServerSchematicLoader.java index 8980e2d93..96c1c1479 100644 --- a/src/main/java/com/simibubi/create/content/schematics/ServerSchematicLoader.java +++ b/src/main/java/com/simibubi/create/content/schematics/ServerSchematicLoader.java @@ -22,12 +22,12 @@ import com.simibubi.create.content.schematics.item.SchematicItem; import com.simibubi.create.foundation.config.AllConfigs; import com.simibubi.create.foundation.config.CSchematics; import com.simibubi.create.foundation.utility.FilesHelper; +import com.simibubi.create.foundation.utility.Lang; import net.minecraft.core.BlockPos; import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.NbtIo; import net.minecraft.network.chat.TextComponent; -import net.minecraft.network.chat.TranslatableComponent; import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.InteractionHand; import net.minecraft.world.level.Level; @@ -163,9 +163,10 @@ public class ServerSchematicLoader { protected boolean validateSchematicSizeOnServer(ServerPlayer player, long size) { Integer maxFileSize = getConfig().maxTotalSchematicSize.get(); if (size > maxFileSize * 1000) { - player.sendMessage(new TranslatableComponent("create.schematics.uploadTooLarge") + + player.sendMessage(Lang.translateDirect("schematics.uploadTooLarge") .append(new TextComponent(" (" + size / 1000 + " KB).")), player.getUUID()); - player.sendMessage(new TranslatableComponent("create.schematics.maxAllowedSize") + player.sendMessage(Lang.translateDirect("schematics.maxAllowedSize") .append(new TextComponent(" " + maxFileSize + " KB")), player.getUUID()); return false; } diff --git a/src/main/java/com/simibubi/create/content/schematics/block/SchematicannonScreen.java b/src/main/java/com/simibubi/create/content/schematics/block/SchematicannonScreen.java index 8e8edef7b..acb3fdfbc 100644 --- a/src/main/java/com/simibubi/create/content/schematics/block/SchematicannonScreen.java +++ b/src/main/java/com/simibubi/create/content/schematics/block/SchematicannonScreen.java @@ -30,7 +30,6 @@ import net.minecraft.client.gui.components.AbstractWidget; import net.minecraft.client.renderer.Rect2i; import net.minecraft.network.chat.Component; import net.minecraft.network.chat.TextComponent; -import net.minecraft.network.chat.TranslatableComponent; import net.minecraft.world.entity.player.Inventory; import net.minecraft.world.item.ItemStack; @@ -391,8 +390,8 @@ public class SchematicannonScreen extends AbstractSimiContainerScreen p.withColor(color)), true); + translate(key, args).color(color).sendStatus(player); } public static String asId(String name) {