Fix some server crashes
This commit is contained in:
parent
8d8bb88942
commit
49b42752a1
7 changed files with 51 additions and 62 deletions
|
@ -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
Add a link
Reference in a new issue