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.ServerTickEvents;
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.loader.api.FabricLoader;
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
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
ServerBoundPackets.init();

View file

@ -25,7 +25,7 @@
package reborncore.client;
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.VertexConsumer;
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.ItemStack;
import net.minecraft.nbt.NbtCompound;
import net.minecraft.text.LiteralText;
import net.minecraft.text.MutableText;
import net.minecraft.text.Text;
import net.minecraft.util.Formatting;
@ -59,7 +58,7 @@ public class StackToolTipHandler implements ItemTooltipCallback {
((IListInfoProvider) item).addInfo(tooltipLines, false, false);
}
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(PowerSystem.getLocalizedPower(energyItem.getEnergyCapacity()));
line1.formatted(Formatting.GOLD);
@ -76,7 +75,8 @@ public class StackToolTipHandler implements ItemTooltipCallback {
double inputRate = energyItem.getEnergyMaxInput();
double outputRate = energyItem.getEnergyMaxOutput();
LiteralText line3 = new LiteralText("");
MutableText line3 = Text.literal("");
if (inputRate != 0 && inputRate == outputRate){
line3.append(I18n.translate("techreborn.tooltip.transferRate"));
line3.append(" : ");
@ -111,7 +111,7 @@ public class StackToolTipHandler implements ItemTooltipCallback {
if (blockEntity != null) {
blockEntity.readNbt(blockEntityData);
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) {

View file

@ -29,7 +29,6 @@ import com.mojang.blaze3d.systems.RenderSystem;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.widget.ButtonWidget;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.text.LiteralText;
import net.minecraft.text.Text;
import net.minecraft.util.Identifier;
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,
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.textureV = v;
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.util.math.MatrixStack;
import net.minecraft.item.ItemStack;
import net.minecraft.text.LiteralText;
import net.minecraft.text.Text;
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,
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;
textureV = v;
itemstack = stack;

View file

@ -42,9 +42,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.screen.ScreenHandler;
import net.minecraft.screen.slot.Slot;
import net.minecraft.text.LiteralText;
import net.minecraft.text.Text;
import net.minecraft.text.TranslatableText;
import net.minecraft.util.Util;
import org.jetbrains.annotations.Nullable;
import org.lwjgl.glfw.GLFW;
@ -136,7 +134,7 @@ public class GuiBase<T extends ScreenHandler> extends HandledScreen<T> {
public boolean upgrades;
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.builtScreenHandler = (BuiltScreenHandler) screenHandler;
selectedTab = null;
@ -266,13 +264,13 @@ public class GuiBase<T extends ScreenHandler> extends HandledScreen<T> {
if (isPointWithinBounds(-25, 6, 24, 80, mouseX, mouseY) && upgrades
&& this.focusedSlot != null && !this.focusedSlot.hasStack()) {
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);
}
int offset = upgrades ? 82 : 0;
for (GuiTab tab : tabs) {
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;
}
@ -290,7 +288,7 @@ public class GuiBase<T extends ScreenHandler> extends HandledScreen<T> {
}
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) {

View file

@ -27,7 +27,7 @@ package reborncore.client.gui.builder;
import net.minecraft.client.render.item.ItemRenderer;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.text.Text;
import net.minecraft.text.TranslatableText;
import net.minecraft.text.Text;
import reborncore.client.RenderUtil;
import reborncore.client.gui.guibuilder.GuiBuilder;
import reborncore.common.blockentity.RedstoneConfiguration;
@ -53,13 +53,13 @@ public class RedstoneConfigGui {
for (RedstoneConfiguration.Element element : configuration.getElements()) {
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);
int color = hovered ? 0xFF8b8b8b : 0x668b8b8b;
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.getTextRenderer().drawWithShadow(name, x + 92, y + (i * spread), -1);
i++;

View file

@ -28,10 +28,13 @@ import com.google.common.collect.Lists;
import com.mojang.blaze3d.systems.RenderSystem;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.network.MessageType;
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.registry.Registry;
import org.jetbrains.annotations.Nullable;
import org.spongepowered.asm.mixin.Unique;
import reborncore.client.gui.GuiUtil;
import reborncore.client.gui.builder.GuiBase;
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.network.NetworkManager;
import reborncore.common.network.ServerBoundPackets;
import reborncore.common.util.ClientChatUtils;
import reborncore.common.util.Color;
import java.util.Collections;
@ -108,7 +112,7 @@ public class SlotConfigGui {
}
String json = machine.getSlotConfiguration().toJson(machine.getClass().getCanonicalName());
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() {
@ -120,9 +124,9 @@ public class SlotConfigGui {
try {
machine.getSlotConfiguration().readJson(json, machine.getClass().getCanonicalName());
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) {
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;
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.common.util.Tank;
@ -51,12 +51,12 @@ public class ConfigFluidElement extends ElementBase {
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) -> {
popupElement.updateCheckBox((CheckBoxElement) element, "input", gui12);
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) -> {
popupElement.updateCheckBox((CheckBoxElement) element, "output", gui13);
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.inventory.Inventory;
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.slot.SlotConfigGui;
import reborncore.client.gui.slots.BaseSlot;
@ -74,14 +74,14 @@ public class ConfigSlotElement extends ElementBase {
}));
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) -> {
popupElement.updateCheckBox((CheckBoxElement) element, "input", gui12);
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) -> {
popupElement.updateCheckBox((CheckBoxElement) element, "output", gui13);
return true;
@ -89,7 +89,7 @@ public class ConfigSlotElement extends ElementBase {
if (gui.getMachine() instanceof SlotConfiguration.SlotFilter slotFilter) {
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) -> {
popupElement.updateCheckBox((CheckBoxElement) element, "filter", gui13);
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.util.math.MatrixStack;
import net.minecraft.text.LiteralText;
import net.minecraft.text.Text;
import reborncore.client.gui.builder.GuiBase;
/**
@ -38,7 +38,7 @@ public class GuiButtonHologram extends GuiButtonExtended {
GuiBase<?> gui;
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.gui = gui;
}

View file

@ -27,7 +27,7 @@ package reborncore.client.gui.builder.widget;
import com.mojang.blaze3d.systems.RenderSystem;
import net.minecraft.client.gui.widget.ButtonWidget;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.text.LiteralText;
import net.minecraft.text.Text;
import reborncore.client.gui.builder.GuiBase;
/**
@ -39,7 +39,7 @@ public class GuiButtonUpDown extends GuiButtonExtended {
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.type = type;
}

View file

@ -42,9 +42,8 @@ import net.minecraft.client.texture.SpriteAtlasTexture;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.fluid.Fluids;
import net.minecraft.item.ItemStack;
import net.minecraft.text.LiteralText;
import net.minecraft.text.Text;
import net.minecraft.text.TranslatableText;
import net.minecraft.text.Text;
import net.minecraft.util.Formatting;
import net.minecraft.util.Identifier;
import reborncore.api.IListInfoProvider;
@ -67,7 +66,7 @@ import java.util.stream.Collectors;
*/
public class GuiBuilder {
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;
public GuiBuilder() {
@ -175,9 +174,9 @@ public class GuiBuilder {
if (gui.isPointInRect(x, y, 20, 12, mouseX, mouseY)) {
List<Text> list = new ArrayList<>();
if (locked) {
list.add(new TranslatableText("reborncore.gui.tooltip.unlock_items"));
list.add(Text.translatable("reborncore.gui.tooltip.unlock_items"));
} else {
list.add(new TranslatableText("reborncore.gui.tooltip.lock_items"));
list.add(Text.translatable("reborncore.gui.tooltip.lock_items"));
}
matrixStack.push();
gui.renderTooltip(matrixStack, list, mouseX, mouseY);
@ -209,7 +208,7 @@ public class GuiBuilder {
}
if (gui.isPointInRect(x, y, 20, 12, mouseX, mouseY)) {
List<Text> list = new ArrayList<>();
list.add(new TranslatableText("reborncore.gui.tooltip.hologram"));
list.add(Text.translatable("reborncore.gui.tooltip.hologram"));
matrixStack.push();
if (layer == GuiBase.Layer.FOREGROUND) {
mouseX -= gui.getGuiLeft();
@ -245,8 +244,8 @@ public class GuiBuilder {
}
gui.drawTexture(matrixStack, x + 4, y + 4, 26, 246, j, 10);
Text text = new LiteralText(String.valueOf(value))
.append(new TranslatableText("reborncore.gui.heat"));
Text text = Text.literal(String.valueOf(value))
.append(Text.translatable("reborncore.gui.heat"));
gui.drawCentredText(matrixStack, text, y + 5, 0xFFFFFF, layer);
}
@ -282,13 +281,13 @@ public class GuiBuilder {
if (!suffix.equals("")) {
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)) {
int percentage = percentage(max, value);
List<Text> list = new ArrayList<>();
list.add(
new LiteralText(String.valueOf(value))
Text.literal(String.valueOf(value))
.formatted(Formatting.GOLD)
.append("/")
.append(String.valueOf(max))
@ -296,11 +295,11 @@ public class GuiBuilder {
);
list.add(
new LiteralText(String.valueOf(percentage))
Text.literal(String.valueOf(percentage))
.formatted(StringUtils.getPercentageColour(percentage))
.append("%")
.append(
new TranslatableText("reborncore.gui.tooltip.dsu_fullness")
Text.translatable("reborncore.gui.tooltip.dsu_fullness")
.formatted(Formatting.GRAY)
)
);
@ -309,15 +308,15 @@ public class GuiBuilder {
if (value > max) {
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)
);
list.add(
new LiteralText("prolly a bug")
Text.literal("prolly a bug")
.formatted(Formatting.GRAY)
);
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)
);
}
@ -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) {
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) {
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);
RenderSystem.colorMask(true, true, true, true);
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) {
List<Text> tips = guiTab.getTips().stream()
.map(TranslatableText::new)
.map(Text::translatable)
.collect(Collectors.toList());
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) {
if (gui.hideGuiElements()) return;
Text text = new LiteralText(PowerSystem.getLocalizedPowerNoSuffix(maxOutput))
Text text = Text.literal(PowerSystem.getLocalizedPowerNoSuffix(maxOutput))
.append(SPACE_TEXT)
.append(PowerSystem.getDisplayPower().abbreviation)
.append("\t");
@ -544,7 +543,7 @@ public class GuiBuilder {
int percentage = percentage(maxProgress, progress);
List<Text> list = new ArrayList<>();
list.add(
new LiteralText(String.valueOf(percentage))
Text.literal(String.valueOf(percentage))
.formatted(StringUtils.getPercentageColour(percentage))
.append("%")
);
@ -592,14 +591,14 @@ public class GuiBuilder {
List<Text> list = Lists.newArrayList();
if (Screen.hasShiftDown()) {
list.add(
new LiteralText(PowerSystem.getLocalizedPowerFullNoSuffix(energyStored))
Text.literal(PowerSystem.getLocalizedPowerFullNoSuffix(energyStored))
.formatted(Formatting.GOLD)
.append("/")
.append(PowerSystem.getLocalizedPowerFull(maxEnergyStored))
);
} else {
list.add(
new LiteralText(PowerSystem.getLocalizedPowerNoSuffix(energyStored))
Text.literal(PowerSystem.getLocalizedPowerNoSuffix(energyStored))
.formatted(Formatting.GOLD)
.append("/")
.append(PowerSystem.getLocalizedPower(maxEnergyStored))
@ -609,7 +608,7 @@ public class GuiBuilder {
StringUtils.getPercentageText(percentage)
.append(SPACE_TEXT)
.append(
new TranslatableText("reborncore.gui.tooltip.power_charged")
Text.translatable("reborncore.gui.tooltip.power_charged")
.formatted(Formatting.GRAY)
)
);
@ -618,14 +617,14 @@ public class GuiBuilder {
if (Screen.hasShiftDown()) {
((IListInfoProvider) gui.be).addInfo(list, true, true);
} else {
list.add(LiteralText.EMPTY);
list.add(Text.empty());
list.add(
new LiteralText("Shift")
Text.literal("Shift")
.formatted(Formatting.BLUE)
.append(SPACE_TEXT)
.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)) {
List<Text> list = new ArrayList<>();
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 {
list.add(
new LiteralText(String.format("%s / %s", amount, maxCapacity))
Text.literal(String.format("%s / %s", amount, maxCapacity))
.formatted(Formatting.GOLD)
.append(SPACE_TEXT)
.append(FluidUtils.getFluidName(fluid))
@ -689,7 +688,7 @@ public class GuiBuilder {
StringUtils.getPercentageText(percentage)
.formatted(Formatting.GRAY)
.append(SPACE_TEXT)
.append(new TranslatableText("reborncore.gui.tooltip.tank_fullness"))
.append(Text.translatable("reborncore.gui.tooltip.tank_fullness"))
);
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.item.ItemStack;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.random.AbstractRandom;
import net.minecraft.world.BlockRenderView;
import net.minecraft.world.BlockView;
import reborncore.common.blockentity.MultiblockWriter;
@ -46,7 +47,7 @@ record HologramRenderer(BlockRenderView view, MatrixStack matrix, VertexConsumer
} else {
matrix.translate(-0.5, -0.5, -0.5);
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();

View file

@ -43,7 +43,7 @@ import net.minecraft.server.command.ServerCommandSource;
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.server.world.ServerChunkManager;
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.world.chunk.ChunkStatus;
import reborncore.common.network.ClientBoundPackets;
@ -108,13 +108,14 @@ public class RebornCoreCommands {
.executes(RebornCoreCommands::renderMod)
)
)
.then(
literal("item")
.then(
argument("item", ItemStackArgumentType.itemStack())
.executes(RebornCoreCommands::itemRenderer)
)
)
// TODO 1.19: Waiting on https://github.com/FabricMC/fabric/pull/2227
// .then(
// literal("item")
// .then(
// argument("item", ItemStackArgumentType.itemStack())
// .executes(RebornCoreCommands::itemRenderer)
// )
// )
.then(
literal("hand")
.executes(RebornCoreCommands::handRenderer)
@ -137,7 +138,7 @@ public class RebornCoreCommands {
CompletableFuture.supplyAsync(() -> serverChunkManager.getChunk(chunkPosX, chunkPosZ, ChunkStatus.FULL, true), EXECUTOR_SERVICE)
.whenComplete((chunk, throwable) -> {
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) {
try {
queueRender(Collections.singletonList(ctx.getSource().getPlayer().getInventory().getMainHandStack()), ctx);
} catch (CommandSyntaxException e) {
e.printStackTrace();
return 0;
}
queueRender(Collections.singletonList(ctx.getSource().getPlayer().getInventory().getMainHandStack()), ctx);
return Command.SINGLE_SUCCESS;
}
private static void queueRender(List<ItemStack> stacks, CommandContext<ServerCommandSource> ctx) {
IdentifiedPacket packet = ClientBoundPackets.createPacketQueueItemStacksToRender(stacks);
try {
NetworkManager.sendToPlayer(packet, ctx.getSource().getPlayer());
} catch (CommandSyntaxException e) {
e.printStackTrace();
}
NetworkManager.sendToPlayer(packet, ctx.getSource().getPlayer());
}
}

View file

@ -36,7 +36,6 @@ import net.minecraft.inventory.SidedInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NbtCompound;
import net.minecraft.network.packet.s2c.play.BlockEntityUpdateS2CPacket;
import net.minecraft.text.LiteralText;
import net.minecraft.text.Text;
import net.minecraft.util.Formatting;
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) {
if (hasData) {
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()) {
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.CriterionMerger;
import net.minecraft.advancement.criterion.RecipeUnlockedCriterion;
import net.minecraft.inventory.Inventory;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.nbt.NbtCompound;
import net.minecraft.nbt.NbtOps;
import net.minecraft.recipe.Recipe;
import net.minecraft.util.Identifier;
import net.minecraft.util.JsonHelper;
import net.minecraft.util.collection.DefaultedList;
@ -48,16 +46,12 @@ import org.jetbrains.annotations.NotNull;
import reborncore.common.util.DefaultedListCollector;
import reborncore.common.util.serialization.SerializationUtil;
import java.util.Collection;
import java.util.List;
import java.util.Objects;
public class RecipeUtils {
@SuppressWarnings("unchecked")
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();
//noinspection unchecked
return (List<T>) (Object) recipes;
return (List<T>) world.getRecipeManager().getAllOfType(type).values().stream().toList();
}
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.recipe.Ingredient;
import net.minecraft.recipe.ShapedRecipe;
import net.minecraft.tag.Tag;
import net.minecraft.tag.TagKey;
import net.minecraft.util.JsonHelper;
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.inventory.Inventory;
import net.minecraft.item.ItemStack;
import net.minecraft.text.TranslatableText;
import net.minecraft.text.Text;
import net.minecraft.util.Hand;
import net.minecraft.util.registry.Registry;
import org.jetbrains.annotations.NotNull;
@ -78,7 +78,7 @@ public class FluidUtils {
// Just extract as much as we can
try (Transaction tx = Transaction.openOuter()) {
boolean didSomething = false;
for (var view : itemStorage.iterable(tx)) {
for (var view : itemStorage) {
if (view.isResourceBlank()) continue;
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.
try (var tx = Transaction.openNested(Transaction.getCurrentUnsafe())) {
for (var view : fluidStorage.iterable(tx)) {
for (var view : fluidStorage) {
if (!view.isResourceBlank() && view.getAmount() > 0) {
return false;
}
@ -161,7 +161,7 @@ public class FluidUtils {
// Use current transaction in case this check is nested in a transfer operation.
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())) {
return true;
}
@ -183,6 +183,6 @@ public class FluidUtils {
}
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.nbt.NbtCompound;
import net.minecraft.text.Text;
import net.minecraft.text.TranslatableText;
import net.minecraft.util.Formatting;
import net.minecraft.util.math.BlockPos;
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) {
if (!isReal && hasData) {
info.add(
new TranslatableText("reborncore.tooltip.energy")
Text.translatable("reborncore.tooltip.energy")
.formatted(Formatting.GRAY)
.append(": ")
.append(PowerSystem.getLocalizedPower(getStored()))
@ -465,7 +464,7 @@ public abstract class PowerAcceptorBlockEntity extends MachineBaseBlockEntity im
}
info.add(
new TranslatableText("reborncore.tooltip.energy.maxEnergy")
Text.translatable("reborncore.tooltip.energy.maxEnergy")
.formatted(Formatting.GRAY)
.append(": ")
.append(PowerSystem.getLocalizedPower(getMaxStoredPower()))
@ -474,7 +473,7 @@ public abstract class PowerAcceptorBlockEntity extends MachineBaseBlockEntity im
if (getMaxInput(null) != 0) {
info.add(
new TranslatableText("reborncore.tooltip.energy.inputRate")
Text.translatable("reborncore.tooltip.energy.inputRate")
.formatted(Formatting.GRAY)
.append(": ")
.append(PowerSystem.getLocalizedPower(getMaxInput(null)))
@ -483,7 +482,7 @@ public abstract class PowerAcceptorBlockEntity extends MachineBaseBlockEntity im
}
if (getMaxOutput(null) > 0) {
info.add(
new TranslatableText("reborncore.tooltip.energy.outputRate")
Text.translatable("reborncore.tooltip.energy.outputRate")
.formatted(Formatting.GRAY)
.append(": ")
.append(PowerSystem.getLocalizedPower(getMaxOutput(null)))
@ -492,7 +491,7 @@ public abstract class PowerAcceptorBlockEntity extends MachineBaseBlockEntity im
}
info.add(
new TranslatableText("reborncore.tooltip.energy.tier")
Text.translatable("reborncore.tooltip.energy.tier")
.formatted(Formatting.GRAY)
.append(": ")
.append(StringUtils.toFirstCapitalAllLowercase(getTier().toString()))
@ -501,7 +500,7 @@ public abstract class PowerAcceptorBlockEntity extends MachineBaseBlockEntity im
if (isReal) {
info.add(
new TranslatableText("reborncore.tooltip.energy.change")
Text.translatable("reborncore.tooltip.energy.change")
.formatted(Formatting.GRAY)
.append(": ")
.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.server.network.ServerPlayerEntity;
import net.minecraft.text.Text;
import net.minecraft.text.TranslatableText;
import net.minecraft.text.Text;
import net.minecraft.util.Formatting;
import reborncore.common.powerSystem.RcEnergyItem;
import reborncore.common.recipes.IRecipeInput;
@ -172,11 +172,11 @@ public class ItemUtils {
}
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)
.append(" ")
.append(
new TranslatableText("reborncore.message.deactivating")
Text.translatable("reborncore.message.deactivating")
.formatted(Formatting.GOLD)
)
);
@ -199,11 +199,11 @@ public class ItemUtils {
stack.getOrCreateNbt().putBoolean("isActive", true);
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)
.append(" ")
.append(
new TranslatableText("reborncore.message.active")
Text.translatable("reborncore.message.active")
.formatted(Formatting.GOLD)
)
);
@ -211,11 +211,11 @@ public class ItemUtils {
} else {
stack.getOrCreateNbt().putBoolean("isActive", false);
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)
.append(" ")
.append(
new TranslatableText("reborncore.message.inactive")
Text.translatable("reborncore.message.inactive")
.formatted(Formatting.GOLD)
)
);
@ -231,9 +231,9 @@ public class ItemUtils {
*/
public static void buildActiveTooltip(ItemStack stack, List<Text> tooltip) {
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 {
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;
import net.minecraft.text.LiteralText;
import net.minecraft.text.MutableText;
import net.minecraft.text.Text;
import net.minecraft.util.Formatting;
import java.util.Locale;
@ -68,7 +68,7 @@ public class StringUtils {
}
public static MutableText getPercentageText(int percentage) {
return new LiteralText(String.valueOf(percentage))
return Text.literal(String.valueOf(percentage))
.formatted(getPercentageColour(percentage))
.append("%");
}

View file

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

View file

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

View file

@ -12,7 +12,7 @@ plugins {
id 'eclipse'
id 'maven-publish'
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 "de.undercouch.download" version "4.1.1"
}
@ -183,7 +183,7 @@ dependencies {
api project(path: ":RebornCore", configuration: "namedElements")
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 "net.oskarstrom:DashLoader:${project.dashloader_version}"

View file

@ -2,14 +2,14 @@
org.gradle.jvmargs=-Xmx2G
# Mod properties
mod_version=5.2.0-beta.3
mod_version=5.3.0-beta.1
# Fabric Properties
# check these on https://modmuss50.me/fabric.html
minecraft_version=1.18.2
yarn_version=1.18.2+build.3
loader_version=0.13.3
fapi_version=0.51.1+1.18.2
minecraft_version=1.19-pre1
yarn_version=1.19-pre1+build.1
loader_version=0.14.5
fapi_version=0.52.4+1.19
# Dependencies
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.fabric.api.blockrenderlayer.v1.BlockRenderLayerMap;
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.minecraft.client.item.ModelPredicateProviderRegistry;
import net.minecraft.client.item.UnclampedModelPredicateProvider;
@ -170,18 +170,18 @@ public class TechRebornClient implements ClientModInitializer {
BlockRenderLayerMap.INSTANCE.putFluid(fluid.getFlowingFluid(), RenderLayer.getTranslucent());
}
BlockEntityRendererRegistry.INSTANCE.register(TRBlockEntities.INDUSTRIAL_GRINDER, MultiblockRenderer::new);
BlockEntityRendererRegistry.INSTANCE.register(TRBlockEntities.FUSION_CONTROL_COMPUTER, MultiblockRenderer::new);
BlockEntityRendererRegistry.INSTANCE.register(TRBlockEntities.INDUSTRIAL_BLAST_FURNACE, MultiblockRenderer::new);
BlockEntityRendererRegistry.INSTANCE.register(TRBlockEntities.VACUUM_FREEZER, MultiblockRenderer::new);
BlockEntityRendererRegistry.INSTANCE.register(TRBlockEntities.FLUID_REPLICATOR, MultiblockRenderer::new);
BlockEntityRendererRegistry.INSTANCE.register(TRBlockEntities.INDUSTRIAL_SAWMILL, MultiblockRenderer::new);
BlockEntityRendererRegistry.INSTANCE.register(TRBlockEntities.DISTILLATION_TOWER, MultiblockRenderer::new);
BlockEntityRendererRegistry.INSTANCE.register(TRBlockEntities.IMPLOSION_COMPRESSOR, MultiblockRenderer::new);
BlockEntityRendererRegistry.INSTANCE.register(TRBlockEntities.GREENHOUSE_CONTROLLER, MultiblockRenderer::new);
BlockEntityRendererRegistry.INSTANCE.register(TRBlockEntities.STORAGE_UNIT, StorageUnitRenderer::new);
BlockEntityRendererRegistry.INSTANCE.register(TRBlockEntities.CABLE, CableCoverRenderer::new);
BlockEntityRendererRegistry.INSTANCE.register(TRBlockEntities.WIND_MILL, TurbineRenderer::new);
BlockEntityRendererRegistry.register(TRBlockEntities.INDUSTRIAL_GRINDER, MultiblockRenderer::new);
BlockEntityRendererRegistry.register(TRBlockEntities.FUSION_CONTROL_COMPUTER, MultiblockRenderer::new);
BlockEntityRendererRegistry.register(TRBlockEntities.INDUSTRIAL_BLAST_FURNACE, MultiblockRenderer::new);
BlockEntityRendererRegistry.register(TRBlockEntities.VACUUM_FREEZER, MultiblockRenderer::new);
BlockEntityRendererRegistry.register(TRBlockEntities.FLUID_REPLICATOR, MultiblockRenderer::new);
BlockEntityRendererRegistry.register(TRBlockEntities.INDUSTRIAL_SAWMILL, MultiblockRenderer::new);
BlockEntityRendererRegistry.register(TRBlockEntities.DISTILLATION_TOWER, MultiblockRenderer::new);
BlockEntityRendererRegistry.register(TRBlockEntities.IMPLOSION_COMPRESSOR, MultiblockRenderer::new);
BlockEntityRendererRegistry.register(TRBlockEntities.GREENHOUSE_CONTROLLER, MultiblockRenderer::new);
BlockEntityRendererRegistry.register(TRBlockEntities.STORAGE_UNIT, StorageUnitRenderer::new);
BlockEntityRendererRegistry.register(TRBlockEntities.CABLE, CableCoverRenderer::new);
BlockEntityRendererRegistry.register(TRBlockEntities.WIND_MILL, TurbineRenderer::new);
registerPredicateProvider(
BatpackItem.class,

View file

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

View file

@ -35,9 +35,9 @@ import net.minecraft.nbt.NbtCompound;
import net.minecraft.nbt.NbtHelper;
import net.minecraft.network.packet.s2c.play.BlockEntityUpdateS2CPacket;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.text.LiteralText;
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.math.BlockPos;
import net.minecraft.util.math.Direction;
@ -265,7 +265,7 @@ public class CableBlockEntity extends BlockEntity
@Override
public void addInfo(List<Text> info, boolean isReal, boolean hasData) {
info.add(
new TranslatableText("techreborn.tooltip.transferRate")
Text.translatable("techreborn.tooltip.transferRate")
.formatted(Formatting.GRAY)
.append(": ")
.append(PowerSystem.getLocalizedPower(getCableType().transferRate))
@ -274,17 +274,17 @@ public class CableBlockEntity extends BlockEntity
);
info.add(
new TranslatableText("techreborn.tooltip.tier")
Text.translatable("techreborn.tooltip.tier")
.formatted(Formatting.GRAY)
.append(": ")
.append(
new LiteralText(StringUtils.toFirstCapitalAllLowercase(getCableType().tier.toString()))
Text.literal(StringUtils.toFirstCapitalAllLowercase(getCableType().tier.toString()))
.formatted(Formatting.GOLD)
)
);
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.item.ItemStack;
import net.minecraft.nbt.NbtCompound;
import net.minecraft.text.LiteralText;
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.math.BlockPos;
import net.minecraft.util.math.Direction;
@ -217,41 +217,41 @@ public class SolarPanelBlockEntity extends PowerAcceptorBlockEntity implements I
}
info.add(
new TranslatableText("reborncore.tooltip.energy.maxEnergy")
Text.translatable("reborncore.tooltip.energy.maxEnergy")
.formatted(Formatting.GRAY)
.append(": ")
.append(
new LiteralText(PowerSystem.getLocalizedPower(getMaxStoredPower()))
Text.literal(PowerSystem.getLocalizedPower(getMaxStoredPower()))
.formatted(Formatting.GOLD)
)
);
info.add(
new TranslatableText("techreborn.tooltip.generationRate.day")
Text.translatable("techreborn.tooltip.generationRate.day")
.formatted(Formatting.GRAY)
.append(": ")
.append(
new LiteralText(PowerSystem.getLocalizedPower(panel.generationRateD))
Text.literal(PowerSystem.getLocalizedPower(panel.generationRateD))
.formatted(Formatting.GOLD)
)
);
info.add(
new TranslatableText("techreborn.tooltip.generationRate.night")
Text.translatable("techreborn.tooltip.generationRate.night")
.formatted(Formatting.GRAY)
.append(": ")
.append(
new LiteralText(PowerSystem.getLocalizedPower(panel.generationRateN))
Text.literal(PowerSystem.getLocalizedPower(panel.generationRateN))
.formatted(Formatting.GOLD)
)
);
info.add(
new TranslatableText("reborncore.tooltip.energy.tier")
Text.translatable("reborncore.tooltip.energy.tier")
.formatted(Formatting.GRAY)
.append(": ")
.append(
new LiteralText(StringUtils.toFirstCapitalAllLowercase(getTier().toString()))
Text.literal(StringUtils.toFirstCapitalAllLowercase(getTier().toString()))
.formatted(Formatting.GOLD)
)
);

View file

@ -33,7 +33,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NbtCompound;
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.sound.SoundCategory;
import net.minecraft.text.TranslatableText;
import net.minecraft.text.Text;
import net.minecraft.util.Formatting;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
@ -63,7 +63,7 @@ public class AlarmBlockEntity extends BlockEntity
}
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)
.append(" Alarm ")
.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.item.ItemStack;
import net.minecraft.nbt.NbtCompound;
import net.minecraft.text.LiteralText;
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.math.BlockPos;
import net.minecraft.util.math.Direction;
@ -87,22 +87,22 @@ public class FusionControlComputerBlockEntity extends GenericMachineBlockEntity
public Text getStateText() {
if (state == -1) {
return LiteralText.EMPTY;
return Text.empty();
} else if (state == 0) {
return new TranslatableText("gui.techreborn.fusion.norecipe");
return Text.translatable("gui.techreborn.fusion.norecipe");
} else if (state == 1) {
FusionReactorRecipe r = getCurrentRecipeFromID();
if (r == null) {
return new TranslatableText("gui.techreborn.fusion.charging");
return Text.translatable("gui.techreborn.fusion.charging");
}
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)}
);
} 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;
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>

View file

@ -1,8 +1,8 @@
package techreborn.blockentity.machine.tier0.block.blockbreaker;
import net.minecraft.text.LiteralText;
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 techreborn.blockentity.machine.tier0.block.ProcessingStatus;
@ -14,13 +14,13 @@ import techreborn.blockentity.machine.tier0.block.ProcessingStatus;
* @author SimonFlapse
*/
enum BlockBreakerStatus implements ProcessingStatus {
IDLE(new TranslatableText("gui.techreborn.block_breaker.idle"), Color.BLUE),
IDLE_PAUSED(new TranslatableText("gui.techreborn.block.idle_redstone"), Color.BLUE),
OUTPUT_FULL(new TranslatableText("gui.techreborn.block.output_full"), Color.RED),
NO_ENERGY(new TranslatableText("gui.techreborn.block.no_energy"), Color.RED),
INTERRUPTED(new TranslatableText("gui.techreborn.block.interrupted"), Color.RED),
OUTPUT_BLOCKED(new TranslatableText("gui.techreborn.block.output_blocked"), Color.RED),
PROCESSING(new TranslatableText("gui.techreborn.block_breaker.processing"), Color.DARK_GREEN);
IDLE(Text.translatable("gui.techreborn.block_breaker.idle"), Color.BLUE),
IDLE_PAUSED(Text.translatable("gui.techreborn.block.idle_redstone"), Color.BLUE),
OUTPUT_FULL(Text.translatable("gui.techreborn.block.output_full"), Color.RED),
NO_ENERGY(Text.translatable("gui.techreborn.block.no_energy"), Color.RED),
INTERRUPTED(Text.translatable("gui.techreborn.block.interrupted"), Color.RED),
OUTPUT_BLOCKED(Text.translatable("gui.techreborn.block.output_blocked"), Color.RED),
PROCESSING(Text.translatable("gui.techreborn.block_breaker.processing"), Color.DARK_GREEN);
private final Text text;
private final int color;
@ -40,12 +40,12 @@ enum BlockBreakerStatus implements ProcessingStatus {
progress = Math.max(progress, 0);
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) {
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

View file

@ -1,8 +1,8 @@
package techreborn.blockentity.machine.tier0.block.blockplacer;
import net.minecraft.text.LiteralText;
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 techreborn.blockentity.machine.tier0.block.ProcessingStatus;
@ -14,12 +14,12 @@ import techreborn.blockentity.machine.tier0.block.ProcessingStatus;
* @author SimonFlapse
*/
enum BlockPlacerStatus implements ProcessingStatus {
IDLE(new TranslatableText("gui.techreborn.block_placer.idle"), Color.BLUE),
IDLE_PAUSED(new TranslatableText("gui.techreborn.block.idle_redstone"), Color.BLUE),
NO_ENERGY(new TranslatableText("gui.techreborn.block.no_energy"), Color.RED),
INTERRUPTED(new TranslatableText("gui.techreborn.block.interrupted"), Color.RED),
OUTPUT_BLOCKED(new TranslatableText("gui.techreborn.block.output_blocked"), Color.RED),
PROCESSING(new TranslatableText("gui.techreborn.block_placer.processing"), Color.DARK_GREEN);
IDLE(Text.translatable("gui.techreborn.block_placer.idle"), Color.BLUE),
IDLE_PAUSED(Text.translatable("gui.techreborn.block.idle_redstone"), Color.BLUE),
NO_ENERGY(Text.translatable("gui.techreborn.block.no_energy"), Color.RED),
INTERRUPTED(Text.translatable("gui.techreborn.block.interrupted"), Color.RED),
OUTPUT_BLOCKED(Text.translatable("gui.techreborn.block.output_blocked"), Color.RED),
PROCESSING(Text.translatable("gui.techreborn.block_placer.processing"), Color.DARK_GREEN);
private final Text text;
private final int color;
@ -39,11 +39,11 @@ enum BlockPlacerStatus implements ProcessingStatus {
progress = Math.max(progress, 0);
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) {
return new TranslatableText("gui.techreborn.block.progress.stopped");
return Text.translatable("gui.techreborn.block.progress.stopped");
} 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() {
if (inventoryCrafting == null) {
inventoryCrafting = new CraftingInventory(new ScreenHandler(null, -1) {
@Override
public ItemStack transferSlot(PlayerEntity player, int index) {
return ItemStack.EMPTY;
}
@Override
public boolean canUse(PlayerEntity playerIn) {
return false;

View file

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

View file

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

View file

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

View file

@ -30,7 +30,7 @@ import net.minecraft.block.entity.BlockEntityType;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.text.Text;
import net.minecraft.text.TranslatableText;
import net.minecraft.text.Text;
import net.minecraft.util.Formatting;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
@ -146,28 +146,28 @@ public class TransformerBlockEntity extends PowerAcceptorBlockEntity implements
@Override
public void addInfo(List<Text> info, boolean isReal, boolean hasData) {
info.add(
new TranslatableText("reborncore.tooltip.energy.inputRate")
Text.translatable("reborncore.tooltip.energy.inputRate")
.formatted(Formatting.GRAY)
.append(": ")
.append(PowerSystem.getLocalizedPower(getMaxInput(null)))
.formatted(Formatting.GOLD)
);
info.add(
new TranslatableText("techreborn.tooltip.input_tier")
Text.translatable("techreborn.tooltip.input_tier")
.formatted(Formatting.GRAY)
.append(": ")
.append(StringUtils.toFirstCapitalAllLowercase(inputTier.toString()))
.formatted(Formatting.GOLD)
);
info.add(
new TranslatableText("reborncore.tooltip.energy.outputRate")
Text.translatable("reborncore.tooltip.energy.outputRate")
.formatted(Formatting.GRAY)
.append(": ")
.append(PowerSystem.getLocalizedPower(getMaxOutput(null)))
.formatted(Formatting.GOLD)
);
info.add(
new TranslatableText("techreborn.tooltip.output_tier")
Text.translatable("techreborn.tooltip.output_tier")
.formatted(Formatting.GRAY)
.append(": ")
.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.SoundCategory;
import net.minecraft.text.Text;
import net.minecraft.text.TranslatableText;
import net.minecraft.text.Text;
import net.minecraft.util.ActionResult;
import net.minecraft.util.Formatting;
import net.minecraft.util.Hand;
@ -82,6 +82,6 @@ public class BlockFusionCoil extends Block {
@Override
public void appendTooltip(ItemStack stack, @Nullable BlockView worldIn, List<Text> tooltip, TooltipContext 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.state.StateManager;
import net.minecraft.state.property.EnumProperty;
import net.minecraft.text.LiteralText;
import net.minecraft.text.TranslatableText;
import net.minecraft.text.Text;
import net.minecraft.text.Text;
import net.minecraft.util.ActionResult;
import net.minecraft.util.Formatting;
import net.minecraft.util.Hand;
@ -126,11 +126,11 @@ public class PlayerDetectorBlock extends BlockMachineBase {
if (playerIn instanceof ServerPlayerEntity serverPlayerEntity) {
ChatUtils.sendNoSpamMessage(serverPlayerEntity, MessageIDs.playerDetectorID,
new TranslatableText("techreborn.message.detects")
Text.translatable("techreborn.message.detects")
.formatted(Formatting.GRAY)
.append(" ")
.append(
new LiteralText(StringUtils.toFirstCapital(newType.asString()))
Text.literal(StringUtils.toFirstCapital(newType.asString()))
.formatted(color)
)
);

View file

@ -33,14 +33,13 @@ import net.minecraft.state.StateManager;
import net.minecraft.state.property.BooleanProperty;
import net.minecraft.state.property.DirectionProperty;
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.Hand;
import net.minecraft.util.hit.BlockHitResult;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
import net.minecraft.util.shape.VoxelShape;
import net.minecraft.util.shape.VoxelShapes;
import net.minecraft.world.BlockView;
import net.minecraft.world.World;
import reborncore.common.BaseBlockEntityProvider;
@ -113,7 +112,7 @@ public class ResinBasinBlock extends BaseBlockEntityProvider {
if (worldIn.getBlockState(pos.offset(facing.getOpposite())).getBlock() != TRContent.RUBBER_LOG) {
worldIn.setBlockState(pos, Blocks.AIR.getDefaultState());
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.Properties;
import net.minecraft.text.Text;
import net.minecraft.text.TranslatableText;
import net.minecraft.text.Text;
import net.minecraft.util.ActionResult;
import net.minecraft.util.Formatting;
import net.minecraft.util.Hand;
@ -161,7 +161,7 @@ public class BlockAlarm extends BaseBlockEntityProvider {
@Override
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.math.BlockPos;
import net.minecraft.util.math.Direction;
import net.minecraft.util.math.random.AbstractRandom;
import net.minecraft.world.World;
import org.jetbrains.annotations.Nullable;
import reborncore.common.util.WorldUtils;
@ -111,7 +112,7 @@ public class BlockRubberLog extends PillarBlock {
@SuppressWarnings("deprecation")
@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);
if (state.get(AXIS) != Direction.Axis.Y) 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.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.text.LiteralText;
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.math.BlockPos;
import net.minecraft.util.registry.Registry;
@ -116,19 +116,19 @@ public class StackToolTipHandler implements ItemTooltipCallback {
}
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) {
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()) {
tooltipLines.add(new LiteralText("Round and round it goes"));
tooltipLines.add(Text.literal("Round and round it goes"));
}
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)) {
OreDepth oreDepth = OreDepthSyncHandler.getOreDepthMap().get(block);
Text text = getOreDepthText(oreDepth);
@ -140,10 +140,10 @@ public class StackToolTipHandler implements ItemTooltipCallback {
return Registry.ITEM.getId(item).getNamespace().equals("techreborn");
}
private static TranslatableText getOreDepthText(OreDepth depth) {
return new TranslatableText("techreborn.tooltip.ores.%s".formatted(depth.dimension().name().toLowerCase(Locale.ROOT)),
new LiteralText(String.valueOf(depth.minY())).formatted(Formatting.YELLOW),
new LiteralText(String.valueOf(depth.maxY())).formatted(Formatting.YELLOW)
private static Text getOreDepthText(OreDepth depth) {
return Text.translatable("techreborn.tooltip.ores.%s".formatted(depth.dimension().name().toLowerCase(Locale.ROOT)),
Text.literal(String.valueOf(depth.minY())).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.resource.language.I18n;
import net.minecraft.text.LiteralText;
import net.minecraft.text.Text;
import net.minecraft.text.Text;
import net.minecraft.util.Formatting;
import techreborn.config.TechRebornConfig;
@ -63,7 +63,7 @@ public class ToolTipAssistUtils {
// Add reminder that they can use shift to calculate the entire stack
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;
@ -82,10 +82,10 @@ public class ToolTipAssistUtils {
String[] infoLines = info.split("\\r?\\n");
for (String infoLine : infoLines) {
list.add(1, new LiteralText(infoColour + infoLine));
list.add(1, Text.literal(infoColour + infoLine));
}
} 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) {
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) {
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) {

View file

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

View file

@ -26,7 +26,7 @@ package techreborn.client.gui;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.text.LiteralText;
import net.minecraft.text.Text;
import net.minecraft.text.Text;
import reborncore.client.gui.builder.GuiBase;
import reborncore.common.screen.BuiltScreenHandler;
@ -59,7 +59,7 @@ public class GuiBatbox extends GuiBase<BuiltScreenHandler> {
if (!hideGuiElements()) {
matrixStack.push();
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(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.util.math.MatrixStack;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.text.LiteralText;
import net.minecraft.text.Text;
import net.minecraft.text.Text;
import reborncore.client.ClientChunkManager;
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 + 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
@ -64,7 +64,7 @@ public class GuiChunkLoader extends GuiBase<BuiltScreenHandler> {
if (hideGuiElements()) return;
Text text = new LiteralText("Radius: ")
Text text = Text.literal("Radius: ")
.append(String.valueOf(blockEntity.getRadius()));
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.util.math.MatrixStack;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.text.LiteralText;
import net.minecraft.text.Text;
import org.apache.commons.lang3.tuple.Pair;
import reborncore.client.gui.builder.GuiBase;
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);
drawCentredText(matrixStack, blockEntity.getStateText(), 20, Color.BLUE.darker().getColor(), layer);
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 {
builder.drawMultiblockMissingBar(matrixStack, this, layer);
@ -101,19 +101,19 @@ public class GuiFusionReactor extends GuiBase<BuiltScreenHandler> {
if (stackSize.get().getLeft() > 0) {
drawCentredText(matrixStack,
new LiteralText("Required Coils: ")
Text.literal("Required Coils: ")
.append(String.valueOf(stackSize.get().getLeft()))
.append("x64 +")
.append(String.valueOf(stackSize.get().getRight()))
, 25, 0xFFFFFF, layer);
} 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, new LiteralText(String.valueOf(blockEntity.getPowerMultiplier())).append("x"), 10, 81, 0xFFFFFF);
drawTextWithShadow(matrixStack, this.textRenderer, Text.literal("Size: ").append(String.valueOf(blockEntity.size)), 83, 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);
}

View file

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

View file

@ -26,7 +26,7 @@ package techreborn.client.gui;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.text.LiteralText;
import net.minecraft.text.Text;
import net.minecraft.text.Text;
import reborncore.client.gui.builder.GuiBase;
import reborncore.common.screen.BuiltScreenHandler;
@ -60,7 +60,7 @@ public class GuiIDSU extends GuiBase<BuiltScreenHandler> {
matrixStack.push();
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(PowerSystem.getLocalizedPowerNoSuffix(idsu.getMaxStoredPower()))
.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.util.math.MatrixStack;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.text.LiteralText;
import net.minecraft.text.Text;
import net.minecraft.util.Identifier;
import reborncore.client.gui.builder.GuiBase;
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(
@ -99,7 +99,7 @@ public class GuiIronFurnace extends GuiBase<BuiltScreenHandler> {
16,
b -> onClick(),
tooltipSupplier,
LiteralText.EMPTY));
Text.empty()));
}
@Override

View file

@ -26,7 +26,7 @@ package techreborn.client.gui;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.text.LiteralText;
import net.minecraft.text.Text;
import reborncore.client.gui.builder.GuiBase;
import reborncore.common.screen.BuiltScreenHandler;
import reborncore.common.powerSystem.PowerSystem;
@ -58,7 +58,7 @@ public class GuiLESU extends GuiBase<BuiltScreenHandler> {
matrixStack.push();
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(PowerSystem.getLocalizedPowerNoSuffix(blockEntity.getMaxStoredPower()))
.append(" ")

View file

@ -26,7 +26,7 @@ package techreborn.client.gui;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.text.LiteralText;
import net.minecraft.text.Text;
import reborncore.client.gui.builder.GuiBase;
import reborncore.common.screen.BuiltScreenHandler;
import reborncore.common.powerSystem.PowerSystem;
@ -60,7 +60,7 @@ public class GuiMFE extends GuiBase<BuiltScreenHandler> {
matrixStack.push();
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(PowerSystem.getLocalizedPower(mfe.getMaxStoredPower()))
, 35, 0, 58, layer);

View file

@ -26,7 +26,7 @@ package techreborn.client.gui;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.text.LiteralText;
import net.minecraft.text.Text;
import reborncore.client.gui.builder.GuiBase;
import reborncore.common.screen.BuiltScreenHandler;
import reborncore.common.powerSystem.PowerSystem;
@ -58,7 +58,7 @@ public class GuiMFSU extends GuiBase<BuiltScreenHandler> {
matrixStack.push();
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();
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.Screen;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.text.LiteralText;
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.Util;
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");
int guiWidth = 207;
int guiHeight = 195;
private static final Text text1 = new TranslatableText("techreborn.manual.wiki");
private static final Text text2 = new TranslatableText("techreborn.manual.discord");
private static final Text text3 = new TranslatableText("techreborn.manual.refund");
private static final Text text1 = Text.translatable("techreborn.manual.wiki");
private static final Text text2 = Text.translatable("techreborn.manual.discord");
private static final Text text3 = Text.translatable("techreborn.manual.refund");
public GuiManual() {
super(new LiteralText("gui.manual"));
super(Text.literal("gui.manual"));
}
@Override
@ -56,14 +56,14 @@ public class GuiManual extends Screen {
int y = (height / 2) - guiHeight / 2;
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) {
Util.getOperatingSystem().open("http://wiki.techreborn.ovh");
}
this.client.setScreen(this);
}, "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) {
Util.getOperatingSystem().open("https://discord.gg/teamreborn");
}
@ -71,7 +71,7 @@ public class GuiManual extends Screen {
}, "https://discord.gg/teamreborn", false))));
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());
this.client.setScreen(null);
}));

View file

@ -26,7 +26,7 @@ package techreborn.client.gui;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.text.LiteralText;
import net.minecraft.text.Text;
import net.minecraft.text.Text;
import reborncore.client.gui.builder.GuiBase;
import reborncore.client.gui.builder.widget.GuiButtonUpDown;
@ -65,7 +65,7 @@ public class GuiPlayerDetector extends GuiBase<BuiltScreenHandler> {
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);
}

View file

@ -26,8 +26,8 @@ package techreborn.client.gui;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.text.LiteralText;
import net.minecraft.text.TranslatableText;
import net.minecraft.text.Text;
import net.minecraft.text.Text;
import reborncore.client.gui.builder.GuiBase;
import reborncore.common.screen.BuiltScreenHandler;
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);
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.entity.player.PlayerEntity;
import net.minecraft.text.TranslatableText;
import net.minecraft.text.Text;
import reborncore.client.gui.builder.GuiBase;
import reborncore.common.screen.BuiltScreenHandler;
import reborncore.common.network.NetworkManager;
@ -59,26 +59,26 @@ public class GuiStorageUnit extends GuiBase<BuiltScreenHandler> {
super.drawForeground(matrixStack, mouseX, mouseY);
// Draw in/out labels
builder.drawText(matrixStack, this, new TranslatableText("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.in"), 100, 43, 4210752);
builder.drawText(matrixStack, this, Text.translatable("gui.techreborn.unit.out"), 140, 43, 4210752);
int storedAmount = storageEntity.storedAmount;
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 {
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, 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);
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.entity.player.PlayerEntity;
import net.minecraft.text.TranslatableText;
import net.minecraft.text.Text;
import reborncore.client.gui.builder.GuiBase;
import reborncore.common.screen.BuiltScreenHandler;
import reborncore.common.fluid.FluidUtils;
@ -57,27 +57,27 @@ public class GuiTankUnit extends GuiBase<BuiltScreenHandler> {
super.drawForeground(matrixStack, mouseX, mouseY);
// Draw input/out
builder.drawText(matrixStack, this, new TranslatableText("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.in"), 100, 43, 4210752);
builder.drawText(matrixStack, this, Text.translatable("gui.techreborn.unit.out"), 140, 43, 4210752);
FluidInstance fluid = tankEntity.getTank().getFluidInstance();
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 {
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, 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);
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.math.BlockPos;
import net.minecraft.util.math.Direction;
import net.minecraft.util.math.random.AbstractRandom;
import net.minecraft.world.BlockRenderView;
import org.jetbrains.annotations.Nullable;
import reborncore.client.RenderUtil;
@ -54,7 +55,6 @@ import reborncore.common.util.Color;
import java.util.Collections;
import java.util.List;
import java.util.Random;
import java.util.function.Supplier;
public abstract class BaseDynamicFluidBakedModel implements BakedModel, FabricBakedModel {
@ -66,7 +66,7 @@ public abstract class BaseDynamicFluidBakedModel implements BakedModel, FabricBa
public abstract ModelIdentifier getFluidModel();
@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;
if (stack.getItem() instanceof ItemFluidInfo fluidInfo) {
fluid = fluidInfo.getFluid(stack);
@ -106,12 +106,12 @@ public abstract class BaseDynamicFluidBakedModel implements BakedModel, FabricBa
}
@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
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();
}

View file

@ -32,6 +32,7 @@ import net.minecraft.client.texture.SpriteAtlasTexture;
import net.minecraft.client.util.ModelIdentifier;
import net.minecraft.item.ItemStack;
import net.minecraft.util.Identifier;
import net.minecraft.util.math.random.AbstractRandom;
import techreborn.TechReborn;
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");
@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);
BakedModelManager bakedModelManager = MinecraftClient.getInstance().getBakedModelManager();

View file

@ -39,9 +39,6 @@ import java.io.IOException;
import java.io.InputStreamReader;
import java.io.Reader;
/*
* Credits to JsonDestroyer
*/
@Environment(EnvType.CLIENT)
public class ModelHelper {
@ -61,7 +58,7 @@ public class ModelHelper {
public static Reader getReaderForResource(Identifier location) throws IOException {
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));
}

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.BlockEntityRendererFactory;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.util.math.random.AbstractRandom;
import techreborn.blockentity.cable.CableBlockEntity;
import techreborn.blocks.cable.CableBlock;
@ -56,7 +57,7 @@ public class CableCoverRenderer implements BlockEntityRenderer<CableBlockEntity>
final BlockRenderManager blockRenderManager = MinecraftClient.getInstance().getBlockRenderManager();
BlockState coverState = blockEntity.getCover() != null ? blockEntity.getCover() : Blocks.OAK_PLANKS.getDefaultState();
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;
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.EntityRendererFactory;
import net.minecraft.client.render.entity.TntMinecartEntityRenderer;
@ -41,10 +42,12 @@ import techreborn.init.TRContent;
* Created by Mark on 13/03/2016.
*/
public class NukeRenderer extends EntityRenderer<EntityNukePrimed> {
private final BlockRenderManager blockRenderManager;
public NukeRenderer(EntityRendererFactory.Context ctx) {
super(ctx);
this.shadowRadius = 0.5F;
this.blockRenderManager = ctx.getBlockRenderManager();
}
@Nullable
@ -68,7 +71,7 @@ public class NukeRenderer extends EntityRenderer<EntityNukePrimed> {
matrixStack.multiply(Vec3f.POSITIVE_Y.getDegreesQuaternion(-90.0F));
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();
super.render(entity, f, g, matrixStack, vertexConsumerProvider, i);
}

View file

@ -44,6 +44,11 @@ public class DestructoPackScreenHandler extends ScreenHandler {
buildContainer();
}
@Override
public ItemStack transferSlot(PlayerEntity player, int index) {
return ItemStack.EMPTY;
}
@Override
public boolean canUse(PlayerEntity arg0) {
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.util.EntryStacks;
import net.minecraft.text.Text;
import net.minecraft.text.TranslatableText;
import net.minecraft.text.Text;
import net.minecraft.util.Formatting;
import net.minecraft.util.Identifier;
import reborncore.client.gui.guibuilder.GuiBuilder;
@ -62,7 +62,7 @@ public class FluidGeneratorRecipeCategory implements DisplayCategory<FluidGenera
@Override
public Text getTitle() {
return new TranslatableText(identifier.toString());
return Text.translatable(identifier.toString());
}
@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 -> {
List<Text> list = Lists.newArrayList();
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(ClientHelper.getInstance().getFormattedModFromIdentifier(new Identifier("techreborn", "")));
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 net.minecraft.item.Items;
import net.minecraft.text.Text;
import net.minecraft.text.TranslatableText;
import net.minecraft.text.Text;
import net.minecraft.util.Formatting;
import net.minecraft.util.Identifier;
import reborncore.client.gui.guibuilder.GuiBuilder;
@ -63,7 +63,7 @@ public class FluidReplicatorRecipeCategory implements DisplayCategory<FluidRepli
@Override
public Text getTitle() {
return new TranslatableText(rebornRecipeType.name().toString());
return Text.translatable(rebornRecipeType.name().toString());
}
@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 -> {
List<Text> list = Lists.newArrayList();
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(ClientHelper.getInstance().getFormattedModFromIdentifier(new Identifier("techreborn", "")));
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.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)
.leftAligned()
.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.Widgets;
import net.minecraft.text.Text;
import net.minecraft.text.TranslatableText;
import net.minecraft.text.Text;
import net.minecraft.util.Formatting;
import net.minecraft.util.Identifier;
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 -> {
List<Text> list = Lists.newArrayList();
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(ClientHelper.getInstance().getFormattedModFromIdentifier(new Identifier("techreborn", "")));
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 net.minecraft.item.Items;
import net.minecraft.text.Text;
import net.minecraft.text.TranslatableText;
import net.minecraft.text.Text;
import reborncore.common.crafting.RebornRecipe;
import reborncore.common.crafting.RebornRecipeType;
import techreborn.compat.rei.MachineRecipeDisplay;
@ -56,7 +56,7 @@ public abstract class AbstractMachineCategory<R extends RebornRecipe> implements
@Override
public Text getTitle() {
return new TranslatableText(rebornRecipeType.name().toString());
return Text.translatable(rebornRecipeType.name().toString());
}
@Override

View file

@ -28,7 +28,7 @@ import me.shedaniel.math.Point;
import me.shedaniel.math.Rectangle;
import me.shedaniel.rei.api.client.gui.widgets.Widget;
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.common.crafting.RebornRecipe;
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(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)
.rightAligned()
.color(0xFF404040, 0xFFBBBBBB)

View file

@ -28,9 +28,9 @@ import me.shedaniel.math.Point;
import me.shedaniel.math.Rectangle;
import me.shedaniel.rei.api.client.gui.widgets.Widget;
import me.shedaniel.rei.api.client.gui.widgets.Widgets;
import net.minecraft.text.LiteralText;
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.common.crafting.RebornRecipe;
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(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)
.shadow(false)
.rightAligned()
.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)
.leftAligned()
.color(0xFF404040, 0xFFBBBBBB)

View file

@ -28,7 +28,7 @@ import me.shedaniel.math.Point;
import me.shedaniel.math.Rectangle;
import me.shedaniel.rei.api.client.gui.widgets.Widget;
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.common.crafting.RebornRecipe;
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(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)
.rightAligned()
.color(0xFF404040, 0xFFBBBBBB)

View file

@ -28,7 +28,7 @@ import me.shedaniel.math.Point;
import me.shedaniel.math.Rectangle;
import me.shedaniel.rei.api.client.gui.widgets.Widget;
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.common.crafting.RebornRecipe;
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(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)
.rightAligned()
.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.Widgets;
import net.minecraft.text.Text;
import net.minecraft.text.TranslatableText;
import net.minecraft.text.Text;
import net.minecraft.util.Formatting;
import net.minecraft.util.Identifier;
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 -> {
List<Text> list = Lists.newArrayList();
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(ClientHelper.getInstance().getFormattedModFromIdentifier(new Identifier("techreborn", "")));
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.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)
.leftAligned()
.color(0xFF404040, 0xFFBBBBBB)

View file

@ -28,7 +28,7 @@ import me.shedaniel.math.Point;
import me.shedaniel.math.Rectangle;
import me.shedaniel.rei.api.client.gui.widgets.Widget;
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.common.crafting.RebornRecipe;
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(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)
.rightAligned()
.color(0xFF404040, 0xFFBBBBBB)

View file

@ -28,7 +28,7 @@ import me.shedaniel.math.Point;
import me.shedaniel.math.Rectangle;
import me.shedaniel.rei.api.client.gui.widgets.Widget;
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.common.crafting.RebornRecipe;
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(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)
.leftAligned()
.color(0xFF404040, 0xFFBBBBBB)

View file

@ -28,7 +28,7 @@ import me.shedaniel.math.Point;
import me.shedaniel.math.Rectangle;
import me.shedaniel.rei.api.client.gui.widgets.Widget;
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.common.crafting.RebornRecipe;
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(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)
.rightAligned()
.color(0xFF404040, 0xFFBBBBBB)

View file

@ -28,7 +28,7 @@ import me.shedaniel.math.Point;
import me.shedaniel.math.Rectangle;
import me.shedaniel.rei.api.client.gui.widgets.Widget;
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.common.crafting.RebornRecipe;
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.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)
.leftAligned()
.color(0xFF404040, 0xFFBBBBBB)

View file

@ -28,7 +28,7 @@ import me.shedaniel.math.Point;
import me.shedaniel.math.Rectangle;
import me.shedaniel.rei.api.client.gui.widgets.Widget;
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.common.crafting.RebornRecipe;
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 + 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)
.rightAligned()
.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 net.minecraft.item.Items;
import net.minecraft.text.Text;
import net.minecraft.text.TranslatableText;
import net.minecraft.text.Text;
import reborncore.common.crafting.RebornRecipeType;
import techreborn.api.recipe.recipes.RollingMachineRecipe;
import techreborn.compat.rei.ReiPlugin;
@ -51,7 +51,7 @@ public class RollingMachineCategory extends DefaultCraftingCategory {
@Override
public Text getTitle() {
return new TranslatableText(rebornRecipeType.name().toString());
return Text.translatable(rebornRecipeType.name().toString());
}
@Override

View file

@ -7,6 +7,7 @@ import net.minecraft.item.Items;
import net.minecraft.sound.SoundEvents;
import net.minecraft.util.Identifier;
import net.minecraft.util.registry.Registry;
import net.minecraft.util.registry.RegistryKey;
import net.minecraft.village.TradeOffer;
import net.minecraft.village.VillagerProfession;
import net.minecraft.world.poi.PointOfInterestType;
@ -28,9 +29,9 @@ public class TRVillager {
ELECTRICIAN_ID, 1, 1, TRContent.Machine.SOLID_FUEL_GENERATOR.block);
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,
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. */}

View file

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

View file

@ -49,9 +49,9 @@ import net.minecraft.sound.SoundCategory;
import net.minecraft.sound.SoundEvent;
import net.minecraft.sound.SoundEvents;
import net.minecraft.tag.FluidTags;
import net.minecraft.text.LiteralText;
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.Identifier;
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))) {
return hitResult != null && this.placeFluid(player, world, hitResult.getBlockPos().offset(hitResult.getSide()), null, filledCell);
} else {
if (world.getDimension().isUltrawarm() && fluid.isIn(FluidTags.WATER)) {
if (world.getDimension().ultrawarm() && fluid.isIn(FluidTags.WATER)) {
int i = pos.getX();
int j = pos.getY();
int k = pos.getZ();
@ -167,7 +167,7 @@ public class DynamicCellItem extends Item implements ItemFluidInfo {
Fluid fluid = getFluid(itemStack);
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
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);
}

View file

@ -31,12 +31,12 @@ import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemUsageContext;
import net.minecraft.nbt.NbtOps;
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.text.LiteralText;
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.dynamic.GlobalPos;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.GlobalPos;
import net.minecraft.util.registry.RegistryKey;
import net.minecraft.world.World;
import org.jetbrains.annotations.Nullable;
@ -66,17 +66,17 @@ public class FrequencyTransmitterItem extends Item {
.ifPresent(tag -> stack.getOrCreateNbt().put("pos", tag));
if (context.getPlayer() instanceof ServerPlayerEntity serverPlayerEntity) {
ChatUtils.sendNoSpamMessage(serverPlayerEntity, MessageIDs.freqTransmitterID, new TranslatableText("techreborn.message.setTo")
.append(new LiteralText(" X:").formatted(Formatting.GRAY))
.append(new LiteralText(String.valueOf(pos.getX())).formatted(Formatting.GOLD))
.append(new LiteralText(" Y:").formatted(Formatting.GRAY))
.append(new LiteralText(String.valueOf(pos.getY())).formatted(Formatting.GOLD))
.append(new LiteralText(" Z:").formatted(Formatting.GRAY))
.append(new LiteralText(String.valueOf(pos.getZ())).formatted(Formatting.GOLD))
ChatUtils.sendNoSpamMessage(serverPlayerEntity, MessageIDs.freqTransmitterID, Text.translatable("techreborn.message.setTo")
.append(Text.literal(" X:").formatted(Formatting.GRAY))
.append(Text.literal(String.valueOf(pos.getX())).formatted(Formatting.GOLD))
.append(Text.literal(" Y:").formatted(Formatting.GRAY))
.append(Text.literal(String.valueOf(pos.getY())).formatted(Formatting.GOLD))
.append(Text.literal(" Z:").formatted(Formatting.GRAY))
.append(Text.literal(String.valueOf(pos.getZ())).formatted(Formatting.GOLD))
.append(" ")
.append(new TranslatableText("techreborn.message.in").formatted(Formatting.GRAY))
.append(Text.translatable("techreborn.message.in").formatted(Formatting.GRAY))
.append(" ")
.append(new LiteralText(getDimName(globalPos.getDimension()).toString()).formatted(Formatting.GOLD)));
.append(Text.literal(getDimName(globalPos.getDimension()).toString()).formatted(Formatting.GOLD)));
}
return ActionResult.SUCCESS;
@ -98,11 +98,11 @@ public class FrequencyTransmitterItem extends Item {
if (player instanceof ServerPlayerEntity serverPlayerEntity) {
ChatUtils.sendNoSpamMessage(serverPlayerEntity, MessageIDs.freqTransmitterID,
new TranslatableText("techreborn.message.coordsHaveBeen")
Text.translatable("techreborn.message.coordsHaveBeen")
.formatted(Formatting.GRAY)
.append(" ")
.append(
new TranslatableText("techreborn.message.cleared")
Text.translatable("techreborn.message.cleared")
.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) {
getPos(stack)
.ifPresent(globalPos -> {
tooltip.add(new LiteralText(Formatting.GRAY + "X: " + Formatting.GOLD + globalPos.getPos().getX()));
tooltip.add(new LiteralText(Formatting.GRAY + "Y: " + Formatting.GOLD + globalPos.getPos().getY()));
tooltip.add(new LiteralText(Formatting.GRAY + "Z: " + Formatting.GOLD + globalPos.getPos().getZ()));
tooltip.add(new LiteralText(Formatting.DARK_GRAY + getDimName(globalPos.getDimension()).toString()));
tooltip.add(Text.literal(Formatting.GRAY + "X: " + Formatting.GOLD + globalPos.getPos().getX()));
tooltip.add(Text.literal(Formatting.GRAY + "Y: " + Formatting.GOLD + globalPos.getPos().getY()));
tooltip.add(Text.literal(Formatting.GRAY + "Z: " + Formatting.GOLD + globalPos.getPos().getZ()));
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.ItemUsageContext;
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.Text;
import net.minecraft.util.ActionResult;
@ -63,15 +63,15 @@ public class DebugToolItem extends Item {
if (context.getWorld().isClient) {
return ActionResult.SUCCESS;
}
sendMessage(context, new LiteralText(getRegistryName(block)));
sendMessage(context, Text.literal(getRegistryName(block)));
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());
if (energyStorage != null) {
sendMessage(context, new LiteralText(getRCPower(energyStorage)));
sendMessage(context, Text.literal(getRCPower(energyStorage)));
}
BlockEntity blockEntity = context.getWorld().getBlockEntity(context.getBlockPos());
@ -79,7 +79,7 @@ public class DebugToolItem extends Item {
return ActionResult.CONSUME;
}
sendMessage(context, new LiteralText(getBlockEntityType(blockEntity)));
sendMessage(context, Text.literal(getBlockEntityType(blockEntity)));
sendMessage(context, getBlockEntityTags(blockEntity));
@ -90,7 +90,7 @@ public class DebugToolItem extends Item {
if (context.getWorld().isClient || context.getPlayer() == null) {
return;
}
context.getPlayer().sendSystemMessage(message, Util.NIL_UUID);
context.getPlayer().sendMessage(message);
}
private String getPropertyString(Entry<Property<?>, Comparable<?>> entryIn) {
@ -136,7 +136,7 @@ public class DebugToolItem extends Item {
}
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());
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.SoundEvents;
import net.minecraft.text.Text;
import net.minecraft.text.TranslatableText;
import net.minecraft.text.Text;
import net.minecraft.util.ActionResult;
import net.minecraft.util.Formatting;
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) {
BlockState blockState = getCover(stack);
if (blockState != null) {
tooltip.add((new TranslatableText(blockState.getBlock().getTranslationKey())).formatted(Formatting.GRAY));
tooltip.add((new TranslatableText("techreborn.tooltip.painting_tool.apply")).formatted(Formatting.GOLD));
tooltip.add((Text.translatable(blockState.getBlock().getTranslationKey())).formatted(Formatting.GRAY));
tooltip.add((Text.translatable("techreborn.tooltip.painting_tool.apply")).formatted(Formatting.GOLD));
} 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.item.ItemStack;
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.text.LiteralText;
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.Formatting;
import net.minecraft.util.Hand;
@ -69,7 +69,7 @@ public class IndustrialJackhammerItem extends JackhammerItem implements MultiBlo
ItemUtils.switchActive(stack, cost, messageId, entity);
stack.getOrCreateNbt().putBoolean("AOE5", false);
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 {
if (isAOE5(stack)) {
@ -78,7 +78,7 @@ public class IndustrialJackhammerItem extends JackhammerItem implements MultiBlo
} else {
stack.getOrCreateNbt().putBoolean("AOE5", true);
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);
if (ItemUtils.isActive(stack)) {
if (isAOE5(stack)) {
tooltip.add(new LiteralText("5*5").formatted(Formatting.RED));
tooltip.add(Text.literal("5*5").formatted(Formatting.RED));
} 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;
import net.minecraft.block.sapling.SaplingGenerator;
import net.minecraft.util.math.random.AbstractRandom;
import net.minecraft.util.registry.BuiltinRegistries;
import net.minecraft.util.registry.RegistryEntry;
import net.minecraft.world.gen.feature.ConfiguredFeature;
@ -35,7 +36,7 @@ import java.util.Random;
public class RubberSaplingGenerator extends SaplingGenerator {
@Nullable
@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);
}
}

View file

@ -64,13 +64,13 @@ public class RubberTreeSpikeDecorator extends TreeDecorator {
}
@Override
public void generate(TestableWorld world, BiConsumer<BlockPos, BlockState> replacer, Random random, List<BlockPos> logPositions, List<BlockPos> leavesPositions) {
logPositions.stream()
public void generate(Generator generator) {
generator.getLogPositions().stream()
.max(Comparator.comparingInt(BlockPos::getY))
.ifPresent(blockPos -> {
for (int i = 0; i < spireHeight; 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.minecraft.block.BlockState;
import net.minecraft.tag.BiomeTags;
import net.minecraft.util.Identifier;
import net.minecraft.util.collection.DataPool;
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.RegistryKey;
import net.minecraft.world.biome.Biome;
import net.minecraft.world.biome.BiomeKeys;
import net.minecraft.world.gen.GenerationStep;
import net.minecraft.world.gen.feature.*;
import net.minecraft.world.gen.feature.size.TwoLayersFeatureSize;
@ -72,7 +74,9 @@ public class WorldGenerator {
BiomeModifications.create(new Identifier("techreborn", "features"))
.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() {

View file

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