Fix some server crashes

This commit is contained in:
modmuss50 2019-08-21 19:39:10 +01:00
parent 8d8bb88942
commit 49b42752a1
7 changed files with 51 additions and 62 deletions

View file

@ -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);
}

View file

@ -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);
}));