1.19-pre1

This commit is contained in:
modmuss50 2022-05-18 20:20:44 +01:00
parent 05d443c51d
commit 3cb62b0291
95 changed files with 451 additions and 403 deletions

View file

@ -29,7 +29,6 @@ import net.fabricmc.api.ModInitializer;
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerBlockEntityEvents; import net.fabricmc.fabric.api.event.lifecycle.v1.ServerBlockEntityEvents;
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerTickEvents; import net.fabricmc.fabric.api.event.lifecycle.v1.ServerTickEvents;
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerWorldEvents; import net.fabricmc.fabric.api.event.lifecycle.v1.ServerWorldEvents;
import net.fabricmc.fabric.api.event.world.WorldTickCallback;
import net.fabricmc.fabric.api.transfer.v1.fluid.FluidStorage; import net.fabricmc.fabric.api.transfer.v1.fluid.FluidStorage;
import net.fabricmc.loader.api.FabricLoader; import net.fabricmc.loader.api.FabricLoader;
import net.minecraft.util.Identifier; import net.minecraft.util.Identifier;
@ -95,7 +94,7 @@ public class RebornCore implements ModInitializer {
each game loop. SERVER and WORLD ticks only run on the server. WORLDLOAD each game loop. SERVER and WORLD ticks only run on the server. WORLDLOAD
ticks run only on the server, and only when worlds are loaded. ticks run only on the server, and only when worlds are loaded.
*/ */
WorldTickCallback.EVENT.register(MultiblockRegistry::tickStart); ServerTickEvents.START_WORLD_TICK.register(MultiblockRegistry::tickStart);
// packets // packets
ServerBoundPackets.init(); ServerBoundPackets.init();

View file

@ -25,7 +25,7 @@
package reborncore.client; package reborncore.client;
import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.systems.RenderSystem;
import net.fabricmc.fabric.api.client.rendereregistry.v1.LivingEntityFeatureRendererRegistrationCallback; import net.fabricmc.fabric.api.client.rendering.v1.LivingEntityFeatureRendererRegistrationCallback;
import net.minecraft.client.render.RenderLayer; import net.minecraft.client.render.RenderLayer;
import net.minecraft.client.render.VertexConsumer; import net.minecraft.client.render.VertexConsumer;
import net.minecraft.client.render.VertexConsumerProvider; import net.minecraft.client.render.VertexConsumerProvider;

View file

@ -34,7 +34,6 @@ import net.minecraft.client.resource.language.I18n;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NbtCompound; import net.minecraft.nbt.NbtCompound;
import net.minecraft.text.LiteralText;
import net.minecraft.text.MutableText; import net.minecraft.text.MutableText;
import net.minecraft.text.Text; import net.minecraft.text.Text;
import net.minecraft.util.Formatting; import net.minecraft.util.Formatting;
@ -59,7 +58,7 @@ public class StackToolTipHandler implements ItemTooltipCallback {
((IListInfoProvider) item).addInfo(tooltipLines, false, false); ((IListInfoProvider) item).addInfo(tooltipLines, false, false);
} }
else if (item instanceof RcEnergyItem energyItem) { else if (item instanceof RcEnergyItem energyItem) {
LiteralText line1 = new LiteralText(PowerSystem.getLocalizedPowerNoSuffix(energyItem.getStoredEnergy(itemStack))); MutableText line1 = Text.literal(PowerSystem.getLocalizedPowerNoSuffix(energyItem.getStoredEnergy(itemStack)));
line1.append("/"); line1.append("/");
line1.append(PowerSystem.getLocalizedPower(energyItem.getEnergyCapacity())); line1.append(PowerSystem.getLocalizedPower(energyItem.getEnergyCapacity()));
line1.formatted(Formatting.GOLD); line1.formatted(Formatting.GOLD);
@ -76,7 +75,8 @@ public class StackToolTipHandler implements ItemTooltipCallback {
double inputRate = energyItem.getEnergyMaxInput(); double inputRate = energyItem.getEnergyMaxInput();
double outputRate = energyItem.getEnergyMaxOutput(); double outputRate = energyItem.getEnergyMaxOutput();
LiteralText line3 = new LiteralText("");
MutableText line3 = Text.literal("");
if (inputRate != 0 && inputRate == outputRate){ if (inputRate != 0 && inputRate == outputRate){
line3.append(I18n.translate("techreborn.tooltip.transferRate")); line3.append(I18n.translate("techreborn.tooltip.transferRate"));
line3.append(" : "); line3.append(" : ");
@ -111,7 +111,7 @@ public class StackToolTipHandler implements ItemTooltipCallback {
if (blockEntity != null) { if (blockEntity != null) {
blockEntity.readNbt(blockEntityData); blockEntity.readNbt(blockEntityData);
hasData = true; hasData = true;
tooltipLines.add(new LiteralText(I18n.translate("reborncore.tooltip.has_data")).formatted(Formatting.DARK_GREEN)); tooltipLines.add(Text.literal(I18n.translate("reborncore.tooltip.has_data")).formatted(Formatting.DARK_GREEN));
} }
} }
if (blockEntity instanceof IListInfoProvider) { if (blockEntity instanceof IListInfoProvider) {

View file

@ -29,7 +29,6 @@ import com.mojang.blaze3d.systems.RenderSystem;
import net.minecraft.client.MinecraftClient; import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.widget.ButtonWidget; import net.minecraft.client.gui.widget.ButtonWidget;
import net.minecraft.client.util.math.MatrixStack; import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.text.LiteralText;
import net.minecraft.text.Text; import net.minecraft.text.Text;
import net.minecraft.util.Identifier; import net.minecraft.util.Identifier;
import reborncore.common.util.Color; import reborncore.common.util.Color;
@ -50,7 +49,7 @@ public class GuiButtonCustomTexture extends ButtonWidget {
public GuiButtonCustomTexture(int xPos, int yPos, int u, int v, int buttonWidth, int buttonHeight, public GuiButtonCustomTexture(int xPos, int yPos, int u, int v, int buttonWidth, int buttonHeight,
String textureName, String linkedPage, Text name, int buttonU, int buttonV, int textureH, int textureW, ButtonWidget.PressAction pressAction) { String textureName, String linkedPage, Text name, int buttonU, int buttonV, int textureH, int textureW, ButtonWidget.PressAction pressAction) {
super(xPos, yPos, buttonWidth, buttonHeight, LiteralText.EMPTY, pressAction); super(xPos, yPos, buttonWidth, buttonHeight, Text.empty(), pressAction);
this.textureU = u; this.textureU = u;
this.textureV = v; this.textureV = v;
this.textureName = textureName; this.textureName = textureName;

View file

@ -30,7 +30,6 @@ import net.minecraft.client.gui.widget.ButtonWidget;
import net.minecraft.client.render.item.ItemRenderer; import net.minecraft.client.render.item.ItemRenderer;
import net.minecraft.client.util.math.MatrixStack; import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.text.LiteralText;
import net.minecraft.text.Text; import net.minecraft.text.Text;
import reborncore.common.util.Color; import reborncore.common.util.Color;
@ -44,7 +43,7 @@ public class GuiButtonItemTexture extends ButtonWidget {
public GuiButtonItemTexture(int xPos, int yPos, int u, int v, int width, int height, ItemStack stack, public GuiButtonItemTexture(int xPos, int yPos, int u, int v, int width, int height, ItemStack stack,
String linkedPage, Text name, ButtonWidget.PressAction pressAction) { String linkedPage, Text name, ButtonWidget.PressAction pressAction) {
super(xPos, yPos, width, height, LiteralText.EMPTY, pressAction); super(xPos, yPos, width, height, Text.empty(), pressAction);
textureU = u; textureU = u;
textureV = v; textureV = v;
itemstack = stack; itemstack = stack;

View file

@ -42,9 +42,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.item.Items; import net.minecraft.item.Items;
import net.minecraft.screen.ScreenHandler; import net.minecraft.screen.ScreenHandler;
import net.minecraft.screen.slot.Slot; import net.minecraft.screen.slot.Slot;
import net.minecraft.text.LiteralText;
import net.minecraft.text.Text; import net.minecraft.text.Text;
import net.minecraft.text.TranslatableText;
import net.minecraft.util.Util; import net.minecraft.util.Util;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
import org.lwjgl.glfw.GLFW; import org.lwjgl.glfw.GLFW;
@ -136,7 +134,7 @@ public class GuiBase<T extends ScreenHandler> extends HandledScreen<T> {
public boolean upgrades; public boolean upgrades;
public GuiBase(PlayerEntity player, BlockEntity blockEntity, T screenHandler) { public GuiBase(PlayerEntity player, BlockEntity blockEntity, T screenHandler) {
super(screenHandler, player.getInventory(), new LiteralText(I18n.translate(blockEntity.getCachedState().getBlock().getTranslationKey()))); super(screenHandler, player.getInventory(), Text.literal(I18n.translate(blockEntity.getCachedState().getBlock().getTranslationKey())));
this.be = blockEntity; this.be = blockEntity;
this.builtScreenHandler = (BuiltScreenHandler) screenHandler; this.builtScreenHandler = (BuiltScreenHandler) screenHandler;
selectedTab = null; selectedTab = null;
@ -266,13 +264,13 @@ public class GuiBase<T extends ScreenHandler> extends HandledScreen<T> {
if (isPointWithinBounds(-25, 6, 24, 80, mouseX, mouseY) && upgrades if (isPointWithinBounds(-25, 6, 24, 80, mouseX, mouseY) && upgrades
&& this.focusedSlot != null && !this.focusedSlot.hasStack()) { && this.focusedSlot != null && !this.focusedSlot.hasStack()) {
List<Text> list = new ArrayList<>(); List<Text> list = new ArrayList<>();
list.add(new TranslatableText("reborncore.gui.tooltip.upgrades")); list.add(Text.translatable("reborncore.gui.tooltip.upgrades"));
renderTooltip(matrixStack, list, mouseX, mouseY); renderTooltip(matrixStack, list, mouseX, mouseY);
} }
int offset = upgrades ? 82 : 0; int offset = upgrades ? 82 : 0;
for (GuiTab tab : tabs) { for (GuiTab tab : tabs) {
if (isPointWithinBounds(-26, 6 + offset, 24, 23, mouseX, mouseY)) { if (isPointWithinBounds(-26, 6 + offset, 24, 23, mouseX, mouseY)) {
renderTooltip(matrixStack, Collections.singletonList(new TranslatableText(tab.name())), mouseX, mouseY); renderTooltip(matrixStack, Collections.singletonList(Text.translatable(tab.name())), mouseX, mouseY);
} }
offset += 24; offset += 24;
} }
@ -290,7 +288,7 @@ public class GuiBase<T extends ScreenHandler> extends HandledScreen<T> {
} }
protected void drawTitle(MatrixStack matrixStack) { protected void drawTitle(MatrixStack matrixStack) {
drawCentredText(matrixStack, new TranslatableText(be.getCachedState().getBlock().getTranslationKey()), 6, 4210752, Layer.FOREGROUND); drawCentredText(matrixStack, Text.translatable(be.getCachedState().getBlock().getTranslationKey()), 6, 4210752, Layer.FOREGROUND);
} }
public void drawCentredText(MatrixStack matrixStack, Text text, int y, int colour, Layer layer) { public void drawCentredText(MatrixStack matrixStack, Text text, int y, int colour, Layer layer) {

View file

@ -27,7 +27,7 @@ package reborncore.client.gui.builder;
import net.minecraft.client.render.item.ItemRenderer; import net.minecraft.client.render.item.ItemRenderer;
import net.minecraft.client.util.math.MatrixStack; import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.text.Text; import net.minecraft.text.Text;
import net.minecraft.text.TranslatableText; import net.minecraft.text.Text;
import reborncore.client.RenderUtil; import reborncore.client.RenderUtil;
import reborncore.client.gui.guibuilder.GuiBuilder; import reborncore.client.gui.guibuilder.GuiBuilder;
import reborncore.common.blockentity.RedstoneConfiguration; import reborncore.common.blockentity.RedstoneConfiguration;
@ -53,13 +53,13 @@ public class RedstoneConfigGui {
for (RedstoneConfiguration.Element element : configuration.getElements()) { for (RedstoneConfiguration.Element element : configuration.getElements()) {
itemRenderer.renderInGuiWithOverrides(element.getIcon(), x - 3, y + (i * spread) - 5); itemRenderer.renderInGuiWithOverrides(element.getIcon(), x - 3, y + (i * spread) - 5);
guiBase.getTextRenderer().draw(matrixStack, new TranslatableText("reborncore.gui.fluidconfig." + element.getName()), x + 15, y + (i * spread), -1); guiBase.getTextRenderer().draw(matrixStack, Text.translatable("reborncore.gui.fluidconfig." + element.getName()), x + 15, y + (i * spread), -1);
boolean hovered = withinBounds(guiBase, mouseX, mouseY, x + 92, y + (i * spread) - 2, 63, 15); boolean hovered = withinBounds(guiBase, mouseX, mouseY, x + 92, y + (i * spread) - 2, 63, 15);
int color = hovered ? 0xFF8b8b8b : 0x668b8b8b; int color = hovered ? 0xFF8b8b8b : 0x668b8b8b;
RenderUtil.drawGradientRect(matrixStack, 0, x + 91, y + (i * spread) - 2, x + 93 + 65, y + (i * spread) + 10, color, color); RenderUtil.drawGradientRect(matrixStack, 0, x + 91, y + (i * spread) - 2, x + 93 + 65, y + (i * spread) + 10, color, color);
Text name = new TranslatableText("reborncore.gui.fluidconfig." + configuration.getState(element).name().toLowerCase(Locale.ROOT)); Text name = Text.translatable("reborncore.gui.fluidconfig." + configuration.getState(element).name().toLowerCase(Locale.ROOT));
guiBase.drawCentredText(matrixStack, name, y + (i * spread), -1, x + 37, GuiBase.Layer.FOREGROUND); guiBase.drawCentredText(matrixStack, name, y + (i * spread), -1, x + 37, GuiBase.Layer.FOREGROUND);
//guiBase.getTextRenderer().drawWithShadow(name, x + 92, y + (i * spread), -1); //guiBase.getTextRenderer().drawWithShadow(name, x + 92, y + (i * spread), -1);
i++; i++;

View file

@ -28,10 +28,13 @@ import com.google.common.collect.Lists;
import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.systems.RenderSystem;
import net.minecraft.client.MinecraftClient; import net.minecraft.client.MinecraftClient;
import net.minecraft.client.util.math.MatrixStack; import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.network.MessageType;
import net.minecraft.screen.slot.Slot; import net.minecraft.screen.slot.Slot;
import net.minecraft.text.LiteralText; import net.minecraft.text.Text;
import net.minecraft.util.Util; import net.minecraft.util.Util;
import net.minecraft.util.registry.Registry;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
import org.spongepowered.asm.mixin.Unique;
import reborncore.client.gui.GuiUtil; import reborncore.client.gui.GuiUtil;
import reborncore.client.gui.builder.GuiBase; import reborncore.client.gui.builder.GuiBase;
import reborncore.client.gui.builder.slot.elements.ConfigSlotElement; import reborncore.client.gui.builder.slot.elements.ConfigSlotElement;
@ -41,6 +44,7 @@ import reborncore.common.screen.BuiltScreenHandler;
import reborncore.common.blockentity.MachineBaseBlockEntity; import reborncore.common.blockentity.MachineBaseBlockEntity;
import reborncore.common.network.NetworkManager; import reborncore.common.network.NetworkManager;
import reborncore.common.network.ServerBoundPackets; import reborncore.common.network.ServerBoundPackets;
import reborncore.common.util.ClientChatUtils;
import reborncore.common.util.Color; import reborncore.common.util.Color;
import java.util.Collections; import java.util.Collections;
@ -108,7 +112,7 @@ public class SlotConfigGui {
} }
String json = machine.getSlotConfiguration().toJson(machine.getClass().getCanonicalName()); String json = machine.getSlotConfiguration().toJson(machine.getClass().getCanonicalName());
MinecraftClient.getInstance().keyboard.setClipboard(json); MinecraftClient.getInstance().keyboard.setClipboard(json);
MinecraftClient.getInstance().player.sendSystemMessage(new LiteralText("Slot configuration copied to clipboard"), Util.NIL_UUID); ClientChatUtils.addHudMessage(Text.literal("Slot configuration copied to clipboard"));
} }
public static void pasteFromClipboard() { public static void pasteFromClipboard() {
@ -120,9 +124,9 @@ public class SlotConfigGui {
try { try {
machine.getSlotConfiguration().readJson(json, machine.getClass().getCanonicalName()); machine.getSlotConfiguration().readJson(json, machine.getClass().getCanonicalName());
NetworkManager.sendToServer(ServerBoundPackets.createPacketConfigSave(machine.getPos(), machine.getSlotConfiguration())); NetworkManager.sendToServer(ServerBoundPackets.createPacketConfigSave(machine.getPos(), machine.getSlotConfiguration()));
MinecraftClient.getInstance().player.sendSystemMessage(new LiteralText("Slot configuration loaded from clipboard"), Util.NIL_UUID); ClientChatUtils.addHudMessage(Text.literal("Slot configuration loaded from clipboard"));
} catch (UnsupportedOperationException e) { } catch (UnsupportedOperationException e) {
MinecraftClient.getInstance().player.sendSystemMessage(new LiteralText(e.getMessage()), Util.NIL_UUID); ClientChatUtils.addHudMessage(Text.literal(e.getMessage()));
} }
} }

View file

@ -25,7 +25,7 @@
package reborncore.client.gui.builder.slot.elements; package reborncore.client.gui.builder.slot.elements;
import net.minecraft.client.util.math.MatrixStack; import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.text.TranslatableText; import net.minecraft.text.Text;
import reborncore.client.gui.builder.GuiBase; import reborncore.client.gui.builder.GuiBase;
import reborncore.common.util.Tank; import reborncore.common.util.Tank;
@ -51,12 +51,12 @@ public class ConfigFluidElement extends ElementBase {
return true; return true;
})); }));
elements.add(new CheckBoxElement(new TranslatableText("reborncore.gui.fluidconfig.pullin"), 0xFFFFFFFF, x - 26, y + 42, "input", 0, Sprite.LIGHT_CHECK_BOX, gui.getMachine(), elements.add(new CheckBoxElement(Text.translatable("reborncore.gui.fluidconfig.pullin"), 0xFFFFFFFF, x - 26, y + 42, "input", 0, Sprite.LIGHT_CHECK_BOX, gui.getMachine(),
checkBoxElement -> checkBoxElement.machineBase.fluidConfiguration.autoInput()).addPressAction((element, gui12, provider, mouseX, mouseY) -> { checkBoxElement -> checkBoxElement.machineBase.fluidConfiguration.autoInput()).addPressAction((element, gui12, provider, mouseX, mouseY) -> {
popupElement.updateCheckBox((CheckBoxElement) element, "input", gui12); popupElement.updateCheckBox((CheckBoxElement) element, "input", gui12);
return true; return true;
})); }));
elements.add(new CheckBoxElement(new TranslatableText("reborncore.gui.fluidconfig.pumpout"), 0xFFFFFFFF, x - 26, y + 57, "output", 0, Sprite.LIGHT_CHECK_BOX, gui.getMachine(), elements.add(new CheckBoxElement(Text.translatable("reborncore.gui.fluidconfig.pumpout"), 0xFFFFFFFF, x - 26, y + 57, "output", 0, Sprite.LIGHT_CHECK_BOX, gui.getMachine(),
checkBoxElement -> checkBoxElement.machineBase.fluidConfiguration.autoOutput()).addPressAction((element, gui13, provider, mouseX, mouseY) -> { checkBoxElement -> checkBoxElement.machineBase.fluidConfiguration.autoOutput()).addPressAction((element, gui13, provider, mouseX, mouseY) -> {
popupElement.updateCheckBox((CheckBoxElement) element, "output", gui13); popupElement.updateCheckBox((CheckBoxElement) element, "output", gui13);
return true; return true;

View file

@ -31,7 +31,7 @@ import net.minecraft.client.render.item.ItemRenderer;
import net.minecraft.client.util.math.MatrixStack; import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.inventory.Inventory; import net.minecraft.inventory.Inventory;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.text.TranslatableText; import net.minecraft.text.Text;
import reborncore.client.gui.builder.GuiBase; import reborncore.client.gui.builder.GuiBase;
import reborncore.client.gui.builder.slot.SlotConfigGui; import reborncore.client.gui.builder.slot.SlotConfigGui;
import reborncore.client.gui.slots.BaseSlot; import reborncore.client.gui.slots.BaseSlot;
@ -74,14 +74,14 @@ public class ConfigSlotElement extends ElementBase {
})); }));
if (inputEnabled) { if (inputEnabled) {
elements.add(new CheckBoxElement(new TranslatableText("reborncore.gui.slotconfig.autoinput"), 0xFFFFFFFF, x - 26, y + 42, "input", slotId, Sprite.LIGHT_CHECK_BOX, gui.getMachine(), elements.add(new CheckBoxElement(Text.translatable("reborncore.gui.slotconfig.autoinput"), 0xFFFFFFFF, x - 26, y + 42, "input", slotId, Sprite.LIGHT_CHECK_BOX, gui.getMachine(),
checkBoxElement -> checkBoxElement.machineBase.getSlotConfiguration().getSlotDetails(checkBoxElement.slotID).autoInput()).addPressAction((element, gui12, provider, mouseX, mouseY) -> { checkBoxElement -> checkBoxElement.machineBase.getSlotConfiguration().getSlotDetails(checkBoxElement.slotID).autoInput()).addPressAction((element, gui12, provider, mouseX, mouseY) -> {
popupElement.updateCheckBox((CheckBoxElement) element, "input", gui12); popupElement.updateCheckBox((CheckBoxElement) element, "input", gui12);
return true; return true;
})); }));
} }
elements.add(new CheckBoxElement(new TranslatableText("reborncore.gui.slotconfig.autooutput"), 0xFFFFFFFF, x - 26, y + 57, "output", slotId, Sprite.LIGHT_CHECK_BOX, gui.getMachine(), elements.add(new CheckBoxElement(Text.translatable("reborncore.gui.slotconfig.autooutput"), 0xFFFFFFFF, x - 26, y + 57, "output", slotId, Sprite.LIGHT_CHECK_BOX, gui.getMachine(),
checkBoxElement -> checkBoxElement.machineBase.getSlotConfiguration().getSlotDetails(checkBoxElement.slotID).autoOutput()).addPressAction((element, gui13, provider, mouseX, mouseY) -> { checkBoxElement -> checkBoxElement.machineBase.getSlotConfiguration().getSlotDetails(checkBoxElement.slotID).autoOutput()).addPressAction((element, gui13, provider, mouseX, mouseY) -> {
popupElement.updateCheckBox((CheckBoxElement) element, "output", gui13); popupElement.updateCheckBox((CheckBoxElement) element, "output", gui13);
return true; return true;
@ -89,7 +89,7 @@ public class ConfigSlotElement extends ElementBase {
if (gui.getMachine() instanceof SlotConfiguration.SlotFilter slotFilter) { if (gui.getMachine() instanceof SlotConfiguration.SlotFilter slotFilter) {
if (Arrays.stream(slotFilter.getInputSlots()).anyMatch(value -> value == slotId)) { if (Arrays.stream(slotFilter.getInputSlots()).anyMatch(value -> value == slotId)) {
elements.add(new CheckBoxElement(new TranslatableText("reborncore.gui.slotconfig.filter_input"), 0xFFFFFFFF, x - 26, y + 72, "filter", slotId, Sprite.LIGHT_CHECK_BOX, gui.getMachine(), elements.add(new CheckBoxElement(Text.translatable("reborncore.gui.slotconfig.filter_input"), 0xFFFFFFFF, x - 26, y + 72, "filter", slotId, Sprite.LIGHT_CHECK_BOX, gui.getMachine(),
checkBoxElement -> checkBoxElement.machineBase.getSlotConfiguration().getSlotDetails(checkBoxElement.slotID).filter()).addPressAction((element, gui13, provider, mouseX, mouseY) -> { checkBoxElement -> checkBoxElement.machineBase.getSlotConfiguration().getSlotDetails(checkBoxElement.slotID).filter()).addPressAction((element, gui13, provider, mouseX, mouseY) -> {
popupElement.updateCheckBox((CheckBoxElement) element, "filter", gui13); popupElement.updateCheckBox((CheckBoxElement) element, "filter", gui13);
return true; return true;

View file

@ -26,7 +26,7 @@ package reborncore.client.gui.builder.widget;
import net.minecraft.client.gui.widget.ButtonWidget; import net.minecraft.client.gui.widget.ButtonWidget;
import net.minecraft.client.util.math.MatrixStack; import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.text.LiteralText; import net.minecraft.text.Text;
import reborncore.client.gui.builder.GuiBase; import reborncore.client.gui.builder.GuiBase;
/** /**
@ -38,7 +38,7 @@ public class GuiButtonHologram extends GuiButtonExtended {
GuiBase<?> gui; GuiBase<?> gui;
public GuiButtonHologram(int x, int y, GuiBase<?> gui, GuiBase.Layer layer, ButtonWidget.PressAction pressAction) { public GuiButtonHologram(int x, int y, GuiBase<?> gui, GuiBase.Layer layer, ButtonWidget.PressAction pressAction) {
super(x, y, 20, 12, LiteralText.EMPTY, pressAction); super(x, y, 20, 12, Text.empty(), pressAction);
this.layer = layer; this.layer = layer;
this.gui = gui; this.gui = gui;
} }

View file

@ -27,7 +27,7 @@ package reborncore.client.gui.builder.widget;
import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.systems.RenderSystem;
import net.minecraft.client.gui.widget.ButtonWidget; import net.minecraft.client.gui.widget.ButtonWidget;
import net.minecraft.client.util.math.MatrixStack; import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.text.LiteralText; import net.minecraft.text.Text;
import reborncore.client.gui.builder.GuiBase; import reborncore.client.gui.builder.GuiBase;
/** /**
@ -39,7 +39,7 @@ public class GuiButtonUpDown extends GuiButtonExtended {
UpDownButtonType type; UpDownButtonType type;
public GuiButtonUpDown(int x, int y, GuiBase<?> gui, ButtonWidget.PressAction pressAction, UpDownButtonType type) { public GuiButtonUpDown(int x, int y, GuiBase<?> gui, ButtonWidget.PressAction pressAction, UpDownButtonType type) {
super(x, y, 12, 12, LiteralText.EMPTY, pressAction); super(x, y, 12, 12, Text.empty(), pressAction);
this.gui = gui; this.gui = gui;
this.type = type; this.type = type;
} }

View file

@ -42,9 +42,8 @@ import net.minecraft.client.texture.SpriteAtlasTexture;
import net.minecraft.client.util.math.MatrixStack; import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.fluid.Fluids; import net.minecraft.fluid.Fluids;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.text.LiteralText;
import net.minecraft.text.Text; import net.minecraft.text.Text;
import net.minecraft.text.TranslatableText; import net.minecraft.text.Text;
import net.minecraft.util.Formatting; import net.minecraft.util.Formatting;
import net.minecraft.util.Identifier; import net.minecraft.util.Identifier;
import reborncore.api.IListInfoProvider; import reborncore.api.IListInfoProvider;
@ -67,7 +66,7 @@ import java.util.stream.Collectors;
*/ */
public class GuiBuilder { public class GuiBuilder {
public static final Identifier defaultTextureSheet = new Identifier("reborncore", "textures/gui/guielements.png"); public static final Identifier defaultTextureSheet = new Identifier("reborncore", "textures/gui/guielements.png");
private static final Text SPACE_TEXT = new LiteralText(" "); private static final Text SPACE_TEXT = Text.literal(" ");
static Identifier resourceLocation; static Identifier resourceLocation;
public GuiBuilder() { public GuiBuilder() {
@ -175,9 +174,9 @@ public class GuiBuilder {
if (gui.isPointInRect(x, y, 20, 12, mouseX, mouseY)) { if (gui.isPointInRect(x, y, 20, 12, mouseX, mouseY)) {
List<Text> list = new ArrayList<>(); List<Text> list = new ArrayList<>();
if (locked) { if (locked) {
list.add(new TranslatableText("reborncore.gui.tooltip.unlock_items")); list.add(Text.translatable("reborncore.gui.tooltip.unlock_items"));
} else { } else {
list.add(new TranslatableText("reborncore.gui.tooltip.lock_items")); list.add(Text.translatable("reborncore.gui.tooltip.lock_items"));
} }
matrixStack.push(); matrixStack.push();
gui.renderTooltip(matrixStack, list, mouseX, mouseY); gui.renderTooltip(matrixStack, list, mouseX, mouseY);
@ -209,7 +208,7 @@ public class GuiBuilder {
} }
if (gui.isPointInRect(x, y, 20, 12, mouseX, mouseY)) { if (gui.isPointInRect(x, y, 20, 12, mouseX, mouseY)) {
List<Text> list = new ArrayList<>(); List<Text> list = new ArrayList<>();
list.add(new TranslatableText("reborncore.gui.tooltip.hologram")); list.add(Text.translatable("reborncore.gui.tooltip.hologram"));
matrixStack.push(); matrixStack.push();
if (layer == GuiBase.Layer.FOREGROUND) { if (layer == GuiBase.Layer.FOREGROUND) {
mouseX -= gui.getGuiLeft(); mouseX -= gui.getGuiLeft();
@ -245,8 +244,8 @@ public class GuiBuilder {
} }
gui.drawTexture(matrixStack, x + 4, y + 4, 26, 246, j, 10); gui.drawTexture(matrixStack, x + 4, y + 4, 26, 246, j, 10);
Text text = new LiteralText(String.valueOf(value)) Text text = Text.literal(String.valueOf(value))
.append(new TranslatableText("reborncore.gui.heat")); .append(Text.translatable("reborncore.gui.heat"));
gui.drawCentredText(matrixStack, text, y + 5, 0xFFFFFF, layer); gui.drawCentredText(matrixStack, text, y + 5, 0xFFFFFF, layer);
} }
@ -282,13 +281,13 @@ public class GuiBuilder {
if (!suffix.equals("")) { if (!suffix.equals("")) {
suffix = " " + suffix; suffix = " " + suffix;
} }
gui.drawCentredText(matrixStack, new LiteralText(format).append(suffix), y + 5, 0xFFFFFF, layer); gui.drawCentredText(matrixStack, Text.literal(format).append(suffix), y + 5, 0xFFFFFF, layer);
if (gui.isPointInRect(x, y, 114, 18, mouseX, mouseY)) { if (gui.isPointInRect(x, y, 114, 18, mouseX, mouseY)) {
int percentage = percentage(max, value); int percentage = percentage(max, value);
List<Text> list = new ArrayList<>(); List<Text> list = new ArrayList<>();
list.add( list.add(
new LiteralText(String.valueOf(value)) Text.literal(String.valueOf(value))
.formatted(Formatting.GOLD) .formatted(Formatting.GOLD)
.append("/") .append("/")
.append(String.valueOf(max)) .append(String.valueOf(max))
@ -296,11 +295,11 @@ public class GuiBuilder {
); );
list.add( list.add(
new LiteralText(String.valueOf(percentage)) Text.literal(String.valueOf(percentage))
.formatted(StringUtils.getPercentageColour(percentage)) .formatted(StringUtils.getPercentageColour(percentage))
.append("%") .append("%")
.append( .append(
new TranslatableText("reborncore.gui.tooltip.dsu_fullness") Text.translatable("reborncore.gui.tooltip.dsu_fullness")
.formatted(Formatting.GRAY) .formatted(Formatting.GRAY)
) )
); );
@ -309,15 +308,15 @@ public class GuiBuilder {
if (value > max) { if (value > max) {
list.add( list.add(
new LiteralText("Yo this is storing more than it should be able to") Text.literal("Yo this is storing more than it should be able to")
.formatted(Formatting.GRAY) .formatted(Formatting.GRAY)
); );
list.add( list.add(
new LiteralText("prolly a bug") Text.literal("prolly a bug")
.formatted(Formatting.GRAY) .formatted(Formatting.GRAY)
); );
list.add( list.add(
new LiteralText("pls report and tell how tf you did this") Text.literal("pls report and tell how tf you did this")
.formatted(Formatting.GRAY) .formatted(Formatting.GRAY)
); );
} }
@ -332,12 +331,12 @@ public class GuiBuilder {
} }
public void drawBigBlueBar(MatrixStack matrixStack, GuiBase<?> gui, int x, int y, int value, int max, int mouseX, int mouseY, String suffix, GuiBase.Layer layer) { public void drawBigBlueBar(MatrixStack matrixStack, GuiBase<?> gui, int x, int y, int value, int max, int mouseX, int mouseY, String suffix, GuiBase.Layer layer) {
drawBigBlueBar(matrixStack, gui, x, y, value, max, mouseX, mouseY, suffix, LiteralText.EMPTY, Integer.toString(value), layer); drawBigBlueBar(matrixStack, gui, x, y, value, max, mouseX, mouseY, suffix, Text.empty(), Integer.toString(value), layer);
} }
public void drawBigBlueBar(MatrixStack matrixStack, GuiBase<?> gui, int x, int y, int value, int max, int mouseX, int mouseY, GuiBase.Layer layer) { public void drawBigBlueBar(MatrixStack matrixStack, GuiBase<?> gui, int x, int y, int value, int max, int mouseX, int mouseY, GuiBase.Layer layer) {
drawBigBlueBar(matrixStack, gui, x, y, value, max, mouseX, mouseY, "", LiteralText.EMPTY, "", layer); drawBigBlueBar(matrixStack, gui, x, y, value, max, mouseX, mouseY, "", Text.empty(), "", layer);
} }
/** /**
@ -362,7 +361,7 @@ public class GuiBuilder {
RenderUtil.drawGradientRect(matrixStack, 0, x, y + 68, x + 176, y + 70 + 20, 0xC0000000, 0x00000000); RenderUtil.drawGradientRect(matrixStack, 0, x, y + 68, x + 176, y + 70 + 20, 0xC0000000, 0x00000000);
RenderSystem.colorMask(true, true, true, true); RenderSystem.colorMask(true, true, true, true);
RenderSystem.disableDepthTest(); RenderSystem.disableDepthTest();
gui.drawCentredText(matrixStack, new TranslatableText("reborncore.gui.missingmultiblock"), 43, 0xFFFFFF, layer); gui.drawCentredText(matrixStack, Text.translatable("reborncore.gui.missingmultiblock"), 43, 0xFFFFFF, layer);
} }
/** /**
@ -404,7 +403,7 @@ public class GuiBuilder {
*/ */
public void drawSlotConfigTips(MatrixStack matrixStack, GuiBase<?> gui, int x, int y, int mouseX, int mouseY, GuiTab guiTab) { public void drawSlotConfigTips(MatrixStack matrixStack, GuiBase<?> gui, int x, int y, int mouseX, int mouseY, GuiTab guiTab) {
List<Text> tips = guiTab.getTips().stream() List<Text> tips = guiTab.getTips().stream()
.map(TranslatableText::new) .map(Text::translatable)
.collect(Collectors.toList()); .collect(Collectors.toList());
TipsListWidget explanation = new TipsListWidget(gui, gui.getScreenWidth() - 14, 54, y, y + 76, 9 + 2, tips); TipsListWidget explanation = new TipsListWidget(gui, gui.getScreenWidth() - 14, 54, y, y + 76, 9 + 2, tips);
@ -481,7 +480,7 @@ public class GuiBuilder {
*/ */
public void drawEnergyOutput(MatrixStack matrixStack, GuiBase<?> gui, int x, int y, int maxOutput, GuiBase.Layer layer) { public void drawEnergyOutput(MatrixStack matrixStack, GuiBase<?> gui, int x, int y, int maxOutput, GuiBase.Layer layer) {
if (gui.hideGuiElements()) return; if (gui.hideGuiElements()) return;
Text text = new LiteralText(PowerSystem.getLocalizedPowerNoSuffix(maxOutput)) Text text = Text.literal(PowerSystem.getLocalizedPowerNoSuffix(maxOutput))
.append(SPACE_TEXT) .append(SPACE_TEXT)
.append(PowerSystem.getDisplayPower().abbreviation) .append(PowerSystem.getDisplayPower().abbreviation)
.append("\t"); .append("\t");
@ -544,7 +543,7 @@ public class GuiBuilder {
int percentage = percentage(maxProgress, progress); int percentage = percentage(maxProgress, progress);
List<Text> list = new ArrayList<>(); List<Text> list = new ArrayList<>();
list.add( list.add(
new LiteralText(String.valueOf(percentage)) Text.literal(String.valueOf(percentage))
.formatted(StringUtils.getPercentageColour(percentage)) .formatted(StringUtils.getPercentageColour(percentage))
.append("%") .append("%")
); );
@ -592,14 +591,14 @@ public class GuiBuilder {
List<Text> list = Lists.newArrayList(); List<Text> list = Lists.newArrayList();
if (Screen.hasShiftDown()) { if (Screen.hasShiftDown()) {
list.add( list.add(
new LiteralText(PowerSystem.getLocalizedPowerFullNoSuffix(energyStored)) Text.literal(PowerSystem.getLocalizedPowerFullNoSuffix(energyStored))
.formatted(Formatting.GOLD) .formatted(Formatting.GOLD)
.append("/") .append("/")
.append(PowerSystem.getLocalizedPowerFull(maxEnergyStored)) .append(PowerSystem.getLocalizedPowerFull(maxEnergyStored))
); );
} else { } else {
list.add( list.add(
new LiteralText(PowerSystem.getLocalizedPowerNoSuffix(energyStored)) Text.literal(PowerSystem.getLocalizedPowerNoSuffix(energyStored))
.formatted(Formatting.GOLD) .formatted(Formatting.GOLD)
.append("/") .append("/")
.append(PowerSystem.getLocalizedPower(maxEnergyStored)) .append(PowerSystem.getLocalizedPower(maxEnergyStored))
@ -609,7 +608,7 @@ public class GuiBuilder {
StringUtils.getPercentageText(percentage) StringUtils.getPercentageText(percentage)
.append(SPACE_TEXT) .append(SPACE_TEXT)
.append( .append(
new TranslatableText("reborncore.gui.tooltip.power_charged") Text.translatable("reborncore.gui.tooltip.power_charged")
.formatted(Formatting.GRAY) .formatted(Formatting.GRAY)
) )
); );
@ -618,14 +617,14 @@ public class GuiBuilder {
if (Screen.hasShiftDown()) { if (Screen.hasShiftDown()) {
((IListInfoProvider) gui.be).addInfo(list, true, true); ((IListInfoProvider) gui.be).addInfo(list, true, true);
} else { } else {
list.add(LiteralText.EMPTY); list.add(Text.empty());
list.add( list.add(
new LiteralText("Shift") Text.literal("Shift")
.formatted(Formatting.BLUE) .formatted(Formatting.BLUE)
.append(SPACE_TEXT) .append(SPACE_TEXT)
.formatted(Formatting.GRAY) .formatted(Formatting.GRAY)
.append(new TranslatableText("reborncore.gui.tooltip.power_moreinfo")) .append(Text.translatable("reborncore.gui.tooltip.power_moreinfo"))
); );
} }
} }
@ -675,10 +674,10 @@ public class GuiBuilder {
if (gui.isPointInRect(x, y, 22, 56, mouseX, mouseY)) { if (gui.isPointInRect(x, y, 22, 56, mouseX, mouseY)) {
List<Text> list = new ArrayList<>(); List<Text> list = new ArrayList<>();
if (isTankEmpty) { if (isTankEmpty) {
list.add(new TranslatableText("reborncore.gui.tooltip.tank_empty").formatted(Formatting.GOLD)); list.add(Text.translatable("reborncore.gui.tooltip.tank_empty").formatted(Formatting.GOLD));
} else { } else {
list.add( list.add(
new LiteralText(String.format("%s / %s", amount, maxCapacity)) Text.literal(String.format("%s / %s", amount, maxCapacity))
.formatted(Formatting.GOLD) .formatted(Formatting.GOLD)
.append(SPACE_TEXT) .append(SPACE_TEXT)
.append(FluidUtils.getFluidName(fluid)) .append(FluidUtils.getFluidName(fluid))
@ -689,7 +688,7 @@ public class GuiBuilder {
StringUtils.getPercentageText(percentage) StringUtils.getPercentageText(percentage)
.formatted(Formatting.GRAY) .formatted(Formatting.GRAY)
.append(SPACE_TEXT) .append(SPACE_TEXT)
.append(new TranslatableText("reborncore.gui.tooltip.tank_fullness")) .append(Text.translatable("reborncore.gui.tooltip.tank_fullness"))
); );
if (layer == GuiBase.Layer.FOREGROUND) { if (layer == GuiBase.Layer.FOREGROUND) {

View file

@ -15,6 +15,7 @@ import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.fluid.FluidState; import net.minecraft.fluid.FluidState;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.random.AbstractRandom;
import net.minecraft.world.BlockRenderView; import net.minecraft.world.BlockRenderView;
import net.minecraft.world.BlockView; import net.minecraft.world.BlockView;
import reborncore.common.blockentity.MultiblockWriter; import reborncore.common.blockentity.MultiblockWriter;
@ -46,7 +47,7 @@ record HologramRenderer(BlockRenderView view, MatrixStack matrix, VertexConsumer
} else { } else {
matrix.translate(-0.5, -0.5, -0.5); matrix.translate(-0.5, -0.5, -0.5);
VertexConsumer consumer = vertexConsumerProvider.getBuffer(RenderLayers.getBlockLayer(state)); VertexConsumer consumer = vertexConsumerProvider.getBuffer(RenderLayers.getBlockLayer(state));
blockRenderManager.renderBlock(state, OUT_OF_WORLD_POS, view, matrix, consumer, false, new Random()); blockRenderManager.renderBlock(state, OUT_OF_WORLD_POS, view, matrix, consumer, false, AbstractRandom.create());
} }
matrix.pop(); matrix.pop();

View file

@ -43,7 +43,7 @@ import net.minecraft.server.command.ServerCommandSource;
import net.minecraft.server.network.ServerPlayerEntity; import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.server.world.ServerChunkManager; import net.minecraft.server.world.ServerChunkManager;
import net.minecraft.server.world.ServerWorld; import net.minecraft.server.world.ServerWorld;
import net.minecraft.text.LiteralText; import net.minecraft.text.Text;
import net.minecraft.util.registry.Registry; import net.minecraft.util.registry.Registry;
import net.minecraft.world.chunk.ChunkStatus; import net.minecraft.world.chunk.ChunkStatus;
import reborncore.common.network.ClientBoundPackets; import reborncore.common.network.ClientBoundPackets;
@ -108,13 +108,14 @@ public class RebornCoreCommands {
.executes(RebornCoreCommands::renderMod) .executes(RebornCoreCommands::renderMod)
) )
) )
.then( // TODO 1.19: Waiting on https://github.com/FabricMC/fabric/pull/2227
literal("item") // .then(
.then( // literal("item")
argument("item", ItemStackArgumentType.itemStack()) // .then(
.executes(RebornCoreCommands::itemRenderer) // argument("item", ItemStackArgumentType.itemStack())
) // .executes(RebornCoreCommands::itemRenderer)
) // )
// )
.then( .then(
literal("hand") literal("hand")
.executes(RebornCoreCommands::handRenderer) .executes(RebornCoreCommands::handRenderer)
@ -137,7 +138,7 @@ public class RebornCoreCommands {
CompletableFuture.supplyAsync(() -> serverChunkManager.getChunk(chunkPosX, chunkPosZ, ChunkStatus.FULL, true), EXECUTOR_SERVICE) CompletableFuture.supplyAsync(() -> serverChunkManager.getChunk(chunkPosX, chunkPosZ, ChunkStatus.FULL, true), EXECUTOR_SERVICE)
.whenComplete((chunk, throwable) -> { .whenComplete((chunk, throwable) -> {
int max = (int) Math.pow(size, 2); int max = (int) Math.pow(size, 2);
ctx.getSource().sendFeedback(new LiteralText(String.format("Finished generating %d:%d (%d/%d %d%%)", chunk.getPos().x, chunk.getPos().z, completed.getAndIncrement(), max, completed.get() == 0 ? 0 : (int) ((completed.get() * 100.0f) / max))), true); ctx.getSource().sendFeedback(Text.literal(String.format("Finished generating %d:%d (%d/%d %d%%)", chunk.getPos().x, chunk.getPos().z, completed.getAndIncrement(), max, completed.get() == 0 ? 0 : (int) ((completed.get() * 100.0f) / max))), true);
} }
); );
} }
@ -175,23 +176,13 @@ public class RebornCoreCommands {
} }
private static int handRenderer(CommandContext<ServerCommandSource> ctx) { private static int handRenderer(CommandContext<ServerCommandSource> ctx) {
try { queueRender(Collections.singletonList(ctx.getSource().getPlayer().getInventory().getMainHandStack()), ctx);
queueRender(Collections.singletonList(ctx.getSource().getPlayer().getInventory().getMainHandStack()), ctx);
} catch (CommandSyntaxException e) {
e.printStackTrace();
return 0;
}
return Command.SINGLE_SUCCESS; return Command.SINGLE_SUCCESS;
} }
private static void queueRender(List<ItemStack> stacks, CommandContext<ServerCommandSource> ctx) { private static void queueRender(List<ItemStack> stacks, CommandContext<ServerCommandSource> ctx) {
IdentifiedPacket packet = ClientBoundPackets.createPacketQueueItemStacksToRender(stacks); IdentifiedPacket packet = ClientBoundPackets.createPacketQueueItemStacksToRender(stacks);
NetworkManager.sendToPlayer(packet, ctx.getSource().getPlayer());
try {
NetworkManager.sendToPlayer(packet, ctx.getSource().getPlayer());
} catch (CommandSyntaxException e) {
e.printStackTrace();
}
} }
} }

View file

@ -36,7 +36,6 @@ import net.minecraft.inventory.SidedInventory;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NbtCompound; import net.minecraft.nbt.NbtCompound;
import net.minecraft.network.packet.s2c.play.BlockEntityUpdateS2CPacket; import net.minecraft.network.packet.s2c.play.BlockEntityUpdateS2CPacket;
import net.minecraft.text.LiteralText;
import net.minecraft.text.Text; import net.minecraft.text.Text;
import net.minecraft.util.Formatting; import net.minecraft.util.Formatting;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
@ -405,10 +404,10 @@ public class MachineBaseBlockEntity extends BlockEntity implements BlockEntityTi
public void addInfo(List<Text> info, boolean isReal, boolean hasData) { public void addInfo(List<Text> info, boolean isReal, boolean hasData) {
if (hasData) { if (hasData) {
if (getOptionalInventory().isPresent()) { if (getOptionalInventory().isPresent()) {
info.add(new LiteralText(Formatting.GOLD + "" + getOptionalInventory().get().getContents() + Formatting.GRAY + " items")); info.add(Text.literal(Formatting.GOLD + "" + getOptionalInventory().get().getContents() + Formatting.GRAY + " items"));
} }
if (!upgradeInventory.isEmpty()) { if (!upgradeInventory.isEmpty()) {
info.add(new LiteralText(Formatting .GOLD + "" + upgradeInventory.getContents() + Formatting .GRAY + " upgrades")); info.add(Text.literal(Formatting .GOLD + "" + upgradeInventory.getContents() + Formatting .GRAY + " upgrades"));
} }
} }
} }

View file

@ -32,13 +32,11 @@ import net.minecraft.advancement.Advancement;
import net.minecraft.advancement.AdvancementRewards; import net.minecraft.advancement.AdvancementRewards;
import net.minecraft.advancement.CriterionMerger; import net.minecraft.advancement.CriterionMerger;
import net.minecraft.advancement.criterion.RecipeUnlockedCriterion; import net.minecraft.advancement.criterion.RecipeUnlockedCriterion;
import net.minecraft.inventory.Inventory;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.item.Items; import net.minecraft.item.Items;
import net.minecraft.nbt.NbtCompound; import net.minecraft.nbt.NbtCompound;
import net.minecraft.nbt.NbtOps; import net.minecraft.nbt.NbtOps;
import net.minecraft.recipe.Recipe;
import net.minecraft.util.Identifier; import net.minecraft.util.Identifier;
import net.minecraft.util.JsonHelper; import net.minecraft.util.JsonHelper;
import net.minecraft.util.collection.DefaultedList; import net.minecraft.util.collection.DefaultedList;
@ -48,16 +46,12 @@ import org.jetbrains.annotations.NotNull;
import reborncore.common.util.DefaultedListCollector; import reborncore.common.util.DefaultedListCollector;
import reborncore.common.util.serialization.SerializationUtil; import reborncore.common.util.serialization.SerializationUtil;
import java.util.Collection;
import java.util.List; import java.util.List;
import java.util.Objects; import java.util.Objects;
public class RecipeUtils { public class RecipeUtils {
@SuppressWarnings("unchecked")
public static <T extends RebornRecipe> List<T> getRecipes(World world, RebornRecipeType<T> type) { public static <T extends RebornRecipe> List<T> getRecipes(World world, RebornRecipeType<T> type) {
final Collection<Recipe<Inventory>> recipes = world.getRecipeManager().getAllOfType(type).values().stream().toList(); return (List<T>) world.getRecipeManager().getAllOfType(type).values().stream().toList();
//noinspection unchecked
return (List<T>) (Object) recipes;
} }
public static DefaultedList<ItemStack> deserializeItems(JsonElement jsonObject) { public static DefaultedList<ItemStack> deserializeItems(JsonElement jsonObject) {

View file

@ -29,7 +29,6 @@ import com.google.gson.JsonObject;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.recipe.Ingredient; import net.minecraft.recipe.Ingredient;
import net.minecraft.recipe.ShapedRecipe; import net.minecraft.recipe.ShapedRecipe;
import net.minecraft.tag.Tag;
import net.minecraft.tag.TagKey; import net.minecraft.tag.TagKey;
import net.minecraft.util.JsonHelper; import net.minecraft.util.JsonHelper;
import net.minecraft.util.registry.Registry; import net.minecraft.util.registry.Registry;

View file

@ -41,7 +41,7 @@ import net.minecraft.fluid.Fluid;
import net.minecraft.fluid.Fluids; import net.minecraft.fluid.Fluids;
import net.minecraft.inventory.Inventory; import net.minecraft.inventory.Inventory;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.text.TranslatableText; import net.minecraft.text.Text;
import net.minecraft.util.Hand; import net.minecraft.util.Hand;
import net.minecraft.util.registry.Registry; import net.minecraft.util.registry.Registry;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
@ -78,7 +78,7 @@ public class FluidUtils {
// Just extract as much as we can // Just extract as much as we can
try (Transaction tx = Transaction.openOuter()) { try (Transaction tx = Transaction.openOuter()) {
boolean didSomething = false; boolean didSomething = false;
for (var view : itemStorage.iterable(tx)) { for (var view : itemStorage) {
if (view.isResourceBlank()) continue; if (view.isResourceBlank()) continue;
didSomething = didSomething | view.extract(view.getResource(), Long.MAX_VALUE, tx) > 0; didSomething = didSomething | view.extract(view.getResource(), Long.MAX_VALUE, tx) > 0;
@ -145,7 +145,7 @@ public class FluidUtils {
// Use current transaction in case this check is nested in a transfer operation. // Use current transaction in case this check is nested in a transfer operation.
try (var tx = Transaction.openNested(Transaction.getCurrentUnsafe())) { try (var tx = Transaction.openNested(Transaction.getCurrentUnsafe())) {
for (var view : fluidStorage.iterable(tx)) { for (var view : fluidStorage) {
if (!view.isResourceBlank() && view.getAmount() > 0) { if (!view.isResourceBlank() && view.getAmount() > 0) {
return false; return false;
} }
@ -161,7 +161,7 @@ public class FluidUtils {
// Use current transaction in case this check is nested in a transfer operation. // Use current transaction in case this check is nested in a transfer operation.
try (var tx = Transaction.openNested(Transaction.getCurrentUnsafe())) { try (var tx = Transaction.openNested(Transaction.getCurrentUnsafe())) {
for (var view : fluidStorage.iterable(tx)) { for (var view : fluidStorage) {
if (!view.isResourceBlank() && view.getAmount() > 0 && predicate.test(view.getResource().getFluid())) { if (!view.isResourceBlank() && view.getAmount() > 0 && predicate.test(view.getResource().getFluid())) {
return true; return true;
} }
@ -183,6 +183,6 @@ public class FluidUtils {
} }
public static String getFluidName(@NotNull Fluid fluid) { public static String getFluidName(@NotNull Fluid fluid) {
return new TranslatableText(fluid.getDefaultState().getBlockState().getBlock().getTranslationKey()).getString(); return Text.translatable(fluid.getDefaultState().getBlockState().getBlock().getTranslationKey()).getString();
} }
} }

View file

@ -32,7 +32,6 @@ import net.minecraft.block.entity.BlockEntityType;
import net.minecraft.inventory.Inventory; import net.minecraft.inventory.Inventory;
import net.minecraft.nbt.NbtCompound; import net.minecraft.nbt.NbtCompound;
import net.minecraft.text.Text; import net.minecraft.text.Text;
import net.minecraft.text.TranslatableText;
import net.minecraft.util.Formatting; import net.minecraft.util.Formatting;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction; import net.minecraft.util.math.Direction;
@ -456,7 +455,7 @@ public abstract class PowerAcceptorBlockEntity extends MachineBaseBlockEntity im
public void addInfo(List<Text> info, boolean isReal, boolean hasData) { public void addInfo(List<Text> info, boolean isReal, boolean hasData) {
if (!isReal && hasData) { if (!isReal && hasData) {
info.add( info.add(
new TranslatableText("reborncore.tooltip.energy") Text.translatable("reborncore.tooltip.energy")
.formatted(Formatting.GRAY) .formatted(Formatting.GRAY)
.append(": ") .append(": ")
.append(PowerSystem.getLocalizedPower(getStored())) .append(PowerSystem.getLocalizedPower(getStored()))
@ -465,7 +464,7 @@ public abstract class PowerAcceptorBlockEntity extends MachineBaseBlockEntity im
} }
info.add( info.add(
new TranslatableText("reborncore.tooltip.energy.maxEnergy") Text.translatable("reborncore.tooltip.energy.maxEnergy")
.formatted(Formatting.GRAY) .formatted(Formatting.GRAY)
.append(": ") .append(": ")
.append(PowerSystem.getLocalizedPower(getMaxStoredPower())) .append(PowerSystem.getLocalizedPower(getMaxStoredPower()))
@ -474,7 +473,7 @@ public abstract class PowerAcceptorBlockEntity extends MachineBaseBlockEntity im
if (getMaxInput(null) != 0) { if (getMaxInput(null) != 0) {
info.add( info.add(
new TranslatableText("reborncore.tooltip.energy.inputRate") Text.translatable("reborncore.tooltip.energy.inputRate")
.formatted(Formatting.GRAY) .formatted(Formatting.GRAY)
.append(": ") .append(": ")
.append(PowerSystem.getLocalizedPower(getMaxInput(null))) .append(PowerSystem.getLocalizedPower(getMaxInput(null)))
@ -483,7 +482,7 @@ public abstract class PowerAcceptorBlockEntity extends MachineBaseBlockEntity im
} }
if (getMaxOutput(null) > 0) { if (getMaxOutput(null) > 0) {
info.add( info.add(
new TranslatableText("reborncore.tooltip.energy.outputRate") Text.translatable("reborncore.tooltip.energy.outputRate")
.formatted(Formatting.GRAY) .formatted(Formatting.GRAY)
.append(": ") .append(": ")
.append(PowerSystem.getLocalizedPower(getMaxOutput(null))) .append(PowerSystem.getLocalizedPower(getMaxOutput(null)))
@ -492,7 +491,7 @@ public abstract class PowerAcceptorBlockEntity extends MachineBaseBlockEntity im
} }
info.add( info.add(
new TranslatableText("reborncore.tooltip.energy.tier") Text.translatable("reborncore.tooltip.energy.tier")
.formatted(Formatting.GRAY) .formatted(Formatting.GRAY)
.append(": ") .append(": ")
.append(StringUtils.toFirstCapitalAllLowercase(getTier().toString())) .append(StringUtils.toFirstCapitalAllLowercase(getTier().toString()))
@ -501,7 +500,7 @@ public abstract class PowerAcceptorBlockEntity extends MachineBaseBlockEntity im
if (isReal) { if (isReal) {
info.add( info.add(
new TranslatableText("reborncore.tooltip.energy.change") Text.translatable("reborncore.tooltip.energy.change")
.formatted(Formatting.GRAY) .formatted(Formatting.GRAY)
.append(": ") .append(": ")
.append(PowerSystem.getLocalizedPower(powerChange)) .append(PowerSystem.getLocalizedPower(powerChange))

View file

@ -0,0 +1,43 @@
/*
* This file is part of RebornCore, licensed under the MIT License (MIT).
*
* Copyright (c) 2021 TeamReborn
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package reborncore.common.util;
import net.minecraft.client.MinecraftClient;
import net.minecraft.network.MessageSender;
import net.minecraft.network.MessageType;
import net.minecraft.text.Text;
import net.minecraft.util.Util;
import net.minecraft.util.registry.Registry;
public class ClientChatUtils {
public static void addHudMessage(Text text) {
MinecraftClient.getInstance().inGameHud.onChatMessage(getSystemMessageType(), text, new MessageSender(Util.NIL_UUID, text));
}
private static MessageType getSystemMessageType() {
Registry<MessageType> registry = MinecraftClient.getInstance().world.getRegistryManager().get(Registry.MESSAGE_TYPE_KEY);
return registry.get(MessageType.SYSTEM);
}
}

View file

@ -34,7 +34,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NbtCompound; import net.minecraft.nbt.NbtCompound;
import net.minecraft.server.network.ServerPlayerEntity; import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.text.Text; import net.minecraft.text.Text;
import net.minecraft.text.TranslatableText; import net.minecraft.text.Text;
import net.minecraft.util.Formatting; import net.minecraft.util.Formatting;
import reborncore.common.powerSystem.RcEnergyItem; import reborncore.common.powerSystem.RcEnergyItem;
import reborncore.common.recipes.IRecipeInput; import reborncore.common.recipes.IRecipeInput;
@ -172,11 +172,11 @@ public class ItemUtils {
} }
if (player instanceof ServerPlayerEntity serverPlayerEntity) { if (player instanceof ServerPlayerEntity serverPlayerEntity) {
ChatUtils.sendNoSpamMessage(serverPlayerEntity, messageId, new TranslatableText("reborncore.message.energyError") ChatUtils.sendNoSpamMessage(serverPlayerEntity, messageId, Text.translatable("reborncore.message.energyError")
.formatted(Formatting.GRAY) .formatted(Formatting.GRAY)
.append(" ") .append(" ")
.append( .append(
new TranslatableText("reborncore.message.deactivating") Text.translatable("reborncore.message.deactivating")
.formatted(Formatting.GOLD) .formatted(Formatting.GOLD)
) )
); );
@ -199,11 +199,11 @@ public class ItemUtils {
stack.getOrCreateNbt().putBoolean("isActive", true); stack.getOrCreateNbt().putBoolean("isActive", true);
if (entity instanceof ServerPlayerEntity serverPlayerEntity) { if (entity instanceof ServerPlayerEntity serverPlayerEntity) {
ChatUtils.sendNoSpamMessage(serverPlayerEntity, messageId, new TranslatableText("reborncore.message.setTo") ChatUtils.sendNoSpamMessage(serverPlayerEntity, messageId, Text.translatable("reborncore.message.setTo")
.formatted(Formatting.GRAY) .formatted(Formatting.GRAY)
.append(" ") .append(" ")
.append( .append(
new TranslatableText("reborncore.message.active") Text.translatable("reborncore.message.active")
.formatted(Formatting.GOLD) .formatted(Formatting.GOLD)
) )
); );
@ -211,11 +211,11 @@ public class ItemUtils {
} else { } else {
stack.getOrCreateNbt().putBoolean("isActive", false); stack.getOrCreateNbt().putBoolean("isActive", false);
if (entity instanceof ServerPlayerEntity serverPlayerEntity) { if (entity instanceof ServerPlayerEntity serverPlayerEntity) {
ChatUtils.sendNoSpamMessage(serverPlayerEntity, messageId, new TranslatableText("reborncore.message.setTo") ChatUtils.sendNoSpamMessage(serverPlayerEntity, messageId, Text.translatable("reborncore.message.setTo")
.formatted(Formatting.GRAY) .formatted(Formatting.GRAY)
.append(" ") .append(" ")
.append( .append(
new TranslatableText("reborncore.message.inactive") Text.translatable("reborncore.message.inactive")
.formatted(Formatting.GOLD) .formatted(Formatting.GOLD)
) )
); );
@ -231,9 +231,9 @@ public class ItemUtils {
*/ */
public static void buildActiveTooltip(ItemStack stack, List<Text> tooltip) { public static void buildActiveTooltip(ItemStack stack, List<Text> tooltip) {
if (!ItemUtils.isActive(stack)) { if (!ItemUtils.isActive(stack)) {
tooltip.add(new TranslatableText("reborncore.message.inactive").formatted(Formatting.RED)); tooltip.add(Text.translatable("reborncore.message.inactive").formatted(Formatting.RED));
} else { } else {
tooltip.add(new TranslatableText("reborncore.message.active").formatted(Formatting.GREEN)); tooltip.add(Text.translatable("reborncore.message.active").formatted(Formatting.GREEN));
} }
} }

View file

@ -24,8 +24,8 @@
package reborncore.common.util; package reborncore.common.util;
import net.minecraft.text.LiteralText;
import net.minecraft.text.MutableText; import net.minecraft.text.MutableText;
import net.minecraft.text.Text;
import net.minecraft.util.Formatting; import net.minecraft.util.Formatting;
import java.util.Locale; import java.util.Locale;
@ -68,7 +68,7 @@ public class StringUtils {
} }
public static MutableText getPercentageText(int percentage) { public static MutableText getPercentageText(int percentage) {
return new LiteralText(String.valueOf(percentage)) return Text.literal(String.valueOf(percentage))
.formatted(getPercentageColour(percentage)) .formatted(getPercentageColour(percentage))
.append("%"); .append("%");
} }

View file

@ -7,6 +7,7 @@ import net.minecraft.item.Item;
import net.minecraft.item.ItemConvertible; import net.minecraft.item.ItemConvertible;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.item.Items; import net.minecraft.item.Items;
import net.minecraft.util.math.random.AbstractRandom;
import net.minecraft.village.TradeOffer; import net.minecraft.village.TradeOffer;
import net.minecraft.village.TradeOffers; import net.minecraft.village.TradeOffers;
import net.minecraft.village.VillagerProfession; import net.minecraft.village.VillagerProfession;
@ -56,7 +57,7 @@ public final class TradeUtils {
@Nullable @Nullable
@Override @Override
public TradeOffer create(Entity entity, Random random) { public TradeOffer create(Entity entity, AbstractRandom random) {
return copy(offer); return copy(offer);
} }
}; };

View file

@ -25,11 +25,11 @@
"reborncore.common.mixins.json" "reborncore.common.mixins.json"
], ],
"depends": { "depends": {
"fabricloader": ">=0.13.3", "fabricloader": ">=0.14.5",
"fabric": ">=0.50.0", "fabric": ">=0.52.4",
"team_reborn_energy": ">=2.2.0", "team_reborn_energy": ">=2.2.0",
"fabric-biome-api-v1": ">=3.0.0", "fabric-biome-api-v1": ">=3.0.0",
"minecraft": "~1.18.2-beta.1" "minecraft": "~1.19-beta.1"
}, },
"authors": [ "authors": [
"Team Reborn", "Team Reborn",

View file

@ -12,7 +12,7 @@ plugins {
id 'eclipse' id 'eclipse'
id 'maven-publish' id 'maven-publish'
id "org.cadixdev.licenser" version "0.6.1" id "org.cadixdev.licenser" version "0.6.1"
id "fabric-loom" version "0.11-SNAPSHOT" id "fabric-loom" version "0.12-SNAPSHOT"
id "com.matthewprenger.cursegradle" version "1.4.0" id "com.matthewprenger.cursegradle" version "1.4.0"
id "de.undercouch.download" version "4.1.1" id "de.undercouch.download" version "4.1.1"
} }
@ -183,7 +183,7 @@ dependencies {
api project(path: ":RebornCore", configuration: "namedElements") api project(path: ":RebornCore", configuration: "namedElements")
include project(":RebornCore") include project(":RebornCore")
optionalDependency "me.shedaniel:RoughlyEnoughItems-fabric:${project.rei_version}" disabledOptionalDependency "me.shedaniel:RoughlyEnoughItems-fabric:${project.rei_version}"
disabledOptionalDependency "com.github.emilyploszaj:trinkets:${project.trinkets_version}" disabledOptionalDependency "com.github.emilyploszaj:trinkets:${project.trinkets_version}"
disabledOptionalDependency "net.oskarstrom:DashLoader:${project.dashloader_version}" disabledOptionalDependency "net.oskarstrom:DashLoader:${project.dashloader_version}"

View file

@ -2,14 +2,14 @@
org.gradle.jvmargs=-Xmx2G org.gradle.jvmargs=-Xmx2G
# Mod properties # Mod properties
mod_version=5.2.0-beta.3 mod_version=5.3.0-beta.1
# Fabric Properties # Fabric Properties
# check these on https://modmuss50.me/fabric.html # check these on https://modmuss50.me/fabric.html
minecraft_version=1.18.2 minecraft_version=1.19-pre1
yarn_version=1.18.2+build.3 yarn_version=1.19-pre1+build.1
loader_version=0.13.3 loader_version=0.14.5
fapi_version=0.51.1+1.18.2 fapi_version=0.52.4+1.19
# Dependencies # Dependencies
energy_version=2.2.0 energy_version=2.2.0

View file

@ -28,7 +28,7 @@ import com.mojang.datafixers.util.Pair;
import net.fabricmc.api.ClientModInitializer; import net.fabricmc.api.ClientModInitializer;
import net.fabricmc.fabric.api.blockrenderlayer.v1.BlockRenderLayerMap; import net.fabricmc.fabric.api.blockrenderlayer.v1.BlockRenderLayerMap;
import net.fabricmc.fabric.api.client.model.ModelLoadingRegistry; import net.fabricmc.fabric.api.client.model.ModelLoadingRegistry;
import net.fabricmc.fabric.api.client.rendereregistry.v1.BlockEntityRendererRegistry; import net.fabricmc.fabric.api.client.rendering.v1.BlockEntityRendererRegistry;
import net.fabricmc.fabric.api.renderer.v1.RendererAccess; import net.fabricmc.fabric.api.renderer.v1.RendererAccess;
import net.minecraft.client.item.ModelPredicateProviderRegistry; import net.minecraft.client.item.ModelPredicateProviderRegistry;
import net.minecraft.client.item.UnclampedModelPredicateProvider; import net.minecraft.client.item.UnclampedModelPredicateProvider;
@ -170,18 +170,18 @@ public class TechRebornClient implements ClientModInitializer {
BlockRenderLayerMap.INSTANCE.putFluid(fluid.getFlowingFluid(), RenderLayer.getTranslucent()); BlockRenderLayerMap.INSTANCE.putFluid(fluid.getFlowingFluid(), RenderLayer.getTranslucent());
} }
BlockEntityRendererRegistry.INSTANCE.register(TRBlockEntities.INDUSTRIAL_GRINDER, MultiblockRenderer::new); BlockEntityRendererRegistry.register(TRBlockEntities.INDUSTRIAL_GRINDER, MultiblockRenderer::new);
BlockEntityRendererRegistry.INSTANCE.register(TRBlockEntities.FUSION_CONTROL_COMPUTER, MultiblockRenderer::new); BlockEntityRendererRegistry.register(TRBlockEntities.FUSION_CONTROL_COMPUTER, MultiblockRenderer::new);
BlockEntityRendererRegistry.INSTANCE.register(TRBlockEntities.INDUSTRIAL_BLAST_FURNACE, MultiblockRenderer::new); BlockEntityRendererRegistry.register(TRBlockEntities.INDUSTRIAL_BLAST_FURNACE, MultiblockRenderer::new);
BlockEntityRendererRegistry.INSTANCE.register(TRBlockEntities.VACUUM_FREEZER, MultiblockRenderer::new); BlockEntityRendererRegistry.register(TRBlockEntities.VACUUM_FREEZER, MultiblockRenderer::new);
BlockEntityRendererRegistry.INSTANCE.register(TRBlockEntities.FLUID_REPLICATOR, MultiblockRenderer::new); BlockEntityRendererRegistry.register(TRBlockEntities.FLUID_REPLICATOR, MultiblockRenderer::new);
BlockEntityRendererRegistry.INSTANCE.register(TRBlockEntities.INDUSTRIAL_SAWMILL, MultiblockRenderer::new); BlockEntityRendererRegistry.register(TRBlockEntities.INDUSTRIAL_SAWMILL, MultiblockRenderer::new);
BlockEntityRendererRegistry.INSTANCE.register(TRBlockEntities.DISTILLATION_TOWER, MultiblockRenderer::new); BlockEntityRendererRegistry.register(TRBlockEntities.DISTILLATION_TOWER, MultiblockRenderer::new);
BlockEntityRendererRegistry.INSTANCE.register(TRBlockEntities.IMPLOSION_COMPRESSOR, MultiblockRenderer::new); BlockEntityRendererRegistry.register(TRBlockEntities.IMPLOSION_COMPRESSOR, MultiblockRenderer::new);
BlockEntityRendererRegistry.INSTANCE.register(TRBlockEntities.GREENHOUSE_CONTROLLER, MultiblockRenderer::new); BlockEntityRendererRegistry.register(TRBlockEntities.GREENHOUSE_CONTROLLER, MultiblockRenderer::new);
BlockEntityRendererRegistry.INSTANCE.register(TRBlockEntities.STORAGE_UNIT, StorageUnitRenderer::new); BlockEntityRendererRegistry.register(TRBlockEntities.STORAGE_UNIT, StorageUnitRenderer::new);
BlockEntityRendererRegistry.INSTANCE.register(TRBlockEntities.CABLE, CableCoverRenderer::new); BlockEntityRendererRegistry.register(TRBlockEntities.CABLE, CableCoverRenderer::new);
BlockEntityRendererRegistry.INSTANCE.register(TRBlockEntities.WIND_MILL, TurbineRenderer::new); BlockEntityRendererRegistry.register(TRBlockEntities.WIND_MILL, TurbineRenderer::new);
registerPredicateProvider( registerPredicateProvider(
BatpackItem.class, BatpackItem.class,

View file

@ -33,7 +33,7 @@ import net.minecraft.network.PacketByteBuf;
import net.minecraft.screen.ScreenHandler; import net.minecraft.screen.ScreenHandler;
import net.minecraft.screen.ScreenHandlerType; import net.minecraft.screen.ScreenHandlerType;
import net.minecraft.server.network.ServerPlayerEntity; import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.text.LiteralText; import net.minecraft.text.Text;
import net.minecraft.text.Text; import net.minecraft.text.Text;
import net.minecraft.util.Identifier; import net.minecraft.util.Identifier;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
@ -169,7 +169,7 @@ public final class GuiType<T extends BlockEntity> implements IMachineGuiHandler
@Override @Override
public Text getDisplayName() { public Text getDisplayName() {
return new LiteralText("What is this for?"); return Text.literal("What is this for?");
} }
@Nullable @Nullable

View file

@ -35,9 +35,9 @@ import net.minecraft.nbt.NbtCompound;
import net.minecraft.nbt.NbtHelper; import net.minecraft.nbt.NbtHelper;
import net.minecraft.network.packet.s2c.play.BlockEntityUpdateS2CPacket; import net.minecraft.network.packet.s2c.play.BlockEntityUpdateS2CPacket;
import net.minecraft.server.world.ServerWorld; import net.minecraft.server.world.ServerWorld;
import net.minecraft.text.LiteralText;
import net.minecraft.text.Text; import net.minecraft.text.Text;
import net.minecraft.text.TranslatableText; import net.minecraft.text.Text;
import net.minecraft.text.Text;
import net.minecraft.util.Formatting; import net.minecraft.util.Formatting;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction; import net.minecraft.util.math.Direction;
@ -265,7 +265,7 @@ public class CableBlockEntity extends BlockEntity
@Override @Override
public void addInfo(List<Text> info, boolean isReal, boolean hasData) { public void addInfo(List<Text> info, boolean isReal, boolean hasData) {
info.add( info.add(
new TranslatableText("techreborn.tooltip.transferRate") Text.translatable("techreborn.tooltip.transferRate")
.formatted(Formatting.GRAY) .formatted(Formatting.GRAY)
.append(": ") .append(": ")
.append(PowerSystem.getLocalizedPower(getCableType().transferRate)) .append(PowerSystem.getLocalizedPower(getCableType().transferRate))
@ -274,17 +274,17 @@ public class CableBlockEntity extends BlockEntity
); );
info.add( info.add(
new TranslatableText("techreborn.tooltip.tier") Text.translatable("techreborn.tooltip.tier")
.formatted(Formatting.GRAY) .formatted(Formatting.GRAY)
.append(": ") .append(": ")
.append( .append(
new LiteralText(StringUtils.toFirstCapitalAllLowercase(getCableType().tier.toString())) Text.literal(StringUtils.toFirstCapitalAllLowercase(getCableType().tier.toString()))
.formatted(Formatting.GOLD) .formatted(Formatting.GOLD)
) )
); );
if (!getCableType().canKill) { if (!getCableType().canKill) {
info.add(new TranslatableText("techreborn.tooltip.cable.can_cover").formatted(Formatting.GRAY)); info.add(Text.translatable("techreborn.tooltip.cable.can_cover").formatted(Formatting.GRAY));
} }
} }

View file

@ -30,9 +30,9 @@ import net.minecraft.block.BlockState;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NbtCompound; import net.minecraft.nbt.NbtCompound;
import net.minecraft.text.LiteralText;
import net.minecraft.text.Text; import net.minecraft.text.Text;
import net.minecraft.text.TranslatableText; import net.minecraft.text.Text;
import net.minecraft.text.Text;
import net.minecraft.util.Formatting; import net.minecraft.util.Formatting;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction; import net.minecraft.util.math.Direction;
@ -217,41 +217,41 @@ public class SolarPanelBlockEntity extends PowerAcceptorBlockEntity implements I
} }
info.add( info.add(
new TranslatableText("reborncore.tooltip.energy.maxEnergy") Text.translatable("reborncore.tooltip.energy.maxEnergy")
.formatted(Formatting.GRAY) .formatted(Formatting.GRAY)
.append(": ") .append(": ")
.append( .append(
new LiteralText(PowerSystem.getLocalizedPower(getMaxStoredPower())) Text.literal(PowerSystem.getLocalizedPower(getMaxStoredPower()))
.formatted(Formatting.GOLD) .formatted(Formatting.GOLD)
) )
); );
info.add( info.add(
new TranslatableText("techreborn.tooltip.generationRate.day") Text.translatable("techreborn.tooltip.generationRate.day")
.formatted(Formatting.GRAY) .formatted(Formatting.GRAY)
.append(": ") .append(": ")
.append( .append(
new LiteralText(PowerSystem.getLocalizedPower(panel.generationRateD)) Text.literal(PowerSystem.getLocalizedPower(panel.generationRateD))
.formatted(Formatting.GOLD) .formatted(Formatting.GOLD)
) )
); );
info.add( info.add(
new TranslatableText("techreborn.tooltip.generationRate.night") Text.translatable("techreborn.tooltip.generationRate.night")
.formatted(Formatting.GRAY) .formatted(Formatting.GRAY)
.append(": ") .append(": ")
.append( .append(
new LiteralText(PowerSystem.getLocalizedPower(panel.generationRateN)) Text.literal(PowerSystem.getLocalizedPower(panel.generationRateN))
.formatted(Formatting.GOLD) .formatted(Formatting.GOLD)
) )
); );
info.add( info.add(
new TranslatableText("reborncore.tooltip.energy.tier") Text.translatable("reborncore.tooltip.energy.tier")
.formatted(Formatting.GRAY) .formatted(Formatting.GRAY)
.append(": ") .append(": ")
.append( .append(
new LiteralText(StringUtils.toFirstCapitalAllLowercase(getTier().toString())) Text.literal(StringUtils.toFirstCapitalAllLowercase(getTier().toString()))
.formatted(Formatting.GOLD) .formatted(Formatting.GOLD)
) )
); );

View file

@ -33,7 +33,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NbtCompound; import net.minecraft.nbt.NbtCompound;
import net.minecraft.server.network.ServerPlayerEntity; import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.sound.SoundCategory; import net.minecraft.sound.SoundCategory;
import net.minecraft.text.TranslatableText; import net.minecraft.text.Text;
import net.minecraft.util.Formatting; import net.minecraft.util.Formatting;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World; import net.minecraft.world.World;
@ -63,7 +63,7 @@ public class AlarmBlockEntity extends BlockEntity
} }
if (entity instanceof ServerPlayerEntity serverPlayerEntity) { if (entity instanceof ServerPlayerEntity serverPlayerEntity) {
ChatUtils.sendNoSpamMessage(serverPlayerEntity, MessageIDs.alarmID, new TranslatableText("techreborn.message.alarm") ChatUtils.sendNoSpamMessage(serverPlayerEntity, MessageIDs.alarmID, Text.translatable("techreborn.message.alarm")
.formatted(Formatting.GRAY) .formatted(Formatting.GRAY)
.append(" Alarm ") .append(" Alarm ")
.append(String.valueOf(selectedSound))); .append(String.valueOf(selectedSound)));

View file

@ -29,9 +29,9 @@ import net.minecraft.block.entity.BlockEntity;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NbtCompound; import net.minecraft.nbt.NbtCompound;
import net.minecraft.text.LiteralText;
import net.minecraft.text.Text; import net.minecraft.text.Text;
import net.minecraft.text.TranslatableText; import net.minecraft.text.Text;
import net.minecraft.text.Text;
import net.minecraft.util.Identifier; import net.minecraft.util.Identifier;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction; import net.minecraft.util.math.Direction;
@ -87,22 +87,22 @@ public class FusionControlComputerBlockEntity extends GenericMachineBlockEntity
public Text getStateText() { public Text getStateText() {
if (state == -1) { if (state == -1) {
return LiteralText.EMPTY; return Text.empty();
} else if (state == 0) { } else if (state == 0) {
return new TranslatableText("gui.techreborn.fusion.norecipe"); return Text.translatable("gui.techreborn.fusion.norecipe");
} else if (state == 1) { } else if (state == 1) {
FusionReactorRecipe r = getCurrentRecipeFromID(); FusionReactorRecipe r = getCurrentRecipeFromID();
if (r == null) { if (r == null) {
return new TranslatableText("gui.techreborn.fusion.charging"); return Text.translatable("gui.techreborn.fusion.charging");
} }
int percentage = percentage(r.getStartEnergy(), getEnergy()); int percentage = percentage(r.getStartEnergy(), getEnergy());
return new TranslatableText("gui.techreborn.fusion.chargingdetailed", return Text.translatable("gui.techreborn.fusion.chargingdetailed",
new Object[]{StringUtils.getPercentageText(percentage)} new Object[]{StringUtils.getPercentageText(percentage)}
); );
} else if (state == 2) { } else if (state == 2) {
return new TranslatableText("gui.techreborn.fusion.crafting"); return Text.translatable("gui.techreborn.fusion.crafting");
} }
return LiteralText.EMPTY; return Text.empty();
} }
/** /**

View file

@ -1,7 +1,7 @@
package techreborn.blockentity.machine.tier0.block; package techreborn.blockentity.machine.tier0.block;
import net.minecraft.text.Text; import net.minecraft.text.Text;
import net.minecraft.text.TranslatableText; import net.minecraft.text.Text;
/** /**
* <b>Interface describing different statuses of a Processing Machine</b> * <b>Interface describing different statuses of a Processing Machine</b>

View file

@ -1,8 +1,8 @@
package techreborn.blockentity.machine.tier0.block.blockbreaker; package techreborn.blockentity.machine.tier0.block.blockbreaker;
import net.minecraft.text.LiteralText;
import net.minecraft.text.Text; import net.minecraft.text.Text;
import net.minecraft.text.TranslatableText; import net.minecraft.text.Text;
import net.minecraft.text.Text;
import reborncore.common.util.Color; import reborncore.common.util.Color;
import techreborn.blockentity.machine.tier0.block.ProcessingStatus; import techreborn.blockentity.machine.tier0.block.ProcessingStatus;
@ -14,13 +14,13 @@ import techreborn.blockentity.machine.tier0.block.ProcessingStatus;
* @author SimonFlapse * @author SimonFlapse
*/ */
enum BlockBreakerStatus implements ProcessingStatus { enum BlockBreakerStatus implements ProcessingStatus {
IDLE(new TranslatableText("gui.techreborn.block_breaker.idle"), Color.BLUE), IDLE(Text.translatable("gui.techreborn.block_breaker.idle"), Color.BLUE),
IDLE_PAUSED(new TranslatableText("gui.techreborn.block.idle_redstone"), Color.BLUE), IDLE_PAUSED(Text.translatable("gui.techreborn.block.idle_redstone"), Color.BLUE),
OUTPUT_FULL(new TranslatableText("gui.techreborn.block.output_full"), Color.RED), OUTPUT_FULL(Text.translatable("gui.techreborn.block.output_full"), Color.RED),
NO_ENERGY(new TranslatableText("gui.techreborn.block.no_energy"), Color.RED), NO_ENERGY(Text.translatable("gui.techreborn.block.no_energy"), Color.RED),
INTERRUPTED(new TranslatableText("gui.techreborn.block.interrupted"), Color.RED), INTERRUPTED(Text.translatable("gui.techreborn.block.interrupted"), Color.RED),
OUTPUT_BLOCKED(new TranslatableText("gui.techreborn.block.output_blocked"), Color.RED), OUTPUT_BLOCKED(Text.translatable("gui.techreborn.block.output_blocked"), Color.RED),
PROCESSING(new TranslatableText("gui.techreborn.block_breaker.processing"), Color.DARK_GREEN); PROCESSING(Text.translatable("gui.techreborn.block_breaker.processing"), Color.DARK_GREEN);
private final Text text; private final Text text;
private final int color; private final int color;
@ -40,12 +40,12 @@ enum BlockBreakerStatus implements ProcessingStatus {
progress = Math.max(progress, 0); progress = Math.max(progress, 0);
if (this == PROCESSING) { if (this == PROCESSING) {
return new TranslatableText("gui.techreborn.block.progress.active", new LiteralText("" + progress + "%")); return Text.translatable("gui.techreborn.block.progress.active", Text.literal("" + progress + "%"));
} else if (this == IDLE || this == INTERRUPTED) { } else if (this == IDLE || this == INTERRUPTED) {
return new TranslatableText("gui.techreborn.block.progress.stopped"); return Text.translatable("gui.techreborn.block.progress.stopped");
} }
return new TranslatableText("gui.techreborn.block.progress.paused", new LiteralText("" + progress + "%")); return Text.translatable("gui.techreborn.block.progress.paused", Text.literal("" + progress + "%"));
} }
@Override @Override

View file

@ -1,8 +1,8 @@
package techreborn.blockentity.machine.tier0.block.blockplacer; package techreborn.blockentity.machine.tier0.block.blockplacer;
import net.minecraft.text.LiteralText;
import net.minecraft.text.Text; import net.minecraft.text.Text;
import net.minecraft.text.TranslatableText; import net.minecraft.text.Text;
import net.minecraft.text.Text;
import reborncore.common.util.Color; import reborncore.common.util.Color;
import techreborn.blockentity.machine.tier0.block.ProcessingStatus; import techreborn.blockentity.machine.tier0.block.ProcessingStatus;
@ -14,12 +14,12 @@ import techreborn.blockentity.machine.tier0.block.ProcessingStatus;
* @author SimonFlapse * @author SimonFlapse
*/ */
enum BlockPlacerStatus implements ProcessingStatus { enum BlockPlacerStatus implements ProcessingStatus {
IDLE(new TranslatableText("gui.techreborn.block_placer.idle"), Color.BLUE), IDLE(Text.translatable("gui.techreborn.block_placer.idle"), Color.BLUE),
IDLE_PAUSED(new TranslatableText("gui.techreborn.block.idle_redstone"), Color.BLUE), IDLE_PAUSED(Text.translatable("gui.techreborn.block.idle_redstone"), Color.BLUE),
NO_ENERGY(new TranslatableText("gui.techreborn.block.no_energy"), Color.RED), NO_ENERGY(Text.translatable("gui.techreborn.block.no_energy"), Color.RED),
INTERRUPTED(new TranslatableText("gui.techreborn.block.interrupted"), Color.RED), INTERRUPTED(Text.translatable("gui.techreborn.block.interrupted"), Color.RED),
OUTPUT_BLOCKED(new TranslatableText("gui.techreborn.block.output_blocked"), Color.RED), OUTPUT_BLOCKED(Text.translatable("gui.techreborn.block.output_blocked"), Color.RED),
PROCESSING(new TranslatableText("gui.techreborn.block_placer.processing"), Color.DARK_GREEN); PROCESSING(Text.translatable("gui.techreborn.block_placer.processing"), Color.DARK_GREEN);
private final Text text; private final Text text;
private final int color; private final int color;
@ -39,11 +39,11 @@ enum BlockPlacerStatus implements ProcessingStatus {
progress = Math.max(progress, 0); progress = Math.max(progress, 0);
if (this == PROCESSING) { if (this == PROCESSING) {
return new TranslatableText("gui.techreborn.block.progress.active", new LiteralText("" + progress + "%")); return Text.translatable("gui.techreborn.block.progress.active", Text.literal("" + progress + "%"));
} else if (this == IDLE || this == INTERRUPTED) { } else if (this == IDLE || this == INTERRUPTED) {
return new TranslatableText("gui.techreborn.block.progress.stopped"); return Text.translatable("gui.techreborn.block.progress.stopped");
} else { } else {
return new TranslatableText("gui.techreborn.block.progress.paused", new LiteralText("" + progress + "%")); return Text.translatable("gui.techreborn.block.progress.paused", Text.literal("" + progress + "%"));
} }
} }

View file

@ -124,6 +124,11 @@ public class AutoCraftingTableBlockEntity extends PowerAcceptorBlockEntity
private CraftingInventory getCraftingInventory() { private CraftingInventory getCraftingInventory() {
if (inventoryCrafting == null) { if (inventoryCrafting == null) {
inventoryCrafting = new CraftingInventory(new ScreenHandler(null, -1) { inventoryCrafting = new CraftingInventory(new ScreenHandler(null, -1) {
@Override
public ItemStack transferSlot(PlayerEntity player, int index) {
return ItemStack.EMPTY;
}
@Override @Override
public boolean canUse(PlayerEntity playerIn) { public boolean canUse(PlayerEntity playerIn) {
return false; return false;

View file

@ -433,6 +433,11 @@ public class RollingMachineBlockEntity extends PowerAcceptorBlockEntity
super(null, 0); super(null, 0);
} }
@Override
public ItemStack transferSlot(PlayerEntity player, int index) {
return ItemStack.EMPTY;
}
@Override @Override
public boolean canUse(final PlayerEntity playerEntity) { public boolean canUse(final PlayerEntity playerEntity) {
return true; return true;

View file

@ -28,9 +28,9 @@ import net.minecraft.block.BlockState;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NbtCompound; import net.minecraft.nbt.NbtCompound;
import net.minecraft.text.LiteralText;
import net.minecraft.text.Text; import net.minecraft.text.Text;
import net.minecraft.text.TranslatableText; import net.minecraft.text.Text;
import net.minecraft.text.Text;
import net.minecraft.util.Formatting; import net.minecraft.util.Formatting;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World; import net.minecraft.world.World;
@ -181,18 +181,18 @@ public class TankUnitBaseBlockEntity extends MachineBaseBlockEntity implements I
if (isReal || hasData) { if (isReal || hasData) {
if (!this.tank.getFluidInstance().isEmpty()) { if (!this.tank.getFluidInstance().isEmpty()) {
info.add( info.add(
new LiteralText(String.valueOf(this.tank.getFluidAmount())) Text.literal(String.valueOf(this.tank.getFluidAmount()))
.append(new TranslatableText("techreborn.tooltip.unit.divider")) .append(Text.translatable("techreborn.tooltip.unit.divider"))
.append(WordUtils.capitalize(FluidUtils.getFluidName(this.tank.getFluid()))) .append(WordUtils.capitalize(FluidUtils.getFluidName(this.tank.getFluid())))
); );
} else { } else {
info.add(new TranslatableText("techreborn.tooltip.unit.empty")); info.add(Text.translatable("techreborn.tooltip.unit.empty"));
} }
} }
info.add( info.add(
new TranslatableText("techreborn.tooltip.unit.capacity") Text.translatable("techreborn.tooltip.unit.capacity")
.formatted(Formatting.GRAY) .formatted(Formatting.GRAY)
.append(new LiteralText(String.valueOf(this.tank.getFluidValueCapacity())) .append(Text.literal(String.valueOf(this.tank.getFluidValueCapacity()))
.formatted(Formatting.GOLD)) .formatted(Formatting.GOLD))
); );
} }

View file

@ -33,9 +33,9 @@ import net.minecraft.block.BlockState;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NbtCompound; import net.minecraft.nbt.NbtCompound;
import net.minecraft.text.LiteralText;
import net.minecraft.text.Text; import net.minecraft.text.Text;
import net.minecraft.text.TranslatableText; import net.minecraft.text.Text;
import net.minecraft.text.Text;
import net.minecraft.util.Formatting; import net.minecraft.util.Formatting;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction; import net.minecraft.util.math.Direction;
@ -423,27 +423,27 @@ public class StorageUnitBaseBlockEntity extends MachineBaseBlockEntity implement
if (isReal || hasData) { if (isReal || hasData) {
if (!this.isEmpty()) { if (!this.isEmpty()) {
info.add( info.add(
new LiteralText(String.valueOf(this.getCurrentCapacity())) Text.literal(String.valueOf(this.getCurrentCapacity()))
.append(new TranslatableText("techreborn.tooltip.unit.divider")) .append(Text.translatable("techreborn.tooltip.unit.divider"))
.append(this.getStoredStack().getName()) .append(this.getStoredStack().getName())
); );
} else { } else {
info.add(new TranslatableText("techreborn.tooltip.unit.empty")); info.add(Text.translatable("techreborn.tooltip.unit.empty"));
} }
} }
info.add( info.add(
new TranslatableText("techreborn.tooltip.unit.capacity") Text.translatable("techreborn.tooltip.unit.capacity")
.formatted(Formatting.GRAY) .formatted(Formatting.GRAY)
.append( .append(
new LiteralText(String.valueOf(this.getMaxCapacity())) Text.literal(String.valueOf(this.getMaxCapacity()))
.formatted(Formatting.GOLD) .formatted(Formatting.GOLD)
.append(" ") .append(" ")
.append(new TranslatableText("techreborn.tooltip.unit.items")) .append(Text.translatable("techreborn.tooltip.unit.items"))
.append(" (") .append(" (")
.append(String.valueOf(this.getMaxCapacity() / 64)) .append(String.valueOf(this.getMaxCapacity() / 64))
.append(" ") .append(" ")
.append(new TranslatableText("techreborn.tooltip.unit.stacks")) .append(Text.translatable("techreborn.tooltip.unit.stacks"))
.append(")") .append(")")
) )
); );

View file

@ -30,7 +30,7 @@ import net.minecraft.block.entity.BlockEntityType;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.text.Text; import net.minecraft.text.Text;
import net.minecraft.text.TranslatableText; import net.minecraft.text.Text;
import net.minecraft.util.Formatting; import net.minecraft.util.Formatting;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction; import net.minecraft.util.math.Direction;
@ -146,28 +146,28 @@ public class TransformerBlockEntity extends PowerAcceptorBlockEntity implements
@Override @Override
public void addInfo(List<Text> info, boolean isReal, boolean hasData) { public void addInfo(List<Text> info, boolean isReal, boolean hasData) {
info.add( info.add(
new TranslatableText("reborncore.tooltip.energy.inputRate") Text.translatable("reborncore.tooltip.energy.inputRate")
.formatted(Formatting.GRAY) .formatted(Formatting.GRAY)
.append(": ") .append(": ")
.append(PowerSystem.getLocalizedPower(getMaxInput(null))) .append(PowerSystem.getLocalizedPower(getMaxInput(null)))
.formatted(Formatting.GOLD) .formatted(Formatting.GOLD)
); );
info.add( info.add(
new TranslatableText("techreborn.tooltip.input_tier") Text.translatable("techreborn.tooltip.input_tier")
.formatted(Formatting.GRAY) .formatted(Formatting.GRAY)
.append(": ") .append(": ")
.append(StringUtils.toFirstCapitalAllLowercase(inputTier.toString())) .append(StringUtils.toFirstCapitalAllLowercase(inputTier.toString()))
.formatted(Formatting.GOLD) .formatted(Formatting.GOLD)
); );
info.add( info.add(
new TranslatableText("reborncore.tooltip.energy.outputRate") Text.translatable("reborncore.tooltip.energy.outputRate")
.formatted(Formatting.GRAY) .formatted(Formatting.GRAY)
.append(": ") .append(": ")
.append(PowerSystem.getLocalizedPower(getMaxOutput(null))) .append(PowerSystem.getLocalizedPower(getMaxOutput(null)))
.formatted(Formatting.GOLD) .formatted(Formatting.GOLD)
); );
info.add( info.add(
new TranslatableText("techreborn.tooltip.output_tier") Text.translatable("techreborn.tooltip.output_tier")
.formatted(Formatting.GRAY) .formatted(Formatting.GRAY)
.append(": ") .append(": ")
.append(StringUtils.toFirstCapitalAllLowercase(outputTier.toString())) .append(StringUtils.toFirstCapitalAllLowercase(outputTier.toString()))

View file

@ -35,7 +35,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.sound.BlockSoundGroup; import net.minecraft.sound.BlockSoundGroup;
import net.minecraft.sound.SoundCategory; import net.minecraft.sound.SoundCategory;
import net.minecraft.text.Text; import net.minecraft.text.Text;
import net.minecraft.text.TranslatableText; import net.minecraft.text.Text;
import net.minecraft.util.ActionResult; import net.minecraft.util.ActionResult;
import net.minecraft.util.Formatting; import net.minecraft.util.Formatting;
import net.minecraft.util.Hand; import net.minecraft.util.Hand;
@ -82,6 +82,6 @@ public class BlockFusionCoil extends Block {
@Override @Override
public void appendTooltip(ItemStack stack, @Nullable BlockView worldIn, List<Text> tooltip, TooltipContext flagIn) { public void appendTooltip(ItemStack stack, @Nullable BlockView worldIn, List<Text> tooltip, TooltipContext flagIn) {
super.appendTooltip(stack, worldIn, tooltip, flagIn); super.appendTooltip(stack, worldIn, tooltip, flagIn);
tooltip.add(new TranslatableText("techreborn.tooltip.fusion_coil").formatted(Formatting.BLUE)); tooltip.add(Text.translatable("techreborn.tooltip.fusion_coil").formatted(Formatting.BLUE));
} }
} }

View file

@ -35,8 +35,8 @@ import net.minecraft.item.ItemStack;
import net.minecraft.server.network.ServerPlayerEntity; import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.state.StateManager; import net.minecraft.state.StateManager;
import net.minecraft.state.property.EnumProperty; import net.minecraft.state.property.EnumProperty;
import net.minecraft.text.LiteralText; import net.minecraft.text.Text;
import net.minecraft.text.TranslatableText; import net.minecraft.text.Text;
import net.minecraft.util.ActionResult; import net.minecraft.util.ActionResult;
import net.minecraft.util.Formatting; import net.minecraft.util.Formatting;
import net.minecraft.util.Hand; import net.minecraft.util.Hand;
@ -126,11 +126,11 @@ public class PlayerDetectorBlock extends BlockMachineBase {
if (playerIn instanceof ServerPlayerEntity serverPlayerEntity) { if (playerIn instanceof ServerPlayerEntity serverPlayerEntity) {
ChatUtils.sendNoSpamMessage(serverPlayerEntity, MessageIDs.playerDetectorID, ChatUtils.sendNoSpamMessage(serverPlayerEntity, MessageIDs.playerDetectorID,
new TranslatableText("techreborn.message.detects") Text.translatable("techreborn.message.detects")
.formatted(Formatting.GRAY) .formatted(Formatting.GRAY)
.append(" ") .append(" ")
.append( .append(
new LiteralText(StringUtils.toFirstCapital(newType.asString())) Text.literal(StringUtils.toFirstCapital(newType.asString()))
.formatted(color) .formatted(color)
) )
); );

View file

@ -33,14 +33,13 @@ import net.minecraft.state.StateManager;
import net.minecraft.state.property.BooleanProperty; import net.minecraft.state.property.BooleanProperty;
import net.minecraft.state.property.DirectionProperty; import net.minecraft.state.property.DirectionProperty;
import net.minecraft.state.property.Properties; import net.minecraft.state.property.Properties;
import net.minecraft.text.TranslatableText; import net.minecraft.text.Text;
import net.minecraft.util.ActionResult; import net.minecraft.util.ActionResult;
import net.minecraft.util.Hand; import net.minecraft.util.Hand;
import net.minecraft.util.hit.BlockHitResult; import net.minecraft.util.hit.BlockHitResult;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction; import net.minecraft.util.math.Direction;
import net.minecraft.util.shape.VoxelShape; import net.minecraft.util.shape.VoxelShape;
import net.minecraft.util.shape.VoxelShapes;
import net.minecraft.world.BlockView; import net.minecraft.world.BlockView;
import net.minecraft.world.World; import net.minecraft.world.World;
import reborncore.common.BaseBlockEntityProvider; import reborncore.common.BaseBlockEntityProvider;
@ -113,7 +112,7 @@ public class ResinBasinBlock extends BaseBlockEntityProvider {
if (worldIn.getBlockState(pos.offset(facing.getOpposite())).getBlock() != TRContent.RUBBER_LOG) { if (worldIn.getBlockState(pos.offset(facing.getOpposite())).getBlock() != TRContent.RUBBER_LOG) {
worldIn.setBlockState(pos, Blocks.AIR.getDefaultState()); worldIn.setBlockState(pos, Blocks.AIR.getDefaultState());
WorldUtils.dropItem(this.asItem(), worldIn, pos); WorldUtils.dropItem(this.asItem(), worldIn, pos);
placer.sendSystemMessage(new TranslatableText("techreborn.tooltip.invalid_basin_placement"), UUID.randomUUID()); placer.sendMessage(Text.translatable("techreborn.tooltip.invalid_basin_placement"));
} }
} }

View file

@ -35,7 +35,7 @@ import net.minecraft.state.property.BooleanProperty;
import net.minecraft.state.property.DirectionProperty; import net.minecraft.state.property.DirectionProperty;
import net.minecraft.state.property.Properties; import net.minecraft.state.property.Properties;
import net.minecraft.text.Text; import net.minecraft.text.Text;
import net.minecraft.text.TranslatableText; import net.minecraft.text.Text;
import net.minecraft.util.ActionResult; import net.minecraft.util.ActionResult;
import net.minecraft.util.Formatting; import net.minecraft.util.Formatting;
import net.minecraft.util.Hand; import net.minecraft.util.Hand;
@ -161,7 +161,7 @@ public class BlockAlarm extends BaseBlockEntityProvider {
@Override @Override
public void appendTooltip(ItemStack stack, @Nullable BlockView worldIn, List<Text> tooltip, TooltipContext flagIn) { public void appendTooltip(ItemStack stack, @Nullable BlockView worldIn, List<Text> tooltip, TooltipContext flagIn) {
tooltip.add(new TranslatableText("techreborn.tooltip.alarm").formatted(Formatting.GRAY)); tooltip.add(Text.translatable("techreborn.tooltip.alarm").formatted(Formatting.GRAY));
} }
} }

View file

@ -43,6 +43,7 @@ import net.minecraft.util.Hand;
import net.minecraft.util.hit.BlockHitResult; import net.minecraft.util.hit.BlockHitResult;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction; import net.minecraft.util.math.Direction;
import net.minecraft.util.math.random.AbstractRandom;
import net.minecraft.world.World; import net.minecraft.world.World;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
import reborncore.common.util.WorldUtils; import reborncore.common.util.WorldUtils;
@ -111,7 +112,7 @@ public class BlockRubberLog extends PillarBlock {
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
@Override @Override
public void randomTick(BlockState state, ServerWorld worldIn, BlockPos pos, Random random) { public void randomTick(BlockState state, ServerWorld worldIn, BlockPos pos, AbstractRandom random) {
super.randomTick(state, worldIn, pos, random); super.randomTick(state, worldIn, pos, random);
if (state.get(AXIS) != Direction.Axis.Y) return; if (state.get(AXIS) != Direction.Axis.Y) return;
if (!state.get(SHOULD_SAP)) return; if (!state.get(SHOULD_SAP)) return;

View file

@ -40,9 +40,9 @@ import net.minecraft.fluid.Fluid;
import net.minecraft.fluid.Fluids; import net.minecraft.fluid.Fluids;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.text.LiteralText;
import net.minecraft.text.Text; import net.minecraft.text.Text;
import net.minecraft.text.TranslatableText; import net.minecraft.text.Text;
import net.minecraft.text.Text;
import net.minecraft.util.Formatting; import net.minecraft.util.Formatting;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.registry.Registry; import net.minecraft.util.registry.Registry;
@ -116,19 +116,19 @@ public class StackToolTipHandler implements ItemTooltipCallback {
} }
if (item == TRContent.Upgrades.SUPERCONDUCTOR.item && Screen.hasControlDown()) { if (item == TRContent.Upgrades.SUPERCONDUCTOR.item && Screen.hasControlDown()) {
tooltipLines.add(new LiteralText(Formatting.GOLD + "Blame obstinate_3 for this")); tooltipLines.add(Text.literal(Formatting.GOLD + "Blame obstinate_3 for this"));
} }
if (item == TRContent.OMNI_TOOL) { if (item == TRContent.OMNI_TOOL) {
tooltipLines.add(new LiteralText(Formatting.YELLOW + I18n.translate("techreborn.tooltip.omnitool_motto"))); tooltipLines.add(Text.literal(Formatting.YELLOW + I18n.translate("techreborn.tooltip.omnitool_motto")));
} }
if (block == TRContent.Machine.INDUSTRIAL_CENTRIFUGE.block && Screen.hasControlDown()) { if (block == TRContent.Machine.INDUSTRIAL_CENTRIFUGE.block && Screen.hasControlDown()) {
tooltipLines.add(new LiteralText("Round and round it goes")); tooltipLines.add(Text.literal("Round and round it goes"));
} }
if (UNOBTAINABLE_ORES.contains(block)) { if (UNOBTAINABLE_ORES.contains(block)) {
tooltipLines.add(new TranslatableText("techreborn.tooltip.unobtainable").formatted(Formatting.AQUA)); tooltipLines.add(Text.translatable("techreborn.tooltip.unobtainable").formatted(Formatting.AQUA));
} else if (OreDepthSyncHandler.getOreDepthMap().containsKey(block)) { } else if (OreDepthSyncHandler.getOreDepthMap().containsKey(block)) {
OreDepth oreDepth = OreDepthSyncHandler.getOreDepthMap().get(block); OreDepth oreDepth = OreDepthSyncHandler.getOreDepthMap().get(block);
Text text = getOreDepthText(oreDepth); Text text = getOreDepthText(oreDepth);
@ -140,10 +140,10 @@ public class StackToolTipHandler implements ItemTooltipCallback {
return Registry.ITEM.getId(item).getNamespace().equals("techreborn"); return Registry.ITEM.getId(item).getNamespace().equals("techreborn");
} }
private static TranslatableText getOreDepthText(OreDepth depth) { private static Text getOreDepthText(OreDepth depth) {
return new TranslatableText("techreborn.tooltip.ores.%s".formatted(depth.dimension().name().toLowerCase(Locale.ROOT)), return Text.translatable("techreborn.tooltip.ores.%s".formatted(depth.dimension().name().toLowerCase(Locale.ROOT)),
new LiteralText(String.valueOf(depth.minY())).formatted(Formatting.YELLOW), Text.literal(String.valueOf(depth.minY())).formatted(Formatting.YELLOW),
new LiteralText(String.valueOf(depth.maxY())).formatted(Formatting.YELLOW) Text.literal(String.valueOf(depth.maxY())).formatted(Formatting.YELLOW)
); );
} }
} }

View file

@ -26,7 +26,7 @@ package techreborn.client.events;
import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.resource.language.I18n; import net.minecraft.client.resource.language.I18n;
import net.minecraft.text.LiteralText; import net.minecraft.text.Text;
import net.minecraft.text.Text; import net.minecraft.text.Text;
import net.minecraft.util.Formatting; import net.minecraft.util.Formatting;
import techreborn.config.TechRebornConfig; import techreborn.config.TechRebornConfig;
@ -63,7 +63,7 @@ public class ToolTipAssistUtils {
// Add reminder that they can use shift to calculate the entire stack // Add reminder that they can use shift to calculate the entire stack
if (shouldStackCalculate && !shiftHeld) { if (shouldStackCalculate && !shiftHeld) {
tips.add(new LiteralText(instructColour + I18n.translate("techreborn.tooltip.stack_info"))); tips.add(Text.literal(instructColour + I18n.translate("techreborn.tooltip.stack_info")));
} }
return tips; return tips;
@ -82,10 +82,10 @@ public class ToolTipAssistUtils {
String[] infoLines = info.split("\\r?\\n"); String[] infoLines = info.split("\\r?\\n");
for (String infoLine : infoLines) { for (String infoLine : infoLines) {
list.add(1, new LiteralText(infoColour + infoLine)); list.add(1, Text.literal(infoColour + infoLine));
} }
} else { } else {
list.add(new LiteralText(instructColour + I18n.translate("techreborn.tooltip.more_info"))); list.add(Text.literal(instructColour + I18n.translate("techreborn.tooltip.more_info")));
} }
} }
} }
@ -104,11 +104,11 @@ public class ToolTipAssistUtils {
} }
private static Text getPositive(String text, int value, String unit) { private static Text getPositive(String text, int value, String unit) {
return new LiteralText(posColour + getStatStringUnit(text, value, unit)); return Text.literal(posColour + getStatStringUnit(text, value, unit));
} }
private static Text getNegative(String text, int value, String unit) { private static Text getNegative(String text, int value, String unit) {
return new LiteralText(negColour + getStatStringUnit(text, value, unit)); return Text.literal(negColour + getStatStringUnit(text, value, unit));
} }
private static String getStatStringUnit(String text, int value, String unit) { private static String getStatStringUnit(String text, int value, String unit) {

View file

@ -27,7 +27,7 @@ package techreborn.client.gui;
import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.util.math.MatrixStack; import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.text.LiteralText; import net.minecraft.text.Text;
import net.minecraft.text.Text; import net.minecraft.text.Text;
import reborncore.client.gui.builder.GuiBase; import reborncore.client.gui.builder.GuiBase;
import reborncore.client.gui.builder.widget.GuiButtonUpDown; import reborncore.client.gui.builder.widget.GuiButtonUpDown;
@ -75,7 +75,7 @@ public class GuiAESU extends GuiBase<BuiltScreenHandler> {
if (!hideGuiElements()) { if (!hideGuiElements()) {
matrixStack.push(); matrixStack.push();
matrixStack.scale(0.6f, 0.6f, 1.0f); matrixStack.scale(0.6f, 0.6f, 1.0f);
Text text = new LiteralText(PowerSystem.getLocalizedPowerNoSuffix(blockEntity.getEnergy())) Text text = Text.literal(PowerSystem.getLocalizedPowerNoSuffix(blockEntity.getEnergy()))
.append("/") .append("/")
.append(PowerSystem.getLocalizedPowerNoSuffix(blockEntity.getMaxStoredPower())) .append(PowerSystem.getLocalizedPowerNoSuffix(blockEntity.getMaxStoredPower()))
.append(" ") .append(" ")

View file

@ -26,7 +26,7 @@ package techreborn.client.gui;
import net.minecraft.client.util.math.MatrixStack; import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.text.LiteralText; import net.minecraft.text.Text;
import net.minecraft.text.Text; import net.minecraft.text.Text;
import reborncore.client.gui.builder.GuiBase; import reborncore.client.gui.builder.GuiBase;
import reborncore.common.screen.BuiltScreenHandler; import reborncore.common.screen.BuiltScreenHandler;
@ -59,7 +59,7 @@ public class GuiBatbox extends GuiBase<BuiltScreenHandler> {
if (!hideGuiElements()) { if (!hideGuiElements()) {
matrixStack.push(); matrixStack.push();
matrixStack.scale(0.6f, 0.6f, 1.0f); matrixStack.scale(0.6f, 0.6f, 1.0f);
Text text = new LiteralText(PowerSystem.getLocalizedPowerNoSuffix(blockEntity.getEnergy())) Text text = Text.literal(PowerSystem.getLocalizedPowerNoSuffix(blockEntity.getEnergy()))
.append("/") .append("/")
.append(PowerSystem.getLocalizedPower(blockEntity.getMaxStoredPower())); .append(PowerSystem.getLocalizedPower(blockEntity.getMaxStoredPower()));

View file

@ -27,7 +27,7 @@ package techreborn.client.gui;
import net.minecraft.client.gui.widget.ButtonWidget; import net.minecraft.client.gui.widget.ButtonWidget;
import net.minecraft.client.util.math.MatrixStack; import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.text.LiteralText; import net.minecraft.text.Text;
import net.minecraft.text.Text; import net.minecraft.text.Text;
import reborncore.client.ClientChunkManager; import reborncore.client.ClientChunkManager;
import reborncore.client.gui.builder.GuiBase; import reborncore.client.gui.builder.GuiBase;
@ -54,7 +54,7 @@ public class GuiChunkLoader extends GuiBase<BuiltScreenHandler> {
addDrawableChild(new GuiButtonUpDown(x + 64 + 24, y + 40, this, b -> onClick(-1), UpDownButtonType.REWIND)); addDrawableChild(new GuiButtonUpDown(x + 64 + 24, y + 40, this, b -> onClick(-1), UpDownButtonType.REWIND));
addDrawableChild(new GuiButtonUpDown(x + 64 + 36, y + 40, this, b -> onClick(-5), UpDownButtonType.FASTREWIND)); addDrawableChild(new GuiButtonUpDown(x + 64 + 36, y + 40, this, b -> onClick(-5), UpDownButtonType.FASTREWIND));
addDrawableChild(new ButtonWidget(x + 10, y + 70, 155, 20, new LiteralText("Toggle Loaded Chunks"), b -> ClientChunkManager.toggleLoadedChunks(blockEntity.getPos()))); addDrawableChild(new ButtonWidget(x + 10, y + 70, 155, 20, Text.literal("Toggle Loaded Chunks"), b -> ClientChunkManager.toggleLoadedChunks(blockEntity.getPos())));
} }
@Override @Override
@ -64,7 +64,7 @@ public class GuiChunkLoader extends GuiBase<BuiltScreenHandler> {
if (hideGuiElements()) return; if (hideGuiElements()) return;
Text text = new LiteralText("Radius: ") Text text = Text.literal("Radius: ")
.append(String.valueOf(blockEntity.getRadius())); .append(String.valueOf(blockEntity.getRadius()));
drawCentredText(matrixStack, text, 25, 4210752, layer); drawCentredText(matrixStack, text, 25, 4210752, layer);
} }

View file

@ -27,7 +27,7 @@ package techreborn.client.gui;
import net.minecraft.client.gui.widget.ButtonWidget; import net.minecraft.client.gui.widget.ButtonWidget;
import net.minecraft.client.util.math.MatrixStack; import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.text.LiteralText; import net.minecraft.text.Text;
import org.apache.commons.lang3.tuple.Pair; import org.apache.commons.lang3.tuple.Pair;
import reborncore.client.gui.builder.GuiBase; import reborncore.client.gui.builder.GuiBase;
import reborncore.client.gui.builder.widget.GuiButtonExtended; import reborncore.client.gui.builder.widget.GuiButtonExtended;
@ -89,7 +89,7 @@ public class GuiFusionReactor extends GuiBase<BuiltScreenHandler> {
addHologramButton(6, 4, 212, layer).clickHandler(this::hologramToggle); addHologramButton(6, 4, 212, layer).clickHandler(this::hologramToggle);
drawCentredText(matrixStack, blockEntity.getStateText(), 20, Color.BLUE.darker().getColor(), layer); drawCentredText(matrixStack, blockEntity.getStateText(), 20, Color.BLUE.darker().getColor(), layer);
if (blockEntity.state == 2) { if (blockEntity.state == 2) {
drawCentredText(matrixStack, new LiteralText(PowerSystem.getLocalizedPower(blockEntity.getPowerChange())).append("/t"), 30, Color.GREEN.darker().getColor(), layer); drawCentredText(matrixStack, Text.literal(PowerSystem.getLocalizedPower(blockEntity.getPowerChange())).append("/t"), 30, Color.GREEN.darker().getColor(), layer);
} }
} else { } else {
builder.drawMultiblockMissingBar(matrixStack, this, layer); builder.drawMultiblockMissingBar(matrixStack, this, layer);
@ -101,19 +101,19 @@ public class GuiFusionReactor extends GuiBase<BuiltScreenHandler> {
if (stackSize.get().getLeft() > 0) { if (stackSize.get().getLeft() > 0) {
drawCentredText(matrixStack, drawCentredText(matrixStack,
new LiteralText("Required Coils: ") Text.literal("Required Coils: ")
.append(String.valueOf(stackSize.get().getLeft())) .append(String.valueOf(stackSize.get().getLeft()))
.append("x64 +") .append("x64 +")
.append(String.valueOf(stackSize.get().getRight())) .append(String.valueOf(stackSize.get().getRight()))
, 25, 0xFFFFFF, layer); , 25, 0xFFFFFF, layer);
} else { } else {
drawCentredText(matrixStack, new LiteralText("Required Coils: ").append(String.valueOf(stackSize.get().getRight())), 25, 0xFFFFFF, layer); drawCentredText(matrixStack, Text.literal("Required Coils: ").append(String.valueOf(stackSize.get().getRight())), 25, 0xFFFFFF, layer);
} }
} }
} }
drawTextWithShadow(matrixStack, this.textRenderer, new LiteralText("Size: ").append(String.valueOf(blockEntity.size)), 83, 81, 0xFFFFFF); drawTextWithShadow(matrixStack, this.textRenderer, Text.literal("Size: ").append(String.valueOf(blockEntity.size)), 83, 81, 0xFFFFFF);
drawTextWithShadow(matrixStack, this.textRenderer, new LiteralText(String.valueOf(blockEntity.getPowerMultiplier())).append("x"), 10, 81, 0xFFFFFF); drawTextWithShadow(matrixStack, this.textRenderer, Text.literal(String.valueOf(blockEntity.getPowerMultiplier())).append("x"), 10, 81, 0xFFFFFF);
builder.drawMultiEnergyBar(matrixStack, this, 9, 19, this.blockEntity.getEnergy(), this.blockEntity.getMaxStoredPower(), mouseX, mouseY, 0, layer); builder.drawMultiEnergyBar(matrixStack, this, 9, 19, this.blockEntity.getEnergy(), this.blockEntity.getMaxStoredPower(), mouseX, mouseY, 0, layer);
} }

View file

@ -28,7 +28,7 @@ import com.mojang.blaze3d.systems.RenderSystem;
import net.minecraft.client.resource.language.I18n; import net.minecraft.client.resource.language.I18n;
import net.minecraft.client.util.math.MatrixStack; import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.text.LiteralText; import net.minecraft.text.Text;
import net.minecraft.text.Text; import net.minecraft.text.Text;
import net.minecraft.util.Identifier; import net.minecraft.util.Identifier;
import reborncore.client.gui.builder.GuiBase; import reborncore.client.gui.builder.GuiBase;
@ -70,7 +70,7 @@ public class GuiGreenhouseController extends GuiBase<BuiltScreenHandler> {
if (isPointInRect(68, 22, 16, 16, mouseX, mouseY)) { if (isPointInRect(68, 22, 16, 16, mouseX, mouseY)) {
List<Text> list = Arrays.stream(I18n.translate("techreborn.tooltip.greenhouse.upgrade_available") List<Text> list = Arrays.stream(I18n.translate("techreborn.tooltip.greenhouse.upgrade_available")
.split("\\r?\\n")) .split("\\r?\\n"))
.map(LiteralText::new) .map(Text::literal)
.collect(Collectors.toList()); .collect(Collectors.toList());
matrixStack.push(); matrixStack.push();
@ -93,7 +93,7 @@ public class GuiGreenhouseController extends GuiBase<BuiltScreenHandler> {
if (isPointInRect(68, 22, 16, 16, mouseX, mouseY)) { if (isPointInRect(68, 22, 16, 16, mouseX, mouseY)) {
List<Text> list = Arrays.stream(I18n.translate("techreborn.tooltip.greenhouse.upgrade_available") List<Text> list = Arrays.stream(I18n.translate("techreborn.tooltip.greenhouse.upgrade_available")
.split("\\r?\\n")) .split("\\r?\\n"))
.map(LiteralText::new) .map(Text::literal)
.collect(Collectors.toList()); .collect(Collectors.toList());
matrixStack.push(); matrixStack.push();

View file

@ -26,7 +26,7 @@ package techreborn.client.gui;
import net.minecraft.client.util.math.MatrixStack; import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.text.LiteralText; import net.minecraft.text.Text;
import net.minecraft.text.Text; import net.minecraft.text.Text;
import reborncore.client.gui.builder.GuiBase; import reborncore.client.gui.builder.GuiBase;
import reborncore.common.screen.BuiltScreenHandler; import reborncore.common.screen.BuiltScreenHandler;
@ -60,7 +60,7 @@ public class GuiIDSU extends GuiBase<BuiltScreenHandler> {
matrixStack.push(); matrixStack.push();
matrixStack.scale(0.6f, 0.6f, 1.0f); matrixStack.scale(0.6f, 0.6f, 1.0f);
Text text = new LiteralText(PowerSystem.getLocalizedPowerNoSuffix(idsu.getEnergy())) Text text = Text.literal(PowerSystem.getLocalizedPowerNoSuffix(idsu.getEnergy()))
.append("/") .append("/")
.append(PowerSystem.getLocalizedPowerNoSuffix(idsu.getMaxStoredPower())) .append(PowerSystem.getLocalizedPowerNoSuffix(idsu.getMaxStoredPower()))
.append(" ") .append(" ")

View file

@ -29,7 +29,7 @@ import net.minecraft.client.gui.widget.ButtonWidget;
import net.minecraft.client.gui.widget.TexturedButtonWidget; import net.minecraft.client.gui.widget.TexturedButtonWidget;
import net.minecraft.client.util.math.MatrixStack; import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.text.LiteralText; import net.minecraft.text.Text;
import net.minecraft.util.Identifier; import net.minecraft.util.Identifier;
import reborncore.client.gui.builder.GuiBase; import reborncore.client.gui.builder.GuiBase;
import reborncore.client.gui.guibuilder.GuiBuilder; import reborncore.client.gui.guibuilder.GuiBuilder;
@ -83,7 +83,7 @@ public class GuiIronFurnace extends GuiBase<BuiltScreenHandler> {
} }
} }
renderTooltip(matrices, new LiteralText(message), mouseX, mouseY); renderTooltip(matrices, Text.literal(message), mouseX, mouseY);
}; };
addDrawableChild(new TexturedButtonWidget( addDrawableChild(new TexturedButtonWidget(
@ -99,7 +99,7 @@ public class GuiIronFurnace extends GuiBase<BuiltScreenHandler> {
16, 16,
b -> onClick(), b -> onClick(),
tooltipSupplier, tooltipSupplier,
LiteralText.EMPTY)); Text.empty()));
} }
@Override @Override

View file

@ -26,7 +26,7 @@ package techreborn.client.gui;
import net.minecraft.client.util.math.MatrixStack; import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.text.LiteralText; import net.minecraft.text.Text;
import reborncore.client.gui.builder.GuiBase; import reborncore.client.gui.builder.GuiBase;
import reborncore.common.screen.BuiltScreenHandler; import reborncore.common.screen.BuiltScreenHandler;
import reborncore.common.powerSystem.PowerSystem; import reborncore.common.powerSystem.PowerSystem;
@ -58,7 +58,7 @@ public class GuiLESU extends GuiBase<BuiltScreenHandler> {
matrixStack.push(); matrixStack.push();
matrixStack.scale(0.6f, 0.6f, 1.0f); matrixStack.scale(0.6f, 0.6f, 1.0f);
drawCentredText(matrixStack, new LiteralText(PowerSystem.getLocalizedPowerNoSuffix( blockEntity.getEnergy())) drawCentredText(matrixStack, Text.literal(PowerSystem.getLocalizedPowerNoSuffix( blockEntity.getEnergy()))
.append("/") .append("/")
.append(PowerSystem.getLocalizedPowerNoSuffix(blockEntity.getMaxStoredPower())) .append(PowerSystem.getLocalizedPowerNoSuffix(blockEntity.getMaxStoredPower()))
.append(" ") .append(" ")

View file

@ -26,7 +26,7 @@ package techreborn.client.gui;
import net.minecraft.client.util.math.MatrixStack; import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.text.LiteralText; import net.minecraft.text.Text;
import reborncore.client.gui.builder.GuiBase; import reborncore.client.gui.builder.GuiBase;
import reborncore.common.screen.BuiltScreenHandler; import reborncore.common.screen.BuiltScreenHandler;
import reborncore.common.powerSystem.PowerSystem; import reborncore.common.powerSystem.PowerSystem;
@ -60,7 +60,7 @@ public class GuiMFE extends GuiBase<BuiltScreenHandler> {
matrixStack.push(); matrixStack.push();
matrixStack.scale(0.6f, 0.6f, 1.0f); matrixStack.scale(0.6f, 0.6f, 1.0f);
drawCentredText(matrixStack, new LiteralText(PowerSystem.getLocalizedPowerNoSuffix(mfe.getEnergy())) drawCentredText(matrixStack, Text.literal(PowerSystem.getLocalizedPowerNoSuffix(mfe.getEnergy()))
.append("/") .append("/")
.append(PowerSystem.getLocalizedPower(mfe.getMaxStoredPower())) .append(PowerSystem.getLocalizedPower(mfe.getMaxStoredPower()))
, 35, 0, 58, layer); , 35, 0, 58, layer);

View file

@ -26,7 +26,7 @@ package techreborn.client.gui;
import net.minecraft.client.util.math.MatrixStack; import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.text.LiteralText; import net.minecraft.text.Text;
import reborncore.client.gui.builder.GuiBase; import reborncore.client.gui.builder.GuiBase;
import reborncore.common.screen.BuiltScreenHandler; import reborncore.common.screen.BuiltScreenHandler;
import reborncore.common.powerSystem.PowerSystem; import reborncore.common.powerSystem.PowerSystem;
@ -58,7 +58,7 @@ public class GuiMFSU extends GuiBase<BuiltScreenHandler> {
matrixStack.push(); matrixStack.push();
matrixStack.scale(0.6f, 0.6f, 1.0f); matrixStack.scale(0.6f, 0.6f, 1.0f);
drawCentredText(matrixStack, new LiteralText(PowerSystem.getLocalizedPowerNoSuffix(mfsu.getEnergy()) + "/" + PowerSystem.getLocalizedPower(mfsu.getMaxStoredPower())), 35, 0, 58, layer); drawCentredText(matrixStack, Text.literal(PowerSystem.getLocalizedPowerNoSuffix(mfsu.getEnergy()) + "/" + PowerSystem.getLocalizedPower(mfsu.getMaxStoredPower())), 35, 0, 58, layer);
matrixStack.pop(); matrixStack.pop();
builder.drawMultiEnergyBar(matrixStack, this, 81, 28, (int) mfsu.getEnergy(), (int) mfsu.getMaxStoredPower(), mouseX, mouseY, 0, layer); builder.drawMultiEnergyBar(matrixStack, this, 81, 28, (int) mfsu.getEnergy(), (int) mfsu.getMaxStoredPower(), mouseX, mouseY, 0, layer);

View file

@ -28,9 +28,9 @@ import com.mojang.blaze3d.systems.RenderSystem;
import net.minecraft.client.gui.screen.ConfirmChatLinkScreen; import net.minecraft.client.gui.screen.ConfirmChatLinkScreen;
import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.util.math.MatrixStack; import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.text.LiteralText;
import net.minecraft.text.Text; import net.minecraft.text.Text;
import net.minecraft.text.TranslatableText; import net.minecraft.text.Text;
import net.minecraft.text.Text;
import net.minecraft.util.Identifier; import net.minecraft.util.Identifier;
import net.minecraft.util.Util; import net.minecraft.util.Util;
import reborncore.client.gui.builder.widget.GuiButtonExtended; import reborncore.client.gui.builder.widget.GuiButtonExtended;
@ -43,12 +43,12 @@ public class GuiManual extends Screen {
private static final Identifier MANUAL_TEXTURE = new Identifier("techreborn", "textures/gui/manual.png"); private static final Identifier MANUAL_TEXTURE = new Identifier("techreborn", "textures/gui/manual.png");
int guiWidth = 207; int guiWidth = 207;
int guiHeight = 195; int guiHeight = 195;
private static final Text text1 = new TranslatableText("techreborn.manual.wiki"); private static final Text text1 = Text.translatable("techreborn.manual.wiki");
private static final Text text2 = new TranslatableText("techreborn.manual.discord"); private static final Text text2 = Text.translatable("techreborn.manual.discord");
private static final Text text3 = new TranslatableText("techreborn.manual.refund"); private static final Text text3 = Text.translatable("techreborn.manual.refund");
public GuiManual() { public GuiManual() {
super(new LiteralText("gui.manual")); super(Text.literal("gui.manual"));
} }
@Override @Override
@ -56,14 +56,14 @@ public class GuiManual extends Screen {
int y = (height / 2) - guiHeight / 2; int y = (height / 2) - guiHeight / 2;
if (client == null) { return; } if (client == null) { return; }
addSelectableChild(new GuiButtonExtended((width / 2 - 30), y + 40, 60, 20, new TranslatableText("techreborn.manual.wikibtn"), var1 -> client.setScreen(new ConfirmChatLinkScreen(t -> { addSelectableChild(new GuiButtonExtended((width / 2 - 30), y + 40, 60, 20, Text.translatable("techreborn.manual.wikibtn"), var1 -> client.setScreen(new ConfirmChatLinkScreen(t -> {
if (t) { if (t) {
Util.getOperatingSystem().open("http://wiki.techreborn.ovh"); Util.getOperatingSystem().open("http://wiki.techreborn.ovh");
} }
this.client.setScreen(this); this.client.setScreen(this);
}, "http://wiki.techreborn.ovh", false)))); }, "http://wiki.techreborn.ovh", false))));
addSelectableChild(new GuiButtonExtended((width / 2 - 30), y + 90, 60, 20, new TranslatableText("techreborn.manual.discordbtn"), var1 -> client.setScreen(new ConfirmChatLinkScreen(t -> { addSelectableChild(new GuiButtonExtended((width / 2 - 30), y + 90, 60, 20, Text.translatable("techreborn.manual.discordbtn"), var1 -> client.setScreen(new ConfirmChatLinkScreen(t -> {
if (t) { if (t) {
Util.getOperatingSystem().open("https://discord.gg/teamreborn"); Util.getOperatingSystem().open("https://discord.gg/teamreborn");
} }
@ -71,7 +71,7 @@ public class GuiManual extends Screen {
}, "https://discord.gg/teamreborn", false)))); }, "https://discord.gg/teamreborn", false))));
if (TechRebornConfig.allowManualRefund) { if (TechRebornConfig.allowManualRefund) {
addSelectableChild(new GuiButtonExtended((width / 2 - 30), y + 140, 60, 20, new TranslatableText("techreborn.manual.refundbtn"), var1 -> { addSelectableChild(new GuiButtonExtended((width / 2 - 30), y + 140, 60, 20, Text.translatable("techreborn.manual.refundbtn"), var1 -> {
NetworkManager.sendToServer(ServerboundPackets.createRefundPacket()); NetworkManager.sendToServer(ServerboundPackets.createRefundPacket());
this.client.setScreen(null); this.client.setScreen(null);
})); }));

View file

@ -26,7 +26,7 @@ package techreborn.client.gui;
import net.minecraft.client.util.math.MatrixStack; import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.text.LiteralText; import net.minecraft.text.Text;
import net.minecraft.text.Text; import net.minecraft.text.Text;
import reborncore.client.gui.builder.GuiBase; import reborncore.client.gui.builder.GuiBase;
import reborncore.client.gui.builder.widget.GuiButtonUpDown; import reborncore.client.gui.builder.widget.GuiButtonUpDown;
@ -65,7 +65,7 @@ public class GuiPlayerDetector extends GuiBase<BuiltScreenHandler> {
if (hideGuiElements()) return; if (hideGuiElements()) return;
Text text = new LiteralText("Radius: ").append(String.valueOf(blockEntity.getCurrentRadius())); Text text = Text.literal("Radius: ").append(String.valueOf(blockEntity.getCurrentRadius()));
drawCentredText(matrixStack, text, 25, 4210752, layer); drawCentredText(matrixStack, text, 25, 4210752, layer);
} }

View file

@ -26,8 +26,8 @@ package techreborn.client.gui;
import net.minecraft.client.util.math.MatrixStack; import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.text.LiteralText; import net.minecraft.text.Text;
import net.minecraft.text.TranslatableText; import net.minecraft.text.Text;
import reborncore.client.gui.builder.GuiBase; import reborncore.client.gui.builder.GuiBase;
import reborncore.common.screen.BuiltScreenHandler; import reborncore.common.screen.BuiltScreenHandler;
import techreborn.blockentity.generator.SolarPanelBlockEntity; import techreborn.blockentity.generator.SolarPanelBlockEntity;
@ -49,10 +49,10 @@ public class GuiSolar extends GuiBase<BuiltScreenHandler> {
builder.drawMultiEnergyBar(matrixStack, this, 156, 19, (int) blockEntity.getEnergy(), (int) blockEntity.getMaxStoredPower(), mouseX, mouseY, 0, layer); builder.drawMultiEnergyBar(matrixStack, this, 156, 19, (int) blockEntity.getEnergy(), (int) blockEntity.getMaxStoredPower(), mouseX, mouseY, 0, layer);
if (!blockEntity.isGenerating()) { if (!blockEntity.isGenerating()) {
builder.drawText(matrixStack, this, new TranslatableText("techreborn.message.panel_blocked"), 10, 20, 12066591); builder.drawText(matrixStack, this, Text.translatable("techreborn.message.panel_blocked"), 10, 20, 12066591);
} }
builder.drawText(matrixStack, this, new LiteralText("Generating: " + blockEntity.getGenerationRate() + " E/t"), 10, 30, 0); builder.drawText(matrixStack, this, Text.literal("Generating: " + blockEntity.getGenerationRate() + " E/t"), 10, 30, 0);
} }
} }

View file

@ -26,7 +26,7 @@ package techreborn.client.gui;
import net.minecraft.client.util.math.MatrixStack; import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.text.TranslatableText; import net.minecraft.text.Text;
import reborncore.client.gui.builder.GuiBase; import reborncore.client.gui.builder.GuiBase;
import reborncore.common.screen.BuiltScreenHandler; import reborncore.common.screen.BuiltScreenHandler;
import reborncore.common.network.NetworkManager; import reborncore.common.network.NetworkManager;
@ -59,26 +59,26 @@ public class GuiStorageUnit extends GuiBase<BuiltScreenHandler> {
super.drawForeground(matrixStack, mouseX, mouseY); super.drawForeground(matrixStack, mouseX, mouseY);
// Draw in/out labels // Draw in/out labels
builder.drawText(matrixStack, this, new TranslatableText("gui.techreborn.unit.in"), 100, 43, 4210752); builder.drawText(matrixStack, this, Text.translatable("gui.techreborn.unit.in"), 100, 43, 4210752);
builder.drawText(matrixStack, this, new TranslatableText("gui.techreborn.unit.out"), 140, 43, 4210752); builder.drawText(matrixStack, this, Text.translatable("gui.techreborn.unit.out"), 140, 43, 4210752);
int storedAmount = storageEntity.storedAmount; int storedAmount = storageEntity.storedAmount;
if (storedAmount == 0 && !storageEntity.isLocked()) { if (storedAmount == 0 && !storageEntity.isLocked()) {
textRenderer.draw(matrixStack, new TranslatableText("techreborn.tooltip.unit.empty"), 10, 20, 4210752); textRenderer.draw(matrixStack, Text.translatable("techreborn.tooltip.unit.empty"), 10, 20, 4210752);
} else { } else {
textRenderer.draw(matrixStack, new TranslatableText("gui.techreborn.storage.store"), 10, 20, 4210752); textRenderer.draw(matrixStack, Text.translatable("gui.techreborn.storage.store"), 10, 20, 4210752);
textRenderer.draw(matrixStack, storageEntity.getDisplayedStack().getName(), 10, 30, 4210752); textRenderer.draw(matrixStack, storageEntity.getDisplayedStack().getName(), 10, 30, 4210752);
textRenderer.draw(matrixStack, new TranslatableText("gui.techreborn.storage.amount"), 10, 50, 4210752); textRenderer.draw(matrixStack, Text.translatable("gui.techreborn.storage.amount"), 10, 50, 4210752);
textRenderer.draw(matrixStack, String.valueOf(storedAmount), 10, 60, 4210752); textRenderer.draw(matrixStack, String.valueOf(storedAmount), 10, 60, 4210752);
String percentFilled = String.valueOf((int) ((double) storedAmount / (double) storageEntity.getMaxCapacity() * 100)); String percentFilled = String.valueOf((int) ((double) storedAmount / (double) storageEntity.getMaxCapacity() * 100));
textRenderer.draw(matrixStack, new TranslatableText("gui.techreborn.unit.used").append(percentFilled + "%"), 10, 70, 4210752); textRenderer.draw(matrixStack, Text.translatable("gui.techreborn.unit.used").append(percentFilled + "%"), 10, 70, 4210752);
textRenderer.draw(matrixStack, new TranslatableText("gui.techreborn.unit.wrenchtip"), 10, 80, 16711680); textRenderer.draw(matrixStack, Text.translatable("gui.techreborn.unit.wrenchtip"), 10, 80, 16711680);
} }
} }

View file

@ -26,7 +26,7 @@ package techreborn.client.gui;
import net.minecraft.client.util.math.MatrixStack; import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.text.TranslatableText; import net.minecraft.text.Text;
import reborncore.client.gui.builder.GuiBase; import reborncore.client.gui.builder.GuiBase;
import reborncore.common.screen.BuiltScreenHandler; import reborncore.common.screen.BuiltScreenHandler;
import reborncore.common.fluid.FluidUtils; import reborncore.common.fluid.FluidUtils;
@ -57,27 +57,27 @@ public class GuiTankUnit extends GuiBase<BuiltScreenHandler> {
super.drawForeground(matrixStack, mouseX, mouseY); super.drawForeground(matrixStack, mouseX, mouseY);
// Draw input/out // Draw input/out
builder.drawText(matrixStack, this, new TranslatableText("gui.techreborn.unit.in"), 100, 43, 4210752); builder.drawText(matrixStack, this, Text.translatable("gui.techreborn.unit.in"), 100, 43, 4210752);
builder.drawText(matrixStack, this, new TranslatableText("gui.techreborn.unit.out"), 140, 43, 4210752); builder.drawText(matrixStack, this, Text.translatable("gui.techreborn.unit.out"), 140, 43, 4210752);
FluidInstance fluid = tankEntity.getTank().getFluidInstance(); FluidInstance fluid = tankEntity.getTank().getFluidInstance();
if (fluid.isEmpty()) { if (fluid.isEmpty()) {
textRenderer.draw(matrixStack, new TranslatableText("techreborn.tooltip.unit.empty"), 10, 20, 4210752); textRenderer.draw(matrixStack, Text.translatable("techreborn.tooltip.unit.empty"), 10, 20, 4210752);
} else { } else {
textRenderer.draw(matrixStack, new TranslatableText("gui.techreborn.tank.type"), 10, 20, 4210752); textRenderer.draw(matrixStack, Text.translatable("gui.techreborn.tank.type"), 10, 20, 4210752);
textRenderer.draw(matrixStack, FluidUtils.getFluidName(fluid).replace("_", " "), 10, 30, 4210752); textRenderer.draw(matrixStack, FluidUtils.getFluidName(fluid).replace("_", " "), 10, 30, 4210752);
textRenderer.draw(matrixStack, new TranslatableText("gui.techreborn.tank.amount"), 10, 50, 4210752); textRenderer.draw(matrixStack, Text.translatable("gui.techreborn.tank.amount"), 10, 50, 4210752);
textRenderer.draw(matrixStack, fluid.getAmount().toString(), 10, 60, 4210752); textRenderer.draw(matrixStack, fluid.getAmount().toString(), 10, 60, 4210752);
String percentFilled = String.valueOf((int) ((double) fluid.getAmount().getRawValue() / (double) tankEntity.getTank().getFluidValueCapacity().getRawValue() * 100)); String percentFilled = String.valueOf((int) ((double) fluid.getAmount().getRawValue() / (double) tankEntity.getTank().getFluidValueCapacity().getRawValue() * 100));
textRenderer.draw(matrixStack, new TranslatableText("gui.techreborn.unit.used").append(percentFilled + "%"), 10, 70, 4210752); textRenderer.draw(matrixStack, Text.translatable("gui.techreborn.unit.used").append(percentFilled + "%"), 10, 70, 4210752);
textRenderer.draw(matrixStack, new TranslatableText("gui.techreborn.unit.wrenchtip"), 10, 80, 16711680); textRenderer.draw(matrixStack, Text.translatable("gui.techreborn.unit.wrenchtip"), 10, 80, 16711680);
} }
} }

View file

@ -46,6 +46,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.util.Identifier; import net.minecraft.util.Identifier;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction; import net.minecraft.util.math.Direction;
import net.minecraft.util.math.random.AbstractRandom;
import net.minecraft.world.BlockRenderView; import net.minecraft.world.BlockRenderView;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
import reborncore.client.RenderUtil; import reborncore.client.RenderUtil;
@ -54,7 +55,6 @@ import reborncore.common.util.Color;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Random;
import java.util.function.Supplier; import java.util.function.Supplier;
public abstract class BaseDynamicFluidBakedModel implements BakedModel, FabricBakedModel { public abstract class BaseDynamicFluidBakedModel implements BakedModel, FabricBakedModel {
@ -66,7 +66,7 @@ public abstract class BaseDynamicFluidBakedModel implements BakedModel, FabricBa
public abstract ModelIdentifier getFluidModel(); public abstract ModelIdentifier getFluidModel();
@Override @Override
public void emitItemQuads(ItemStack stack, Supplier<Random> randomSupplier, RenderContext context) { public void emitItemQuads(ItemStack stack, Supplier<AbstractRandom> randomSupplier, RenderContext context) {
Fluid fluid = Fluids.EMPTY; Fluid fluid = Fluids.EMPTY;
if (stack.getItem() instanceof ItemFluidInfo fluidInfo) { if (stack.getItem() instanceof ItemFluidInfo fluidInfo) {
fluid = fluidInfo.getFluid(stack); fluid = fluidInfo.getFluid(stack);
@ -106,12 +106,12 @@ public abstract class BaseDynamicFluidBakedModel implements BakedModel, FabricBa
} }
@Override @Override
public void emitBlockQuads(BlockRenderView blockView, BlockState state, BlockPos pos, Supplier<Random> randomSupplier, RenderContext context) { public void emitBlockQuads(BlockRenderView blockView, BlockState state, BlockPos pos, Supplier<AbstractRandom> randomSupplier, RenderContext context) {
} }
@Override @Override
public List<BakedQuad> getQuads(@Nullable BlockState blockState, @Nullable Direction direction, Random random) { public List<BakedQuad> getQuads(@Nullable BlockState state, @Nullable Direction face, AbstractRandom random) {
return Collections.emptyList(); return Collections.emptyList();
} }

View file

@ -32,6 +32,7 @@ import net.minecraft.client.texture.SpriteAtlasTexture;
import net.minecraft.client.util.ModelIdentifier; import net.minecraft.client.util.ModelIdentifier;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.Identifier; import net.minecraft.util.Identifier;
import net.minecraft.util.math.random.AbstractRandom;
import techreborn.TechReborn; import techreborn.TechReborn;
import java.util.Random; import java.util.Random;
@ -45,7 +46,7 @@ public class DynamicCellBakedModel extends BaseDynamicFluidBakedModel {
private static final ModelIdentifier CELL_GLASS = new ModelIdentifier(new Identifier(TechReborn.MOD_ID, "cell_glass"), "inventory"); private static final ModelIdentifier CELL_GLASS = new ModelIdentifier(new Identifier(TechReborn.MOD_ID, "cell_glass"), "inventory");
@Override @Override
public void emitItemQuads(ItemStack stack, Supplier<Random> randomSupplier, RenderContext context) { public void emitItemQuads(ItemStack stack, Supplier<AbstractRandom> randomSupplier, RenderContext context) {
super.emitItemQuads(stack, randomSupplier, context); super.emitItemQuads(stack, randomSupplier, context);
BakedModelManager bakedModelManager = MinecraftClient.getInstance().getBakedModelManager(); BakedModelManager bakedModelManager = MinecraftClient.getInstance().getBakedModelManager();

View file

@ -39,9 +39,6 @@ import java.io.IOException;
import java.io.InputStreamReader; import java.io.InputStreamReader;
import java.io.Reader; import java.io.Reader;
/*
* Credits to JsonDestroyer
*/
@Environment(EnvType.CLIENT) @Environment(EnvType.CLIENT)
public class ModelHelper { public class ModelHelper {
@ -61,7 +58,7 @@ public class ModelHelper {
public static Reader getReaderForResource(Identifier location) throws IOException { public static Reader getReaderForResource(Identifier location) throws IOException {
Identifier file = new Identifier(location.getNamespace(), location.getPath() + ".json"); Identifier file = new Identifier(location.getNamespace(), location.getPath() + ".json");
Resource resource = MinecraftClient.getInstance().getResourceManager().getResource(file); Resource resource = MinecraftClient.getInstance().getResourceManager().getResource(file).orElseThrow();
return new BufferedReader(new InputStreamReader(resource.getInputStream(), Charsets.UTF_8)); return new BufferedReader(new InputStreamReader(resource.getInputStream(), Charsets.UTF_8));
} }

View file

@ -34,6 +34,7 @@ import net.minecraft.client.render.block.BlockRenderManager;
import net.minecraft.client.render.block.entity.BlockEntityRenderer; import net.minecraft.client.render.block.entity.BlockEntityRenderer;
import net.minecraft.client.render.block.entity.BlockEntityRendererFactory; import net.minecraft.client.render.block.entity.BlockEntityRendererFactory;
import net.minecraft.client.util.math.MatrixStack; import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.util.math.random.AbstractRandom;
import techreborn.blockentity.cable.CableBlockEntity; import techreborn.blockentity.cable.CableBlockEntity;
import techreborn.blocks.cable.CableBlock; import techreborn.blocks.cable.CableBlock;
@ -56,7 +57,7 @@ public class CableCoverRenderer implements BlockEntityRenderer<CableBlockEntity>
final BlockRenderManager blockRenderManager = MinecraftClient.getInstance().getBlockRenderManager(); final BlockRenderManager blockRenderManager = MinecraftClient.getInstance().getBlockRenderManager();
BlockState coverState = blockEntity.getCover() != null ? blockEntity.getCover() : Blocks.OAK_PLANKS.getDefaultState(); BlockState coverState = blockEntity.getCover() != null ? blockEntity.getCover() : Blocks.OAK_PLANKS.getDefaultState();
VertexConsumer consumer = vertexConsumers.getBuffer(RenderLayers.getBlockLayer(coverState)); VertexConsumer consumer = vertexConsumers.getBuffer(RenderLayers.getBlockLayer(coverState));
blockRenderManager.renderBlock(coverState, blockEntity.getPos(), blockEntity.getWorld(), matrices, consumer, true, new Random()); blockRenderManager.renderBlock(coverState, blockEntity.getPos(), blockEntity.getWorld(), matrices, consumer, true, AbstractRandom.create());
} }
} }

View file

@ -25,6 +25,7 @@
package techreborn.client.render.entitys; package techreborn.client.render.entitys;
import net.minecraft.client.render.VertexConsumerProvider; import net.minecraft.client.render.VertexConsumerProvider;
import net.minecraft.client.render.block.BlockRenderManager;
import net.minecraft.client.render.entity.EntityRenderer; import net.minecraft.client.render.entity.EntityRenderer;
import net.minecraft.client.render.entity.EntityRendererFactory; import net.minecraft.client.render.entity.EntityRendererFactory;
import net.minecraft.client.render.entity.TntMinecartEntityRenderer; import net.minecraft.client.render.entity.TntMinecartEntityRenderer;
@ -41,10 +42,12 @@ import techreborn.init.TRContent;
* Created by Mark on 13/03/2016. * Created by Mark on 13/03/2016.
*/ */
public class NukeRenderer extends EntityRenderer<EntityNukePrimed> { public class NukeRenderer extends EntityRenderer<EntityNukePrimed> {
private final BlockRenderManager blockRenderManager;
public NukeRenderer(EntityRendererFactory.Context ctx) { public NukeRenderer(EntityRendererFactory.Context ctx) {
super(ctx); super(ctx);
this.shadowRadius = 0.5F; this.shadowRadius = 0.5F;
this.blockRenderManager = ctx.getBlockRenderManager();
} }
@Nullable @Nullable
@ -68,7 +71,7 @@ public class NukeRenderer extends EntityRenderer<EntityNukePrimed> {
matrixStack.multiply(Vec3f.POSITIVE_Y.getDegreesQuaternion(-90.0F)); matrixStack.multiply(Vec3f.POSITIVE_Y.getDegreesQuaternion(-90.0F));
matrixStack.translate(-0.5D, -0.5D, 0.5D); matrixStack.translate(-0.5D, -0.5D, 0.5D);
TntMinecartEntityRenderer.renderFlashingBlock(TRContent.NUKE.getDefaultState(), matrixStack, vertexConsumerProvider, i, entity.getFuse() / 5 % 2 == 0); TntMinecartEntityRenderer.renderFlashingBlock(blockRenderManager, TRContent.NUKE.getDefaultState(), matrixStack, vertexConsumerProvider, i, entity.getFuse() / 5 % 2 == 0);
matrixStack.pop(); matrixStack.pop();
super.render(entity, f, g, matrixStack, vertexConsumerProvider, i); super.render(entity, f, g, matrixStack, vertexConsumerProvider, i);
} }

View file

@ -44,6 +44,11 @@ public class DestructoPackScreenHandler extends ScreenHandler {
buildContainer(); buildContainer();
} }
@Override
public ItemStack transferSlot(PlayerEntity player, int index) {
return ItemStack.EMPTY;
}
@Override @Override
public boolean canUse(PlayerEntity arg0) { public boolean canUse(PlayerEntity arg0) {
return true; return true;

View file

@ -35,7 +35,7 @@ import me.shedaniel.rei.api.client.registry.display.DisplayCategory;
import me.shedaniel.rei.api.common.category.CategoryIdentifier; import me.shedaniel.rei.api.common.category.CategoryIdentifier;
import me.shedaniel.rei.api.common.util.EntryStacks; import me.shedaniel.rei.api.common.util.EntryStacks;
import net.minecraft.text.Text; import net.minecraft.text.Text;
import net.minecraft.text.TranslatableText; import net.minecraft.text.Text;
import net.minecraft.util.Formatting; import net.minecraft.util.Formatting;
import net.minecraft.util.Identifier; import net.minecraft.util.Identifier;
import reborncore.client.gui.guibuilder.GuiBuilder; import reborncore.client.gui.guibuilder.GuiBuilder;
@ -62,7 +62,7 @@ public class FluidGeneratorRecipeCategory implements DisplayCategory<FluidGenera
@Override @Override
public Text getTitle() { public Text getTitle() {
return new TranslatableText(identifier.toString()); return Text.translatable(identifier.toString());
} }
@Override @Override
@ -77,7 +77,7 @@ public class FluidGeneratorRecipeCategory implements DisplayCategory<FluidGenera
widgets.add(ReiPlugin.createEnergyDisplay(new Rectangle(bounds.x + 108, bounds.y + 8, 14, 50), recipeDisplay.getTotalEnergy(), ReiPlugin.EntryAnimation.upwards(5000), point -> { widgets.add(ReiPlugin.createEnergyDisplay(new Rectangle(bounds.x + 108, bounds.y + 8, 14, 50), recipeDisplay.getTotalEnergy(), ReiPlugin.EntryAnimation.upwards(5000), point -> {
List<Text> list = Lists.newArrayList(); List<Text> list = Lists.newArrayList();
list.add(Text.of("Energy")); list.add(Text.of("Energy"));
list.add(new TranslatableText("techreborn.jei.recipe.generator.total", recipeDisplay.getTotalEnergy()).formatted(Formatting.GRAY)); list.add(Text.translatable("techreborn.jei.recipe.generator.total", recipeDisplay.getTotalEnergy()).formatted(Formatting.GRAY));
list.add(Text.of("")); list.add(Text.of(""));
list.add(ClientHelper.getInstance().getFormattedModFromIdentifier(new Identifier("techreborn", ""))); list.add(ClientHelper.getInstance().getFormattedModFromIdentifier(new Identifier("techreborn", "")));
return Tooltip.create(point, list); return Tooltip.create(point, list);

View file

@ -37,7 +37,7 @@ import me.shedaniel.rei.api.common.category.CategoryIdentifier;
import me.shedaniel.rei.api.common.util.EntryStacks; import me.shedaniel.rei.api.common.util.EntryStacks;
import net.minecraft.item.Items; import net.minecraft.item.Items;
import net.minecraft.text.Text; import net.minecraft.text.Text;
import net.minecraft.text.TranslatableText; import net.minecraft.text.Text;
import net.minecraft.util.Formatting; import net.minecraft.util.Formatting;
import net.minecraft.util.Identifier; import net.minecraft.util.Identifier;
import reborncore.client.gui.guibuilder.GuiBuilder; import reborncore.client.gui.guibuilder.GuiBuilder;
@ -63,7 +63,7 @@ public class FluidReplicatorRecipeCategory implements DisplayCategory<FluidRepli
@Override @Override
public Text getTitle() { public Text getTitle() {
return new TranslatableText(rebornRecipeType.name().toString()); return Text.translatable(rebornRecipeType.name().toString());
} }
@Override @Override
@ -80,7 +80,7 @@ public class FluidReplicatorRecipeCategory implements DisplayCategory<FluidRepli
widgets.add(ReiPlugin.createEnergyDisplay(new Rectangle(bounds.x + 8, bounds.y + 8, 14, 50), recipeDisplay.getEnergy(), ReiPlugin.EntryAnimation.downwards(5000), point -> { widgets.add(ReiPlugin.createEnergyDisplay(new Rectangle(bounds.x + 8, bounds.y + 8, 14, 50), recipeDisplay.getEnergy(), ReiPlugin.EntryAnimation.downwards(5000), point -> {
List<Text> list = Lists.newArrayList(); List<Text> list = Lists.newArrayList();
list.add(Text.of("Energy")); list.add(Text.of("Energy"));
list.add(new TranslatableText("techreborn.jei.recipe.running.cost", "E", recipeDisplay.getEnergy()).formatted(Formatting.GRAY)); list.add(Text.translatable("techreborn.jei.recipe.running.cost", "E", recipeDisplay.getEnergy()).formatted(Formatting.GRAY));
list.add(Text.of("")); list.add(Text.of(""));
list.add(ClientHelper.getInstance().getFormattedModFromIdentifier(new Identifier("techreborn", ""))); list.add(ClientHelper.getInstance().getFormattedModFromIdentifier(new Identifier("techreborn", "")));
return Tooltip.create(point, list); return Tooltip.create(point, list);
@ -90,7 +90,7 @@ public class FluidReplicatorRecipeCategory implements DisplayCategory<FluidRepli
widgets.add(ReiPlugin.createProgressBar(bounds.x + 46 + 21, bounds.y + 30, recipeDisplay.getTime() * 50, GuiBuilder.ProgressDirection.RIGHT)); widgets.add(ReiPlugin.createProgressBar(bounds.x + 46 + 21, bounds.y + 30, recipeDisplay.getTime() * 50, GuiBuilder.ProgressDirection.RIGHT));
widgets.add(ReiPlugin.createFluidDisplay(new Rectangle(bounds.x + 46 + 46, bounds.y + 8, 16, 50), recipeDisplay.getOutputEntries().get(0).get(0).cast(), ReiPlugin.EntryAnimation.upwards(5000))); widgets.add(ReiPlugin.createFluidDisplay(new Rectangle(bounds.x + 46 + 46, bounds.y + 8, 16, 50), recipeDisplay.getOutputEntries().get(0).get(0).cast(), ReiPlugin.EntryAnimation.upwards(5000)));
widgets.add(Widgets.createLabel(new Point(bounds.x + 24, bounds.y + 5), new TranslatableText("techreborn.jei.recipe.processing.time.3", new DecimalFormat("###.##").format(recipeDisplay.getTime() / 20.0))) widgets.add(Widgets.createLabel(new Point(bounds.x + 24, bounds.y + 5), Text.translatable("techreborn.jei.recipe.processing.time.3", new DecimalFormat("###.##").format(recipeDisplay.getTime() / 20.0)))
.shadow(false) .shadow(false)
.leftAligned() .leftAligned()
.color(0xFF404040, 0xFFBBBBBB) .color(0xFF404040, 0xFFBBBBBB)

View file

@ -31,7 +31,7 @@ import me.shedaniel.rei.api.client.gui.widgets.Tooltip;
import me.shedaniel.rei.api.client.gui.widgets.Widget; import me.shedaniel.rei.api.client.gui.widgets.Widget;
import me.shedaniel.rei.api.client.gui.widgets.Widgets; import me.shedaniel.rei.api.client.gui.widgets.Widgets;
import net.minecraft.text.Text; import net.minecraft.text.Text;
import net.minecraft.text.TranslatableText; import net.minecraft.text.Text;
import net.minecraft.util.Formatting; import net.minecraft.util.Formatting;
import net.minecraft.util.Identifier; import net.minecraft.util.Identifier;
import reborncore.common.crafting.RebornRecipe; import reborncore.common.crafting.RebornRecipe;
@ -53,7 +53,7 @@ public abstract class AbstractEnergyConsumingMachineCategory<R extends RebornRec
widgets.add(ReiPlugin.createEnergyDisplay(new Rectangle(bounds.x + 8, bounds.y + 8, 14, 50), recipeDisplay.getEnergy(), ReiPlugin.EntryAnimation.downwards(5000), point -> { widgets.add(ReiPlugin.createEnergyDisplay(new Rectangle(bounds.x + 8, bounds.y + 8, 14, 50), recipeDisplay.getEnergy(), ReiPlugin.EntryAnimation.downwards(5000), point -> {
List<Text> list = Lists.newArrayList(); List<Text> list = Lists.newArrayList();
list.add(Text.of("Energy")); list.add(Text.of("Energy"));
list.add(new TranslatableText("techreborn.jei.recipe.running.cost", "E", recipeDisplay.getEnergy()).formatted(Formatting.GRAY)); list.add(Text.translatable("techreborn.jei.recipe.running.cost", "E", recipeDisplay.getEnergy()).formatted(Formatting.GRAY));
list.add(Text.of("")); list.add(Text.of(""));
list.add(ClientHelper.getInstance().getFormattedModFromIdentifier(new Identifier("techreborn", ""))); list.add(ClientHelper.getInstance().getFormattedModFromIdentifier(new Identifier("techreborn", "")));
return Tooltip.create(point, list); return Tooltip.create(point, list);

View file

@ -33,7 +33,7 @@ import me.shedaniel.rei.api.common.entry.EntryIngredient;
import me.shedaniel.rei.api.common.util.EntryStacks; import me.shedaniel.rei.api.common.util.EntryStacks;
import net.minecraft.item.Items; import net.minecraft.item.Items;
import net.minecraft.text.Text; import net.minecraft.text.Text;
import net.minecraft.text.TranslatableText; import net.minecraft.text.Text;
import reborncore.common.crafting.RebornRecipe; import reborncore.common.crafting.RebornRecipe;
import reborncore.common.crafting.RebornRecipeType; import reborncore.common.crafting.RebornRecipeType;
import techreborn.compat.rei.MachineRecipeDisplay; import techreborn.compat.rei.MachineRecipeDisplay;
@ -56,7 +56,7 @@ public abstract class AbstractMachineCategory<R extends RebornRecipe> implements
@Override @Override
public Text getTitle() { public Text getTitle() {
return new TranslatableText(rebornRecipeType.name().toString()); return Text.translatable(rebornRecipeType.name().toString());
} }
@Override @Override

View file

@ -28,7 +28,7 @@ import me.shedaniel.math.Point;
import me.shedaniel.math.Rectangle; import me.shedaniel.math.Rectangle;
import me.shedaniel.rei.api.client.gui.widgets.Widget; import me.shedaniel.rei.api.client.gui.widgets.Widget;
import me.shedaniel.rei.api.client.gui.widgets.Widgets; import me.shedaniel.rei.api.client.gui.widgets.Widgets;
import net.minecraft.text.TranslatableText; import net.minecraft.text.Text;
import reborncore.client.gui.guibuilder.GuiBuilder; import reborncore.client.gui.guibuilder.GuiBuilder;
import reborncore.common.crafting.RebornRecipe; import reborncore.common.crafting.RebornRecipe;
import reborncore.common.crafting.RebornRecipeType; import reborncore.common.crafting.RebornRecipeType;
@ -52,7 +52,7 @@ public class AssemblingMachineCategory<R extends RebornRecipe> extends AbstractE
widgets.add(Widgets.createSlot(new Point(bounds.x + 101 - 9, bounds.y + 45 - 19)).entries(getOutput(recipeDisplay, 0)).disableBackground().markOutput()); widgets.add(Widgets.createSlot(new Point(bounds.x + 101 - 9, bounds.y + 45 - 19)).entries(getOutput(recipeDisplay, 0)).disableBackground().markOutput());
widgets.add(ReiPlugin.createProgressBar(bounds.x + 76 - 9, bounds.y + 48 - 19, recipeDisplay.getTime() * 50, GuiBuilder.ProgressDirection.RIGHT)); widgets.add(ReiPlugin.createProgressBar(bounds.x + 76 - 9, bounds.y + 48 - 19, recipeDisplay.getTime() * 50, GuiBuilder.ProgressDirection.RIGHT));
widgets.add(Widgets.createLabel(new Point(bounds.getMaxX() - 5, bounds.y + 5), new TranslatableText("techreborn.jei.recipe.processing.time.3", new DecimalFormat("###.##").format(recipeDisplay.getTime() / 20.0))) widgets.add(Widgets.createLabel(new Point(bounds.getMaxX() - 5, bounds.y + 5), Text.translatable("techreborn.jei.recipe.processing.time.3", new DecimalFormat("###.##").format(recipeDisplay.getTime() / 20.0)))
.shadow(false) .shadow(false)
.rightAligned() .rightAligned()
.color(0xFF404040, 0xFFBBBBBB) .color(0xFF404040, 0xFFBBBBBB)

View file

@ -28,9 +28,9 @@ import me.shedaniel.math.Point;
import me.shedaniel.math.Rectangle; import me.shedaniel.math.Rectangle;
import me.shedaniel.rei.api.client.gui.widgets.Widget; import me.shedaniel.rei.api.client.gui.widgets.Widget;
import me.shedaniel.rei.api.client.gui.widgets.Widgets; import me.shedaniel.rei.api.client.gui.widgets.Widgets;
import net.minecraft.text.LiteralText;
import net.minecraft.text.Text; import net.minecraft.text.Text;
import net.minecraft.text.TranslatableText; import net.minecraft.text.Text;
import net.minecraft.text.Text;
import reborncore.client.gui.guibuilder.GuiBuilder; import reborncore.client.gui.guibuilder.GuiBuilder;
import reborncore.common.crafting.RebornRecipe; import reborncore.common.crafting.RebornRecipe;
import reborncore.common.crafting.RebornRecipeType; import reborncore.common.crafting.RebornRecipeType;
@ -55,14 +55,14 @@ public class BlastFurnaceCategory<R extends RebornRecipe> extends AbstractEnergy
widgets.add(Widgets.createSlot(new Point(bounds.x + 101 + 20 - 17, bounds.y + 45 - 19)).entries(getOutput(recipeDisplay, 1)).disableBackground().markOutput()); widgets.add(Widgets.createSlot(new Point(bounds.x + 101 + 20 - 17, bounds.y + 45 - 19)).entries(getOutput(recipeDisplay, 1)).disableBackground().markOutput());
widgets.add(ReiPlugin.createProgressBar(bounds.x + 76 - 17, bounds.y + 48 - 19, recipeDisplay.getTime() * 50, GuiBuilder.ProgressDirection.RIGHT)); widgets.add(ReiPlugin.createProgressBar(bounds.x + 76 - 17, bounds.y + 48 - 19, recipeDisplay.getTime() * 50, GuiBuilder.ProgressDirection.RIGHT));
Text neededHeat = new LiteralText(String.valueOf(recipeDisplay.getHeat())).append(" ").append(new TranslatableText("techreborn.jei.recipe.heat")); Text neededHeat = Text.literal(String.valueOf(recipeDisplay.getHeat())).append(" ").append(Text.translatable("techreborn.jei.recipe.heat"));
widgets.add(Widgets.createLabel(new Point(bounds.getMaxX() - 5, bounds.y + 5), neededHeat) widgets.add(Widgets.createLabel(new Point(bounds.getMaxX() - 5, bounds.y + 5), neededHeat)
.shadow(false) .shadow(false)
.rightAligned() .rightAligned()
.color(0xFF404040, 0xFFBBBBBB) .color(0xFF404040, 0xFFBBBBBB)
); );
widgets.add(Widgets.createLabel(new Point(bounds.x + 24, bounds.y + 5), new TranslatableText("techreborn.jei.recipe.processing.time.3", new DecimalFormat("###.##").format(recipeDisplay.getTime() / 20.0))) widgets.add(Widgets.createLabel(new Point(bounds.x + 24, bounds.y + 5), Text.translatable("techreborn.jei.recipe.processing.time.3", new DecimalFormat("###.##").format(recipeDisplay.getTime() / 20.0)))
.shadow(false) .shadow(false)
.leftAligned() .leftAligned()
.color(0xFF404040, 0xFFBBBBBB) .color(0xFF404040, 0xFFBBBBBB)

View file

@ -28,7 +28,7 @@ import me.shedaniel.math.Point;
import me.shedaniel.math.Rectangle; import me.shedaniel.math.Rectangle;
import me.shedaniel.rei.api.client.gui.widgets.Widget; import me.shedaniel.rei.api.client.gui.widgets.Widget;
import me.shedaniel.rei.api.client.gui.widgets.Widgets; import me.shedaniel.rei.api.client.gui.widgets.Widgets;
import net.minecraft.text.TranslatableText; import net.minecraft.text.Text;
import reborncore.client.gui.guibuilder.GuiBuilder; import reborncore.client.gui.guibuilder.GuiBuilder;
import reborncore.common.crafting.RebornRecipe; import reborncore.common.crafting.RebornRecipe;
import reborncore.common.crafting.RebornRecipeType; import reborncore.common.crafting.RebornRecipeType;
@ -54,7 +54,7 @@ public class DistillationTowerCategory<R extends RebornRecipe> extends AbstractE
widgets.add(Widgets.createSlot(new Point(bounds.x + 101 + 40 - 23, bounds.y + 45 - 19)).entries(getOutput(recipeDisplay, 2)).disableBackground().markOutput()); widgets.add(Widgets.createSlot(new Point(bounds.x + 101 + 40 - 23, bounds.y + 45 - 19)).entries(getOutput(recipeDisplay, 2)).disableBackground().markOutput());
widgets.add(ReiPlugin.createProgressBar(bounds.x + 76 - 23, bounds.y + 48 - 19, recipeDisplay.getTime() * 50, GuiBuilder.ProgressDirection.RIGHT)); widgets.add(ReiPlugin.createProgressBar(bounds.x + 76 - 23, bounds.y + 48 - 19, recipeDisplay.getTime() * 50, GuiBuilder.ProgressDirection.RIGHT));
widgets.add(Widgets.createLabel(new Point(bounds.getMaxX() - 5, bounds.y + 5), new TranslatableText("techreborn.jei.recipe.processing.time.3", new DecimalFormat("###.##").format(recipeDisplay.getTime() / 20.0))) widgets.add(Widgets.createLabel(new Point(bounds.getMaxX() - 5, bounds.y + 5), Text.translatable("techreborn.jei.recipe.processing.time.3", new DecimalFormat("###.##").format(recipeDisplay.getTime() / 20.0)))
.shadow(false) .shadow(false)
.rightAligned() .rightAligned()
.color(0xFF404040, 0xFFBBBBBB) .color(0xFF404040, 0xFFBBBBBB)

View file

@ -28,7 +28,7 @@ import me.shedaniel.math.Point;
import me.shedaniel.math.Rectangle; import me.shedaniel.math.Rectangle;
import me.shedaniel.rei.api.client.gui.widgets.Widget; import me.shedaniel.rei.api.client.gui.widgets.Widget;
import me.shedaniel.rei.api.client.gui.widgets.Widgets; import me.shedaniel.rei.api.client.gui.widgets.Widgets;
import net.minecraft.text.TranslatableText; import net.minecraft.text.Text;
import reborncore.client.gui.guibuilder.GuiBuilder; import reborncore.client.gui.guibuilder.GuiBuilder;
import reborncore.common.crafting.RebornRecipe; import reborncore.common.crafting.RebornRecipe;
import reborncore.common.crafting.RebornRecipeType; import reborncore.common.crafting.RebornRecipeType;
@ -55,7 +55,7 @@ public class ElectrolyzerCategory<R extends RebornRecipe> extends AbstractEnergy
widgets.add(Widgets.createSlot(new Point(bounds.x + 55 + 17 - 9 + 40, bounds.y + 36 - 22)).entries(getOutput(recipeDisplay, 3)).disableBackground().markOutput()); widgets.add(Widgets.createSlot(new Point(bounds.x + 55 + 17 - 9 + 40, bounds.y + 36 - 22)).entries(getOutput(recipeDisplay, 3)).disableBackground().markOutput());
widgets.add(ReiPlugin.createProgressBar(bounds.x + 55 + 21, bounds.y + 36 + 4, recipeDisplay.getTime() * 50, GuiBuilder.ProgressDirection.UP)); widgets.add(ReiPlugin.createProgressBar(bounds.x + 55 + 21, bounds.y + 36 + 4, recipeDisplay.getTime() * 50, GuiBuilder.ProgressDirection.UP));
widgets.add(Widgets.createLabel(new Point(bounds.getMaxX() - 17, bounds.getMaxY() - 13), new TranslatableText("techreborn.jei.recipe.processing.time.3", new DecimalFormat("###.##").format(recipeDisplay.getTime() / 20.0))) widgets.add(Widgets.createLabel(new Point(bounds.getMaxX() - 17, bounds.getMaxY() - 13), Text.translatable("techreborn.jei.recipe.processing.time.3", new DecimalFormat("###.##").format(recipeDisplay.getTime() / 20.0)))
.shadow(false) .shadow(false)
.rightAligned() .rightAligned()
.color(0xFF404040, 0xFFBBBBBB) .color(0xFF404040, 0xFFBBBBBB)

View file

@ -32,7 +32,7 @@ import me.shedaniel.rei.api.client.gui.widgets.Tooltip;
import me.shedaniel.rei.api.client.gui.widgets.Widget; import me.shedaniel.rei.api.client.gui.widgets.Widget;
import me.shedaniel.rei.api.client.gui.widgets.Widgets; import me.shedaniel.rei.api.client.gui.widgets.Widgets;
import net.minecraft.text.Text; import net.minecraft.text.Text;
import net.minecraft.text.TranslatableText; import net.minecraft.text.Text;
import net.minecraft.util.Formatting; import net.minecraft.util.Formatting;
import net.minecraft.util.Identifier; import net.minecraft.util.Identifier;
import reborncore.client.gui.guibuilder.GuiBuilder; import reborncore.client.gui.guibuilder.GuiBuilder;
@ -56,7 +56,7 @@ public class GrinderCategory<R extends RebornRecipe> extends AbstractMachineCate
widgets.add(ReiPlugin.createEnergyDisplay(new Rectangle(bounds.x + 8, bounds.y + 18, 14, 50), recipeDisplay.getEnergy(), ReiPlugin.EntryAnimation.downwards(5000), point -> { widgets.add(ReiPlugin.createEnergyDisplay(new Rectangle(bounds.x + 8, bounds.y + 18, 14, 50), recipeDisplay.getEnergy(), ReiPlugin.EntryAnimation.downwards(5000), point -> {
List<Text> list = Lists.newArrayList(); List<Text> list = Lists.newArrayList();
list.add(Text.of("Energy")); list.add(Text.of("Energy"));
list.add(new TranslatableText("techreborn.jei.recipe.running.cost", "E", recipeDisplay.getEnergy()).formatted(Formatting.GRAY)); list.add(Text.translatable("techreborn.jei.recipe.running.cost", "E", recipeDisplay.getEnergy()).formatted(Formatting.GRAY));
list.add(Text.of("")); list.add(Text.of(""));
list.add(ClientHelper.getInstance().getFormattedModFromIdentifier(new Identifier("techreborn", ""))); list.add(ClientHelper.getInstance().getFormattedModFromIdentifier(new Identifier("techreborn", "")));
return Tooltip.create(point, list); return Tooltip.create(point, list);
@ -69,7 +69,7 @@ public class GrinderCategory<R extends RebornRecipe> extends AbstractMachineCate
widgets.add(ReiPlugin.createProgressBar(bounds.x + 55 + 21, bounds.y + 36 + 4, recipeDisplay.getTime() * 50, GuiBuilder.ProgressDirection.RIGHT)); widgets.add(ReiPlugin.createProgressBar(bounds.x + 55 + 21, bounds.y + 36 + 4, recipeDisplay.getTime() * 50, GuiBuilder.ProgressDirection.RIGHT));
widgets.add(ReiPlugin.createFluidDisplay(new Rectangle(bounds.x + 55 - 26, bounds.y + 18, 16, 50), getInput(recipeDisplay, 1).get(0).cast(), ReiPlugin.EntryAnimation.downwards(5000))); widgets.add(ReiPlugin.createFluidDisplay(new Rectangle(bounds.x + 55 - 26, bounds.y + 18, 16, 50), getInput(recipeDisplay, 1).get(0).cast(), ReiPlugin.EntryAnimation.downwards(5000)));
widgets.add(Widgets.createLabel(new Point(bounds.x + 51, bounds.y + 15), new TranslatableText("techreborn.jei.recipe.processing.time.3", new DecimalFormat("###.##").format(recipeDisplay.getTime() / 20.0))) widgets.add(Widgets.createLabel(new Point(bounds.x + 51, bounds.y + 15), Text.translatable("techreborn.jei.recipe.processing.time.3", new DecimalFormat("###.##").format(recipeDisplay.getTime() / 20.0)))
.shadow(false) .shadow(false)
.leftAligned() .leftAligned()
.color(0xFF404040, 0xFFBBBBBB) .color(0xFF404040, 0xFFBBBBBB)

View file

@ -28,7 +28,7 @@ import me.shedaniel.math.Point;
import me.shedaniel.math.Rectangle; import me.shedaniel.math.Rectangle;
import me.shedaniel.rei.api.client.gui.widgets.Widget; import me.shedaniel.rei.api.client.gui.widgets.Widget;
import me.shedaniel.rei.api.client.gui.widgets.Widgets; import me.shedaniel.rei.api.client.gui.widgets.Widgets;
import net.minecraft.text.TranslatableText; import net.minecraft.text.Text;
import reborncore.client.gui.guibuilder.GuiBuilder; import reborncore.client.gui.guibuilder.GuiBuilder;
import reborncore.common.crafting.RebornRecipe; import reborncore.common.crafting.RebornRecipe;
import reborncore.common.crafting.RebornRecipeType; import reborncore.common.crafting.RebornRecipeType;
@ -52,7 +52,7 @@ public class ImplosionCompressorCategory<R extends RebornRecipe> extends Abstrac
widgets.add(Widgets.createSlot(new Point(bounds.x + 97 + 18 - 15, bounds.y + 45 - 19)).entries(getOutput(recipeDisplay, 1)).markOutput()); widgets.add(Widgets.createSlot(new Point(bounds.x + 97 + 18 - 15, bounds.y + 45 - 19)).entries(getOutput(recipeDisplay, 1)).markOutput());
widgets.add(ReiPlugin.createProgressBar(bounds.x + 76 - 15, bounds.y + 48 - 19, recipeDisplay.getTime() * 50, GuiBuilder.ProgressDirection.RIGHT)); widgets.add(ReiPlugin.createProgressBar(bounds.x + 76 - 15, bounds.y + 48 - 19, recipeDisplay.getTime() * 50, GuiBuilder.ProgressDirection.RIGHT));
widgets.add(Widgets.createLabel(new Point(bounds.getMaxX() - 5, bounds.y + 5), new TranslatableText("techreborn.jei.recipe.processing.time.3", new DecimalFormat("###.##").format(recipeDisplay.getTime() / 20.0))) widgets.add(Widgets.createLabel(new Point(bounds.getMaxX() - 5, bounds.y + 5), Text.translatable("techreborn.jei.recipe.processing.time.3", new DecimalFormat("###.##").format(recipeDisplay.getTime() / 20.0)))
.shadow(false) .shadow(false)
.rightAligned() .rightAligned()
.color(0xFF404040, 0xFFBBBBBB) .color(0xFF404040, 0xFFBBBBBB)

View file

@ -28,7 +28,7 @@ import me.shedaniel.math.Point;
import me.shedaniel.math.Rectangle; import me.shedaniel.math.Rectangle;
import me.shedaniel.rei.api.client.gui.widgets.Widget; import me.shedaniel.rei.api.client.gui.widgets.Widget;
import me.shedaniel.rei.api.client.gui.widgets.Widgets; import me.shedaniel.rei.api.client.gui.widgets.Widgets;
import net.minecraft.text.TranslatableText; import net.minecraft.text.Text;
import reborncore.client.gui.guibuilder.GuiBuilder; import reborncore.client.gui.guibuilder.GuiBuilder;
import reborncore.common.crafting.RebornRecipe; import reborncore.common.crafting.RebornRecipe;
import reborncore.common.crafting.RebornRecipeType; import reborncore.common.crafting.RebornRecipeType;
@ -54,7 +54,7 @@ public class IndustrialCentrifugeCategory<R extends RebornRecipe> extends Abstra
widgets.add(Widgets.createSlot(new Point(bounds.x + 116 - 17, bounds.y + 64 - 19)).entries(getOutput(recipeDisplay, 3)).markOutput()); widgets.add(Widgets.createSlot(new Point(bounds.x + 116 - 17, bounds.y + 64 - 19)).entries(getOutput(recipeDisplay, 3)).markOutput());
widgets.add(ReiPlugin.createProgressBar(bounds.x + 76 - 17, bounds.y + 48 - 19, recipeDisplay.getTime() * 50, GuiBuilder.ProgressDirection.RIGHT)); widgets.add(ReiPlugin.createProgressBar(bounds.x + 76 - 17, bounds.y + 48 - 19, recipeDisplay.getTime() * 50, GuiBuilder.ProgressDirection.RIGHT));
widgets.add(Widgets.createLabel(new Point(bounds.x + 24, bounds.y + 5), new TranslatableText("techreborn.jei.recipe.processing.time.3", new DecimalFormat("###.##").format(recipeDisplay.getTime() / 20.0))) widgets.add(Widgets.createLabel(new Point(bounds.x + 24, bounds.y + 5), Text.translatable("techreborn.jei.recipe.processing.time.3", new DecimalFormat("###.##").format(recipeDisplay.getTime() / 20.0)))
.shadow(false) .shadow(false)
.leftAligned() .leftAligned()
.color(0xFF404040, 0xFFBBBBBB) .color(0xFF404040, 0xFFBBBBBB)

View file

@ -28,7 +28,7 @@ import me.shedaniel.math.Point;
import me.shedaniel.math.Rectangle; import me.shedaniel.math.Rectangle;
import me.shedaniel.rei.api.client.gui.widgets.Widget; import me.shedaniel.rei.api.client.gui.widgets.Widget;
import me.shedaniel.rei.api.client.gui.widgets.Widgets; import me.shedaniel.rei.api.client.gui.widgets.Widgets;
import net.minecraft.text.TranslatableText; import net.minecraft.text.Text;
import reborncore.client.gui.guibuilder.GuiBuilder; import reborncore.client.gui.guibuilder.GuiBuilder;
import reborncore.common.crafting.RebornRecipe; import reborncore.common.crafting.RebornRecipe;
import reborncore.common.crafting.RebornRecipeType; import reborncore.common.crafting.RebornRecipeType;
@ -51,7 +51,7 @@ public class OneInputOneOutputCategory<R extends RebornRecipe> extends AbstractE
widgets.add(Widgets.createSlot(new Point(bounds.x + 46 + 46, bounds.y + 26)).entries(getOutput(recipeDisplay, 0)).disableBackground().markOutput()); widgets.add(Widgets.createSlot(new Point(bounds.x + 46 + 46, bounds.y + 26)).entries(getOutput(recipeDisplay, 0)).disableBackground().markOutput());
widgets.add(ReiPlugin.createProgressBar(bounds.x + 46 + 21, bounds.y + 30, recipeDisplay.getTime() * 50, GuiBuilder.ProgressDirection.RIGHT)); widgets.add(ReiPlugin.createProgressBar(bounds.x + 46 + 21, bounds.y + 30, recipeDisplay.getTime() * 50, GuiBuilder.ProgressDirection.RIGHT));
widgets.add(Widgets.createLabel(new Point(bounds.getMaxX() - 5, bounds.y + 5), new TranslatableText("techreborn.jei.recipe.processing.time.3", new DecimalFormat("###.##").format(recipeDisplay.getTime() / 20.0))) widgets.add(Widgets.createLabel(new Point(bounds.getMaxX() - 5, bounds.y + 5), Text.translatable("techreborn.jei.recipe.processing.time.3", new DecimalFormat("###.##").format(recipeDisplay.getTime() / 20.0)))
.shadow(false) .shadow(false)
.rightAligned() .rightAligned()
.color(0xFF404040, 0xFFBBBBBB) .color(0xFF404040, 0xFFBBBBBB)

View file

@ -28,7 +28,7 @@ import me.shedaniel.math.Point;
import me.shedaniel.math.Rectangle; import me.shedaniel.math.Rectangle;
import me.shedaniel.rei.api.client.gui.widgets.Widget; import me.shedaniel.rei.api.client.gui.widgets.Widget;
import me.shedaniel.rei.api.client.gui.widgets.Widgets; import me.shedaniel.rei.api.client.gui.widgets.Widgets;
import net.minecraft.text.TranslatableText; import net.minecraft.text.Text;
import reborncore.client.gui.guibuilder.GuiBuilder; import reborncore.client.gui.guibuilder.GuiBuilder;
import reborncore.common.crafting.RebornRecipe; import reborncore.common.crafting.RebornRecipe;
import reborncore.common.crafting.RebornRecipeType; import reborncore.common.crafting.RebornRecipeType;
@ -53,7 +53,7 @@ public class SawmillCategory<R extends RebornRecipe> extends AbstractEnergyConsu
widgets.add(ReiPlugin.createProgressBar(bounds.x + 55 + 21, bounds.y + 30, recipeDisplay.getTime() * 50, GuiBuilder.ProgressDirection.RIGHT)); widgets.add(ReiPlugin.createProgressBar(bounds.x + 55 + 21, bounds.y + 30, recipeDisplay.getTime() * 50, GuiBuilder.ProgressDirection.RIGHT));
widgets.add(ReiPlugin.createFluidDisplay(new Rectangle(bounds.x + 55 - 26, bounds.y + 8, 16, 50), getInput(recipeDisplay, 1).get(0).cast(), ReiPlugin.EntryAnimation.downwards(5000))); widgets.add(ReiPlugin.createFluidDisplay(new Rectangle(bounds.x + 55 - 26, bounds.y + 8, 16, 50), getInput(recipeDisplay, 1).get(0).cast(), ReiPlugin.EntryAnimation.downwards(5000)));
widgets.add(Widgets.createLabel(new Point(bounds.x + 51, bounds.y + 5), new TranslatableText("techreborn.jei.recipe.processing.time.3", new DecimalFormat("###.##").format(recipeDisplay.getTime() / 20.0))) widgets.add(Widgets.createLabel(new Point(bounds.x + 51, bounds.y + 5), Text.translatable("techreborn.jei.recipe.processing.time.3", new DecimalFormat("###.##").format(recipeDisplay.getTime() / 20.0)))
.shadow(false) .shadow(false)
.leftAligned() .leftAligned()
.color(0xFF404040, 0xFFBBBBBB) .color(0xFF404040, 0xFFBBBBBB)

View file

@ -28,7 +28,7 @@ import me.shedaniel.math.Point;
import me.shedaniel.math.Rectangle; import me.shedaniel.math.Rectangle;
import me.shedaniel.rei.api.client.gui.widgets.Widget; import me.shedaniel.rei.api.client.gui.widgets.Widget;
import me.shedaniel.rei.api.client.gui.widgets.Widgets; import me.shedaniel.rei.api.client.gui.widgets.Widgets;
import net.minecraft.text.TranslatableText; import net.minecraft.text.Text;
import reborncore.client.gui.guibuilder.GuiBuilder; import reborncore.client.gui.guibuilder.GuiBuilder;
import reborncore.common.crafting.RebornRecipe; import reborncore.common.crafting.RebornRecipe;
import reborncore.common.crafting.RebornRecipeType; import reborncore.common.crafting.RebornRecipeType;
@ -53,7 +53,7 @@ public class TwoInputsCenterOutputCategory<R extends RebornRecipe> extends Abstr
widgets.add(ReiPlugin.createProgressBar(bounds.x + 29 + 21, bounds.y + 30, recipeDisplay.getTime() * 50, GuiBuilder.ProgressDirection.RIGHT)); widgets.add(ReiPlugin.createProgressBar(bounds.x + 29 + 21, bounds.y + 30, recipeDisplay.getTime() * 50, GuiBuilder.ProgressDirection.RIGHT));
widgets.add(ReiPlugin.createProgressBar(bounds.x + 29 + 71, bounds.y + 30, recipeDisplay.getTime() * 50, GuiBuilder.ProgressDirection.LEFT)); widgets.add(ReiPlugin.createProgressBar(bounds.x + 29 + 71, bounds.y + 30, recipeDisplay.getTime() * 50, GuiBuilder.ProgressDirection.LEFT));
widgets.add(Widgets.createLabel(new Point(bounds.getMaxX() - 5, bounds.y + 5), new TranslatableText("techreborn.jei.recipe.processing.time.3", new DecimalFormat("###.##").format(recipeDisplay.getTime() / 20.0))) widgets.add(Widgets.createLabel(new Point(bounds.getMaxX() - 5, bounds.y + 5), Text.translatable("techreborn.jei.recipe.processing.time.3", new DecimalFormat("###.##").format(recipeDisplay.getTime() / 20.0)))
.shadow(false) .shadow(false)
.rightAligned() .rightAligned()
.color(0xFF404040, 0xFFBBBBBB) .color(0xFF404040, 0xFFBBBBBB)

View file

@ -31,7 +31,7 @@ import me.shedaniel.rei.plugin.client.categories.crafting.DefaultCraftingCategor
import me.shedaniel.rei.plugin.common.displays.crafting.DefaultCraftingDisplay; import me.shedaniel.rei.plugin.common.displays.crafting.DefaultCraftingDisplay;
import net.minecraft.item.Items; import net.minecraft.item.Items;
import net.minecraft.text.Text; import net.minecraft.text.Text;
import net.minecraft.text.TranslatableText; import net.minecraft.text.Text;
import reborncore.common.crafting.RebornRecipeType; import reborncore.common.crafting.RebornRecipeType;
import techreborn.api.recipe.recipes.RollingMachineRecipe; import techreborn.api.recipe.recipes.RollingMachineRecipe;
import techreborn.compat.rei.ReiPlugin; import techreborn.compat.rei.ReiPlugin;
@ -51,7 +51,7 @@ public class RollingMachineCategory extends DefaultCraftingCategory {
@Override @Override
public Text getTitle() { public Text getTitle() {
return new TranslatableText(rebornRecipeType.name().toString()); return Text.translatable(rebornRecipeType.name().toString());
} }
@Override @Override

View file

@ -7,6 +7,7 @@ import net.minecraft.item.Items;
import net.minecraft.sound.SoundEvents; import net.minecraft.sound.SoundEvents;
import net.minecraft.util.Identifier; import net.minecraft.util.Identifier;
import net.minecraft.util.registry.Registry; import net.minecraft.util.registry.Registry;
import net.minecraft.util.registry.RegistryKey;
import net.minecraft.village.TradeOffer; import net.minecraft.village.TradeOffer;
import net.minecraft.village.VillagerProfession; import net.minecraft.village.VillagerProfession;
import net.minecraft.world.poi.PointOfInterestType; import net.minecraft.world.poi.PointOfInterestType;
@ -28,9 +29,9 @@ public class TRVillager {
ELECTRICIAN_ID, 1, 1, TRContent.Machine.SOLID_FUEL_GENERATOR.block); ELECTRICIAN_ID, 1, 1, TRContent.Machine.SOLID_FUEL_GENERATOR.block);
public static final VillagerProfession METALLURGIST_PROFESSION = Registry.register(Registry.VILLAGER_PROFESSION, METALLURGIST_ID, public static final VillagerProfession METALLURGIST_PROFESSION = Registry.register(Registry.VILLAGER_PROFESSION, METALLURGIST_ID,
VillagerProfessionBuilder.create().id(METALLURGIST_ID).workstation(METALLURGIST_POI).workSound(SoundEvents.ENTITY_VILLAGER_WORK_TOOLSMITH).build()); VillagerProfessionBuilder.create().id(METALLURGIST_ID).workstation(RegistryKey.of(Registry.POINT_OF_INTEREST_TYPE_KEY, METALLURGIST_ID)).workSound(SoundEvents.ENTITY_VILLAGER_WORK_TOOLSMITH).build());
public static final VillagerProfession ELECTRICIAN_PROFESSION = Registry.register(Registry.VILLAGER_PROFESSION,ELECTRICIAN_ID, public static final VillagerProfession ELECTRICIAN_PROFESSION = Registry.register(Registry.VILLAGER_PROFESSION,ELECTRICIAN_ID,
VillagerProfessionBuilder.create().id(ELECTRICIAN_ID).workstation(ELECTRICIAN_POI).workSound(ModSounds.CABLE_SHOCK).build()); VillagerProfessionBuilder.create().id(ELECTRICIAN_ID).workstation(RegistryKey.of(Registry.POINT_OF_INTEREST_TYPE_KEY, ELECTRICIAN_ID)).workSound(ModSounds.CABLE_SHOCK).build());
private TRVillager() {/* No instantiation. */} private TRVillager() {/* No instantiation. */}

View file

@ -30,7 +30,7 @@ import com.mojang.brigadier.context.CommandContext;
import net.fabricmc.fabric.api.command.v1.CommandRegistrationCallback; import net.fabricmc.fabric.api.command.v1.CommandRegistrationCallback;
import net.fabricmc.loader.api.FabricLoader; import net.fabricmc.loader.api.FabricLoader;
import net.minecraft.server.command.ServerCommandSource; import net.minecraft.server.command.ServerCommandSource;
import net.minecraft.text.LiteralText; import net.minecraft.text.Text;
import techreborn.init.TRContent; import techreborn.init.TRContent;
import java.io.IOException; import java.io.IOException;
@ -69,11 +69,11 @@ public class TechRebornTemplates {
process(processor); process(processor);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
ctx.getSource().sendError(new LiteralText(e.getMessage())); ctx.getSource().sendError(Text.literal(e.getMessage()));
return 0; return 0;
} }
ctx.getSource().sendFeedback(new LiteralText("done"), true); ctx.getSource().sendFeedback(Text.literal("done"), true);
return Command.SINGLE_SUCCESS; return Command.SINGLE_SUCCESS;
} }

View file

@ -49,9 +49,9 @@ import net.minecraft.sound.SoundCategory;
import net.minecraft.sound.SoundEvent; import net.minecraft.sound.SoundEvent;
import net.minecraft.sound.SoundEvents; import net.minecraft.sound.SoundEvents;
import net.minecraft.tag.FluidTags; import net.minecraft.tag.FluidTags;
import net.minecraft.text.LiteralText;
import net.minecraft.text.Text; import net.minecraft.text.Text;
import net.minecraft.text.TranslatableText; import net.minecraft.text.Text;
import net.minecraft.text.Text;
import net.minecraft.util.Hand; import net.minecraft.util.Hand;
import net.minecraft.util.Identifier; import net.minecraft.util.Identifier;
import net.minecraft.util.TypedActionResult; import net.minecraft.util.TypedActionResult;
@ -124,7 +124,7 @@ public class DynamicCellItem extends Item implements ItemFluidInfo {
if (!blockState.isAir() && !canPlace && (!(blockState.getBlock() instanceof FluidFillable) || !((FluidFillable) blockState.getBlock()).canFillWithFluid(world, pos, blockState, fluid))) { if (!blockState.isAir() && !canPlace && (!(blockState.getBlock() instanceof FluidFillable) || !((FluidFillable) blockState.getBlock()).canFillWithFluid(world, pos, blockState, fluid))) {
return hitResult != null && this.placeFluid(player, world, hitResult.getBlockPos().offset(hitResult.getSide()), null, filledCell); return hitResult != null && this.placeFluid(player, world, hitResult.getBlockPos().offset(hitResult.getSide()), null, filledCell);
} else { } else {
if (world.getDimension().isUltrawarm() && fluid.isIn(FluidTags.WATER)) { if (world.getDimension().ultrawarm() && fluid.isIn(FluidTags.WATER)) {
int i = pos.getX(); int i = pos.getX();
int j = pos.getY(); int j = pos.getY();
int k = pos.getZ(); int k = pos.getZ();
@ -167,7 +167,7 @@ public class DynamicCellItem extends Item implements ItemFluidInfo {
Fluid fluid = getFluid(itemStack); Fluid fluid = getFluid(itemStack);
if (fluid != Fluids.EMPTY) { if (fluid != Fluids.EMPTY) {
// TODO use translation keys for fluid and the cell https://fabric.asie.pl/wiki/tutorial:lang?s[]=translation might be useful // TODO use translation keys for fluid and the cell https://fabric.asie.pl/wiki/tutorial:lang?s[]=translation might be useful
return new LiteralText(new TranslatableText("item.techreborn.cell.fluid").getString().replace("$fluid$", FluidUtils.getFluidName(fluid))); return Text.literal(Text.translatable("item.techreborn.cell.fluid").getString().replace("$fluid$", FluidUtils.getFluidName(fluid)));
} }
return super.getName(itemStack); return super.getName(itemStack);
} }

View file

@ -31,12 +31,12 @@ import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemUsageContext; import net.minecraft.item.ItemUsageContext;
import net.minecraft.nbt.NbtOps; import net.minecraft.nbt.NbtOps;
import net.minecraft.server.network.ServerPlayerEntity; import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.text.LiteralText;
import net.minecraft.text.Text; import net.minecraft.text.Text;
import net.minecraft.text.TranslatableText; import net.minecraft.text.Text;
import net.minecraft.text.Text;
import net.minecraft.util.*; import net.minecraft.util.*;
import net.minecraft.util.dynamic.GlobalPos;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.GlobalPos;
import net.minecraft.util.registry.RegistryKey; import net.minecraft.util.registry.RegistryKey;
import net.minecraft.world.World; import net.minecraft.world.World;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
@ -66,17 +66,17 @@ public class FrequencyTransmitterItem extends Item {
.ifPresent(tag -> stack.getOrCreateNbt().put("pos", tag)); .ifPresent(tag -> stack.getOrCreateNbt().put("pos", tag));
if (context.getPlayer() instanceof ServerPlayerEntity serverPlayerEntity) { if (context.getPlayer() instanceof ServerPlayerEntity serverPlayerEntity) {
ChatUtils.sendNoSpamMessage(serverPlayerEntity, MessageIDs.freqTransmitterID, new TranslatableText("techreborn.message.setTo") ChatUtils.sendNoSpamMessage(serverPlayerEntity, MessageIDs.freqTransmitterID, Text.translatable("techreborn.message.setTo")
.append(new LiteralText(" X:").formatted(Formatting.GRAY)) .append(Text.literal(" X:").formatted(Formatting.GRAY))
.append(new LiteralText(String.valueOf(pos.getX())).formatted(Formatting.GOLD)) .append(Text.literal(String.valueOf(pos.getX())).formatted(Formatting.GOLD))
.append(new LiteralText(" Y:").formatted(Formatting.GRAY)) .append(Text.literal(" Y:").formatted(Formatting.GRAY))
.append(new LiteralText(String.valueOf(pos.getY())).formatted(Formatting.GOLD)) .append(Text.literal(String.valueOf(pos.getY())).formatted(Formatting.GOLD))
.append(new LiteralText(" Z:").formatted(Formatting.GRAY)) .append(Text.literal(" Z:").formatted(Formatting.GRAY))
.append(new LiteralText(String.valueOf(pos.getZ())).formatted(Formatting.GOLD)) .append(Text.literal(String.valueOf(pos.getZ())).formatted(Formatting.GOLD))
.append(" ") .append(" ")
.append(new TranslatableText("techreborn.message.in").formatted(Formatting.GRAY)) .append(Text.translatable("techreborn.message.in").formatted(Formatting.GRAY))
.append(" ") .append(" ")
.append(new LiteralText(getDimName(globalPos.getDimension()).toString()).formatted(Formatting.GOLD))); .append(Text.literal(getDimName(globalPos.getDimension()).toString()).formatted(Formatting.GOLD)));
} }
return ActionResult.SUCCESS; return ActionResult.SUCCESS;
@ -98,11 +98,11 @@ public class FrequencyTransmitterItem extends Item {
if (player instanceof ServerPlayerEntity serverPlayerEntity) { if (player instanceof ServerPlayerEntity serverPlayerEntity) {
ChatUtils.sendNoSpamMessage(serverPlayerEntity, MessageIDs.freqTransmitterID, ChatUtils.sendNoSpamMessage(serverPlayerEntity, MessageIDs.freqTransmitterID,
new TranslatableText("techreborn.message.coordsHaveBeen") Text.translatable("techreborn.message.coordsHaveBeen")
.formatted(Formatting.GRAY) .formatted(Formatting.GRAY)
.append(" ") .append(" ")
.append( .append(
new TranslatableText("techreborn.message.cleared") Text.translatable("techreborn.message.cleared")
.formatted(Formatting.GOLD) .formatted(Formatting.GOLD)
) )
); );
@ -116,10 +116,10 @@ public class FrequencyTransmitterItem extends Item {
public void appendTooltip(ItemStack stack, @Nullable World worldIn, List<Text> tooltip, TooltipContext flagIn) { public void appendTooltip(ItemStack stack, @Nullable World worldIn, List<Text> tooltip, TooltipContext flagIn) {
getPos(stack) getPos(stack)
.ifPresent(globalPos -> { .ifPresent(globalPos -> {
tooltip.add(new LiteralText(Formatting.GRAY + "X: " + Formatting.GOLD + globalPos.getPos().getX())); tooltip.add(Text.literal(Formatting.GRAY + "X: " + Formatting.GOLD + globalPos.getPos().getX()));
tooltip.add(new LiteralText(Formatting.GRAY + "Y: " + Formatting.GOLD + globalPos.getPos().getY())); tooltip.add(Text.literal(Formatting.GRAY + "Y: " + Formatting.GOLD + globalPos.getPos().getY()));
tooltip.add(new LiteralText(Formatting.GRAY + "Z: " + Formatting.GOLD + globalPos.getPos().getZ())); tooltip.add(Text.literal(Formatting.GRAY + "Z: " + Formatting.GOLD + globalPos.getPos().getZ()));
tooltip.add(new LiteralText(Formatting.DARK_GRAY + getDimName(globalPos.getDimension()).toString())); tooltip.add(Text.literal(Formatting.DARK_GRAY + getDimName(globalPos.getDimension()).toString()));
}); });
} }

View file

@ -31,7 +31,7 @@ import net.minecraft.command.BlockDataObject;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemUsageContext; import net.minecraft.item.ItemUsageContext;
import net.minecraft.state.property.Property; import net.minecraft.state.property.Property;
import net.minecraft.text.LiteralText; import net.minecraft.text.Text;
import net.minecraft.text.MutableText; import net.minecraft.text.MutableText;
import net.minecraft.text.Text; import net.minecraft.text.Text;
import net.minecraft.util.ActionResult; import net.minecraft.util.ActionResult;
@ -63,15 +63,15 @@ public class DebugToolItem extends Item {
if (context.getWorld().isClient) { if (context.getWorld().isClient) {
return ActionResult.SUCCESS; return ActionResult.SUCCESS;
} }
sendMessage(context, new LiteralText(getRegistryName(block))); sendMessage(context, Text.literal(getRegistryName(block)));
for (Entry<Property<?>, Comparable<?>> entry : blockState.getEntries().entrySet()) { for (Entry<Property<?>, Comparable<?>> entry : blockState.getEntries().entrySet()) {
sendMessage(context, new LiteralText(getPropertyString(entry))); sendMessage(context, Text.literal(getPropertyString(entry)));
} }
EnergyStorage energyStorage = EnergyStorage.SIDED.find(context.getWorld(), context.getBlockPos(), context.getSide()); EnergyStorage energyStorage = EnergyStorage.SIDED.find(context.getWorld(), context.getBlockPos(), context.getSide());
if (energyStorage != null) { if (energyStorage != null) {
sendMessage(context, new LiteralText(getRCPower(energyStorage))); sendMessage(context, Text.literal(getRCPower(energyStorage)));
} }
BlockEntity blockEntity = context.getWorld().getBlockEntity(context.getBlockPos()); BlockEntity blockEntity = context.getWorld().getBlockEntity(context.getBlockPos());
@ -79,7 +79,7 @@ public class DebugToolItem extends Item {
return ActionResult.CONSUME; return ActionResult.CONSUME;
} }
sendMessage(context, new LiteralText(getBlockEntityType(blockEntity))); sendMessage(context, Text.literal(getBlockEntityType(blockEntity)));
sendMessage(context, getBlockEntityTags(blockEntity)); sendMessage(context, getBlockEntityTags(blockEntity));
@ -90,7 +90,7 @@ public class DebugToolItem extends Item {
if (context.getWorld().isClient || context.getPlayer() == null) { if (context.getWorld().isClient || context.getPlayer() == null) {
return; return;
} }
context.getPlayer().sendSystemMessage(message, Util.NIL_UUID); context.getPlayer().sendMessage(message);
} }
private String getPropertyString(Entry<Property<?>, Comparable<?>> entryIn) { private String getPropertyString(Entry<Property<?>, Comparable<?>> entryIn) {
@ -136,7 +136,7 @@ public class DebugToolItem extends Item {
} }
private Text getBlockEntityTags(BlockEntity blockEntity){ private Text getBlockEntityTags(BlockEntity blockEntity){
MutableText s = new LiteralText("BlockEntity Tags:").formatted(Formatting.GREEN); MutableText s = Text.literal("BlockEntity Tags:").formatted(Formatting.GREEN);
BlockDataObject bdo = new BlockDataObject(blockEntity, blockEntity.getPos()); BlockDataObject bdo = new BlockDataObject(blockEntity, blockEntity.getPos());
s.append(bdo.getNbt().toString()); s.append(bdo.getNbt().toString());

View file

@ -35,7 +35,7 @@ import net.minecraft.nbt.NbtHelper;
import net.minecraft.sound.SoundCategory; import net.minecraft.sound.SoundCategory;
import net.minecraft.sound.SoundEvents; import net.minecraft.sound.SoundEvents;
import net.minecraft.text.Text; import net.minecraft.text.Text;
import net.minecraft.text.TranslatableText; import net.minecraft.text.Text;
import net.minecraft.util.ActionResult; import net.minecraft.util.ActionResult;
import net.minecraft.util.Formatting; import net.minecraft.util.Formatting;
import net.minecraft.world.World; import net.minecraft.world.World;
@ -97,10 +97,10 @@ public class PaintingToolItem extends Item {
public void appendTooltip(ItemStack stack, @Nullable World world, List<Text> tooltip, TooltipContext context) { public void appendTooltip(ItemStack stack, @Nullable World world, List<Text> tooltip, TooltipContext context) {
BlockState blockState = getCover(stack); BlockState blockState = getCover(stack);
if (blockState != null) { if (blockState != null) {
tooltip.add((new TranslatableText(blockState.getBlock().getTranslationKey())).formatted(Formatting.GRAY)); tooltip.add((Text.translatable(blockState.getBlock().getTranslationKey())).formatted(Formatting.GRAY));
tooltip.add((new TranslatableText("techreborn.tooltip.painting_tool.apply")).formatted(Formatting.GOLD)); tooltip.add((Text.translatable("techreborn.tooltip.painting_tool.apply")).formatted(Formatting.GOLD));
} else { } else {
tooltip.add((new TranslatableText("techreborn.tooltip.painting_tool.select")).formatted(Formatting.GOLD)); tooltip.add((Text.translatable("techreborn.tooltip.painting_tool.select")).formatted(Formatting.GOLD));
} }
} }

View file

@ -31,9 +31,9 @@ import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.server.network.ServerPlayerEntity; import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.text.LiteralText;
import net.minecraft.text.Text; import net.minecraft.text.Text;
import net.minecraft.text.TranslatableText; import net.minecraft.text.Text;
import net.minecraft.text.Text;
import net.minecraft.util.ActionResult; import net.minecraft.util.ActionResult;
import net.minecraft.util.Formatting; import net.minecraft.util.Formatting;
import net.minecraft.util.Hand; import net.minecraft.util.Hand;
@ -69,7 +69,7 @@ public class IndustrialJackhammerItem extends JackhammerItem implements MultiBlo
ItemUtils.switchActive(stack, cost, messageId, entity); ItemUtils.switchActive(stack, cost, messageId, entity);
stack.getOrCreateNbt().putBoolean("AOE5", false); stack.getOrCreateNbt().putBoolean("AOE5", false);
if (entity instanceof ServerPlayerEntity serverPlayerEntity) { if (entity instanceof ServerPlayerEntity serverPlayerEntity) {
ChatUtils.sendNoSpamMessage(serverPlayerEntity, messageId, new TranslatableText("techreborn.message.setTo").formatted(Formatting.GRAY).append(" ").append(new LiteralText("3*3").formatted(Formatting.GOLD))); ChatUtils.sendNoSpamMessage(serverPlayerEntity, messageId, Text.translatable("techreborn.message.setTo").formatted(Formatting.GRAY).append(" ").append(Text.literal("3*3").formatted(Formatting.GOLD)));
} }
} else { } else {
if (isAOE5(stack)) { if (isAOE5(stack)) {
@ -78,7 +78,7 @@ public class IndustrialJackhammerItem extends JackhammerItem implements MultiBlo
} else { } else {
stack.getOrCreateNbt().putBoolean("AOE5", true); stack.getOrCreateNbt().putBoolean("AOE5", true);
if (entity instanceof ServerPlayerEntity serverPlayerEntity) { if (entity instanceof ServerPlayerEntity serverPlayerEntity) {
ChatUtils.sendNoSpamMessage(serverPlayerEntity, messageId, new TranslatableText("techreborn.message.setTo").formatted(Formatting.GRAY).append(" ").append(new LiteralText("5*5").formatted(Formatting.GOLD))); ChatUtils.sendNoSpamMessage(serverPlayerEntity, messageId, Text.translatable("techreborn.message.setTo").formatted(Formatting.GRAY).append(" ").append(Text.literal("5*5").formatted(Formatting.GOLD)));
} }
} }
} }
@ -149,9 +149,9 @@ public class IndustrialJackhammerItem extends JackhammerItem implements MultiBlo
ItemUtils.buildActiveTooltip(stack, tooltip); ItemUtils.buildActiveTooltip(stack, tooltip);
if (ItemUtils.isActive(stack)) { if (ItemUtils.isActive(stack)) {
if (isAOE5(stack)) { if (isAOE5(stack)) {
tooltip.add(new LiteralText("5*5").formatted(Formatting.RED)); tooltip.add(Text.literal("5*5").formatted(Formatting.RED));
} else { } else {
tooltip.add(new LiteralText("3*3").formatted(Formatting.RED)); tooltip.add(Text.literal("3*3").formatted(Formatting.RED));
} }
} }
} }

View file

@ -25,6 +25,7 @@
package techreborn.world; package techreborn.world;
import net.minecraft.block.sapling.SaplingGenerator; import net.minecraft.block.sapling.SaplingGenerator;
import net.minecraft.util.math.random.AbstractRandom;
import net.minecraft.util.registry.BuiltinRegistries; import net.minecraft.util.registry.BuiltinRegistries;
import net.minecraft.util.registry.RegistryEntry; import net.minecraft.util.registry.RegistryEntry;
import net.minecraft.world.gen.feature.ConfiguredFeature; import net.minecraft.world.gen.feature.ConfiguredFeature;
@ -35,7 +36,7 @@ import java.util.Random;
public class RubberSaplingGenerator extends SaplingGenerator { public class RubberSaplingGenerator extends SaplingGenerator {
@Nullable @Nullable
@Override @Override
protected RegistryEntry<? extends ConfiguredFeature<?, ?>> getTreeFeature(Random random, boolean bees) { protected RegistryEntry<? extends ConfiguredFeature<?, ?>> getTreeFeature(AbstractRandom random, boolean bees) {
return WorldGenerator.getEntry(BuiltinRegistries.CONFIGURED_FEATURE, WorldGenerator.RUBBER_TREE_FEATURE); return WorldGenerator.getEntry(BuiltinRegistries.CONFIGURED_FEATURE, WorldGenerator.RUBBER_TREE_FEATURE);
} }
} }

View file

@ -64,13 +64,13 @@ public class RubberTreeSpikeDecorator extends TreeDecorator {
} }
@Override @Override
public void generate(TestableWorld world, BiConsumer<BlockPos, BlockState> replacer, Random random, List<BlockPos> logPositions, List<BlockPos> leavesPositions) { public void generate(Generator generator) {
logPositions.stream() generator.getLogPositions().stream()
.max(Comparator.comparingInt(BlockPos::getY)) .max(Comparator.comparingInt(BlockPos::getY))
.ifPresent(blockPos -> { .ifPresent(blockPos -> {
for (int i = 0; i < spireHeight; i++) { for (int i = 0; i < spireHeight; i++) {
BlockPos sPos = blockPos.up(i); BlockPos sPos = blockPos.up(i);
replacer.accept(sPos, provider.getBlockState(random, sPos)); generator.replace(sPos, provider.getBlockState(generator.getRandom(), sPos));
} }
}); });
} }

View file

@ -26,6 +26,7 @@ package techreborn.world;
import net.fabricmc.fabric.api.biome.v1.*; import net.fabricmc.fabric.api.biome.v1.*;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.tag.BiomeTags;
import net.minecraft.util.Identifier; import net.minecraft.util.Identifier;
import net.minecraft.util.collection.DataPool; import net.minecraft.util.collection.DataPool;
import net.minecraft.util.math.Direction; import net.minecraft.util.math.Direction;
@ -35,6 +36,7 @@ import net.minecraft.util.registry.Registry;
import net.minecraft.util.registry.RegistryEntry; import net.minecraft.util.registry.RegistryEntry;
import net.minecraft.util.registry.RegistryKey; import net.minecraft.util.registry.RegistryKey;
import net.minecraft.world.biome.Biome; import net.minecraft.world.biome.Biome;
import net.minecraft.world.biome.BiomeKeys;
import net.minecraft.world.gen.GenerationStep; import net.minecraft.world.gen.GenerationStep;
import net.minecraft.world.gen.feature.*; import net.minecraft.world.gen.feature.*;
import net.minecraft.world.gen.feature.size.TwoLayersFeatureSize; import net.minecraft.world.gen.feature.size.TwoLayersFeatureSize;
@ -72,7 +74,9 @@ public class WorldGenerator {
BiomeModifications.create(new Identifier("techreborn", "features")) BiomeModifications.create(new Identifier("techreborn", "features"))
.add(ModificationPhase.ADDITIONS, BiomeSelectors.all(), oreModifier()) .add(ModificationPhase.ADDITIONS, BiomeSelectors.all(), oreModifier())
.add(ModificationPhase.ADDITIONS, BiomeSelectors.categories(Biome.Category.FOREST, Biome.Category.TAIGA, Biome.Category.SWAMP), rubberTreeModifier()); .add(ModificationPhase.ADDITIONS, BiomeSelectors.tag(BiomeTags.IS_FOREST)
.or(BiomeSelectors.tag(BiomeTags.IS_TAIGA))
.or(BiomeSelectors.includeByKey(BiomeKeys.SWAMP)), rubberTreeModifier());
} }
private static BiConsumer<BiomeSelectionContext, BiomeModificationContext> oreModifier() { private static BiConsumer<BiomeSelectionContext, BiomeModificationContext> oreModifier() {

View file

@ -30,12 +30,12 @@
] ]
}, },
"depends": { "depends": {
"fabricloader": ">=0.13.3", "fabricloader": ">=0.14.5",
"fabric": ">=0.51.1", "fabric": ">=0.52.4",
"reborncore": "*", "reborncore": "*",
"team_reborn_energy": ">=2.2.0", "team_reborn_energy": ">=2.2.0",
"fabric-biome-api-v1": ">=3.0.0", "fabric-biome-api-v1": ">=3.0.0",
"minecraft": "~1.18.2-beta.1" "minecraft": "~1.19-beta.1"
}, },
"accessWidener": "techreborn.accesswidener", "accessWidener": "techreborn.accesswidener",
"authors": [ "authors": [