From 3799a430397ce4221d21936323ba8331bd9e42d4 Mon Sep 17 00:00:00 2001 From: IThundxr Date: Tue, 28 Jan 2025 15:16:00 -0500 Subject: [PATCH 1/2] Emptier than ever --- .../IDisplayAssemblyExceptions.java | 4 +- .../elevator/ElevatorContactScreen.java | 7 +- .../glue/SuperGlueSelectionHandler.java | 6 +- .../content/equipment/armor/BacktankUtil.java | 4 +- .../equipment/goggles/GoggleConfigScreen.java | 17 ++- .../goggles/GoggleOverlayRenderer.java | 6 +- .../potatoCannon/PotatoCannonItem.java | 138 +++++++++--------- .../symmetryWand/SymmetryWandScreen.java | 37 +++-- .../equipment/zapper/ZapperScreen.java | 10 +- .../terrainzapper/WorldshaperScreen.java | 12 +- .../fluids/potion/PotionFluidHandler.java | 33 +++-- .../content/fluids/tank/BoilerData.java | 26 ++-- .../content/kinetics/belt/BeltSlicer.java | 33 +++-- .../deployer/DeployerBlockEntity.java | 19 +-- .../filter/AttributeFilterScreen.java | 24 +-- .../logistics/filter/FilterScreen.java | 10 +- .../sequenced/SequencedAssemblyRecipe.java | 46 +++--- .../displayLink/DisplayLinkScreen.java | 106 +++++++------- .../LinkedControllerClientHandler.java | 13 +- .../cannon/SchematicannonScreen.java | 77 +++++----- .../client/SchematicEditScreen.java | 26 ++-- .../client/SchematicPromptScreen.java | 15 +- .../table/SchematicTableScreen.java | 21 ++- .../display/FlapDisplayBlockEntity.java | 9 +- .../entity/CarriageContraptionEntity.java | 20 +-- .../trains/schedule/ScheduleScreen.java | 29 ++-- .../content/trains/station/StationMarker.java | 15 +- .../content/trains/station/StationScreen.java | 12 +- .../blockEntity/behaviour/ValueBox.java | 15 +- .../EdgeInteractionRenderer.java | 4 +- .../foundation/gui/ModularGuiLineBuilder.java | 14 +- .../foundation/item/ItemDescription.java | 15 +- .../create/foundation/item/KineticStats.java | 4 +- .../gui/CreateMainMenuScreen.java | 31 ++-- .../gui/OpenCreateMenuButton.java | 6 +- .../ponder/scenes/DisplayScenes.java | 33 ++--- 36 files changed, 450 insertions(+), 447 deletions(-) diff --git a/src/main/java/com/simibubi/create/content/contraptions/IDisplayAssemblyExceptions.java b/src/main/java/com/simibubi/create/content/contraptions/IDisplayAssemblyExceptions.java index c727c60cb0..87f0e2ddbb 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/IDisplayAssemblyExceptions.java +++ b/src/main/java/com/simibubi/create/content/contraptions/IDisplayAssemblyExceptions.java @@ -7,8 +7,8 @@ import com.simibubi.create.foundation.item.TooltipHelper; import com.simibubi.create.foundation.utility.CreateLang; import net.createmod.catnip.lang.FontHelper.Palette; -import net.createmod.catnip.lang.Lang; import net.minecraft.ChatFormatting; +import net.minecraft.network.chat.CommonComponents; import net.minecraft.network.chat.Component; public interface IDisplayAssemblyExceptions { @@ -19,7 +19,7 @@ public interface IDisplayAssemblyExceptions { return false; if (!tooltip.isEmpty()) - tooltip.add(Lang.IMMUTABLE_EMPTY); + tooltip.add(CommonComponents.EMPTY); CreateLang.translate("gui.assembly.exception").style(ChatFormatting.GOLD) .forGoggles(tooltip); diff --git a/src/main/java/com/simibubi/create/content/contraptions/elevator/ElevatorContactScreen.java b/src/main/java/com/simibubi/create/content/contraptions/elevator/ElevatorContactScreen.java index 18e4aca87d..ee0060c6f7 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/elevator/ElevatorContactScreen.java +++ b/src/main/java/com/simibubi/create/content/contraptions/elevator/ElevatorContactScreen.java @@ -1,7 +1,5 @@ package com.simibubi.create.content.contraptions.elevator; -import net.createmod.catnip.lang.Lang; - import org.lwjgl.glfw.GLFW; import com.google.common.collect.ImmutableList; @@ -23,6 +21,7 @@ import net.minecraft.ChatFormatting; import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.gui.components.EditBox; import net.minecraft.core.BlockPos; +import net.minecraft.network.chat.CommonComponents; import net.minecraft.network.chat.MutableComponent; import net.minecraft.util.FormattedCharSequence; @@ -108,7 +107,7 @@ public class ElevatorContactScreen extends AbstractSimiScreen { } private EditBox editBox(int x, int width, int chars) { - EditBox editBox = new EditBox(font, guiLeft + x, guiTop + 30, width, 10, Lang.IMMUTABLE_EMPTY); + EditBox editBox = new EditBox(font, guiLeft + x, guiTop + 30, width, 10, CommonComponents.EMPTY); editBox.setTextColor(-1); editBox.setTextColorUneditable(-1); editBox.setBordered(false); @@ -131,7 +130,7 @@ public class ElevatorContactScreen extends AbstractSimiScreen { (float) (x + (background.getWidth() - 8) / 2 - font.width(formattedcharsequence) / 2), (float) y + 6, 0x2F3738, false); GuiGameElement.of(AllBlocks.ELEVATOR_CONTACT.asStack()).at(x + background.getWidth() + 6, y + background.getHeight() - 56, -200) + .GuiRenderBuilder>at(x + background.getWidth() + 6, y + background.getHeight() - 56, -200) .scale(5) .render(graphics); diff --git a/src/main/java/com/simibubi/create/content/contraptions/glue/SuperGlueSelectionHandler.java b/src/main/java/com/simibubi/create/content/contraptions/glue/SuperGlueSelectionHandler.java index b40fbc88c3..743b9a13f9 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/glue/SuperGlueSelectionHandler.java +++ b/src/main/java/com/simibubi/create/content/contraptions/glue/SuperGlueSelectionHandler.java @@ -12,13 +12,13 @@ import com.simibubi.create.content.contraptions.chassis.AbstractChassisBlock; import com.simibubi.create.foundation.utility.CreateLang; import com.simibubi.create.foundation.utility.RaycastHelper; -import net.createmod.catnip.lang.Lang; import net.createmod.catnip.outliner.Outliner; import net.minecraft.client.Minecraft; import net.minecraft.client.multiplayer.ClientLevel; import net.minecraft.client.player.LocalPlayer; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; +import net.minecraft.network.chat.CommonComponents; import net.minecraft.sounds.SoundEvents; import net.minecraft.sounds.SoundSource; import net.minecraft.world.item.ItemStack; @@ -63,7 +63,7 @@ public class SuperGlueSelectionHandler { if (clusterCooldown > 0) { if (clusterCooldown == 25) - player.displayClientMessage(Lang.IMMUTABLE_EMPTY, true); + player.displayClientMessage(CommonComponents.EMPTY, true); Outliner.getInstance().keep(clusterOutlineSlot); clusterCooldown--; } @@ -217,7 +217,7 @@ public class SuperGlueSelectionHandler { if (mc.hitResult instanceof BlockHitResult bhr) { face = bhr.getDirection(); BlockState blockState = level.getBlockState(hoveredPos); - if (blockState.getBlock()instanceof AbstractChassisBlock cb) + if (blockState.getBlock() instanceof AbstractChassisBlock cb) if (cb.getGlueableSide(blockState, bhr.getDirection()) != null) return false; } diff --git a/src/main/java/com/simibubi/create/content/equipment/armor/BacktankUtil.java b/src/main/java/com/simibubi/create/content/equipment/armor/BacktankUtil.java index 4d17a38e5b..861183e401 100644 --- a/src/main/java/com/simibubi/create/content/equipment/armor/BacktankUtil.java +++ b/src/main/java/com/simibubi/create/content/equipment/armor/BacktankUtil.java @@ -10,10 +10,10 @@ import com.simibubi.create.AllTags; import com.simibubi.create.foundation.utility.CreateLang; import com.simibubi.create.infrastructure.config.AllConfigs; -import net.createmod.catnip.lang.Lang; import net.minecraft.ChatFormatting; import net.minecraft.client.Minecraft; import net.minecraft.nbt.CompoundTag; +import net.minecraft.network.chat.CommonComponents; import net.minecraft.network.chat.Component; import net.minecraft.network.chat.MutableComponent; import net.minecraft.network.protocol.game.ClientboundSetSubtitleTextPacket; @@ -100,7 +100,7 @@ public class BacktankUtil { player.connection.send(new ClientboundSetSubtitleTextPacket( Component.literal("\u26A0 ").withStyle(depleted ? ChatFormatting.RED : ChatFormatting.GOLD) .append(component.withStyle(ChatFormatting.GRAY)))); - player.connection.send(new ClientboundSetTitleTextPacket(Lang.IMMUTABLE_EMPTY)); + player.connection.send(new ClientboundSetTitleTextPacket(CommonComponents.EMPTY)); } public static int maxAir(ItemStack backtank) { diff --git a/src/main/java/com/simibubi/create/content/equipment/goggles/GoggleConfigScreen.java b/src/main/java/com/simibubi/create/content/equipment/goggles/GoggleConfigScreen.java index 3227a5fdba..3538a8698d 100644 --- a/src/main/java/com/simibubi/create/content/equipment/goggles/GoggleConfigScreen.java +++ b/src/main/java/com/simibubi/create/content/equipment/goggles/GoggleConfigScreen.java @@ -1,21 +1,22 @@ package com.simibubi.create.content.equipment.goggles; +import java.util.ArrayList; +import java.util.List; + import com.simibubi.create.AllItems; import com.simibubi.create.foundation.utility.CreateLang; import com.simibubi.create.infrastructure.config.AllConfigs; + import net.createmod.catnip.gui.AbstractSimiScreen; import net.createmod.catnip.gui.element.GuiGameElement; -import net.createmod.catnip.lang.Lang; import net.minecraft.ChatFormatting; import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.network.chat.CommonComponents; import net.minecraft.network.chat.Component; import net.minecraft.network.chat.FormattedText; import net.minecraft.util.Mth; import net.minecraft.world.item.ItemStack; -import java.util.ArrayList; -import java.util.List; - public class GoggleConfigScreen extends AbstractSimiScreen { private int offsetX; @@ -30,19 +31,19 @@ public class GoggleConfigScreen extends AbstractSimiScreen { tooltip.add(componentSpacing.plainCopy() .append(CreateLang.translateDirect("gui.config.overlay2") .withStyle(ChatFormatting.GRAY))); - tooltip.add(Lang.IMMUTABLE_EMPTY); + tooltip.add(CommonComponents.EMPTY); tooltip.add(componentSpacing.plainCopy() .append(CreateLang.translateDirect("gui.config.overlay3"))); tooltip.add(componentSpacing.plainCopy() .append(CreateLang.translateDirect("gui.config.overlay4"))); - tooltip.add(Lang.IMMUTABLE_EMPTY); + tooltip.add(CommonComponents.EMPTY); tooltip.add(componentSpacing.plainCopy() .append(CreateLang.translateDirect("gui.config.overlay5") .withStyle(ChatFormatting.GRAY))); tooltip.add(componentSpacing.plainCopy() .append(CreateLang.translateDirect("gui.config.overlay6") .withStyle(ChatFormatting.GRAY))); - tooltip.add(Lang.IMMUTABLE_EMPTY); + tooltip.add(CommonComponents.EMPTY); tooltip.add(componentSpacing.plainCopy() .append(CreateLang.translateDirect("gui.config.overlay7"))); tooltip.add(componentSpacing.plainCopy() @@ -75,7 +76,7 @@ public class GoggleConfigScreen extends AbstractSimiScreen { @Override public boolean mouseDragged(double p_mouseDragged_1_, double p_mouseDragged_3_, int p_mouseDragged_5_, - double p_mouseDragged_6_, double p_mouseDragged_8_) { + double p_mouseDragged_6_, double p_mouseDragged_8_) { updateOffset(p_mouseDragged_1_, p_mouseDragged_3_); return true; diff --git a/src/main/java/com/simibubi/create/content/equipment/goggles/GoggleOverlayRenderer.java b/src/main/java/com/simibubi/create/content/equipment/goggles/GoggleOverlayRenderer.java index 6d896b1a93..fa2a4fe138 100644 --- a/src/main/java/com/simibubi/create/content/equipment/goggles/GoggleOverlayRenderer.java +++ b/src/main/java/com/simibubi/create/content/equipment/goggles/GoggleOverlayRenderer.java @@ -27,7 +27,6 @@ import com.simibubi.create.infrastructure.config.CClient; import net.createmod.catnip.data.Iterate; import net.createmod.catnip.gui.element.BoxElement; import net.createmod.catnip.gui.element.GuiGameElement; -import net.createmod.catnip.lang.Lang; import net.createmod.catnip.outliner.Outline; import net.createmod.catnip.outliner.Outliner; import net.createmod.catnip.outliner.Outliner.OutlineEntry; @@ -38,6 +37,7 @@ import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.multiplayer.ClientLevel; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; +import net.minecraft.network.chat.CommonComponents; import net.minecraft.network.chat.Component; import net.minecraft.network.chat.FormattedText; import net.minecraft.util.Mth; @@ -116,7 +116,7 @@ public class GoggleOverlayRenderer { if (hasHoveringInformation) { if (!tooltip.isEmpty()) - tooltip.add(Lang.IMMUTABLE_EMPTY); + tooltip.add(CommonComponents.EMPTY); IHaveHoveringInformation hte = (IHaveHoveringInformation) be; hoverAddedInformation = hte.addToTooltip(tooltip, isShifting); @@ -163,7 +163,7 @@ public class GoggleOverlayRenderer { return; } if (!tooltip.isEmpty()) - tooltip.add(Lang.IMMUTABLE_EMPTY); + tooltip.add(CommonComponents.EMPTY); CreateLang.translate("gui.goggles.pole_length") .text(" " + poles) diff --git a/src/main/java/com/simibubi/create/content/equipment/potatoCannon/PotatoCannonItem.java b/src/main/java/com/simibubi/create/content/equipment/potatoCannon/PotatoCannonItem.java index 7a3252c609..fdd5e3bf47 100644 --- a/src/main/java/com/simibubi/create/content/equipment/potatoCannon/PotatoCannonItem.java +++ b/src/main/java/com/simibubi/create/content/equipment/potatoCannon/PotatoCannonItem.java @@ -5,8 +5,6 @@ import java.util.Optional; import java.util.function.Consumer; import java.util.function.Predicate; -import net.createmod.catnip.lang.Lang; - import org.jetbrains.annotations.Nullable; import com.simibubi.create.AllEnchantments; @@ -29,6 +27,7 @@ import net.minecraft.client.player.AbstractClientPlayer; import net.minecraft.client.player.LocalPlayer; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction.Axis; +import net.minecraft.network.chat.CommonComponents; import net.minecraft.network.chat.Component; import net.minecraft.network.chat.MutableComponent; import net.minecraft.util.Mth; @@ -47,6 +46,7 @@ import net.minecraft.world.item.enchantment.Enchantments; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.phys.Vec3; + import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.client.extensions.common.IClientItemExtensions; @@ -113,75 +113,75 @@ public class PotatoCannonItem extends ProjectileWeaponItem implements CustomArmP ItemStack stack = player.getItemInHand(hand); return findAmmoInInventory(world, player, stack).map(itemStack -> { - if (ShootableGadgetItemMethods.shouldSwap(player, stack, hand, this::isCannon)) - return InteractionResultHolder.fail(stack); + if (ShootableGadgetItemMethods.shouldSwap(player, stack, hand, this::isCannon)) + return InteractionResultHolder.fail(stack); - if (world.isClientSide) { - CreateClient.POTATO_CANNON_RENDER_HANDLER.dontAnimateItem(hand); - return InteractionResultHolder.success(stack); - } - - Vec3 barrelPos = ShootableGadgetItemMethods.getGunBarrelVec(player, hand == InteractionHand.MAIN_HAND, - new Vec3(.75f, -0.15f, 1.5f)); - Vec3 correction = - ShootableGadgetItemMethods.getGunBarrelVec(player, hand == InteractionHand.MAIN_HAND, new Vec3(-.05f, 0, 0)) - .subtract(player.position() - .add(0, player.getEyeHeight(), 0)); - - PotatoCannonProjectileType projectileType = PotatoProjectileTypeManager.getTypeForStack(itemStack) - .orElse(BuiltinPotatoProjectileTypes.FALLBACK); - Vec3 lookVec = player.getLookAngle(); - Vec3 motion = lookVec.add(correction) - .normalize() - .scale(2) - .scale(projectileType.getVelocityMultiplier()); - - float soundPitch = projectileType.getSoundPitch() + (Create.RANDOM.nextFloat() - .5f) / 4f; - - boolean spray = projectileType.getSplit() > 1; - Vec3 sprayBase = VecHelper.rotate(new Vec3(0, 0.1, 0), 360 * Create.RANDOM.nextFloat(), Axis.Z); - float sprayChange = 360f / projectileType.getSplit(); - - for (int i = 0; i < projectileType.getSplit(); i++) { - PotatoProjectileEntity projectile = AllEntityTypes.POTATO_PROJECTILE.create(world); - projectile.setItem(itemStack); - projectile.setEnchantmentEffectsFromCannon(stack); - - Vec3 splitMotion = motion; - if (spray) { - float imperfection = 40 * (Create.RANDOM.nextFloat() - 0.5f); - Vec3 sprayOffset = VecHelper.rotate(sprayBase, i * sprayChange + imperfection, Axis.Z); - splitMotion = splitMotion.add(VecHelper.lookAt(sprayOffset, motion)); + if (world.isClientSide) { + CreateClient.POTATO_CANNON_RENDER_HANDLER.dontAnimateItem(hand); + return InteractionResultHolder.success(stack); } - if (i != 0) - projectile.recoveryChance = 0; + Vec3 barrelPos = ShootableGadgetItemMethods.getGunBarrelVec(player, hand == InteractionHand.MAIN_HAND, + new Vec3(.75f, -0.15f, 1.5f)); + Vec3 correction = + ShootableGadgetItemMethods.getGunBarrelVec(player, hand == InteractionHand.MAIN_HAND, new Vec3(-.05f, 0, 0)) + .subtract(player.position() + .add(0, player.getEyeHeight(), 0)); - projectile.setPos(barrelPos.x, barrelPos.y, barrelPos.z); - projectile.setDeltaMovement(splitMotion); - projectile.setOwner(player); - world.addFreshEntity(projectile); - } + PotatoCannonProjectileType projectileType = PotatoProjectileTypeManager.getTypeForStack(itemStack) + .orElse(BuiltinPotatoProjectileTypes.FALLBACK); + Vec3 lookVec = player.getLookAngle(); + Vec3 motion = lookVec.add(correction) + .normalize() + .scale(2) + .scale(projectileType.getVelocityMultiplier()); - if (!player.isCreative()) { - itemStack.shrink(1); - if (itemStack.isEmpty()) - player.getInventory().removeItem(itemStack); - } + float soundPitch = projectileType.getSoundPitch() + (Create.RANDOM.nextFloat() - .5f) / 4f; - if (!BacktankUtil.canAbsorbDamage(player, maxUses())) - stack.hurtAndBreak(1, player, p -> p.broadcastBreakEvent(hand)); + boolean spray = projectileType.getSplit() > 1; + Vec3 sprayBase = VecHelper.rotate(new Vec3(0, 0.1, 0), 360 * Create.RANDOM.nextFloat(), Axis.Z); + float sprayChange = 360f / projectileType.getSplit(); - Integer cooldown = - findAmmoInInventory(world, player, stack).flatMap(PotatoProjectileTypeManager::getTypeForStack) - .map(PotatoCannonProjectileType::getReloadTicks) - .orElse(10); + for (int i = 0; i < projectileType.getSplit(); i++) { + PotatoProjectileEntity projectile = AllEntityTypes.POTATO_PROJECTILE.create(world); + projectile.setItem(itemStack); + projectile.setEnchantmentEffectsFromCannon(stack); - ShootableGadgetItemMethods.applyCooldown(player, stack, hand, this::isCannon, cooldown); - ShootableGadgetItemMethods.sendPackets(player, - b -> new PotatoCannonPacket(barrelPos, lookVec.normalize(), itemStack, hand, soundPitch, b)); - return InteractionResultHolder.success(stack); - }) + Vec3 splitMotion = motion; + if (spray) { + float imperfection = 40 * (Create.RANDOM.nextFloat() - 0.5f); + Vec3 sprayOffset = VecHelper.rotate(sprayBase, i * sprayChange + imperfection, Axis.Z); + splitMotion = splitMotion.add(VecHelper.lookAt(sprayOffset, motion)); + } + + if (i != 0) + projectile.recoveryChance = 0; + + projectile.setPos(barrelPos.x, barrelPos.y, barrelPos.z); + projectile.setDeltaMovement(splitMotion); + projectile.setOwner(player); + world.addFreshEntity(projectile); + } + + if (!player.isCreative()) { + itemStack.shrink(1); + if (itemStack.isEmpty()) + player.getInventory().removeItem(itemStack); + } + + if (!BacktankUtil.canAbsorbDamage(player, maxUses())) + stack.hurtAndBreak(1, player, p -> p.broadcastBreakEvent(hand)); + + Integer cooldown = + findAmmoInInventory(world, player, stack).flatMap(PotatoProjectileTypeManager::getTypeForStack) + .map(PotatoCannonProjectileType::getReloadTicks) + .orElse(10); + + ShootableGadgetItemMethods.applyCooldown(player, stack, hand, this::isCannon, cooldown); + ShootableGadgetItemMethods.sendPackets(player, + b -> new PotatoCannonPacket(barrelPos, lookVec.normalize(), itemStack, hand, soundPitch, b)); + return InteractionResultHolder.success(stack); + }) .orElse(InteractionResultHolder.pass(stack)); } @@ -226,20 +226,20 @@ public class PotatoCannonItem extends ProjectileWeaponItem implements CustomArmP String _reload = "potato_cannon.ammo.reload_ticks"; String _knockback = "potato_cannon.ammo.knockback"; - tooltip.add(Lang.IMMUTABLE_EMPTY); + tooltip.add(CommonComponents.EMPTY); tooltip.add(Component.translatable(ammo.getDescriptionId()).append(Component.literal(":")) .withStyle(ChatFormatting.GRAY)); PotatoCannonProjectileType type = PotatoProjectileTypeManager.getTypeForStack(ammo) .get(); - MutableComponent spacing = Component.literal(" "); + MutableComponent spacing = Component.literal(" "); ChatFormatting green = ChatFormatting.GREEN; ChatFormatting darkGreen = ChatFormatting.DARK_GREEN; float damageF = type.getDamage() * additionalDamageMult; - MutableComponent damage = Component.literal(damageF == Mth.floor(damageF) ? "" + Mth.floor(damageF) : "" + damageF); - MutableComponent reloadTicks = Component.literal("" + type.getReloadTicks()); - MutableComponent knockback = - Component.literal("" + (type.getKnockback() + additionalKnockback)); + MutableComponent damage = Component.literal(damageF == Mth.floor(damageF) ? "" + Mth.floor(damageF) : "" + damageF); + MutableComponent reloadTicks = Component.literal("" + type.getReloadTicks()); + MutableComponent knockback = + Component.literal("" + (type.getKnockback() + additionalKnockback)); damage = damage.withStyle(additionalDamageMult > 1 ? green : darkGreen); knockback = knockback.withStyle(additionalKnockback > 0 ? green : darkGreen); diff --git a/src/main/java/com/simibubi/create/content/equipment/symmetryWand/SymmetryWandScreen.java b/src/main/java/com/simibubi/create/content/equipment/symmetryWand/SymmetryWandScreen.java index ba1cf60af4..99daca5446 100644 --- a/src/main/java/com/simibubi/create/content/equipment/symmetryWand/SymmetryWandScreen.java +++ b/src/main/java/com/simibubi/create/content/equipment/symmetryWand/SymmetryWandScreen.java @@ -1,7 +1,5 @@ package com.simibubi.create.content.equipment.symmetryWand; -import net.createmod.catnip.lang.Lang; - import org.joml.Vector3f; import com.mojang.blaze3d.vertex.PoseStack; @@ -23,6 +21,7 @@ import com.simibubi.create.foundation.utility.CreateLang; import net.createmod.catnip.gui.AbstractSimiScreen; import net.createmod.catnip.gui.element.GuiGameElement; import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.network.chat.CommonComponents; import net.minecraft.network.chat.Component; import net.minecraft.world.InteractionHand; import net.minecraft.world.item.ItemStack; @@ -65,9 +64,9 @@ public class SymmetryWandScreen extends AbstractSimiScreen { int x = guiLeft; int y = guiTop; - labelType = new Label(x + 51, y + 28, Lang.IMMUTABLE_EMPTY).colored(0xFFFFFFFF) + labelType = new Label(x + 51, y + 28, CommonComponents.EMPTY).colored(0xFFFFFFFF) .withShadow(); - labelAlign = new Label(x + 51, y + 50, Lang.IMMUTABLE_EMPTY).colored(0xFFFFFFFF) + labelAlign = new Label(x + 51, y + 50, CommonComponents.EMPTY).colored(0xFFFFFFFF) .withShadow(); int state = @@ -79,17 +78,17 @@ public class SymmetryWandScreen extends AbstractSimiScreen { areaType.calling(position -> { switch (position) { - case 0: - currentElement = new PlaneMirror(currentElement.getPosition()); - break; - case 1: - currentElement = new CrossPlaneMirror(currentElement.getPosition()); - break; - case 2: - currentElement = new TriplePlaneMirror(currentElement.getPosition()); - break; - default: - break; + case 0: + currentElement = new PlaneMirror(currentElement.getPosition()); + break; + case 1: + currentElement = new CrossPlaneMirror(currentElement.getPosition()); + break; + case 2: + currentElement = new TriplePlaneMirror(currentElement.getPosition()); + break; + default: + break; } initAlign(currentElement, x, y); }); @@ -131,10 +130,10 @@ public class SymmetryWandScreen extends AbstractSimiScreen { renderBlock(graphics, x, y); GuiGameElement.of(wand) - .scale(4) - .rotate(-70, 20, 20) - .at(x + 178, y + 448, -150) - .render(graphics); + .scale(4) + .rotate(-70, 20, 20) + .at(x + 178, y + 448, -150) + .render(graphics); } protected void renderBlock(GuiGraphics graphics, int x, int y) { diff --git a/src/main/java/com/simibubi/create/content/equipment/zapper/ZapperScreen.java b/src/main/java/com/simibubi/create/content/equipment/zapper/ZapperScreen.java index 61f46141af..3dd8cfbb8e 100644 --- a/src/main/java/com/simibubi/create/content/equipment/zapper/ZapperScreen.java +++ b/src/main/java/com/simibubi/create/content/equipment/zapper/ZapperScreen.java @@ -12,12 +12,12 @@ import com.simibubi.create.foundation.utility.CreateLang; import net.createmod.catnip.gui.AbstractSimiScreen; import net.createmod.catnip.gui.element.GuiGameElement; -import net.createmod.catnip.lang.Lang; import net.createmod.catnip.nbt.NBTHelper; import net.minecraft.client.gui.GuiGraphics; import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.NbtUtils; +import net.minecraft.network.chat.CommonComponents; import net.minecraft.network.chat.Component; import net.minecraft.world.InteractionHand; import net.minecraft.world.item.ItemStack; @@ -46,7 +46,7 @@ public abstract class ZapperScreen extends AbstractSimiScreen { this.background = background; this.zapper = zapper; this.hand = hand; - title = Lang.IMMUTABLE_EMPTY; + title = CommonComponents.EMPTY; brightColor = 0xFEFEFE; fontColor = AllGuiTextures.FONT_COLOR; @@ -124,9 +124,9 @@ public abstract class ZapperScreen extends AbstractSimiScreen { protected void renderZapper(GuiGraphics graphics, int x, int y) { GuiGameElement.of(zapper) - .scale(4) - .at(x + background.getWidth(), y + background.getHeight() - 48, -200) - .render(graphics); + .scale(4) + .at(x + background.getWidth(), y + background.getHeight() - 48, -200) + .render(graphics); } @SuppressWarnings("deprecation") diff --git a/src/main/java/com/simibubi/create/content/equipment/zapper/terrainzapper/WorldshaperScreen.java b/src/main/java/com/simibubi/create/content/equipment/zapper/terrainzapper/WorldshaperScreen.java index 2dda8ef1ff..0d0094800a 100644 --- a/src/main/java/com/simibubi/create/content/equipment/zapper/terrainzapper/WorldshaperScreen.java +++ b/src/main/java/com/simibubi/create/content/equipment/zapper/terrainzapper/WorldshaperScreen.java @@ -15,13 +15,13 @@ import com.simibubi.create.foundation.gui.widget.ScrollInput; import com.simibubi.create.foundation.gui.widget.SelectionScrollInput; import com.simibubi.create.foundation.utility.CreateLang; -import net.createmod.catnip.lang.Lang; import net.createmod.catnip.nbt.NBTHelper; import net.minecraft.client.gui.GuiGraphics; import net.minecraft.core.BlockPos; import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.NbtUtils; import net.minecraft.nbt.Tag; +import net.minecraft.network.chat.CommonComponents; import net.minecraft.network.chat.Component; import net.minecraft.world.InteractionHand; import net.minecraft.world.item.ItemStack; @@ -46,7 +46,7 @@ public class WorldshaperScreen extends ZapperScreen { protected Indicator acrossMaterialsIndicator; protected TerrainBrushes currentBrush; - protected int[] currentBrushParams = new int[] { 1, 1, 1 }; + protected int[] currentBrushParams = new int[]{1, 1, 1}; protected boolean currentFollowDiagonals; protected boolean currentAcrossMaterials; protected TerrainTools currentTool; @@ -82,7 +82,7 @@ public class WorldshaperScreen extends ZapperScreen { int x = guiLeft; int y = guiTop; - brushLabel = new Label(x + 61, y + 25, Lang.IMMUTABLE_EMPTY).withShadow(); + brushLabel = new Label(x + 61, y + 25, CommonComponents.EMPTY).withShadow(); brushInput = new SelectionScrollInput(x + 56, y + 20, 77, 18).forOptions(brushOptions) .titled(CreateLang.translateDirect("gui.terrainzapper.brush")) .writingTo(brushLabel) @@ -111,7 +111,7 @@ public class WorldshaperScreen extends ZapperScreen { brushParams.clear(); for (int index = 0; index < 3; index++) { - Label label = new Label(x + 65 + 20 * index, y + 45, Lang.IMMUTABLE_EMPTY).withShadow(); + Label label = new Label(x + 65 + 20 * index, y + 45, CommonComponents.EMPTY).withShadow(); final int finalIndex = index; ScrollInput input = new ScrollInput(x + 56 + 20 * index, y + 40, 18, 18) @@ -155,10 +155,10 @@ public class WorldshaperScreen extends ZapperScreen { if (currentBrush.hasConnectivityOptions()) { int x1 = x + 7 + 4 * 18; int y1 = y + 79; - followDiagonalsIndicator = new Indicator(x1, y1 - 6, Lang.IMMUTABLE_EMPTY); + followDiagonalsIndicator = new Indicator(x1, y1 - 6, CommonComponents.EMPTY); followDiagonals = new IconButton(x1, y1, AllIcons.I_FOLLOW_DIAGONAL); x1 += 18; - acrossMaterialsIndicator = new Indicator(x1, y1 - 6, Lang.IMMUTABLE_EMPTY); + acrossMaterialsIndicator = new Indicator(x1, y1 - 6, CommonComponents.EMPTY); acrossMaterials = new IconButton(x1, y1, AllIcons.I_FOLLOW_MATERIAL); followDiagonals.withCallback(() -> { diff --git a/src/main/java/com/simibubi/create/content/fluids/potion/PotionFluidHandler.java b/src/main/java/com/simibubi/create/content/fluids/potion/PotionFluidHandler.java index ed397fa956..ce98662442 100644 --- a/src/main/java/com/simibubi/create/content/fluids/potion/PotionFluidHandler.java +++ b/src/main/java/com/simibubi/create/content/fluids/potion/PotionFluidHandler.java @@ -9,11 +9,11 @@ import com.simibubi.create.content.fluids.potion.PotionFluid.BottleType; import com.simibubi.create.foundation.fluid.FluidHelper; import com.simibubi.create.foundation.fluid.FluidIngredient; -import net.createmod.catnip.lang.Lang; -import net.createmod.catnip.nbt.NBTHelper; import net.createmod.catnip.data.Pair; +import net.createmod.catnip.nbt.NBTHelper; import net.minecraft.ChatFormatting; import net.minecraft.nbt.CompoundTag; +import net.minecraft.network.chat.CommonComponents; import net.minecraft.network.chat.Component; import net.minecraft.network.chat.MutableComponent; import net.minecraft.util.Tuple; @@ -32,6 +32,7 @@ import net.minecraft.world.item.alchemy.PotionUtils; import net.minecraft.world.item.alchemy.Potions; import net.minecraft.world.level.ItemLike; import net.minecraft.world.level.material.Fluids; + import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.fluids.FluidStack; @@ -83,13 +84,13 @@ public class PotionFluidHandler { public static ItemLike itemFromBottleType(BottleType type) { switch (type) { - case LINGERING: - return Items.LINGERING_POTION; - case SPLASH: - return Items.SPLASH_POTION; - case REGULAR: - default: - return Items.POTION; + case LINGERING: + return Items.LINGERING_POTION; + case SPLASH: + return Items.SPLASH_POTION; + case REGULAR: + default: + return Items.POTION; } } @@ -111,10 +112,10 @@ public class PotionFluidHandler { List list = PotionUtils.getAllEffects(fs.getOrCreateTag()); List> list1 = Lists.newArrayList(); if (list.isEmpty()) { - tooltip.add((Component.translatable("effect.none")).withStyle(ChatFormatting.GRAY)); + tooltip.add((Component.translatable("effect.none")).withStyle(ChatFormatting.GRAY)); } else { for (MobEffectInstance effectinstance : list) { - MutableComponent textcomponent = Component.translatable(effectinstance.getDescriptionId()); + MutableComponent textcomponent = Component.translatable(effectinstance.getDescriptionId()); MobEffect effect = effectinstance.getEffect(); Map map = effect.getAttributeModifiers(); if (!map.isEmpty()) { @@ -130,7 +131,7 @@ public class PotionFluidHandler { } if (effectinstance.getAmplifier() > 0) { - textcomponent.append(" ") + textcomponent.append(" ") .append(Component.translatable("potion.potency." + effectinstance.getAmplifier()).getString()); } @@ -146,8 +147,8 @@ public class PotionFluidHandler { } if (!list1.isEmpty()) { - tooltip.add(Lang.IMMUTABLE_EMPTY); - tooltip.add((Component.translatable("potion.whenDrank")).withStyle(ChatFormatting.DARK_PURPLE)); + tooltip.add(CommonComponents.EMPTY); + tooltip.add((Component.translatable("potion.whenDrank")).withStyle(ChatFormatting.DARK_PURPLE)); for (Tuple tuple : list1) { AttributeModifier attributemodifier2 = tuple.getB(); @@ -164,13 +165,13 @@ public class PotionFluidHandler { Object[] args = new Object[]{ItemStack.ATTRIBUTE_MODIFIER_FORMAT.format(d1), Component.translatable(tuple.getA())}; tooltip.add((Component.translatable("attribute.modifier.plus." + attributemodifier2.getOperation() .toValue(), args)) - .withStyle(ChatFormatting.BLUE)); + .withStyle(ChatFormatting.BLUE)); } else if (d0 < 0.0D) { d1 = d1 * -1.0D; Object[] args = new Object[]{ItemStack.ATTRIBUTE_MODIFIER_FORMAT.format(d1), Component.translatable(tuple.getA())}; tooltip.add((Component.translatable("attribute.modifier.take." + attributemodifier2.getOperation() .toValue(), args)) - .withStyle(ChatFormatting.RED)); + .withStyle(ChatFormatting.RED)); } } } diff --git a/src/main/java/com/simibubi/create/content/fluids/tank/BoilerData.java b/src/main/java/com/simibubi/create/content/fluids/tank/BoilerData.java index 08d171ecd7..45f9a61741 100644 --- a/src/main/java/com/simibubi/create/content/fluids/tank/BoilerData.java +++ b/src/main/java/com/simibubi/create/content/fluids/tank/BoilerData.java @@ -6,8 +6,6 @@ import java.util.HashSet; import java.util.List; import java.util.Set; -import net.createmod.catnip.lang.Lang; - import org.jetbrains.annotations.NotNull; import com.simibubi.create.AllBlocks; @@ -22,13 +20,14 @@ import com.simibubi.create.foundation.fluid.FluidHelper; import com.simibubi.create.foundation.utility.CreateLang; import joptsimple.internal.Strings; -import net.createmod.catnip.data.Iterate; import net.createmod.catnip.animation.LerpedFloat; import net.createmod.catnip.animation.LerpedFloat.Chaser; +import net.createmod.catnip.data.Iterate; import net.minecraft.ChatFormatting; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.nbt.CompoundTag; +import net.minecraft.network.chat.CommonComponents; import net.minecraft.network.chat.Component; import net.minecraft.network.chat.MutableComponent; import net.minecraft.sounds.SoundEvents; @@ -37,6 +36,7 @@ import net.minecraft.util.Mth; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.phys.AABB; + import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.capability.IFluidHandler; @@ -67,7 +67,7 @@ public class BoilerData { private int maxHeatForWater = 0; private int minValue = 0; private int maxValue = 0; - public boolean[] occludedDirections = { true, true, true, true }; + public boolean[] occludedDirections = {true, true, true, true}; public LerpedFloat gauge = LerpedFloat.linear(); @@ -197,7 +197,7 @@ public class BoilerData { calcMinMaxForSize(boilerSize); CreateLang.translate("boiler.status", getHeatLevelTextComponent().withStyle(ChatFormatting.GREEN)) - .forGoggles(tooltip); + .forGoggles(tooltip); CreateLang.builder().add(getSizeComponent(true, false)).forGoggles(tooltip, 1); CreateLang.builder().add(getWaterComponent(true, false)).forGoggles(tooltip, 1); CreateLang.builder().add(getHeatComponent(true, false)).forGoggles(tooltip, 1); @@ -209,7 +209,7 @@ public class BoilerData { double totalSU = getEngineEfficiency(boilerSize) * 16 * Math.max(boilerLevel, attachedEngines) * BlockStressValues.getCapacity(AllBlocks.STEAM_ENGINE.get()); - tooltip.add(Lang.IMMUTABLE_EMPTY); + tooltip.add(CommonComponents.EMPTY); if (attachedEngines > 0 && maxHeatForSize > 0 && maxHeatForWater == 0 && (passiveHeat ? 1 : activeHeat) > 0) { CreateLang.translate("boiler.water_input_rate") @@ -221,7 +221,7 @@ public class BoilerData { .add(CreateLang.text(" / ") .style(ChatFormatting.GRAY)) .add(CreateLang.translate("boiler.per_tick", CreateLang.number(waterSupplyPerLevel) - .add(CreateLang.translate("generic.unit.millibuckets"))) + .add(CreateLang.translate("generic.unit.millibuckets"))) .style(ChatFormatting.DARK_GRAY)) .forGoggles(tooltip, 1); return true; @@ -256,8 +256,8 @@ public class BoilerData { return isPassive() ? CreateLang.translateDirect("boiler.passive") : (boilerLevel == 0 ? CreateLang.translateDirect("boiler.idle") - : boilerLevel == 18 ? CreateLang.translateDirect("boiler.max_lvl") - : CreateLang.translateDirect("boiler.lvl", String.valueOf(boilerLevel))); + : boilerLevel == 18 ? CreateLang.translateDirect("boiler.max_lvl") + : CreateLang.translateDirect("boiler.lvl", String.valueOf(boilerLevel))); } public MutableComponent getSizeComponent(boolean forGoggles, boolean useBlocksAsBars, ChatFormatting... styles) { @@ -273,7 +273,7 @@ public class BoilerData { } private MutableComponent componentHelper(String label, int level, boolean forGoggles, boolean useBlocksAsBars, - ChatFormatting... styles) { + ChatFormatting... styles) { MutableComponent base = useBlocksAsBars ? blockComponent(level) : barComponent(level); if (!forGoggles) @@ -294,7 +294,7 @@ public class BoilerData { } private MutableComponent barComponent(int level) { - return Component.empty() + return Component.empty() .append(bars(Math.max(0, minValue - 1), ChatFormatting.DARK_GREEN)) .append(bars(minValue > 0 ? 1 : 0, ChatFormatting.GREEN)) .append(bars(Math.max(0, level - minValue), ChatFormatting.DARK_GREEN)) @@ -332,7 +332,7 @@ public class BoilerData { attachedEngines++; if (AllBlocks.STEAM_WHISTLE.has(attachedState) && WhistleBlock.getAttachedDirection(attachedState) - .getOpposite() == d) + .getOpposite() == d) attachedWhistles++; } } @@ -365,7 +365,7 @@ public class BoilerData { BlockState attachedState = level.getBlockState(attachedPos); if (AllBlocks.STEAM_WHISTLE.has(attachedState) && WhistleBlock.getAttachedDirection(attachedState) - .getOpposite() == d) { + .getOpposite() == d) { if (level.getBlockEntity(attachedPos) instanceof WhistleBlockEntity wbe) whistlePitches.add(wbe.getPitchId()); } diff --git a/src/main/java/com/simibubi/create/content/kinetics/belt/BeltSlicer.java b/src/main/java/com/simibubi/create/content/kinetics/belt/BeltSlicer.java index db08175e36..e29744cf34 100644 --- a/src/main/java/com/simibubi/create/content/kinetics/belt/BeltSlicer.java +++ b/src/main/java/com/simibubi/create/content/kinetics/belt/BeltSlicer.java @@ -15,7 +15,6 @@ import com.simibubi.create.content.kinetics.belt.transport.TransportedItemStack; import com.simibubi.create.foundation.block.ProperWaterloggedBlock; import com.simibubi.create.foundation.utility.CreateLang; -import net.createmod.catnip.lang.Lang; import net.createmod.catnip.math.VecHelper; import net.createmod.catnip.outliner.Outliner; import net.minecraft.ChatFormatting; @@ -24,6 +23,7 @@ import net.minecraft.client.multiplayer.ClientLevel; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.core.Direction.Axis; +import net.minecraft.network.chat.CommonComponents; import net.minecraft.sounds.SoundEvents; import net.minecraft.sounds.SoundSource; import net.minecraft.world.InteractionHand; @@ -54,7 +54,7 @@ public class BeltSlicer { } public static InteractionResult useWrench(BlockState state, Level world, BlockPos pos, Player player, - InteractionHand handIn, BlockHitResult hit, Feedback feedBack) { + InteractionHand handIn, BlockHitResult hit, Feedback feedBack) { BeltBlockEntity controllerBE = BeltHelper.getControllerBE(world, pos); if (controllerBE == null) return InteractionResult.PASS; @@ -163,7 +163,8 @@ public class BeltSlicer { int amountRetrieved = 0; boolean beltFound = false; - Search: while (true) { + Search: + while (true) { for (int i = 0; i < player.getInventory().getContainerSize(); ++i) { if (amountRetrieved == requiredShafts && beltFound) break Search; @@ -221,7 +222,7 @@ public class BeltSlicer { newController.inventory = null; newController.setController(newController.getBlockPos()); for (Iterator iterator = inventory.getTransportedItems() - .iterator(); iterator.hasNext();) { + .iterator(); iterator.hasNext(); ) { TransportedItemStack transportedItemStack = iterator.next(); float newPosition = transportedItemStack.beltPosition - hitSegment - (towardPositive ? 1 : 0); if (newPosition <= 0) @@ -238,7 +239,7 @@ public class BeltSlicer { } public static InteractionResult useConnector(BlockState state, Level world, BlockPos pos, Player player, - InteractionHand handIn, BlockHitResult hit, Feedback feedBack) { + InteractionHand handIn, BlockHitResult hit, Feedback feedBack) { BeltBlockEntity controllerBE = BeltHelper.getControllerBE(world, pos); if (controllerBE == null) return InteractionResult.PASS; @@ -400,16 +401,16 @@ public class BeltSlicer { BeltSlope slope2 = nextState.getValue(BeltBlock.SLOPE); switch (slope1) { - case UPWARD: - if (slope2 == BeltSlope.DOWNWARD) - return facing1 == facing2.getOpposite(); - return slope2 == slope1 && facing1 == facing2; - case DOWNWARD: - if (slope2 == BeltSlope.UPWARD) - return facing1 == facing2.getOpposite(); - return slope2 == slope1 && facing1 == facing2; - default: - return slope2 == slope1 && facing2.getAxis() == facing1.getAxis(); + case UPWARD: + if (slope2 == BeltSlope.DOWNWARD) + return facing1 == facing2.getOpposite(); + return slope2 == slope1 && facing1 == facing2; + case DOWNWARD: + if (slope2 == BeltSlope.UPWARD) + return facing1 == facing2.getOpposite(); + return slope2 == slope1 && facing1 == facing2; + default: + return slope2 == slope1 && facing2.getAxis() == facing1.getAxis(); } } @@ -477,7 +478,7 @@ public class BeltSlicer { mc.player.displayClientMessage(CreateLang.translateDirect(feedback.langKey) .withStyle(feedback.formatting), true); else - mc.player.displayClientMessage(Lang.IMMUTABLE_EMPTY, true); + mc.player.displayClientMessage(CommonComponents.EMPTY, true); if (feedback.bb != null) Outliner.getInstance().chaseAABB("BeltSlicer", feedback.bb) diff --git a/src/main/java/com/simibubi/create/content/kinetics/deployer/DeployerBlockEntity.java b/src/main/java/com/simibubi/create/content/kinetics/deployer/DeployerBlockEntity.java index ce4407391e..2179c83d91 100644 --- a/src/main/java/com/simibubi/create/content/kinetics/deployer/DeployerBlockEntity.java +++ b/src/main/java/com/simibubi/create/content/kinetics/deployer/DeployerBlockEntity.java @@ -27,16 +27,16 @@ import com.simibubi.create.foundation.item.TooltipHelper; import com.simibubi.create.foundation.utility.CreateLang; import dev.engine_room.flywheel.lib.model.baked.PartialModel; -import net.createmod.catnip.lang.Lang; -import net.createmod.catnip.nbt.NBTHelper; -import net.createmod.catnip.math.VecHelper; import net.createmod.catnip.animation.LerpedFloat; +import net.createmod.catnip.math.VecHelper; +import net.createmod.catnip.nbt.NBTHelper; import net.minecraft.ChatFormatting; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.ListTag; import net.minecraft.nbt.Tag; +import net.minecraft.network.chat.CommonComponents; import net.minecraft.network.chat.Component; import net.minecraft.server.level.ServerLevel; import net.minecraft.sounds.SoundEvents; @@ -57,6 +57,7 @@ import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.phys.AABB; import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.Vec3; + import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.common.MinecraftForge; @@ -503,14 +504,14 @@ public class DeployerBlockEntity extends KineticBlockEntity { .forGoggles(tooltip); if (!heldItem.isEmpty()) - CreateLang.translate("tooltip.deployer.contains", Component.translatable(heldItem.getDescriptionId()) - .getString(), heldItem.getCount()) - .style(ChatFormatting.GREEN) - .forGoggles(tooltip); + CreateLang.translate("tooltip.deployer.contains", Component.translatable(heldItem.getDescriptionId()) + .getString(), heldItem.getCount()) + .style(ChatFormatting.GREEN) + .forGoggles(tooltip); float stressAtBase = calculateStressApplied(); if (StressImpact.isEnabled() && !Mth.equal(stressAtBase, 0)) { - tooltip.add(Lang.IMMUTABLE_EMPTY); + tooltip.add(CommonComponents.EMPTY); addStressImpactStats(tooltip, stressAtBase); } @@ -556,7 +557,7 @@ public class DeployerBlockEntity extends KineticBlockEntity { if (heldItemMainhand.getItem() instanceof SandPaperItem) { sandpaperInv.setItem(0, stack); Optional> polishingRecipe = checkRecipe(AllRecipeTypes.SANDPAPER_POLISHING, sandpaperInv, level); - if (polishingRecipe.isPresent()){ + if (polishingRecipe.isPresent()) { return polishingRecipe.get(); } } diff --git a/src/main/java/com/simibubi/create/content/logistics/filter/AttributeFilterScreen.java b/src/main/java/com/simibubi/create/content/logistics/filter/AttributeFilterScreen.java index 41e0e1dc3a..b961b4a371 100644 --- a/src/main/java/com/simibubi/create/content/logistics/filter/AttributeFilterScreen.java +++ b/src/main/java/com/simibubi/create/content/logistics/filter/AttributeFilterScreen.java @@ -21,10 +21,10 @@ import com.simibubi.create.foundation.gui.widget.SelectionScrollInput; import com.simibubi.create.foundation.utility.CreateLang; import net.createmod.catnip.data.Pair; -import net.createmod.catnip.lang.Lang; import net.minecraft.ChatFormatting; import net.minecraft.client.gui.GuiGraphics; import net.minecraft.nbt.CompoundTag; +import net.minecraft.network.chat.CommonComponents; import net.minecraft.network.chat.Component; import net.minecraft.network.chat.MutableComponent; import net.minecraft.world.entity.player.Inventory; @@ -90,9 +90,9 @@ public class AttributeFilterScreen extends AbstractFilterScreen { - selectedAttributes.add(Component.literal("- ") - .append(at.getFirst() - .format(at.getSecond())) - .withStyle(ChatFormatting.GRAY)); - }); + selectedAttributes.add(Component.literal("- ") + .append(at.getFirst() + .format(at.getSecond())) + .withStyle(ChatFormatting.GRAY)); + }); } private void referenceItemChanged(ItemStack stack) { @@ -242,7 +242,7 @@ public class AttributeFilterScreen extends AbstractFilterScreen { sendOptionUpdate(Option.WHITELIST); }); whitelist.setToolTip(allowN); - blacklistIndicator = new Indicator(x + 18, y + 69, Lang.IMMUTABLE_EMPTY); - whitelistIndicator = new Indicator(x + 36, y + 69, Lang.IMMUTABLE_EMPTY); + blacklistIndicator = new Indicator(x + 18, y + 69, CommonComponents.EMPTY); + whitelistIndicator = new Indicator(x + 36, y + 69, CommonComponents.EMPTY); addRenderableWidgets(blacklist, whitelist, blacklistIndicator, whitelistIndicator); respectNBT = new IconButton(x + 60, y + 75, AllIcons.I_RESPECT_NBT); @@ -74,8 +74,8 @@ public class FilterScreen extends AbstractFilterScreen { sendOptionUpdate(Option.IGNORE_DATA); }); ignoreNBT.setToolTip(ignoreDataN); - respectNBTIndicator = new Indicator(x + 60, y + 69, Lang.IMMUTABLE_EMPTY); - ignoreNBTIndicator = new Indicator(x + 78, y + 69, Lang.IMMUTABLE_EMPTY); + respectNBTIndicator = new Indicator(x + 60, y + 69, CommonComponents.EMPTY); + ignoreNBTIndicator = new Indicator(x + 78, y + 69, CommonComponents.EMPTY); addRenderableWidgets(respectNBT, ignoreNBT, respectNBTIndicator, ignoreNBTIndicator); handleIndicators(); diff --git a/src/main/java/com/simibubi/create/content/processing/sequenced/SequencedAssemblyRecipe.java b/src/main/java/com/simibubi/create/content/processing/sequenced/SequencedAssemblyRecipe.java index cc9c4dbaff..e87268bdf9 100644 --- a/src/main/java/com/simibubi/create/content/processing/sequenced/SequencedAssemblyRecipe.java +++ b/src/main/java/com/simibubi/create/content/processing/sequenced/SequencedAssemblyRecipe.java @@ -16,13 +16,12 @@ import com.simibubi.create.foundation.fluid.FluidIngredient; import com.simibubi.create.foundation.utility.CreateLang; import net.createmod.catnip.data.Pair; -import net.createmod.catnip.lang.Lang; import net.minecraft.ChatFormatting; import net.minecraft.client.Minecraft; import net.minecraft.core.RegistryAccess; import net.minecraft.nbt.CompoundTag; +import net.minecraft.network.chat.CommonComponents; import net.minecraft.network.chat.Component; -import net.minecraft.network.chat.MutableComponent; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.Container; import net.minecraft.world.item.ItemStack; @@ -32,6 +31,7 @@ import net.minecraft.world.item.crafting.RecipeSerializer; import net.minecraft.world.item.crafting.RecipeType; import net.minecraft.world.level.ItemLike; import net.minecraft.world.level.Level; + import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.event.entity.player.ItemTooltipEvent; @@ -59,18 +59,18 @@ public class SequencedAssemblyRecipe implements Recipe { } public static > Optional getRecipe(Level world, C inv, - RecipeType type, Class recipeClass) { + RecipeType type, Class recipeClass) { return getRecipe(world, inv, type, recipeClass, r -> r.matches(inv, world)); } public static > Optional getRecipe(Level world, C inv, - RecipeType type, Class recipeClass, Predicate recipeFilter) { + RecipeType type, Class recipeClass, Predicate recipeFilter) { return getRecipes(world, inv.getItem(0), type, recipeClass).filter(recipeFilter) .findFirst(); } public static > Optional getRecipe(Level world, ItemStack item, - RecipeType type, Class recipeClass) { + RecipeType type, Class recipeClass) { List all = world.getRecipeManager() .getAllRecipesFor(AllRecipeTypes.SEQUENCED_ASSEMBLY.getType()); for (SequencedAssemblyRecipe sequencedAssemblyRecipe : all) { @@ -87,21 +87,21 @@ public class SequencedAssemblyRecipe implements Recipe { } public static > Stream getRecipes(Level world, ItemStack item, - RecipeType type, Class recipeClass) { + RecipeType type, Class recipeClass) { List all = world.getRecipeManager() .getAllRecipesFor(AllRecipeTypes.SEQUENCED_ASSEMBLY.getType()); return all.stream() - .filter(it -> it.appliesTo(item)) - .map(it -> Pair.of(it, it.getNextRecipe(item).getRecipe())) - .filter(it -> it.getSecond() - .getType() == type && recipeClass.isInstance(it.getSecond())) - .map(it -> { - it.getSecond() - .enforceNextResult(() -> it.getFirst().advance(item)); - return it.getSecond(); - }) - .map(recipeClass::cast); + .filter(it -> it.appliesTo(item)) + .map(it -> Pair.of(it, it.getNextRecipe(item).getRecipe())) + .filter(it -> it.getSecond() + .getType() == type && recipeClass.isInstance(it.getSecond())) + .map(it -> { + it.getSecond() + .enforceNextResult(() -> it.getFirst().advance(item)); + return it.getSecond(); + }) + .map(recipeClass::cast); } private ItemStack advance(ItemStack input) { @@ -159,9 +159,9 @@ public class SequencedAssemblyRecipe implements Recipe { return true; return input.hasTag() && getTransitionalItem().getItem() == input.getItem() && input.getTag() .contains("SequencedAssembly") && input.getTag() - .getCompound("SequencedAssembly") - .getString("id") - .equals(id.toString()); + .getCompound("SequencedAssembly") + .getString("id") + .equals(id.toString()); } private SequencedRecipe getNextRecipe(ItemStack input) { @@ -250,7 +250,7 @@ public class SequencedAssemblyRecipe implements Recipe { int step = sequencedAssemblyRecipe.getStep(stack); int total = length * sequencedAssemblyRecipe.loops; List tooltip = event.getToolTip(); - tooltip.add(Lang.IMMUTABLE_EMPTY); + tooltip.add(CommonComponents.EMPTY); tooltip.add(CreateLang.translateDirect("recipe.sequenced_assembly") .withStyle(ChatFormatting.GRAY)); tooltip.add(CreateLang.translateDirect("recipe.assembly.progress", step, total) @@ -267,9 +267,9 @@ public class SequencedAssemblyRecipe implements Recipe { tooltip.add(CreateLang.translateDirect("recipe.assembly.next", textComponent) .withStyle(ChatFormatting.AQUA)); else { - tooltip.add(Component.literal("-> ").append(textComponent) - .withStyle(ChatFormatting.DARK_AQUA)); - } + tooltip.add(Component.literal("-> ").append(textComponent) + .withStyle(ChatFormatting.DARK_AQUA)); + } } } diff --git a/src/main/java/com/simibubi/create/content/redstone/displayLink/DisplayLinkScreen.java b/src/main/java/com/simibubi/create/content/redstone/displayLink/DisplayLinkScreen.java index 557e380373..d6f669caff 100644 --- a/src/main/java/com/simibubi/create/content/redstone/displayLink/DisplayLinkScreen.java +++ b/src/main/java/com/simibubi/create/content/redstone/displayLink/DisplayLinkScreen.java @@ -21,13 +21,12 @@ import com.simibubi.create.foundation.utility.CreateLang; import com.simibubi.create.infrastructure.ponder.AllCreatePonderTags; import dev.engine_room.flywheel.lib.transform.TransformStack; +import net.createmod.catnip.data.Couple; import net.createmod.catnip.gui.AbstractSimiScreen; import net.createmod.catnip.gui.ScreenOpener; import net.createmod.catnip.gui.element.GuiGameElement; import net.createmod.catnip.gui.widget.AbstractSimiWidget; import net.createmod.catnip.gui.widget.ElementWidget; -import net.createmod.catnip.data.Couple; -import net.createmod.catnip.lang.Lang; import net.createmod.ponder.foundation.ui.PonderTagScreen; import net.minecraft.ChatFormatting; import net.minecraft.client.gui.GuiGraphics; @@ -35,6 +34,7 @@ import net.minecraft.client.gui.components.events.GuiEventListener; import net.minecraft.client.multiplayer.ClientLevel; import net.minecraft.core.Direction; import net.minecraft.nbt.CompoundTag; +import net.minecraft.network.chat.CommonComponents; import net.minecraft.network.chat.Component; import net.minecraft.network.chat.MutableComponent; import net.minecraft.world.item.ItemStack; @@ -94,9 +94,9 @@ public class DisplayLinkScreen extends AbstractSimiScreen { public void tick() { super.tick(); if (sourceState != null && sourceState.getBlock() != minecraft.level.getBlockState(blockEntity.getSourcePosition()) - .getBlock() - || targetState != null && targetState.getBlock() != minecraft.level.getBlockState(blockEntity.getTargetPosition()) - .getBlock()) + .getBlock() + || targetState != null && targetState.getBlock() != minecraft.level.getBlockState(blockEntity.getTargetPosition()) + .getBlock()) initGathererOptions(); } @@ -138,15 +138,15 @@ public class DisplayLinkScreen extends AbstractSimiScreen { int rows = stats.maxRows(); int startIndex = Math.min(blockEntity.targetLine, rows); - targetLineLabel = new Label(x + 65, y + 109, Lang.IMMUTABLE_EMPTY).withShadow(); + targetLineLabel = new Label(x + 65, y + 109, CommonComponents.EMPTY).withShadow(); targetLineLabel.text = target.getLineOptionText(startIndex); if (rows > 1) { targetLineSelector = new ScrollInput(x + 61, y + 105, 135, 16).withRange(0, rows) - .titled(CreateLang.translateDirect("display_link.display_on")) - .inverted() - .calling(i -> targetLineLabel.text = target.getLineOptionText(i)) - .setState(startIndex); + .titled(CreateLang.translateDirect("display_link.display_on")) + .inverted() + .calling(i -> targetLineLabel.text = target.getLineOptionText(i)) + .setState(startIndex); addRenderableWidget(targetLineSelector); } @@ -154,35 +154,35 @@ public class DisplayLinkScreen extends AbstractSimiScreen { } sourceWidget = new ElementWidget(x + 37, y + 26) - .showingElement(GuiGameElement.of(sourceIcon)) - .withCallback((mX, mY) -> { - ScreenOpener.open(new PonderTagScreen(AllCreatePonderTags.DISPLAY_SOURCES)); - }); + .showingElement(GuiGameElement.of(sourceIcon)) + .withCallback((mX, mY) -> { + ScreenOpener.open(new PonderTagScreen(AllCreatePonderTags.DISPLAY_SOURCES)); + }); sourceWidget.getToolTip().addAll(List.of( - CreateLang.translateDirect("display_link.reading_from"), - sourceState.getBlock().getName() - .withStyle(s -> s.withColor(sources.isEmpty() ? 0xF68989 : 0xF2C16D)), - CreateLang.translateDirect("display_link.attached_side"), - CreateLang.translateDirect("display_link.view_compatible") - .withStyle(ChatFormatting.GRAY) + CreateLang.translateDirect("display_link.reading_from"), + sourceState.getBlock().getName() + .withStyle(s -> s.withColor(sources.isEmpty() ? 0xF68989 : 0xF2C16D)), + CreateLang.translateDirect("display_link.attached_side"), + CreateLang.translateDirect("display_link.view_compatible") + .withStyle(ChatFormatting.GRAY) )); addRenderableWidget(sourceWidget); targetWidget = new ElementWidget(x + 37, y + 105) - .showingElement(GuiGameElement.of(targetIcon)) - .withCallback((mX, mY) -> { - ScreenOpener.open(new PonderTagScreen(AllCreatePonderTags.DISPLAY_TARGETS)); - }); + .showingElement(GuiGameElement.of(targetIcon)) + .withCallback((mX, mY) -> { + ScreenOpener.open(new PonderTagScreen(AllCreatePonderTags.DISPLAY_TARGETS)); + }); targetWidget.getToolTip().addAll(List.of( - CreateLang.translateDirect("display_link.writing_to"), - targetState.getBlock().getName() - .withStyle(s -> s.withColor(target == null ? 0xF68989 : 0xF2C16D)), - CreateLang.translateDirect("display_link.targeted_location"), - CreateLang.translateDirect("display_link.view_compatible") - .withStyle(ChatFormatting.GRAY) + CreateLang.translateDirect("display_link.writing_to"), + targetState.getBlock().getName() + .withStyle(s -> s.withColor(target == null ? 0xF68989 : 0xF2C16D)), + CreateLang.translateDirect("display_link.targeted_location"), + CreateLang.translateDirect("display_link.view_compatible") + .withStyle(ChatFormatting.GRAY) )); addRenderableWidget(targetWidget); @@ -190,19 +190,19 @@ public class DisplayLinkScreen extends AbstractSimiScreen { if (!sources.isEmpty()) { int startIndex = Math.max(sources.indexOf(blockEntity.activeSource), 0); - sourceTypeLabel = new Label(x + 65, y + 30, Lang.IMMUTABLE_EMPTY).withShadow(); + sourceTypeLabel = new Label(x + 65, y + 30, CommonComponents.EMPTY).withShadow(); sourceTypeLabel.text = sources.get(startIndex) - .getName(); + .getName(); if (sources.size() > 1) { List options = sources.stream() - .map(DisplaySource::getName) - .toList(); + .map(DisplaySource::getName) + .toList(); sourceTypeSelector = new SelectionScrollInput(x + 61, y + 26, 135, 16).forOptions(options) - .writingTo(sourceTypeLabel) - .titled(CreateLang.translateDirect("display_link.information_type")) - .calling(this::initGathererSourceSubOptions) - .setState(startIndex); + .writingTo(sourceTypeLabel) + .titled(CreateLang.translateDirect("display_link.information_type")) + .calling(this::initGathererSourceSubOptions) + .setState(startIndex); sourceTypeSelector.onChanged(); addRenderableWidget(sourceTypeSelector); } else @@ -219,8 +219,8 @@ public class DisplayLinkScreen extends AbstractSimiScreen { if (targetLineSelector != null) targetLineSelector - .titled(source instanceof SingleLineDisplaySource ? CreateLang.translateDirect("display_link.display_on") - : CreateLang.translateDirect("display_link.display_on_multiline")); + .titled(source instanceof SingleLineDisplaySource ? CreateLang.translateDirect("display_link.display_on") + : CreateLang.translateDirect("display_link.display_on_multiline")); configWidgets.forEach(s -> { s.forEach(this::removeWidget); @@ -229,9 +229,9 @@ public class DisplayLinkScreen extends AbstractSimiScreen { DisplayLinkContext context = new DisplayLinkContext(minecraft.level, blockEntity); configWidgets.forEachWithContext((s, first) -> source.initConfigurationWidgets(context, - new ModularGuiLineBuilder(font, s, guiLeft + 60, guiTop + (first ? 51 : 72)), first)); + new ModularGuiLineBuilder(font, s, guiLeft + 60, guiTop + (first ? 51 : 72)), first)); configWidgets - .forEach(s -> s.loadValues(blockEntity.getSourceConfig(), this::addRenderableWidget, this::addRenderableOnly)); + .forEach(s -> s.loadValues(blockEntity.getSourceConfig(), this::addRenderableWidget, this::addRenderableOnly)); } @Override @@ -241,12 +241,12 @@ public class DisplayLinkScreen extends AbstractSimiScreen { if (!sources.isEmpty()) { sourceData.putString("Id", - sources.get(sourceTypeSelector == null ? 0 : sourceTypeSelector.getState()).id.toString()); + sources.get(sourceTypeSelector == null ? 0 : sourceTypeSelector.getState()).id.toString()); configWidgets.forEach(s -> s.saveValues(sourceData)); } AllPackets.getChannel().sendToServer(new DisplayLinkConfigurationPacket(blockEntity.getBlockPos(), sourceData, - targetLineSelector == null ? 0 : targetLineSelector.getState())); + targetLineSelector == null ? 0 : targetLineSelector.getState())); } @Override @@ -267,22 +267,22 @@ public class DisplayLinkScreen extends AbstractSimiScreen { ms.pushPose(); ms.translate(0, guiTop + 46, 0); configWidgets.getFirst() - .renderWidgetBG(guiLeft, graphics); + .renderWidgetBG(guiLeft, graphics); ms.translate(0, 21, 0); configWidgets.getSecond() - .renderWidgetBG(guiLeft, graphics); + .renderWidgetBG(guiLeft, graphics); ms.popPose(); ms.pushPose(); TransformStack.of(ms) - .pushPose() - .translate(x + background.getWidth() + 4, y + background.getHeight() + 4, 100) - .scale(40) - .rotateXDegrees(-22) - .rotateYDegrees(63); + .pushPose() + .translate(x + background.getWidth() + 4, y + background.getHeight() + 4, 100) + .scale(40) + .rotateXDegrees(-22) + .rotateYDegrees(63); GuiGameElement.of(blockEntity.getBlockState() - .setValue(DisplayLinkBlock.FACING, Direction.UP)) - .render(graphics); + .setValue(DisplayLinkBlock.FACING, Direction.UP)) + .render(graphics); ms.popPose(); } diff --git a/src/main/java/com/simibubi/create/content/redstone/link/controller/LinkedControllerClientHandler.java b/src/main/java/com/simibubi/create/content/redstone/link/controller/LinkedControllerClientHandler.java index 2dc270f35f..deff75be25 100644 --- a/src/main/java/com/simibubi/create/content/redstone/link/controller/LinkedControllerClientHandler.java +++ b/src/main/java/com/simibubi/create/content/redstone/link/controller/LinkedControllerClientHandler.java @@ -6,8 +6,6 @@ import java.util.HashSet; import java.util.List; import java.util.Vector; -import net.createmod.catnip.lang.Lang; - import org.lwjgl.glfw.GLFW; import com.mojang.blaze3d.platform.InputConstants; @@ -31,6 +29,7 @@ import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.gui.screens.Screen; import net.minecraft.client.player.LocalPlayer; import net.minecraft.core.BlockPos; +import net.minecraft.network.chat.CommonComponents; import net.minecraft.network.chat.Component; import net.minecraft.world.item.ItemStack; import net.minecraft.world.phys.shapes.VoxelShape; @@ -192,7 +191,7 @@ public class LinkedControllerClientHandler { .getShape(mc.level, selectedLocation); if (!shape.isEmpty()) Outliner.getInstance().showAABB("controller", shape.bounds() - .move(selectedLocation)) + .move(selectedLocation)) .colored(0xB73C2D) .lineWidth(1 / 16f); @@ -201,8 +200,8 @@ public class LinkedControllerClientHandler { if (linkBehaviour != null) { AllPackets.getChannel().sendToServer(new LinkedControllerBindPacket(integer, selectedLocation)); CreateLang.translate("linked_controller.key_bound", controls.get(integer) - .getTranslatedKeyMessage() - .getString()) + .getTranslatedKeyMessage() + .getString()) .sendStatus(mc.player); } MODE = Mode.IDLE; @@ -215,7 +214,7 @@ public class LinkedControllerClientHandler { } public static void renderOverlay(ForgeGui gui, GuiGraphics graphics, float partialTicks, int width1, - int height1) { + int height1) { Minecraft mc = Minecraft.getInstance(); if (mc.options.hideGui) return; @@ -225,7 +224,7 @@ public class LinkedControllerClientHandler { PoseStack poseStack = graphics.pose(); poseStack.pushPose(); - Screen tooltipScreen = new Screen(Lang.IMMUTABLE_EMPTY) { + Screen tooltipScreen = new Screen(CommonComponents.EMPTY) { }; tooltipScreen.init(mc, width1, height1); diff --git a/src/main/java/com/simibubi/create/content/schematics/cannon/SchematicannonScreen.java b/src/main/java/com/simibubi/create/content/schematics/cannon/SchematicannonScreen.java index 55b46b19ca..39de007c09 100644 --- a/src/main/java/com/simibubi/create/content/schematics/cannon/SchematicannonScreen.java +++ b/src/main/java/com/simibubi/create/content/schematics/cannon/SchematicannonScreen.java @@ -24,13 +24,12 @@ import com.simibubi.create.foundation.utility.CreateLang; import net.createmod.catnip.gui.element.GuiGameElement; import net.createmod.catnip.lang.FontHelper.Palette; -import net.createmod.catnip.lang.Lang; import net.minecraft.ChatFormatting; import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.gui.components.AbstractWidget; import net.minecraft.client.renderer.Rect2i; +import net.minecraft.network.chat.CommonComponents; import net.minecraft.network.chat.Component; -import net.minecraft.network.chat.MutableComponent; import net.minecraft.world.entity.player.Inventory; import net.minecraft.world.item.ItemStack; @@ -96,17 +95,17 @@ public class SchematicannonScreen extends AbstractSimiContainerScreen { sendOptionUpdate(Option.PLAY, true); }); - playIndicator = new Indicator(x + 75, y + 79, Lang.IMMUTABLE_EMPTY); + playIndicator = new Indicator(x + 75, y + 79, CommonComponents.EMPTY); pauseButton = new IconButton(x + 93, y + 85, AllIcons.I_PAUSE); pauseButton.withCallback(() -> { sendOptionUpdate(Option.PAUSE, true); }); - pauseIndicator = new Indicator(x + 93, y + 79, Lang.IMMUTABLE_EMPTY); + pauseIndicator = new Indicator(x + 93, y + 79, CommonComponents.EMPTY); resetButton = new IconButton(x + 111, y + 85, AllIcons.I_STOP); resetButton.withCallback(() -> { sendOptionUpdate(Option.STOP, true); }); - resetIndicator = new Indicator(x + 111, y + 79, Lang.IMMUTABLE_EMPTY); + resetIndicator = new Indicator(x + 111, y + 79, CommonComponents.EMPTY); resetIndicator.state = State.RED; addRenderableWidgets(playButton, playIndicator, pauseButton, pauseIndicator, resetButton, resetIndicator); @@ -123,7 +122,7 @@ public class SchematicannonScreen extends AbstractSimiContainerScreen { @@ -171,7 +170,7 @@ public class SchematicannonScreen extends AbstractSimiContainerScreenat(x + BG_TOP.getWidth(), y + BG_TOP.getHeight() + BG_BOTTOM.getHeight() - 48, -200) + .GuiRenderBuilder>at(x + BG_TOP.getWidth(), y + BG_TOP.getHeight() + BG_BOTTOM.getHeight() - 48, -200) .scale(5) .render(graphics); @@ -307,7 +306,7 @@ public class SchematicannonScreen extends AbstractSimiContainerScreenat(x + 128, y + 49, 100) + .GuiRenderBuilder>at(x + 128, y + 49, 100) .scale(1) .render(graphics); } @@ -396,8 +395,8 @@ public class SchematicannonScreen extends AbstractSimiContainerScreen rotationOptions = - CreateLang.translatedOptions("schematic.rotation", "none", "cw90", "cw180", "cw270"); + CreateLang.translatedOptions("schematic.rotation", "none", "cw90", "cw180", "cw270"); private final List mirrorOptions = - CreateLang.translatedOptions("schematic.mirror", "none", "leftRight", "frontBack"); + CreateLang.translatedOptions("schematic.mirror", "none", "leftRight", "frontBack"); private final Component rotationLabel = CreateLang.translateDirect("schematic.rotation"); private final Component mirrorLabel = CreateLang.translateDirect("schematic.mirror"); @@ -59,12 +59,12 @@ public class SchematicEditScreen extends AbstractSimiScreen { int x = guiLeft; int y = guiTop + 2; - xInput = new EditBox(font, x + 50, y + 26, 34, 10, Lang.IMMUTABLE_EMPTY); - yInput = new EditBox(font, x + 90, y + 26, 34, 10, Lang.IMMUTABLE_EMPTY); - zInput = new EditBox(font, x + 130, y + 26, 34, 10, Lang.IMMUTABLE_EMPTY); + xInput = new EditBox(font, x + 50, y + 26, 34, 10, CommonComponents.EMPTY); + yInput = new EditBox(font, x + 90, y + 26, 34, 10, CommonComponents.EMPTY); + zInput = new EditBox(font, x + 130, y + 26, 34, 10, CommonComponents.EMPTY); BlockPos anchor = handler.getTransformation() - .getAnchor(); + .getAnchor(); if (handler.isDeployed()) { xInput.setValue("" + anchor.getX()); yInput.setValue("" + anchor.getY()); @@ -76,7 +76,7 @@ public class SchematicEditScreen extends AbstractSimiScreen { zInput.setValue("" + alt.getZ()); } - for (EditBox widget : new EditBox[] { xInput, yInput, zInput }) { + for (EditBox widget : new EditBox[]{xInput, yInput, zInput}) { widget.setMaxLength(6); widget.setBordered(false); widget.setTextColor(0xFFFFFF); @@ -96,14 +96,14 @@ public class SchematicEditScreen extends AbstractSimiScreen { StructurePlaceSettings settings = handler.getTransformation() .toSettings(); - Label labelR = new Label(x + 50, y + 48, Lang.IMMUTABLE_EMPTY).withShadow(); + Label labelR = new Label(x + 50, y + 48, CommonComponents.EMPTY).withShadow(); rotationArea = new SelectionScrollInput(x + 45, y + 43, 118, 18).forOptions(rotationOptions) .titled(rotationLabel.plainCopy()) .setState(settings.getRotation() .ordinal()) .writingTo(labelR); - Label labelM = new Label(x + 50, y + 70, Lang.IMMUTABLE_EMPTY).withShadow(); + Label labelM = new Label(x + 50, y + 70, CommonComponents.EMPTY).withShadow(); mirrorArea = new SelectionScrollInput(x + 45, y + 65, 118, 18).forOptions(mirrorOptions) .titled(mirrorLabel.plainCopy()) .setState(settings.getMirror() @@ -160,9 +160,9 @@ public class SchematicEditScreen extends AbstractSimiScreen { graphics.drawString(font, title, x + (background.getWidth() - 8 - font.width(title)) / 2, y + 4, 0x505050, false); GuiGameElement.of(AllItems.SCHEMATIC.asStack()) - .at(x + background.getWidth() + 6, y + background.getHeight() - 40, -200) - .scale(3) - .render(graphics); + .at(x + background.getWidth() + 6, y + background.getHeight() - 40, -200) + .scale(3) + .render(graphics); } @Override diff --git a/src/main/java/com/simibubi/create/content/schematics/client/SchematicPromptScreen.java b/src/main/java/com/simibubi/create/content/schematics/client/SchematicPromptScreen.java index 96da9f4d15..a15ae33f6b 100644 --- a/src/main/java/com/simibubi/create/content/schematics/client/SchematicPromptScreen.java +++ b/src/main/java/com/simibubi/create/content/schematics/client/SchematicPromptScreen.java @@ -1,7 +1,5 @@ package com.simibubi.create.content.schematics.client; -import net.createmod.catnip.lang.Lang; - import org.lwjgl.glfw.GLFW; import com.simibubi.create.AllItems; @@ -15,6 +13,7 @@ import net.createmod.catnip.gui.AbstractSimiScreen; import net.createmod.catnip.gui.element.GuiGameElement; import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.gui.components.EditBox; +import net.minecraft.network.chat.CommonComponents; import net.minecraft.network.chat.Component; public class SchematicPromptScreen extends AbstractSimiScreen { @@ -43,7 +42,7 @@ public class SchematicPromptScreen extends AbstractSimiScreen { int x = guiLeft; int y = guiTop + 2; - nameField = new EditBox(font, x + 49, y + 26, 131, 10, Lang.IMMUTABLE_EMPTY); + nameField = new EditBox(font, x + 49, y + 26, 131, 10, CommonComponents.EMPTY); nameField.setTextColor(-1); nameField.setTextColorUneditable(-1); nameField.setBordered(false); @@ -84,13 +83,13 @@ public class SchematicPromptScreen extends AbstractSimiScreen { graphics.drawString(font, title, x + (background.getWidth() - 8 - font.width(title)) / 2, y + 4, 0x505050, false); GuiGameElement.of(AllItems.SCHEMATIC.asStack()) - .at(x + 22, y + 24, 0) - .render(graphics); + .at(x + 22, y + 24, 0) + .render(graphics); GuiGameElement.of(AllItems.SCHEMATIC_AND_QUILL.asStack()) - .scale(3) - .at(x + background.getWidth() + 6, y + background.getHeight() - 38, -200) - .render(graphics); + .scale(3) + .at(x + background.getWidth() + 6, y + background.getHeight() - 38, -200) + .render(graphics); } @Override diff --git a/src/main/java/com/simibubi/create/content/schematics/table/SchematicTableScreen.java b/src/main/java/com/simibubi/create/content/schematics/table/SchematicTableScreen.java index 13acb4e08c..3bbf83a61d 100644 --- a/src/main/java/com/simibubi/create/content/schematics/table/SchematicTableScreen.java +++ b/src/main/java/com/simibubi/create/content/schematics/table/SchematicTableScreen.java @@ -21,12 +21,11 @@ import com.simibubi.create.foundation.gui.widget.SelectionScrollInput; import com.simibubi.create.foundation.utility.CreateLang; import net.createmod.catnip.gui.element.GuiGameElement; -import net.createmod.catnip.lang.Lang; import net.minecraft.Util; import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.renderer.Rect2i; +import net.minecraft.network.chat.CommonComponents; import net.minecraft.network.chat.Component; -import net.minecraft.network.chat.MutableComponent; import net.minecraft.util.Mth; import net.minecraft.world.entity.player.Inventory; import net.minecraft.world.item.ItemStack; @@ -57,7 +56,7 @@ public class SchematicTableScreen extends AbstractSimiContainerScreen extraAreas = Collections.emptyList(); public SchematicTableScreen(SchematicTableMenu menu, Inventory playerInventory, - Component title) { + Component title) { super(menu, playerInventory, title); background = AllGuiTextures.SCHEMATIC_TABLE; } @@ -74,8 +73,8 @@ public class SchematicTableScreen extends AbstractSimiContainerScreen behaviours) {} + public void addBehaviours(List behaviours) { + } public int getLineColor(int line) { DyeColor color = colour[line]; return color == null ? 0xFF_D3C6BA : DyeHelper.getDyeColors(color) - .getFirst() | 0xFF_000000; + .getFirst() | 0xFF_000000; } public boolean isLineGlowing(int line) { diff --git a/src/main/java/com/simibubi/create/content/trains/entity/CarriageContraptionEntity.java b/src/main/java/com/simibubi/create/content/trains/entity/CarriageContraptionEntity.java index d5e22134ae..be88cb7c5e 100644 --- a/src/main/java/com/simibubi/create/content/trains/entity/CarriageContraptionEntity.java +++ b/src/main/java/com/simibubi/create/content/trains/entity/CarriageContraptionEntity.java @@ -29,7 +29,6 @@ import com.simibubi.create.foundation.utility.CreateLang; import com.simibubi.create.infrastructure.config.AllConfigs; import net.createmod.catnip.data.Couple; -import net.createmod.catnip.lang.Lang; import net.createmod.catnip.math.VecHelper; import net.createmod.catnip.theme.Color; import net.minecraft.core.BlockPos; @@ -37,6 +36,7 @@ import net.minecraft.core.Direction; import net.minecraft.core.Direction.Axis; import net.minecraft.core.particles.ParticleTypes; import net.minecraft.nbt.CompoundTag; +import net.minecraft.network.chat.CommonComponents; import net.minecraft.network.chat.Component; import net.minecraft.network.chat.MutableComponent; import net.minecraft.network.syncher.EntityDataAccessor; @@ -50,6 +50,7 @@ import net.minecraft.world.entity.player.Player; import net.minecraft.world.level.Level; import net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplate.StructureBlockInfo; import net.minecraft.world.phys.Vec3; + import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.network.PacketDistributor; @@ -90,7 +91,7 @@ public class CarriageContraptionEntity extends OrientedContraptionEntity { firstPositionUpdate = true; arrivalSoundTicks = Integer.MIN_VALUE; derailParticleOffset = VecHelper.offsetRandomly(Vec3.ZERO, world.random, 1.5f) - .multiply(1, .25f, 1); + .multiply(1, .25f, 1); } @Override @@ -157,7 +158,7 @@ public class CarriageContraptionEntity extends OrientedContraptionEntity { } public boolean isLocalCoordWithin(BlockPos localPos, int min, int max) { - if (!(getContraption()instanceof CarriageContraption cc)) + if (!(getContraption() instanceof CarriageContraption cc)) return false; Direction facing = cc.getAssemblyDirection(); Axis axis = facing.getClockWise() @@ -389,7 +390,8 @@ public class CarriageContraptionEntity extends OrientedContraptionEntity { } @Override - protected void handleStallInformation(double x, double y, double z, float angle) {} + protected void handleStallInformation(double x, double y, double z, float angle) { + } Vec3 derailParticleOffset; @@ -591,7 +593,7 @@ public class CarriageContraptionEntity extends OrientedContraptionEntity { boolean spaceDown = heldControls.contains(4); GlobalStation currentStation = carriage.train.getCurrentStation(); if (currentStation != null && spaceDown) { - sendPrompt(player, CreateLang.translateDirect("train.arrived_at", + sendPrompt(player, CreateLang.translateDirect("train.arrived_at", Component.literal(currentStation.name).withStyle(s -> s.withColor(0x704630))), false); return true; } @@ -603,7 +605,7 @@ public class CarriageContraptionEntity extends OrientedContraptionEntity { if (currentStation != null && targetSpeed != 0) { stationMessage = false; - sendPrompt(player, CreateLang.translateDirect("train.departing_from", + sendPrompt(player, CreateLang.translateDirect("train.departing_from", Component.literal(currentStation.name).withStyle(s -> s.withColor(0x704630))), false); } @@ -617,8 +619,8 @@ public class CarriageContraptionEntity extends OrientedContraptionEntity { double f = (nav.distanceToDestination / navDistanceTotal); int progress = (int) (Mth.clamp(1 - ((1 - f) * (1 - f)), 0, 1) * 30); boolean arrived = progress == 0; - MutableComponent whiteComponent = Component.literal(Strings.repeat("|", progress)); - MutableComponent greenComponent = Component.literal(Strings.repeat("|", 30 - progress)); + MutableComponent whiteComponent = Component.literal(Strings.repeat("|", progress)); + MutableComponent greenComponent = Component.literal(Strings.repeat("|", 30 - progress)); int fromColor = 0x00_FFC244; int toColor = 0x00_529915; @@ -691,7 +693,7 @@ public class CarriageContraptionEntity extends OrientedContraptionEntity { private void cleanUpApproachStationMessage(Player player) { if (!stationMessage) return; - player.displayClientMessage(Lang.IMMUTABLE_EMPTY, true); + player.displayClientMessage(CommonComponents.EMPTY, true); stationMessage = false; } diff --git a/src/main/java/com/simibubi/create/content/trains/schedule/ScheduleScreen.java b/src/main/java/com/simibubi/create/content/trains/schedule/ScheduleScreen.java index cb3b8360a5..7c36a93813 100644 --- a/src/main/java/com/simibubi/create/content/trains/schedule/ScheduleScreen.java +++ b/src/main/java/com/simibubi/create/content/trains/schedule/ScheduleScreen.java @@ -39,13 +39,12 @@ import com.simibubi.create.foundation.gui.widget.SelectionScrollInput; import com.simibubi.create.foundation.utility.CreateLang; import dev.engine_room.flywheel.lib.transform.TransformStack; -import net.createmod.catnip.gui.UIRenderHelper; -import net.createmod.catnip.gui.element.GuiGameElement; -import net.createmod.catnip.data.IntAttached; -import net.createmod.catnip.data.Pair; import net.createmod.catnip.animation.LerpedFloat; import net.createmod.catnip.animation.LerpedFloat.Chaser; -import net.createmod.catnip.lang.Lang; +import net.createmod.catnip.data.IntAttached; +import net.createmod.catnip.data.Pair; +import net.createmod.catnip.gui.UIRenderHelper; +import net.createmod.catnip.gui.element.GuiGameElement; import net.minecraft.ChatFormatting; import net.minecraft.client.gui.Font; import net.minecraft.client.gui.GuiGraphics; @@ -53,6 +52,7 @@ import net.minecraft.client.gui.components.EditBox; import net.minecraft.client.gui.components.Renderable; import net.minecraft.client.renderer.Rect2i; import net.minecraft.nbt.CompoundTag; +import net.minecraft.network.chat.CommonComponents; import net.minecraft.network.chat.Component; import net.minecraft.util.FormattedCharSequence; import net.minecraft.util.Mth; @@ -114,7 +114,7 @@ public class ScheduleScreen extends AbstractSimiContainerScreen im confirmButton.withCallback(() -> minecraft.player.closeContainer()); addRenderableWidget(confirmButton); - cyclicIndicator = new Indicator(leftPos + 21, topPos + 196, Lang.IMMUTABLE_EMPTY); + cyclicIndicator = new Indicator(leftPos + 21, topPos + 196, CommonComponents.EMPTY); cyclicIndicator.state = schedule.cyclic ? State.ON : State.OFF; List tip = new ArrayList<>(); @@ -179,7 +179,7 @@ public class ScheduleScreen extends AbstractSimiContainerScreen im resetProgress.visible = false; scrollInput = new SelectionScrollInput(leftPos + 56, topPos + 65, 143, 16); - scrollInputLabel = new Label(leftPos + 59, topPos + 69, Lang.IMMUTABLE_EMPTY).withShadow(); + scrollInputLabel = new Label(leftPos + 59, topPos + 69, CommonComponents.EMPTY).withShadow(); editorConfirm = new IconButton(leftPos + 56 + 168, topPos + 65 + 22, AllIcons.I_CONFIRM); if (allowDeletion) editorDelete = new IconButton(leftPos + 56 - 45, topPos + 65 + 22, AllIcons.I_TRASH); @@ -327,7 +327,8 @@ public class ScheduleScreen extends AbstractSimiContainerScreen im String filter = destination.getFilterForRegex(); if (filter.isBlank()) continue; - Graphs: for (Iterator iterator = viableGraphs.iterator(); iterator.hasNext();) { + Graphs: + for (Iterator iterator = viableGraphs.iterator(); iterator.hasNext(); ) { TrackGraph trackGraph = iterator.next(); for (GlobalStation station : trackGraph.getPoints(EdgePointType.STATION)) { if (station.name.matches(filter)) @@ -486,7 +487,7 @@ public class ScheduleScreen extends AbstractSimiContainerScreen im } public int renderScheduleEntry(GuiGraphics graphics, ScheduleEntry entry, int yOffset, int mouseX, int mouseY, - float partialTicks) { + float partialTicks) { int zLevel = -100; AllGuiTextures light = AllGuiTextures.SCHEDULE_CARD_LIGHT; @@ -538,7 +539,7 @@ public class ScheduleScreen extends AbstractSimiContainerScreen im } public void renderScheduleConditions(GuiGraphics graphics, ScheduleEntry entry, int yOffset, int mouseX, int mouseY, - float partialTicks, int cardHeight, int entryIndex) { + float partialTicks, int cardHeight, int entryIndex) { int cardWidth = CARD_WIDTH; int cardHeader = CARD_HEADER; @@ -608,7 +609,7 @@ public class ScheduleScreen extends AbstractSimiContainerScreen im } protected int renderInput(GuiGraphics graphics, Pair pair, int x, int y, boolean clean, - int minSize) { + int minSize) { ItemStack stack = pair.getFirst(); Component text = pair.getSecond(); boolean hasItem = !stack.isEmpty(); @@ -653,7 +654,7 @@ public class ScheduleScreen extends AbstractSimiContainerScreen im if (editingCondition != null || editingDestination != null) return false; - Component empty = Lang.IMMUTABLE_EMPTY; + Component empty = CommonComponents.EMPTY; int mx = (int) mouseX; int my = (int) mouseY; @@ -984,7 +985,7 @@ public class ScheduleScreen extends AbstractSimiContainerScreen im super.renderForeground(graphics, mouseX, mouseY, partialTicks); GuiGameElement.of(menu.contentHolder).at(leftPos + AllGuiTextures.SCHEDULE.getWidth(), + .GuiRenderBuilder>at(leftPos + AllGuiTextures.SCHEDULE.getWidth(), topPos + AllGuiTextures.SCHEDULE.getHeight() - 56, -200) .scale(3) .render(graphics); @@ -1036,7 +1037,7 @@ public class ScheduleScreen extends AbstractSimiContainerScreen im formattedcharsequence = editingCondition == null ? CreateLang.translateDirect("schedule.instruction.editor") .getVisualOrderText() : CreateLang.translateDirect("schedule.condition.editor") - .getVisualOrderText(); + .getVisualOrderText(); graphics.drawString(font, formattedcharsequence, (float) (center - font.width(formattedcharsequence) / 2), (float) topPos + 44, 0x505050, false); diff --git a/src/main/java/com/simibubi/create/content/trains/station/StationMarker.java b/src/main/java/com/simibubi/create/content/trains/station/StationMarker.java index a15b83363a..2c156e8fff 100644 --- a/src/main/java/com/simibubi/create/content/trains/station/StationMarker.java +++ b/src/main/java/com/simibubi/create/content/trains/station/StationMarker.java @@ -3,8 +3,6 @@ package com.simibubi.create.content.trains.station; import java.util.Objects; import java.util.Optional; -import net.createmod.catnip.lang.Lang; - import org.joml.Matrix4f; import com.mojang.blaze3d.vertex.PoseStack; @@ -22,6 +20,7 @@ import net.minecraft.client.renderer.RenderType; import net.minecraft.core.BlockPos; import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.NbtUtils; +import net.minecraft.network.chat.CommonComponents; import net.minecraft.network.chat.Component; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.level.BlockGetter; @@ -48,7 +47,7 @@ public class StationMarker { BlockPos source = NbtUtils.readBlockPos(tag.getCompound("source")); BlockPos target = NbtUtils.readBlockPos(tag.getCompound("target")); Component name = Component.Serializer.fromJson(tag.getString("name")); - if (name == null) name = Lang.IMMUTABLE_EMPTY; + if (name == null) name = CommonComponents.EMPTY; return new StationMarker(source, target, name); } @@ -136,17 +135,17 @@ public class StationMarker { VertexConsumer buffer = bufferSource.getBuffer(RenderType.text(TEXTURE)); Matrix4f mat = poseStack.last().pose(); float zOffset = -0.001f; - buffer.vertex(mat, -1, -1, zOffset * index).color(255, 255, 255, 255).uv(0.0f , 0.0f ).uv2(packedLight).endVertex(); - buffer.vertex(mat, -1, 1, zOffset * index).color(255, 255, 255, 255).uv(0.0f , 0.0f + 1.0f).uv2(packedLight).endVertex(); - buffer.vertex(mat, 1, 1, zOffset * index).color(255, 255, 255, 255).uv(0.0f + 1.0f, 0.0f + 1.0f).uv2(packedLight).endVertex(); - buffer.vertex(mat, 1, -1, zOffset * index).color(255, 255, 255, 255).uv(0.0f + 1.0f, 0.0f ).uv2(packedLight).endVertex(); + buffer.vertex(mat, -1, -1, zOffset * index).color(255, 255, 255, 255).uv(0.0f, 0.0f).uv2(packedLight).endVertex(); + buffer.vertex(mat, -1, 1, zOffset * index).color(255, 255, 255, 255).uv(0.0f, 0.0f + 1.0f).uv2(packedLight).endVertex(); + buffer.vertex(mat, 1, 1, zOffset * index).color(255, 255, 255, 255).uv(0.0f + 1.0f, 0.0f + 1.0f).uv2(packedLight).endVertex(); + buffer.vertex(mat, 1, -1, zOffset * index).color(255, 255, 255, 255).uv(0.0f + 1.0f, 0.0f).uv2(packedLight).endVertex(); poseStack.popPose(); if (getName() != null) { Font font = Minecraft.getInstance().font; Component component = getName(); - float f6 = (float)font.width(component); + float f6 = (float) font.width(component); // float f7 = Mth.clamp(25.0F / f6, 0.0F, 6.0F / 9.0F); poseStack.pushPose(); // poseStack.translate((double)(0.0F + (float)getX() / 2.0F + 64.0F / 2.0F), (double)(0.0F + (float)getY() / 2.0F + 64.0F + 4.0F), (double)-0.025F); diff --git a/src/main/java/com/simibubi/create/content/trains/station/StationScreen.java b/src/main/java/com/simibubi/create/content/trains/station/StationScreen.java index e0a8bc8a75..af54849d30 100644 --- a/src/main/java/com/simibubi/create/content/trains/station/StationScreen.java +++ b/src/main/java/com/simibubi/create/content/trains/station/StationScreen.java @@ -23,14 +23,14 @@ import com.simibubi.create.foundation.gui.widget.ScrollInput; import com.simibubi.create.foundation.utility.CreateLang; import dev.engine_room.flywheel.lib.model.baked.PartialModel; -import net.createmod.catnip.gui.UIRenderHelper; import net.createmod.catnip.animation.AnimationTickHolder; -import net.createmod.catnip.data.Pair; import net.createmod.catnip.animation.LerpedFloat; -import net.createmod.catnip.lang.Lang; +import net.createmod.catnip.data.Pair; +import net.createmod.catnip.gui.UIRenderHelper; import net.minecraft.ChatFormatting; import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.gui.components.EditBox; +import net.minecraft.network.chat.CommonComponents; import net.minecraft.network.chat.Component; import net.minecraft.network.chat.MutableComponent; import net.minecraft.util.Mth; @@ -120,7 +120,7 @@ public class StationScreen extends AbstractStationScreen { addRenderableWidget(colorTypeScroll); onTextChanged = s -> trainNameBox.setX(nameBoxX(s, trainNameBox)); - trainNameBox = new EditBox(font, x + 23, y + 47, background.getWidth() - 75, 10, Lang.IMMUTABLE_EMPTY); + trainNameBox = new EditBox(font, x + 23, y + 47, background.getWidth() - 75, 10, CommonComponents.EMPTY); trainNameBox.setBordered(false); trainNameBox.setMaxLength(35); trainNameBox.setTextColor(0xC6C6C6); @@ -161,7 +161,7 @@ public class StationScreen extends AbstractStationScreen { updateAssemblyTooltip(blockEntity.edgePoint.isOnCurve() ? "no_assembly_curve" : !blockEntity.edgePoint.isOrthogonal() ? "no_assembly_diagonal" - : trainPresent() && !blockEntity.trainCanDisassemble ? "train_not_aligned" : null); + : trainPresent() && !blockEntity.trainCanDisassemble ? "train_not_aligned" : null); } private void tickTrainDisplay() { @@ -263,7 +263,7 @@ public class StationScreen extends AbstractStationScreen { newTrainButton.setToolTip(CreateLang.translateDirect("station.create_train")); return; } - for (IconButton ib : new IconButton[] { disassembleTrainButton, newTrainButton }) { + for (IconButton ib : new IconButton[]{disassembleTrainButton, newTrainButton}) { List toolTip = ib.getToolTip(); toolTip.clear(); toolTip.add(CreateLang.translateDirect("station." + key) diff --git a/src/main/java/com/simibubi/create/foundation/blockEntity/behaviour/ValueBox.java b/src/main/java/com/simibubi/create/foundation/blockEntity/behaviour/ValueBox.java index 2834c16d9f..f69a909eaa 100644 --- a/src/main/java/com/simibubi/create/foundation/blockEntity/behaviour/ValueBox.java +++ b/src/main/java/com/simibubi/create/foundation/blockEntity/behaviour/ValueBox.java @@ -8,9 +8,8 @@ import com.simibubi.create.foundation.blockEntity.behaviour.ValueBoxTransform.Si import com.simibubi.create.foundation.blockEntity.behaviour.scrollValue.INamedIconOptions; import com.simibubi.create.foundation.gui.AllIcons; -import net.createmod.catnip.lang.Lang; -import net.createmod.catnip.render.SuperRenderTypeBuffer; import net.createmod.catnip.outliner.ChasingAABBOutline; +import net.createmod.catnip.render.SuperRenderTypeBuffer; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.Font; import net.minecraft.client.renderer.LightTexture; @@ -18,6 +17,7 @@ import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.entity.ItemRenderer; import net.minecraft.client.resources.model.BakedModel; import net.minecraft.core.BlockPos; +import net.minecraft.network.chat.CommonComponents; import net.minecraft.network.chat.Component; import net.minecraft.network.chat.MutableComponent; import net.minecraft.world.item.ItemStack; @@ -29,8 +29,8 @@ import net.minecraft.world.phys.Vec3; public class ValueBox extends ChasingAABBOutline { protected Component label; - protected Component sublabel = Lang.IMMUTABLE_EMPTY; - protected Component scrollTooltip = Lang.IMMUTABLE_EMPTY; + protected Component sublabel = CommonComponents.EMPTY; + protected Component scrollTooltip = CommonComponents.EMPTY; protected Vec3 labelOffset = Vec3.ZERO; public int overrideColor = -1; @@ -111,7 +111,8 @@ public class ValueBox extends ChasingAABBOutline { return outline; } - public void renderContents(PoseStack ms, MultiBufferSource buffer) {} + public void renderContents(PoseStack ms, MultiBufferSource buffer) { + } public static class ItemValueBox extends ValueBox { ItemStack stack; @@ -231,13 +232,13 @@ public class ValueBox extends ChasingAABBOutline { } private static void drawString(PoseStack ms, MultiBufferSource buffer, Component text, float x, float y, - int color) { + int color) { Minecraft.getInstance().font.drawInBatch(text, x, y, color, false, ms.last() .pose(), buffer, Font.DisplayMode.NORMAL, 0, LightTexture.FULL_BRIGHT); } private static void drawString8x(PoseStack ms, MultiBufferSource buffer, Component text, float x, float y, - int color) { + int color) { Minecraft.getInstance().font.drawInBatch8xOutline(text.getVisualOrderText(), x, y, color, 0xff333333, ms.last() .pose(), buffer, LightTexture.FULL_BRIGHT); } diff --git a/src/main/java/com/simibubi/create/foundation/blockEntity/behaviour/edgeInteraction/EdgeInteractionRenderer.java b/src/main/java/com/simibubi/create/foundation/blockEntity/behaviour/edgeInteraction/EdgeInteractionRenderer.java index 26b7c6ae72..a4872812eb 100644 --- a/src/main/java/com/simibubi/create/foundation/blockEntity/behaviour/edgeInteraction/EdgeInteractionRenderer.java +++ b/src/main/java/com/simibubi/create/foundation/blockEntity/behaviour/edgeInteraction/EdgeInteractionRenderer.java @@ -11,13 +11,13 @@ import com.simibubi.create.foundation.blockEntity.behaviour.ValueBox; import com.simibubi.create.foundation.blockEntity.behaviour.ValueBoxTransform; import com.simibubi.create.foundation.utility.CreateLang; -import net.createmod.catnip.lang.Lang; import net.createmod.catnip.math.VecHelper; import net.createmod.catnip.outliner.Outliner; import net.minecraft.client.Minecraft; import net.minecraft.client.multiplayer.ClientLevel; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; +import net.minecraft.network.chat.CommonComponents; import net.minecraft.network.chat.MutableComponent; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; @@ -77,7 +77,7 @@ public class EdgeInteractionRenderer { .scale(.469)) .add(VecHelper.CENTER_OF_ORIGIN); - ValueBox box = new ValueBox(Lang.IMMUTABLE_EMPTY, bb, pos).passive(!hit) + ValueBox box = new ValueBox(CommonComponents.EMPTY, bb, pos).passive(!hit) .transform(new EdgeValueBoxTransform(offset)) .wideOutline(); Outliner.getInstance().showOutline("edge", box) diff --git a/src/main/java/com/simibubi/create/foundation/gui/ModularGuiLineBuilder.java b/src/main/java/com/simibubi/create/foundation/gui/ModularGuiLineBuilder.java index 845c1887f8..f36f1ecf7d 100644 --- a/src/main/java/com/simibubi/create/foundation/gui/ModularGuiLineBuilder.java +++ b/src/main/java/com/simibubi/create/foundation/gui/ModularGuiLineBuilder.java @@ -9,9 +9,9 @@ import com.simibubi.create.foundation.gui.widget.TooltipArea; import net.createmod.catnip.data.Couple; import net.createmod.catnip.data.Pair; -import net.createmod.catnip.lang.Lang; import net.minecraft.client.gui.Font; import net.minecraft.client.gui.components.EditBox; +import net.minecraft.network.chat.CommonComponents; public class ModularGuiLineBuilder { @@ -28,14 +28,14 @@ public class ModularGuiLineBuilder { } public ModularGuiLineBuilder addScrollInput(int x, int width, BiConsumer inputTransform, - String dataKey) { + String dataKey) { ScrollInput input = new ScrollInput(x + this.x, y - 4, width, 18); addScrollInput(input, inputTransform, dataKey); return this; } public ModularGuiLineBuilder addSelectionScrollInput(int x, int width, - BiConsumer inputTransform, String dataKey) { + BiConsumer inputTransform, String dataKey) { SelectionScrollInput input = new SelectionScrollInput(x + this.x, y - 4, width, 18); addScrollInput(input, inputTransform, dataKey); return this; @@ -52,7 +52,7 @@ public class ModularGuiLineBuilder { } private void addScrollInput(T input, BiConsumer inputTransform, String dataKey) { - Label label = new Label(input.getX() + 5, y, Lang.IMMUTABLE_EMPTY); + Label label = new Label(input.getX() + 5, y, CommonComponents.EMPTY); label.withShadow(); inputTransform.accept(input, label); input.writingTo(label); @@ -61,7 +61,7 @@ public class ModularGuiLineBuilder { } public ModularGuiLineBuilder addIntegerTextInput(int x, int width, BiConsumer inputTransform, - String dataKey) { + String dataKey) { return addTextInput(x, width, inputTransform.andThen((editBox, $) -> editBox.setFilter(s -> { if (s.isEmpty()) return true; @@ -75,8 +75,8 @@ public class ModularGuiLineBuilder { } public ModularGuiLineBuilder addTextInput(int x, int width, BiConsumer inputTransform, - String dataKey) { - EditBox input = new EditBox(font, x + this.x + 5, y, width - 9, 8, Lang.IMMUTABLE_EMPTY); + String dataKey) { + EditBox input = new EditBox(font, x + this.x + 5, y, width - 9, 8, CommonComponents.EMPTY); input.setBordered(false); input.setTextColor(0xffffff); input.setFocused(false); diff --git a/src/main/java/com/simibubi/create/foundation/item/ItemDescription.java b/src/main/java/com/simibubi/create/foundation/item/ItemDescription.java index 95e7ba4459..6f6fca4eac 100644 --- a/src/main/java/com/simibubi/create/foundation/item/ItemDescription.java +++ b/src/main/java/com/simibubi/create/foundation/item/ItemDescription.java @@ -11,8 +11,6 @@ import java.util.List; import java.util.Map; import java.util.function.Supplier; -import net.createmod.catnip.lang.Lang; - import org.apache.commons.lang3.tuple.Pair; import org.jetbrains.annotations.Nullable; @@ -23,13 +21,16 @@ import net.createmod.catnip.lang.FontHelper.Palette; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.screens.Screen; import net.minecraft.client.resources.language.I18n; +import net.minecraft.network.chat.CommonComponents; import net.minecraft.network.chat.Component; import net.minecraft.network.chat.MutableComponent; import net.minecraft.world.item.Item; import net.minecraft.world.level.ItemLike; + import net.minecraftforge.event.entity.player.ItemTooltipEvent; -public record ItemDescription(ImmutableList lines, ImmutableList linesOnShift, ImmutableList linesOnCtrl) { +public record ItemDescription(ImmutableList lines, ImmutableList linesOnShift, + ImmutableList linesOnCtrl) { private static final Map> CUSTOM_TOOLTIP_KEYS = new IdentityHashMap<>(); @Nullable @@ -144,7 +145,7 @@ public record ItemDescription(ImmutableList lines, ImmutableList behaviourPair : behaviours) { @@ -183,7 +184,7 @@ public record ItemDescription(ImmutableList lines, ImmutableList lines, ImmutableList lines, ImmutableList kineticStats = getKineticStats(block, context.getEntity()); if (!kineticStats.isEmpty()) { List tooltip = context.getToolTip(); - tooltip.add(Lang.IMMUTABLE_EMPTY); + tooltip.add(CommonComponents.EMPTY); tooltip.addAll(kineticStats); } } diff --git a/src/main/java/com/simibubi/create/infrastructure/gui/CreateMainMenuScreen.java b/src/main/java/com/simibubi/create/infrastructure/gui/CreateMainMenuScreen.java index 5971153592..db65adf997 100644 --- a/src/main/java/com/simibubi/create/infrastructure/gui/CreateMainMenuScreen.java +++ b/src/main/java/com/simibubi/create/infrastructure/gui/CreateMainMenuScreen.java @@ -11,14 +11,13 @@ import com.simibubi.create.foundation.utility.CreateLang; import dev.engine_room.flywheel.lib.transform.TransformStack; import net.createmod.catnip.config.ui.BaseConfigScreen; +import net.createmod.catnip.data.Iterate; import net.createmod.catnip.gui.AbstractSimiScreen; import net.createmod.catnip.gui.ScreenOpener; import net.createmod.catnip.gui.element.BoxElement; import net.createmod.catnip.gui.element.GuiGameElement; import net.createmod.catnip.lang.FontHelper; import net.createmod.catnip.lang.FontHelper.Palette; -import net.createmod.catnip.data.Iterate; -import net.createmod.catnip.lang.Lang; import net.createmod.catnip.theme.Color; import net.createmod.ponder.foundation.ui.PonderTagIndexScreen; import net.minecraft.ChatFormatting; @@ -31,8 +30,8 @@ import net.minecraft.client.gui.screens.Screen; import net.minecraft.client.gui.screens.TitleScreen; import net.minecraft.client.renderer.CubeMap; import net.minecraft.client.renderer.PanoramaRenderer; +import net.minecraft.network.chat.CommonComponents; import net.minecraft.network.chat.Component; -import net.minecraft.network.chat.MutableComponent; import net.minecraft.resources.ResourceLocation; import net.minecraft.util.Mth; @@ -46,17 +45,17 @@ public class CreateMainMenuScreen extends AbstractSimiScreen { private static final Component CURSEFORGE_TOOLTIP; - static { - CURSEFORGE_TOOLTIP = Component.literal("CurseForge").withStyle(s -> s.withColor(0xFC785C).withBold(true)); - } + static { + CURSEFORGE_TOOLTIP = Component.literal("CurseForge").withStyle(s -> s.withColor(0xFC785C).withBold(true)); + } - private static final Component MODRINTH_TOOLTIP; + private static final Component MODRINTH_TOOLTIP; - static { - MODRINTH_TOOLTIP = Component.literal("Modrinth").withStyle(s -> s.withColor(0x3FD32B).withBold(true)); - } + static { + MODRINTH_TOOLTIP = Component.literal("Modrinth").withStyle(s -> s.withColor(0x3FD32B).withBold(true)); + } - public static final String CURSEFORGE_LINK = "https://www.curseforge.com/minecraft/mc-mods/create"; + public static final String CURSEFORGE_LINK = "https://www.curseforge.com/minecraft/mc-mods/create"; public static final String MODRINTH_LINK = "https://modrinth.com/mod/create"; public static final String ISSUE_TRACKER_LINK = "https://github.com/Creators-of-Create/Create/issues"; public static final String SUPPORT_LINK = "https://github.com/Creators-of-Create/Create/wiki/Supporting-the-Project"; @@ -122,7 +121,7 @@ public class CreateMainMenuScreen extends AbstractSimiScreen { ms.popPose(); } - RenderSystem.enableBlend(); + RenderSystem.enableBlend(); ms.pushPose(); ms.translate(width / 2 - 32, 32, -10); @@ -139,9 +138,9 @@ public class CreateMainMenuScreen extends AbstractSimiScreen { ms.pushPose(); ms.translate(0, 0, 200); - graphics.drawCenteredString(font, Component.literal(Create.NAME).withStyle(ChatFormatting.BOLD) - .append( - Component.literal(" v" + CreateBuildInfo.VERSION).withStyle(ChatFormatting.BOLD, ChatFormatting.WHITE)), + graphics.drawCenteredString(font, Component.literal(Create.NAME).withStyle(ChatFormatting.BOLD) + .append( + Component.literal(" v" + CreateBuildInfo.VERSION).withStyle(ChatFormatting.BOLD, ChatFormatting.WHITE)), width / 2, 89, 0xFF_E4BB67); ms.popPose(); @@ -232,7 +231,7 @@ public class CreateMainMenuScreen extends AbstractSimiScreen { protected final float scale; public PlatformIconButton(int pX, int pY, int pWidth, int pHeight, AllGuiTextures icon, float scale, OnPress pOnPress, Tooltip tooltip) { - super(pX, pY, pWidth, pHeight, Lang.IMMUTABLE_EMPTY, pOnPress, DEFAULT_NARRATION); + super(pX, pY, pWidth, pHeight, CommonComponents.EMPTY, pOnPress, DEFAULT_NARRATION); this.icon = icon; this.scale = scale; setTooltip(tooltip); diff --git a/src/main/java/com/simibubi/create/infrastructure/gui/OpenCreateMenuButton.java b/src/main/java/com/simibubi/create/infrastructure/gui/OpenCreateMenuButton.java index 423a6b8baa..4c9b2ec587 100644 --- a/src/main/java/com/simibubi/create/infrastructure/gui/OpenCreateMenuButton.java +++ b/src/main/java/com/simibubi/create/infrastructure/gui/OpenCreateMenuButton.java @@ -4,8 +4,6 @@ import java.util.Arrays; import java.util.List; import java.util.stream.Collectors; -import net.createmod.catnip.lang.Lang; - import org.apache.commons.lang3.mutable.MutableObject; import com.simibubi.create.AllItems; @@ -22,7 +20,9 @@ import net.minecraft.client.gui.screens.PauseScreen; import net.minecraft.client.gui.screens.Screen; import net.minecraft.client.gui.screens.TitleScreen; import net.minecraft.client.resources.language.I18n; +import net.minecraft.network.chat.CommonComponents; import net.minecraft.world.item.ItemStack; + import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.client.event.ScreenEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; @@ -33,7 +33,7 @@ public class OpenCreateMenuButton extends Button { public static final ItemStack ICON = AllItems.GOGGLES.asStack(); public OpenCreateMenuButton(int x, int y) { - super(x, y, 20, 20, Lang.IMMUTABLE_EMPTY, OpenCreateMenuButton::click, DEFAULT_NARRATION); + super(x, y, 20, 20, CommonComponents.EMPTY, OpenCreateMenuButton::click, DEFAULT_NARRATION); } @Override diff --git a/src/main/java/com/simibubi/create/infrastructure/ponder/scenes/DisplayScenes.java b/src/main/java/com/simibubi/create/infrastructure/ponder/scenes/DisplayScenes.java index 3c4cea1069..9d0f5cea25 100644 --- a/src/main/java/com/simibubi/create/infrastructure/ponder/scenes/DisplayScenes.java +++ b/src/main/java/com/simibubi/create/infrastructure/ponder/scenes/DisplayScenes.java @@ -7,7 +7,6 @@ import com.simibubi.create.content.equipment.clipboard.ClipboardOverrides.Clipbo import com.simibubi.create.foundation.ponder.CreateSceneBuilder; import com.simibubi.create.foundation.utility.CreateLang; -import net.createmod.catnip.lang.Lang; import net.createmod.catnip.math.Pointing; import net.createmod.ponder.api.PonderPalette; import net.createmod.ponder.api.element.ElementLink; @@ -17,8 +16,8 @@ import net.createmod.ponder.api.scene.SceneBuildingUtil; import net.createmod.ponder.api.scene.Selection; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; +import net.minecraft.network.chat.CommonComponents; import net.minecraft.network.chat.Component; -import net.minecraft.network.chat.MutableComponent; import net.minecraft.world.item.DyeColor; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; @@ -75,7 +74,7 @@ public class DisplayScenes { Vec3 target = util.vector().of(3.5, 2.75, 3.25); scene.overlay().showControls(target, Pointing.RIGHT, 60).withItem(AllBlocks.DISPLAY_LINK.asStack()) - .rightClick(); + .rightClick(); scene.idle(6); scene.overlay().chaseBoundingBoxOutline(PonderPalette.OUTPUT, link, new AABB(board).expandTowards(-2, -1, 0) .deflate(0, 0, 3 / 16f), 60); @@ -139,7 +138,7 @@ public class DisplayScenes { scene.world().hideSection(depot, Direction.SOUTH); scene.idle(5); - scene.world().setDisplayBoardText(board, 1, Lang.IMMUTABLE_EMPTY); + scene.world().setDisplayBoardText(board, 1, CommonComponents.EMPTY); scene.world().flashDisplayLink(linkPos); scene.idle(5); ElementLink dirtElement = scene.world().showIndependentSection(dirt, Direction.SOUTH); @@ -159,8 +158,8 @@ public class DisplayScenes { ElementLink stressElement = scene.world().showIndependentSection(stresso, Direction.SOUTH); scene.world().moveSection(stressElement, util.vector().of(0, -2, 0), 0); scene.idle(10); - scene.world().setDisplayBoardText(board, 1, - Component.literal(1024 + " ").append(CreateLang.translateDirect("generic.unit.stress"))); + scene.world().setDisplayBoardText(board, 1, + Component.literal(1024 + " ").append(CreateLang.translateDirect("generic.unit.stress"))); scene.world().flashDisplayLink(linkPos); scene.idle(40); scene.world().hideIndependentSection(stressElement, Direction.SOUTH); @@ -169,9 +168,9 @@ public class DisplayScenes { ElementLink chestElement = scene.world().showIndependentSection(content, Direction.SOUTH); scene.world().moveSection(chestElement, util.vector().of(0, -3, 0), 0); scene.idle(10); - scene.world().setDisplayBoardText(board, 1, - Component.literal(418 + " ").append(new ItemStack(Items.DEEPSLATE).getHoverName())); - scene.world().setDisplayBoardText(board, 2, Component.literal(14 + " ").append(AllBlocks.COGWHEEL.asStack() + scene.world().setDisplayBoardText(board, 1, + Component.literal(418 + " ").append(new ItemStack(Items.DEEPSLATE).getHoverName())); + scene.world().setDisplayBoardText(board, 2, Component.literal(14 + " ").append(AllBlocks.COGWHEEL.asStack() .getHoverName())); scene.world().flashDisplayLink(linkPos); scene.idle(40); @@ -188,9 +187,9 @@ public class DisplayScenes { ElementLink cuckooElement = scene.world().showIndependentSection(cuckoo, Direction.SOUTH); scene.world().moveSection(cuckooElement, util.vector().of(0, -1, 0), 0); scene.idle(10); - scene.world().setDisplayBoardText(board, 1, - Component.literal("6:00 ").append(CreateLang.translateDirect("generic.daytime.pm"))); - scene.world().setDisplayBoardText(board, 2, Lang.IMMUTABLE_EMPTY); + scene.world().setDisplayBoardText(board, 1, + Component.literal("6:00 ").append(CreateLang.translateDirect("generic.daytime.pm"))); + scene.world().setDisplayBoardText(board, 2, CommonComponents.EMPTY); scene.world().flashDisplayLink(linkPos); scene.idle(90); @@ -289,7 +288,7 @@ public class DisplayScenes { scene.overlay().showControls(target, Pointing.RIGHT, 40).withItem(clipboard) .rightClick(); scene.idle(6); - scene.world().setDisplayBoardText(board, 0, Component.literal("Create")); + scene.world().setDisplayBoardText(board, 0, Component.literal("Create")); scene.idle(25); scene.overlay().showText(50) @@ -338,7 +337,7 @@ public class DisplayScenes { scene.idle(50); scene.overlay().showControls(target, Pointing.RIGHT, 40).withItem(new ItemStack(Items.PINK_DYE)) - .rightClick(); + .rightClick(); scene.idle(6); scene.world().dyeDisplayBoard(board, 0, DyeColor.PINK); scene.idle(25); @@ -351,14 +350,14 @@ public class DisplayScenes { scene.idle(25); scene.overlay().showControls(target.add(0, -.5f, 0), Pointing.RIGHT, 40).withItem(new ItemStack(Items.LIME_DYE)) - .rightClick(); + .rightClick(); scene.idle(6); scene.world().dyeDisplayBoard(board, 1, DyeColor.LIME); scene.idle(55); scene.overlay().showControls(target, Pointing.RIGHT, 40).rightClick(); scene.idle(6); - scene.world().setDisplayBoardText(board, 0, Lang.IMMUTABLE_EMPTY); + scene.world().setDisplayBoardText(board, 0, CommonComponents.EMPTY); scene.idle(25); scene.overlay().showText(70) @@ -451,7 +450,7 @@ public class DisplayScenes { scene.world().moveSection(redstoneBlock, util.vector().of(-1, 0, 1), 0); scene.idle(10); scene.world().flashDisplayLink(linkPos); - scene.world().setDisplayBoardText(board, 1, Lang.IMMUTABLE_EMPTY); + scene.world().setDisplayBoardText(board, 1, CommonComponents.EMPTY); scene.idle(25); scene.overlay().showOutlineWithText(depot, 80) From 242871bdaae65e2b37f85062eb1ba89639a8aded Mon Sep 17 00:00:00 2001 From: IThundxr Date: Tue, 28 Jan 2025 15:21:22 -0500 Subject: [PATCH 2/2] Spaced out --- .../potatoCannon/PotatoCannonItem.java | 2 +- .../content/logistics/filter/FilterItem.java | 19 ++++++------- .../displayLink/source/DisplaySource.java | 27 +++++++++++++------ .../trains/schedule/ScheduleRuntime.java | 8 +++--- 4 files changed, 35 insertions(+), 21 deletions(-) diff --git a/src/main/java/com/simibubi/create/content/equipment/potatoCannon/PotatoCannonItem.java b/src/main/java/com/simibubi/create/content/equipment/potatoCannon/PotatoCannonItem.java index fdd5e3bf47..23bfe5a864 100644 --- a/src/main/java/com/simibubi/create/content/equipment/potatoCannon/PotatoCannonItem.java +++ b/src/main/java/com/simibubi/create/content/equipment/potatoCannon/PotatoCannonItem.java @@ -231,7 +231,7 @@ public class PotatoCannonItem extends ProjectileWeaponItem implements CustomArmP .withStyle(ChatFormatting.GRAY)); PotatoCannonProjectileType type = PotatoProjectileTypeManager.getTypeForStack(ammo) .get(); - MutableComponent spacing = Component.literal(" "); + MutableComponent spacing = CommonComponents.space(); ChatFormatting green = ChatFormatting.GREEN; ChatFormatting darkGreen = ChatFormatting.DARK_GREEN; diff --git a/src/main/java/com/simibubi/create/content/logistics/filter/FilterItem.java b/src/main/java/com/simibubi/create/content/logistics/filter/FilterItem.java index 77e66a94d9..4eaf0b9b70 100644 --- a/src/main/java/com/simibubi/create/content/logistics/filter/FilterItem.java +++ b/src/main/java/com/simibubi/create/content/logistics/filter/FilterItem.java @@ -7,7 +7,6 @@ import java.util.Objects; import javax.annotation.Nonnull; -import net.minecraft.network.chat.MutableComponent; import org.jetbrains.annotations.NotNull; import com.simibubi.create.AllItems; @@ -22,6 +21,7 @@ import net.minecraft.ChatFormatting; import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.ListTag; import net.minecraft.nbt.Tag; +import net.minecraft.network.chat.CommonComponents; import net.minecraft.network.chat.Component; import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.InteractionHand; @@ -36,6 +36,7 @@ import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.TooltipFlag; import net.minecraft.world.item.context.UseOnContext; import net.minecraft.world.level.Level; + import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.items.ItemHandlerHelper; @@ -83,7 +84,7 @@ public class FilterItem extends Item implements MenuProvider { List makeSummary = makeSummary(stack); if (makeSummary.isEmpty()) return; - tooltip.add(Component.literal(" ")); + tooltip.add(CommonComponents.SPACE); tooltip.addAll(makeSummary); } @@ -102,7 +103,7 @@ public class FilterItem extends Item implements MenuProvider { int count = 0; for (int i = 0; i < filterItems.getSlots(); i++) { if (count > 3) { - list.add(Component.literal("- ...") + list.add(Component.literal("- ...") .withStyle(ChatFormatting.DARK_GRAY)); break; } @@ -110,7 +111,7 @@ public class FilterItem extends Item implements MenuProvider { ItemStack filterStack = filterItems.getStackInSlot(i); if (filterStack.isEmpty()) continue; - list.add(Component.literal("- ") + list.add(Component.literal("- ") .append(filterStack.getHoverName()) .withStyle(ChatFormatting.GRAY)); count++; @@ -126,8 +127,8 @@ public class FilterItem extends Item implements MenuProvider { list.add((whitelistMode == WhitelistMode.WHITELIST_CONJ ? CreateLang.translateDirect("gui.attribute_filter.allow_list_conjunctive") : whitelistMode == WhitelistMode.WHITELIST_DISJ - ? CreateLang.translateDirect("gui.attribute_filter.allow_list_disjunctive") - : CreateLang.translateDirect("gui.attribute_filter.deny_list")).withStyle(ChatFormatting.GOLD)); + ? CreateLang.translateDirect("gui.attribute_filter.allow_list_disjunctive") + : CreateLang.translateDirect("gui.attribute_filter.deny_list")).withStyle(ChatFormatting.GOLD)); int count = 0; ListTag attributes = filter.getOrCreateTag() @@ -139,11 +140,11 @@ public class FilterItem extends Item implements MenuProvider { continue; boolean inverted = compound.getBoolean("Inverted"); if (count > 3) { - list.add(Component.literal("- ...") + list.add(Component.literal("- ...") .withStyle(ChatFormatting.DARK_GRAY)); break; } - list.add(Component.literal("- ") + list.add(Component.literal("- ") .append(attribute.format(inverted))); count++; } @@ -235,7 +236,7 @@ public class FilterItem extends Item implements MenuProvider { if (key.equals("Fragment")) continue; if (!Objects.equals(a.getTag() - .get(key), + .get(key), b.getTag() .get(key))) return false; diff --git a/src/main/java/com/simibubi/create/content/redstone/displayLink/source/DisplaySource.java b/src/main/java/com/simibubi/create/content/redstone/displayLink/source/DisplaySource.java index 5686ab559d..e2eb23bff1 100644 --- a/src/main/java/com/simibubi/create/content/redstone/displayLink/source/DisplaySource.java +++ b/src/main/java/com/simibubi/create/content/redstone/displayLink/source/DisplaySource.java @@ -14,19 +14,21 @@ import com.simibubi.create.content.trains.display.FlapDisplayLayout; import com.simibubi.create.foundation.gui.ModularGuiLineBuilder; import net.createmod.catnip.nbt.NBTProcessors; +import net.minecraft.network.chat.CommonComponents; import net.minecraft.network.chat.Component; import net.minecraft.network.chat.MutableComponent; + import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; public abstract class DisplaySource extends DisplayBehaviour { public static final List EMPTY = ImmutableList.of(Component.empty()); - public static final MutableComponent EMPTY_LINE = Component.empty(); - public static final MutableComponent WHITESPACE; + public static final MutableComponent EMPTY_LINE = Component.empty(); + public static final MutableComponent WHITESPACE; static { - WHITESPACE = Component.literal(" "); + WHITESPACE = CommonComponents.space(); } public abstract List provideText(DisplayLinkContext context, DisplayTargetStats stats); @@ -51,13 +53,21 @@ public abstract class DisplaySource extends DisplayBehaviour { activeTarget.acceptText(line, text, context); } - public void onSignalReset(DisplayLinkContext context) {}; + public void onSignalReset(DisplayLinkContext context) { + } - public void populateData(DisplayLinkContext context) {}; + ; + + public void populateData(DisplayLinkContext context) { + } + + ; public int getPassiveRefreshTicks() { return 100; - }; + } + + ; public boolean shouldPassiveReset() { return true; @@ -76,7 +86,7 @@ public abstract class DisplaySource extends DisplayBehaviour { } public void loadFlapDisplayLayout(DisplayLinkContext context, FlapDisplayBlockEntity flapDisplay, - FlapDisplayLayout layout) { + FlapDisplayLayout layout) { if (!layout.isLayout("Default")) layout.loadDefault(flapDisplay.getMaxCharCount()); } @@ -89,6 +99,7 @@ public abstract class DisplaySource extends DisplayBehaviour { @OnlyIn(Dist.CLIENT) public void initConfigurationWidgets(DisplayLinkContext context, ModularGuiLineBuilder builder, - boolean isFirstLine) {} + boolean isFirstLine) { + } } diff --git a/src/main/java/com/simibubi/create/content/trains/schedule/ScheduleRuntime.java b/src/main/java/com/simibubi/create/content/trains/schedule/ScheduleRuntime.java index 7e3155118d..e9c2050e3b 100644 --- a/src/main/java/com/simibubi/create/content/trains/schedule/ScheduleRuntime.java +++ b/src/main/java/com/simibubi/create/content/trains/schedule/ScheduleRuntime.java @@ -20,6 +20,7 @@ import com.simibubi.create.content.trains.station.GlobalStation; import net.createmod.catnip.nbt.NBTHelper; import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.Tag; +import net.minecraft.network.chat.CommonComponents; import net.minecraft.network.chat.Component; import net.minecraft.network.chat.MutableComponent; import net.minecraft.util.Mth; @@ -286,7 +287,7 @@ public class ScheduleRuntime { } private int predictForEntry(int index, String currentTitle, int accumulatedTime, - Collection predictions) { + Collection predictions) { ScheduleEntry entry = schedule.entries.get(index); if (!(entry.instruction instanceof DestinationInstruction filter)) return accumulatedTime; @@ -325,7 +326,8 @@ public class ScheduleRuntime { } ScheduleEntry scheduleEntry = schedule.entries.get(index); - Columns: for (List list : scheduleEntry.conditions) { + Columns: + for (List list : scheduleEntry.conditions) { int total = 0; for (ScheduleWaitCondition condition : list) { if (!(condition instanceof ScheduledDelay wait)) @@ -345,7 +347,7 @@ public class ScheduleRuntime { int size = schedule.entries.size(); if (index >= size) { if (!schedule.cyclic) { - return new TrainDeparturePrediction(train, time, Component.literal(" "), destination); + return new TrainDeparturePrediction(train, time, CommonComponents.space(), destination); } index %= size; }