Fix some server crashes
This commit is contained in:
parent
8d8bb88942
commit
49b42752a1
7 changed files with 51 additions and 62 deletions
|
@ -31,7 +31,7 @@ import net.minecraft.block.BlockState;
|
|||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.block.Material;
|
||||
import net.minecraft.block.entity.BlockEntity;
|
||||
import net.minecraft.client.resource.language.I18n;
|
||||
import reborncore.common.util.StringUtils;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
@ -124,7 +124,7 @@ public class BlockPlayerDetector extends BlockMachineBase {
|
|||
|
||||
if (worldIn.isClient) {
|
||||
ChatUtils.sendNoSpamMessages(MessageIDs.playerDetectorID, new LiteralText(
|
||||
Formatting.GRAY + I18n.translate("techreborn.message.detects") + " " + color
|
||||
Formatting.GRAY + StringUtils.t("techreborn.message.detects") + " " + color
|
||||
+ StringUtils.toFirstCapital(newType.asString())));
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -27,7 +27,7 @@ package techreborn.client.gui;
|
|||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
import net.minecraft.client.gui.screen.ingame.AbstractContainerScreen;
|
||||
import net.minecraft.client.gui.widget.ButtonWidget;
|
||||
import net.minecraft.client.resource.language.I18n;
|
||||
import reborncore.common.util.StringUtils;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.text.LiteralText;
|
||||
import net.minecraft.util.Identifier;
|
||||
|
@ -81,10 +81,10 @@ public class GuiChunkLoader extends AbstractContainerScreen<BuiltContainer> {
|
|||
|
||||
@Override
|
||||
protected void drawForeground(final int p_146979_1_, final int p_146979_2_) {
|
||||
final String name = I18n.translate("block.techreborn.chunk_loader");
|
||||
final String name = StringUtils.t("block.techreborn.chunk_loader");
|
||||
this.font.draw(name, this.containerWidth / 2 - this.font.getStringWidth(name) / 2, 6,
|
||||
4210752);
|
||||
this.font.draw(I18n.translate("container.inventory", new Object[0]), 8,
|
||||
this.font.draw(StringUtils.t("container.inventory", new Object[0]), 8,
|
||||
this.containerHeight - 96 + 2, 4210752);
|
||||
}
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ package techreborn.client.gui;
|
|||
|
||||
import net.minecraft.client.gui.screen.ConfirmChatLinkScreen;
|
||||
import net.minecraft.client.gui.screen.Screen;
|
||||
import net.minecraft.client.resource.language.I18n;
|
||||
import reborncore.common.util.StringUtils;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.text.LiteralText;
|
||||
import net.minecraft.util.Identifier;
|
||||
|
@ -45,9 +45,9 @@ public class GuiManual extends Screen {
|
|||
private static final Identifier texture = new Identifier("techreborn", "textures/gui/manual.png");
|
||||
int guiWidth = 207;
|
||||
int guiHeight = 195;
|
||||
private static final String text1 = I18n.translate("techreborn.manual.wiki");
|
||||
private static final String text2 = I18n.translate("techreborn.manual.discord");
|
||||
private static final String text3 = I18n.translate("techreborn.manual.refund");
|
||||
private static final String text1 = StringUtils.t("techreborn.manual.wiki");
|
||||
private static final String text2 = StringUtils.t("techreborn.manual.discord");
|
||||
private static final String text3 = StringUtils.t("techreborn.manual.refund");
|
||||
|
||||
public GuiManual(PlayerEntity player) {
|
||||
super(new LiteralText("gui.manual"));
|
||||
|
@ -58,7 +58,7 @@ public class GuiManual extends Screen {
|
|||
public void init() {
|
||||
int y = (height / 2) - guiHeight / 2;
|
||||
y+= 40;
|
||||
addButton(new GuiButtonExtended((width / 2 - 30), y + 10, 60, 20, I18n.translate("techreborn.manual.wikibtn"), var1 -> minecraft.openScreen(new ConfirmChatLinkScreen(t -> {
|
||||
addButton(new GuiButtonExtended((width / 2 - 30), y + 10, 60, 20, StringUtils.t("techreborn.manual.wikibtn"), var1 -> minecraft.openScreen(new ConfirmChatLinkScreen(t -> {
|
||||
if(t){
|
||||
SystemUtil.getOperatingSystem().open("http://wiki.techreborn.ovh");
|
||||
this.minecraft.openScreen(this);
|
||||
|
@ -66,7 +66,7 @@ public class GuiManual extends Screen {
|
|||
this.minecraft.openScreen(this);
|
||||
}
|
||||
}, "http://wiki.techreborn.ovh", false))));
|
||||
addButton(new GuiButtonExtended((width / 2 - 30), y + 60, 60, 20, I18n.translate("techreborn.manual.discordbtn"), var1 -> minecraft.openScreen(new ConfirmChatLinkScreen(t -> {
|
||||
addButton(new GuiButtonExtended((width / 2 - 30), y + 60, 60, 20, StringUtils.t("techreborn.manual.discordbtn"), var1 -> minecraft.openScreen(new ConfirmChatLinkScreen(t -> {
|
||||
if(t){
|
||||
SystemUtil.getOperatingSystem().open("https://discord.gg/teamreborn");
|
||||
this.minecraft.openScreen(this);
|
||||
|
@ -75,7 +75,7 @@ public class GuiManual extends Screen {
|
|||
}
|
||||
}, "https://discord.gg/teamreborn", false))));
|
||||
if(TechRebornConfig.allowManualRefund){
|
||||
addButton(new GuiButtonExtended((width / 2 - 30), y + 110, 60, 20, I18n.translate("techreborn.manual.refundbtn"), var1 -> {
|
||||
addButton(new GuiButtonExtended((width / 2 - 30), y + 110, 60, 20, StringUtils.t("techreborn.manual.refundbtn"), var1 -> {
|
||||
NetworkManager.sendToServer(ServerboundPackets.createRefundPacket());
|
||||
this.minecraft.openScreen(null);
|
||||
}));
|
||||
|
|
|
@ -29,7 +29,7 @@ import net.fabricmc.api.Environment;
|
|||
import net.minecraft.text.LiteralText;
|
||||
import net.minecraft.util.Formatting;
|
||||
import net.minecraft.client.item.TooltipContext;
|
||||
import net.minecraft.client.resource.language.I18n;
|
||||
import reborncore.common.util.StringUtils;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.Item;
|
||||
|
@ -83,13 +83,13 @@ public class ItemFrequencyTransmitter extends Item {
|
|||
|
||||
if (!world.isClient) {
|
||||
ChatUtils.sendNoSpamMessages(MessageIDs.freqTransmitterID, new LiteralText(
|
||||
Formatting.GRAY + I18n.translate("techreborn.message.setTo") + " X: " +
|
||||
Formatting.GRAY + StringUtils.t("techreborn.message.setTo") + " X: " +
|
||||
Formatting.GOLD + pos.getX() +
|
||||
Formatting.GRAY + " Y: " +
|
||||
Formatting.GOLD + pos.getY() +
|
||||
Formatting.GRAY + " Z: " +
|
||||
Formatting.GOLD + pos.getZ() +
|
||||
Formatting.GRAY + " " + I18n.translate("techreborn.message.in") + " " +
|
||||
Formatting.GRAY + " " + StringUtils.t("techreborn.message.in") + " " +
|
||||
Formatting.GOLD + getDimName(world.getDimension().getType())
|
||||
+ " (" + getDimName(world.getDimension().getType()) + ")"));
|
||||
}
|
||||
|
@ -104,8 +104,8 @@ public class ItemFrequencyTransmitter extends Item {
|
|||
stack.setTag(null);
|
||||
if (!world.isClient) {
|
||||
ChatUtils.sendNoSpamMessages(MessageIDs.freqTransmitterID, new LiteralText(
|
||||
Formatting.GRAY + I18n.translate("techreborn.message.coordsHaveBeen") + " "
|
||||
+ Formatting.GOLD + I18n.translate("techreborn.message.cleared")));
|
||||
Formatting.GRAY + StringUtils.t("techreborn.message.coordsHaveBeen") + " "
|
||||
+ Formatting.GOLD + StringUtils.t("techreborn.message.cleared")));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -127,7 +127,7 @@ public class ItemFrequencyTransmitter extends Item {
|
|||
tooltip.add(new LiteralText(Formatting.DARK_GRAY + getDimName(Registry.DIMENSION.get(dim)).toString()));
|
||||
|
||||
} else {
|
||||
tooltip.add(new LiteralText(Formatting.GRAY + I18n.translate("techreborn.message.noCoordsSet")));
|
||||
tooltip.add(new LiteralText(Formatting.GRAY + StringUtils.t("techreborn.message.noCoordsSet")));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -153,7 +153,7 @@ public class ItemFrequencyTransmitter extends Item {
|
|||
int coordDim = stack.getTag().getInt("dim");
|
||||
text = grey + "X: " + gold + coordX + grey + " Y: " + gold + coordY + grey + " Z: " + gold + coordZ + grey + " Dim: " + gold + getDimName(Registry.DIMENSION.get(coordDim)).toString() + " (" + coordDim + ")";
|
||||
} else {
|
||||
text = grey + I18n.translate("techreborn.message.noCoordsSet");
|
||||
text = grey + StringUtils.t("techreborn.message.noCoordsSet");
|
||||
}
|
||||
}
|
||||
return text;
|
||||
|
|
|
@ -29,7 +29,7 @@ import net.fabricmc.api.Environment;
|
|||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.client.item.TooltipContext;
|
||||
import net.minecraft.client.resource.language.I18n;
|
||||
import reborncore.common.util.StringUtils;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemGroup;
|
||||
|
@ -119,9 +119,8 @@ public class ItemIndustrialChainsaw extends ItemChainsaw {
|
|||
if (player.isSneaking()) {
|
||||
if (new ItemPowerManager(stack).getEnergyStored() < cost) {
|
||||
ChatUtils.sendNoSpamMessages(MessageIDs.nanosaberID, new LiteralText(
|
||||
Formatting.GRAY + I18n.translate("techreborn.message.nanosaberEnergyErrorTo") + " "
|
||||
+ Formatting.GOLD + I18n
|
||||
.translate("techreborn.message.nanosaberActivate")));
|
||||
Formatting.GRAY + StringUtils.t("techreborn.message.nanosaberEnergyErrorTo") + " "
|
||||
+ Formatting.GOLD + StringUtils.t("techreborn.message.nanosaberActivate")));
|
||||
} else {
|
||||
if (!ItemUtils.isActive(stack)) {
|
||||
if (stack.getTag() == null) {
|
||||
|
@ -130,17 +129,15 @@ public class ItemIndustrialChainsaw extends ItemChainsaw {
|
|||
stack.getTag().putBoolean("isActive", true);
|
||||
if (world.isClient) {
|
||||
ChatUtils.sendNoSpamMessages(MessageIDs.nanosaberID, new LiteralText(
|
||||
Formatting.GRAY + I18n.translate("techreborn.message.setTo") + " "
|
||||
+ Formatting.GOLD + I18n
|
||||
.translate("techreborn.message.nanosaberActive")));
|
||||
Formatting.GRAY + StringUtils.t("techreborn.message.setTo") + " "
|
||||
+ Formatting.GOLD + StringUtils.t("techreborn.message.nanosaberActive")));
|
||||
}
|
||||
} else {
|
||||
stack.getTag().putBoolean("isActive", false);
|
||||
if (world.isClient) {
|
||||
ChatUtils.sendNoSpamMessages(MessageIDs.nanosaberID, new LiteralText(
|
||||
Formatting.GRAY + I18n.translate("techreborn.message.setTo") + " "
|
||||
+ Formatting.GOLD + I18n
|
||||
.translate("techreborn.message.nanosaberInactive")));
|
||||
Formatting.GRAY + StringUtils.t("techreborn.message.setTo") + " "
|
||||
+ Formatting.GOLD + StringUtils.t("techreborn.message.nanosaberInactive")));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -154,9 +151,8 @@ public class ItemIndustrialChainsaw extends ItemChainsaw {
|
|||
if (ItemUtils.isActive(stack) && new ItemPowerManager(stack).getEnergyStored() < cost) {
|
||||
if(entity.world.isClient){
|
||||
ChatUtils.sendNoSpamMessages(MessageIDs.nanosaberID, new LiteralText(
|
||||
Formatting.GRAY + I18n.translate("techreborn.message.nanosaberEnergyError") + " "
|
||||
+ Formatting.GOLD + I18n
|
||||
.translate("techreborn.message.nanosaberDeactivating")));
|
||||
Formatting.GRAY + StringUtils.t("techreborn.message.nanosaberEnergyError") + " "
|
||||
+ Formatting.GOLD + StringUtils.t("techreborn.message.nanosaberDeactivating")));
|
||||
}
|
||||
stack.getTag().putBoolean("isActive", false);
|
||||
}
|
||||
|
@ -166,9 +162,9 @@ public class ItemIndustrialChainsaw extends ItemChainsaw {
|
|||
@Override
|
||||
public void appendTooltip(ItemStack stack, @Nullable World worldIn, List<Text> tooltip, TooltipContext flagIn) {
|
||||
if (!ItemUtils.isActive(stack)) {
|
||||
tooltip.add(new LiteralText(Formatting.YELLOW + "Shear: " + Formatting.RED + I18n.translate("techreborn.message.nanosaberInactive")));
|
||||
tooltip.add(new LiteralText(Formatting.YELLOW + "Shear: " + Formatting.RED + StringUtils.t("techreborn.message.nanosaberInactive")));
|
||||
} else {
|
||||
tooltip.add(new LiteralText(Formatting.YELLOW + "Shear: " + Formatting.GREEN + I18n.translate("techreborn.message.nanosaberActive")));
|
||||
tooltip.add(new LiteralText(Formatting.YELLOW + "Shear: " + Formatting.GREEN + StringUtils.t("techreborn.message.nanosaberActive")));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ import net.minecraft.block.BlockState;
|
|||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.block.Material;
|
||||
import net.minecraft.client.item.TooltipContext;
|
||||
import net.minecraft.client.resource.language.I18n;
|
||||
import reborncore.common.util.StringUtils;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemGroup;
|
||||
|
@ -51,6 +51,7 @@ import reborncore.api.power.ItemPowerManager;
|
|||
import reborncore.common.powerSystem.ExternalPowerSystems;
|
||||
import reborncore.common.util.ChatUtils;
|
||||
import reborncore.common.util.ItemUtils;
|
||||
import reborncore.common.util.StringUtils;
|
||||
import techreborn.config.TechRebornConfig;
|
||||
import techreborn.init.TRContent;
|
||||
import techreborn.items.tool.ItemDrill;
|
||||
|
@ -178,9 +179,8 @@ public class ItemIndustrialDrill extends ItemDrill {
|
|||
if (player.isSneaking()) {
|
||||
if (new ItemPowerManager(stack).getEnergyStored() < cost) {
|
||||
ChatUtils.sendNoSpamMessages(MessageIDs.nanosaberID, new LiteralText(
|
||||
Formatting.GRAY + I18n.translate("techreborn.message.nanosaberEnergyErrorTo") + " "
|
||||
+ Formatting.GOLD + I18n
|
||||
.translate("techreborn.message.nanosaberActivate")));
|
||||
Formatting.GRAY + StringUtils.t("techreborn.message.nanosaberEnergyErrorTo") + " "
|
||||
+ Formatting.GOLD + StringUtils.t("techreborn.message.nanosaberActivate")));
|
||||
} else {
|
||||
if (!ItemUtils.isActive(stack)) {
|
||||
if (stack.getTag() == null) {
|
||||
|
@ -189,17 +189,15 @@ public class ItemIndustrialDrill extends ItemDrill {
|
|||
stack.getTag().putBoolean("isActive", true);
|
||||
if (world.isClient) {
|
||||
ChatUtils.sendNoSpamMessages(MessageIDs.nanosaberID, new LiteralText(
|
||||
Formatting.GRAY + I18n.translate("techreborn.message.setTo") + " "
|
||||
+ Formatting.GOLD + I18n
|
||||
.translate("techreborn.message.nanosaberActive")));
|
||||
Formatting.GRAY + StringUtils.t("techreborn.message.setTo") + " "
|
||||
+ Formatting.GOLD + StringUtils.t("techreborn.message.nanosaberActive")));
|
||||
}
|
||||
} else {
|
||||
stack.getTag().putBoolean("isActive", false);
|
||||
if (world.isClient) {
|
||||
ChatUtils.sendNoSpamMessages(MessageIDs.nanosaberID, new LiteralText(
|
||||
Formatting.GRAY + I18n.translate("techreborn.message.setTo") + " "
|
||||
+ Formatting.GOLD + I18n
|
||||
.translate("techreborn.message.nanosaberInactive")));
|
||||
Formatting.GRAY + StringUtils.t("techreborn.message.setTo") + " "
|
||||
+ Formatting.GOLD + StringUtils.t("techreborn.message.nanosaberInactive")));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -213,9 +211,8 @@ public class ItemIndustrialDrill extends ItemDrill {
|
|||
if (ItemUtils.isActive(stack) && new ItemPowerManager(stack).getEnergyStored() < cost) {
|
||||
if(entity.world.isClient){
|
||||
ChatUtils.sendNoSpamMessages(MessageIDs.nanosaberID, new LiteralText(
|
||||
Formatting.GRAY + I18n.translate("techreborn.message.nanosaberEnergyError") + " "
|
||||
+ Formatting.GOLD + I18n
|
||||
.translate("techreborn.message.nanosaberDeactivating")));
|
||||
Formatting.GRAY + StringUtils.t("techreborn.message.nanosaberEnergyError") + " "
|
||||
+ Formatting.GOLD + StringUtils.t("techreborn.message.nanosaberDeactivating")));
|
||||
}
|
||||
stack.getTag().putBoolean("isActive", false);
|
||||
}
|
||||
|
@ -225,9 +222,9 @@ public class ItemIndustrialDrill extends ItemDrill {
|
|||
@Override
|
||||
public void appendTooltip(ItemStack stack, @Nullable World worldIn, List<Text> tooltip, TooltipContext flagIn) {
|
||||
if (!ItemUtils.isActive(stack)) {
|
||||
tooltip.add(new LiteralText(Formatting.YELLOW + "Shear: " + Formatting.RED + I18n.translate("techreborn.message.nanosaberInactive")));
|
||||
tooltip.add(new LiteralText(Formatting.YELLOW + "Shear: " + Formatting.RED + StringUtils.t("techreborn.message.nanosaberInactive")));
|
||||
} else {
|
||||
tooltip.add(new LiteralText(Formatting.YELLOW + "Shear: " + Formatting.GREEN + I18n.translate("techreborn.message.nanosaberActive")));
|
||||
tooltip.add(new LiteralText(Formatting.YELLOW + "Shear: " + Formatting.GREEN + StringUtils.t("techreborn.message.nanosaberActive")));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ package techreborn.items.tool.industrial;
|
|||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
import net.minecraft.client.item.TooltipContext;
|
||||
import net.minecraft.client.resource.language.I18n;
|
||||
import reborncore.common.util.StringUtils;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
|
@ -119,9 +119,8 @@ public class ItemNanosaber extends SwordItem implements IEnergyItemInfo, ItemDur
|
|||
if (player.isSneaking()) {
|
||||
if (new ItemPowerManager(stack).getEnergyStored() < cost) {
|
||||
ChatUtils.sendNoSpamMessages(MessageIDs.nanosaberID, new LiteralText(
|
||||
Formatting.GRAY + I18n.translate("techreborn.message.nanosaberEnergyErrorTo") + " "
|
||||
+ Formatting.GOLD + I18n
|
||||
.translate("techreborn.message.nanosaberActivate")));
|
||||
Formatting.GRAY + StringUtils.t("techreborn.message.nanosaberEnergyErrorTo") + " "
|
||||
+ Formatting.GOLD + StringUtils.t("techreborn.message.nanosaberActivate")));
|
||||
} else {
|
||||
if (!ItemUtils.isActive(stack)) {
|
||||
if (stack.getTag() == null) {
|
||||
|
@ -130,17 +129,15 @@ public class ItemNanosaber extends SwordItem implements IEnergyItemInfo, ItemDur
|
|||
stack.getTag().putBoolean("isActive", true);
|
||||
if (world.isClient) {
|
||||
ChatUtils.sendNoSpamMessages(MessageIDs.nanosaberID, new LiteralText(
|
||||
Formatting.GRAY + I18n.translate("techreborn.message.setTo") + " "
|
||||
+ Formatting.GOLD + I18n
|
||||
.translate("techreborn.message.nanosaberActive")));
|
||||
Formatting.GRAY + StringUtils.t("techreborn.message.setTo") + " "
|
||||
+ Formatting.GOLD + StringUtils.t("techreborn.message.nanosaberActive")));
|
||||
}
|
||||
} else {
|
||||
stack.getTag().putBoolean("isActive", false);
|
||||
if (world.isClient) {
|
||||
ChatUtils.sendNoSpamMessages(MessageIDs.nanosaberID, new LiteralText(
|
||||
Formatting.GRAY + I18n.translate("techreborn.message.setTo") + " "
|
||||
+ Formatting.GOLD + I18n
|
||||
.translate("techreborn.message.nanosaberInactive")));
|
||||
Formatting.GRAY + StringUtils.t("techreborn.message.setTo") + " "
|
||||
+ Formatting.GOLD + StringUtils.t("techreborn.message.nanosaberInactive")));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -154,9 +151,8 @@ public class ItemNanosaber extends SwordItem implements IEnergyItemInfo, ItemDur
|
|||
if (ItemUtils.isActive(stack) && new ItemPowerManager(stack).getEnergyStored() < cost) {
|
||||
if(worldIn.isClient){
|
||||
ChatUtils.sendNoSpamMessages(MessageIDs.nanosaberID, new LiteralText(
|
||||
Formatting.GRAY + I18n.translate("techreborn.message.nanosaberEnergyError") + " "
|
||||
+ Formatting.GOLD + I18n
|
||||
.translate("techreborn.message.nanosaberDeactivating")));
|
||||
Formatting.GRAY + StringUtils.t("techreborn.message.nanosaberEnergyError") + " "
|
||||
+ Formatting.GOLD + StringUtils.t("techreborn.message.nanosaberDeactivating")));
|
||||
}
|
||||
stack.getTag().putBoolean("isActive", false);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue