Skip to content

Commit 245ddd8

Browse files
committed
fix lang stuff
not entirely sure if this is the right was to do it or if we should use the lower level lang class from catnip instead
1 parent f657c67 commit 245ddd8

19 files changed

Lines changed: 41 additions & 45 deletions

File tree

fabric/src/main/java/rbasamoyai/createbigcannons/multiloader/fabric/IndexPlatformImpl.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import com.simibubi.create.content.fluids.FluidFX;
88
import com.simibubi.create.foundation.fluid.FluidIngredient;
99
import com.simibubi.create.foundation.utility.CreateLang;
10-
import com.simibubi.create.foundation.utility.LangBuilder;
10+
import net.createmod.catnip.lang.LangBuilder;
1111
import com.simibubi.create.infrastructure.config.AllConfigs;
1212
import com.tterrag.registrate.AbstractRegistrate;
1313
import com.tterrag.registrate.builders.BuilderCallback;
@@ -171,7 +171,7 @@ public static void addFluidShellComponents(Fluid fluid, long amount, List<Compon
171171
String amountStr = FluidTextUtil.getUnicodeMillibuckets(amount, unit, simplify);
172172
String capacityStr = FluidTextUtil.getUnicodeMillibuckets(capacity, unit, simplify);
173173
Lang.text(" ")
174-
.add(CreateLang. ()
174+
.add(CreateLang.builder()
175175
.add(Lang.text(amountStr).add(mb).style(ChatFormatting.GOLD))
176176
.text(ChatFormatting.GRAY, " / ")
177177
.add(Lang.text(capacityStr).add(mb).style(ChatFormatting.DARK_GRAY)))

forge/src/main/java/rbasamoyai/createbigcannons/multiloader/forge/IndexPlatformImpl.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import com.simibubi.create.content.fluids.FluidFX;
88
import com.simibubi.create.foundation.fluid.FluidIngredient;
99
import com.simibubi.create.foundation.utility.CreateLang;
10-
import com.simibubi.create.foundation.utility.LangBuilder;
10+
import net.createmod.catnip.lang.LangBuilder;
1111
import com.tterrag.registrate.AbstractRegistrate;
1212
import com.tterrag.registrate.builders.BuilderCallback;
1313
import com.tterrag.registrate.util.nullness.NonNullFunction;
@@ -152,7 +152,7 @@ public static void addFluidShellComponents(Fluid fluid, long amount, List<Compon
152152
.addTo(tooltip);
153153

154154
Lang.text(" ")
155-
.add(CreateLang. ()
155+
.add(CreateLang.builder()
156156
.add(Lang.number(amount).add(mb).style(ChatFormatting.GOLD))
157157
.text(ChatFormatting.GRAY, " / ")
158158
.add(Lang.number(capacity).add(mb).style(ChatFormatting.DARK_GRAY)))

src/main/java/rbasamoyai/createbigcannons/base/goggles/IDisplayEntityAssemblyExceptions.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,12 @@ default boolean addExceptionToTooltip(List<Component> tooltip) {
1919

2020
if (!tooltip.isEmpty()) tooltip.add(Component.empty());
2121

22-
CreateLang.
23-
().add(Lang.translateDirect("gui.assembly.exception").withStyle(ChatFormatting.GOLD)).forGoggles(tooltip);
22+
CreateLang.builder().add(Lang.translateDirect("gui.assembly.exception").withStyle(ChatFormatting.GOLD)).forGoggles(tooltip);
2423

2524
String text = e.component.getString();
2625
Arrays.stream(text.split("\n"))
2726
.forEach(l -> TooltipHelper.cutStringTextComponent(l, TooltipHelper.Palette.GRAY_AND_WHITE)
28-
.forEach(c -> CreateLang. ().add(c.copy()).forGoggles(tooltip)));
27+
.forEach(c -> CreateLang.builder().add(c.copy()).forGoggles(tooltip)));
2928

3029
return true;
3130
}

src/main/java/rbasamoyai/createbigcannons/cannon_control/cannon_mount/ExtendsCannonMount.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,23 +46,23 @@ static void addCannonInfoToTooltip(List<Component> tooltip, @Nullable PitchOrien
4646
yaw = Mth.positiveModulo(mountedContraption.yaw, 360);
4747
}
4848
String format = "%." + precision + "f\u00ba";
49-
CreateLang. ().add(cannonYawComponent.copy().withStyle(ChatFormatting.GRAY)
49+
CreateLang.builder().add(cannonYawComponent.copy().withStyle(ChatFormatting.GRAY)
5050
.append(Component.literal(String.format(format, yaw)).withStyle(ChatFormatting.WHITE)))
5151
.forGoggles(tooltip);
52-
CreateLang. ().add(cannonPitchComponent.copy().withStyle(ChatFormatting.GRAY)
52+
CreateLang.builder().add(cannonPitchComponent.copy().withStyle(ChatFormatting.GRAY)
5353
.append(Component.literal(String.format(format, Mth.wrapDegrees(pitch))).withStyle(ChatFormatting.WHITE)))
5454
.forGoggles(tooltip);
5555
if (cannon instanceof MountedBigCannonContraption bigCannon) {
56-
CreateLang. ().add(bigCannonStrengthComponent.copy().withStyle(ChatFormatting.GRAY)
56+
CreateLang.builder().add(bigCannonStrengthComponent.copy().withStyle(ChatFormatting.GRAY)
5757
.append(Component.translatable(bigCannonStrengthValueKey, bigCannon.getMaxSafeCharges()).withStyle(ChatFormatting.WHITE)))
5858
.forGoggles(tooltip);
5959
} else if (cannon instanceof MountedAutocannonContraption autocannon) {
60-
CreateLang. ().add(autocannonRPMComponent.copy().withStyle(ChatFormatting.GRAY)
60+
CreateLang.builder().add(autocannonRPMComponent.copy().withStyle(ChatFormatting.GRAY)
6161
.append(Component.translatable(autocannonRPMValueKey, autocannon.getReferencedFireRate()).withStyle(ChatFormatting.WHITE)))
6262
.forGoggles(tooltip);
6363
}
6464
} else {
65-
CreateLang. ().add(noCannonPresent.copy()).forGoggles(tooltip);
65+
CreateLang.builder().add(noCannonPresent.copy()).forGoggles(tooltip);
6666
}
6767
}
6868

src/main/java/rbasamoyai/createbigcannons/cannon_control/fixed_cannon_mount/FixedCannonMountBoxRenderer.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,8 @@ public static void tick() {
4040
BlockPos pos = result.getBlockPos();
4141
Direction face = result.getDirection();
4242

43-
Component anglePitch = CreateLang.
44-
(CreateBigCannons.MOD_ID).translate("fixed_cannon_mount.angle_pitch").component();
45-
Component angleYaw = CreateLang.
46-
(CreateBigCannons.MOD_ID).translate("fixed_cannon_mount.angle_yaw").component();
43+
Component anglePitch = CreateLang.builder(CreateBigCannons.MOD_ID).translate("fixed_cannon_mount.angle_pitch").component();
44+
Component angleYaw = CreateLang.builder(CreateBigCannons.MOD_ID).translate("fixed_cannon_mount.angle_yaw").component();
4745

4846
for (boolean pitch : Iterate.trueAndFalse) {
4947
BehaviourType<FixedCannonMountBlockEntity.FixedCannonMountScrollValueBehaviour> type = pitch ? FixedCannonMountBlockEntity.FixedCannonMountScrollValueBehaviour.PITCH_TYPE : FixedCannonMountBlockEntity.FixedCannonMountScrollValueBehaviour.YAW_TYPE;

src/main/java/rbasamoyai/createbigcannons/crafting/boring/AbstractCannonDrillBlockEntity.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -474,11 +474,11 @@ public boolean addToGoggleTooltip(List<Component> tooltip, boolean isPlayerSneak
474474
this.addFluidInfoToTooltip(tooltip, isPlayerSneaking);
475475
if (this.failureReason != FailureReason.NONE) {
476476
tooltip.add(Component.empty());
477-
CreateLang. ("exception")
477+
CreateLang.builder("exception")
478478
.translate(CreateBigCannons.MOD_ID + ".cannon_drill.tooltip.encounteredProblem")
479479
.style(ChatFormatting.GOLD)
480480
.forGoggles(tooltip);
481-
Component exceptionText = CreateLang. ("exception")
481+
Component exceptionText = CreateLang.builder("exception")
482482
.translate(CreateBigCannons.MOD_ID + ".cannon_drill.tooltip." + this.failureReason.getSerializedName())
483483
.component();
484484
tooltip.addAll(TooltipHelper.cutTextComponent(exceptionText, Palette.GRAY_AND_WHITE.primary(), Palette.GRAY_AND_WHITE.highlight(), 4));

src/main/java/rbasamoyai/createbigcannons/crafting/casting/AbstractCannonCastBlockEntity.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -632,7 +632,7 @@ public boolean addToTooltip(List<Component> tooltip, boolean isPlayerSneaking) {
632632
Component errorMsg = controller.invalidCastingError.getMessage();
633633
List<Component> cutErrorLines = TooltipHelper.cutTextComponent(errorMsg, TooltipHelper.Palette.GRAY_AND_WHITE);
634634
for (Component cline : cutErrorLines) {
635-
CreateLang. ().add(cline.copy()).forGoggles(tooltip);
635+
CreateLang.builder().add(cline.copy()).forGoggles(tooltip);
636636
}
637637
return true;
638638
}

src/main/java/rbasamoyai/createbigcannons/crafting/incomplete/IncompleteCannonBlockTooltip.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import java.util.List;
44

55
import com.simibubi.create.foundation.utility.CreateLang;
6-
import com.simibubi.create.foundation.utility.LangBuilder;
6+
import net.createmod.catnip.lang.LangBuilder;
77

88
import net.minecraft.ChatFormatting;
99
import net.minecraft.network.chat.Component;
@@ -14,15 +14,15 @@
1414
public class IncompleteCannonBlockTooltip {
1515

1616
public static void addToTooltip(List<Component> tooltip, boolean isPlayerSneaking, IncompleteWithItemsCannonBlock incomplete, BlockState state) {
17-
CreateLang. ("block")
17+
CreateLang.builder("block")
1818
.translate(CreateBigCannons.MOD_ID + ".incomplete_block.tooltip.requiredParts")
1919
.style(ChatFormatting.GOLD)
2020
.forGoggles(tooltip);
2121

2222
List<ItemLike> required = incomplete.requiredItems();
2323
int currentState = incomplete.progress(state);
2424
for (int i = 0; i < required.size(); ++i) {
25-
LangBuilder lb = CreateLang. ();
25+
LangBuilder lb = CreateLang.builder();
2626
lb.text(i == currentState ? "> " : "")
2727
.add(Component.translatable(required.get(i).asItem().getDescriptionId()))
2828
.style(i == currentState ? ChatFormatting.WHITE : ChatFormatting.DARK_GRAY);

src/main/java/rbasamoyai/createbigcannons/crafting/welding/CannonWelderSelectionHandler.java

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public void tick() {
5656
return;
5757
}
5858
if (this.firstPos != null && this.firstPos.distManhattan(hovered) > 1) {
59-
CreateLang. (CreateBigCannons.MOD_ID).translate("cannon_welder.too_far").color(FAIL).sendStatus(player);
59+
CreateLang.builder(CreateBigCannons.MOD_ID).translate("cannon_welder.too_far").color(FAIL).sendStatus(player);
6060
return;
6161
}
6262
boolean cancel = player.isSteppingCarefully();
@@ -72,7 +72,7 @@ public void tick() {
7272
color = FAIL;
7373
key = "cannon_welder.click_to_discard";
7474
}
75-
CreateLang. (CreateBigCannons.MOD_ID).translate(key).color(color).sendStatus(player);
75+
CreateLang.builder(CreateBigCannons.MOD_ID).translate(key).color(color).sendStatus(player);
7676
if (this.firstPos != null) {
7777
CreateClient.OUTLINER.showAABB(this.bbOutlineSlot, new AABB(this.firstPos, hovered).expandTowards(1, 1, 1))
7878
.colored(color)
@@ -94,7 +94,7 @@ public void discard() {
9494
LocalPlayer player = mc.player;
9595
ClientLevel level = mc.level;
9696
level.playSound(player, player.blockPosition(), SoundEvents.FIRE_EXTINGUISH, SoundSource.BLOCKS, 0.75f, 1);
97-
CreateLang. (CreateBigCannons.MOD_ID).translate("cannon_welder.abort").sendStatus(player);
97+
CreateLang.builder(CreateBigCannons.MOD_ID).translate("cannon_welder.abort").sendStatus(player);
9898
this.firstPos = null;
9999
}
100100

@@ -105,7 +105,7 @@ public void confirm() {
105105
AllSoundEvents.STEAM.playAt(player.level(), this.hoveredPos, 0.5F, 0.95F, false);
106106
Direction dir = Direction.getNearest(this.hoveredPos.getX() - this.firstPos.getX(), this.hoveredPos.getY() - this.firstPos.getY(), this.hoveredPos.getZ() - this.firstPos.getZ());
107107
spawnParticles(mc.level, this.firstPos, dir, true);
108-
CreateLang. (CreateBigCannons.MOD_ID).translate("cannon_welder.success").sendStatus(player);
108+
CreateLang.builder(CreateBigCannons.MOD_ID).translate("cannon_welder.success").sendStatus(player);
109109
this.firstPos = null;
110110
}
111111

@@ -128,8 +128,7 @@ public boolean onMouseInput() {
128128
if (mc.hitResult instanceof BlockHitResult bhr) {
129129
BlockState blockState = level.getBlockState(this.hoveredPos);
130130
if (!(blockState.getBlock() instanceof WeldableBlock wblock) || !wblock.isWeldable(blockState)) {
131-
CreateLang.
132-
(CreateBigCannons.MOD_ID).translate("cannon_welder.invalid_weld").color(FAIL).sendStatus(player);
131+
CreateLang.builder (CreateBigCannons.MOD_ID).translate("cannon_welder.invalid_weld").color(FAIL).sendStatus(player);
133132
return false;
134133
}
135134
face = bhr.getDirection();
@@ -142,7 +141,7 @@ public boolean onMouseInput() {
142141
}
143142
this.firstPos = this.hoveredPos.immutable();
144143
if (face != null) spawnParticles(level, this.firstPos, face, false);
145-
CreateLang. (CreateBigCannons.MOD_ID).translate("cannon_welder.first_pos").sendStatus(player);
144+
CreateLang.builder(CreateBigCannons.MOD_ID).translate("cannon_welder.first_pos").sendStatus(player);
146145
level.playSound(player, this.firstPos, SoundEvents.BLAZE_SHOOT, SoundSource.BLOCKS, 0.75f, 1);
147146
return true;
148147
}

src/main/java/rbasamoyai/createbigcannons/munitions/FuzedProjectileBlockItem.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public void appendHoverText(ItemStack stack, @Nullable Level level, List<Compone
3030
CompoundTag tag = stack.getOrCreateTag();
3131
ItemStack fuze = ItemStack.of(tag.getCompound("BlockEntityTag").getCompound("Fuze"));
3232
if (!fuze.isEmpty()) {
33-
CreateLang. ("block")
33+
CreateLang.builder("block")
3434
.translate(CreateBigCannons.MOD_ID + ".shell.tooltip.fuze")
3535
.add(Component.literal(" "))
3636
.add(fuze.getDisplayName().copy())

0 commit comments

Comments
 (0)