It runs, sort of...
This commit is contained in:
parent
027be66230
commit
08f75889ec
19 changed files with 75 additions and 79 deletions
|
@ -27,7 +27,7 @@ package reborncore.api.events;
|
||||||
import net.fabricmc.fabric.api.event.Event;
|
import net.fabricmc.fabric.api.event.Event;
|
||||||
import net.fabricmc.fabric.api.event.EventFactory;
|
import net.fabricmc.fabric.api.event.EventFactory;
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.inventory.CraftingInventory;
|
import net.minecraft.inventory.RecipeInputInventory;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
|
|
||||||
|
@ -39,6 +39,6 @@ public interface ItemCraftCallback {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
void onCraft(ItemStack stack, CraftingInventory craftingInventory, PlayerEntity playerEntity);
|
void onCraft(ItemStack stack, RecipeInputInventory craftingInventory, PlayerEntity playerEntity);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
package reborncore.mixin.common;
|
package reborncore.mixin.common;
|
||||||
|
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.inventory.CraftingInventory;
|
import net.minecraft.inventory.RecipeInputInventory;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.screen.slot.CraftingResultSlot;
|
import net.minecraft.screen.slot.CraftingResultSlot;
|
||||||
import org.spongepowered.asm.mixin.Final;
|
import org.spongepowered.asm.mixin.Final;
|
||||||
|
@ -41,7 +41,7 @@ public abstract class MixinCraftingResultSlot {
|
||||||
|
|
||||||
@Shadow
|
@Shadow
|
||||||
@Final
|
@Final
|
||||||
private CraftingInventory input;
|
private RecipeInputInventory input;
|
||||||
|
|
||||||
@Shadow
|
@Shadow
|
||||||
@Final
|
@Final
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
"fabric-api": ">=0.75.3",
|
"fabric-api": ">=0.75.3",
|
||||||
"team_reborn_energy": ">=3.0.0",
|
"team_reborn_energy": ">=3.0.0",
|
||||||
"fabric-biome-api-v1": ">=3.0.0",
|
"fabric-biome-api-v1": ">=3.0.0",
|
||||||
"minecraft": ">=1.19.4- <1.19.5-"
|
"minecraft": ">=1.20- <1.20.1-"
|
||||||
},
|
},
|
||||||
"authors": [
|
"authors": [
|
||||||
"Team Reborn",
|
"Team Reborn",
|
||||||
|
|
|
@ -50,6 +50,7 @@ import me.shedaniel.rei.api.common.util.EntryStacks;
|
||||||
import net.fabricmc.fabric.api.client.render.fluid.v1.FluidRenderHandler;
|
import net.fabricmc.fabric.api.client.render.fluid.v1.FluidRenderHandler;
|
||||||
import net.fabricmc.fabric.api.client.render.fluid.v1.FluidRenderHandlerRegistry;
|
import net.fabricmc.fabric.api.client.render.fluid.v1.FluidRenderHandlerRegistry;
|
||||||
import net.minecraft.client.MinecraftClient;
|
import net.minecraft.client.MinecraftClient;
|
||||||
|
import net.minecraft.client.gui.DrawContext;
|
||||||
import net.minecraft.client.texture.Sprite;
|
import net.minecraft.client.texture.Sprite;
|
||||||
import net.minecraft.client.util.math.MatrixStack;
|
import net.minecraft.client.util.math.MatrixStack;
|
||||||
import net.minecraft.fluid.Fluid;
|
import net.minecraft.fluid.Fluid;
|
||||||
|
@ -95,6 +96,11 @@ import java.util.stream.Stream;
|
||||||
public class ReiPlugin implements REIClientPlugin {
|
public class ReiPlugin implements REIClientPlugin {
|
||||||
public static final Map<RebornRecipeType<?>, ItemConvertible> iconMap = new HashMap<>();
|
public static final Map<RebornRecipeType<?>, ItemConvertible> iconMap = new HashMap<>();
|
||||||
|
|
||||||
|
@Deprecated(forRemoval = true)
|
||||||
|
public static DrawContext drawContext() {
|
||||||
|
throw new IllegalStateException("TODO 1.20 port!");
|
||||||
|
}
|
||||||
|
|
||||||
public ReiPlugin() {
|
public ReiPlugin() {
|
||||||
iconMap.put(ModRecipes.ALLOY_SMELTER, Machine.ALLOY_SMELTER);
|
iconMap.put(ModRecipes.ALLOY_SMELTER, Machine.ALLOY_SMELTER);
|
||||||
iconMap.put(ModRecipes.ASSEMBLING_MACHINE, Machine.ASSEMBLY_MACHINE);
|
iconMap.put(ModRecipes.ASSEMBLING_MACHINE, Machine.ASSEMBLY_MACHINE);
|
||||||
|
@ -270,19 +276,18 @@ public class ReiPlugin implements REIClientPlugin {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Widget createProgressBar(int x, int y, double animationDuration, GuiBuilder.ProgressDirection direction) {
|
public static Widget createProgressBar(int x, int y, double animationDuration, GuiBuilder.ProgressDirection direction) {
|
||||||
return Widgets.createDrawableWidget((helper, matrices, mouseX, mouseY, delta) -> {
|
return Widgets.createDrawableWidget((drawContext, matrices, mouseX, mouseY, delta) -> {
|
||||||
RenderSystem.setShaderTexture(0, GuiBuilder.defaultTextureSheet);
|
drawContext.drawTexture(GuiBuilder.defaultTextureSheet, x, y, direction.x, direction.y, direction.width, direction.height);
|
||||||
helper.drawTexture(matrices, x, y, direction.x, direction.y, direction.width, direction.height);
|
|
||||||
int j = (int) ((System.currentTimeMillis() / animationDuration) % 1.0 * 16.0);
|
int j = (int) ((System.currentTimeMillis() / animationDuration) % 1.0 * 16.0);
|
||||||
if (j < 0) {
|
if (j < 0) {
|
||||||
j = 0;
|
j = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (direction) {
|
switch (direction) {
|
||||||
case RIGHT -> helper.drawTexture(matrices, x, y, direction.xActive, direction.yActive, j, 10);
|
case RIGHT -> drawContext.drawTexture(GuiBuilder.defaultTextureSheet, x, y, direction.xActive, direction.yActive, j, 10);
|
||||||
case LEFT -> helper.drawTexture(matrices, x + 16 - j, y, direction.xActive + 16 - j, direction.yActive, j, 10);
|
case LEFT -> drawContext.drawTexture(GuiBuilder.defaultTextureSheet, x + 16 - j, y, direction.xActive + 16 - j, direction.yActive, j, 10);
|
||||||
case UP -> helper.drawTexture(matrices, x, y + 16 - j, direction.xActive, direction.yActive + 16 - j, 10, j);
|
case UP -> drawContext.drawTexture(GuiBuilder.defaultTextureSheet, x, y + 16 - j, direction.xActive, direction.yActive + 16 - j, 10, j);
|
||||||
case DOWN -> helper.drawTexture(matrices, x, y, direction.xActive, direction.yActive, 10, j);
|
case DOWN -> drawContext.drawTexture(GuiBuilder.defaultTextureSheet, x, y, direction.xActive, direction.yActive, 10, j);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -315,15 +320,14 @@ public class ReiPlugin implements REIClientPlugin {
|
||||||
int innerHeight = height - 2;
|
int innerHeight = height - 2;
|
||||||
|
|
||||||
PowerSystem.EnergySystem displayPower = PowerSystem.getDisplayPower();
|
PowerSystem.EnergySystem displayPower = PowerSystem.getDisplayPower();
|
||||||
RenderSystem.setShaderTexture(0, GuiBuilder.defaultTextureSheet);
|
drawContext().drawTexture(GuiBuilder.defaultTextureSheet, bounds.x - 1, bounds.y - 1, displayPower.xBar - 15, displayPower.yBar - 1, width, height);
|
||||||
drawTexture(matrices, bounds.x - 1, bounds.y - 1, displayPower.xBar - 15, displayPower.yBar - 1, width, height);
|
|
||||||
int innerDisplayHeight;
|
int innerDisplayHeight;
|
||||||
if (animation.animationType != EntryAnimationType.NONE) {
|
if (animation.animationType != EntryAnimationType.NONE) {
|
||||||
innerDisplayHeight = MathHelper.ceil((System.currentTimeMillis() / (animation.duration / (float) innerHeight) % innerHeight));
|
innerDisplayHeight = MathHelper.ceil((System.currentTimeMillis() / (animation.duration / (float) innerHeight) % innerHeight));
|
||||||
if (animation.animationType == EntryAnimationType.DOWNWARDS)
|
if (animation.animationType == EntryAnimationType.DOWNWARDS)
|
||||||
innerDisplayHeight = innerHeight - innerDisplayHeight;
|
innerDisplayHeight = innerHeight - innerDisplayHeight;
|
||||||
} else innerDisplayHeight = innerHeight;
|
} else innerDisplayHeight = innerHeight;
|
||||||
drawTexture(matrices, bounds.x, bounds.y + innerHeight - innerDisplayHeight, displayPower.xBar, innerHeight + displayPower.yBar - innerDisplayHeight, width - 2, innerDisplayHeight);
|
drawContext().drawTexture(GuiBuilder.defaultTextureSheet, bounds.x, bounds.y + innerHeight - innerDisplayHeight, displayPower.xBar, innerHeight + displayPower.yBar - innerDisplayHeight, width - 2, innerDisplayHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -347,9 +351,8 @@ public class ReiPlugin implements REIClientPlugin {
|
||||||
int width = bounds.width;
|
int width = bounds.width;
|
||||||
int height = bounds.height;
|
int height = bounds.height;
|
||||||
|
|
||||||
RenderSystem.setShaderTexture(0, GuiBuilder.defaultTextureSheet);
|
drawContext().drawTexture(GuiBuilder.defaultTextureSheet, bounds.x - 4, bounds.y - 4, 194, 26, width + 8, height + 8);
|
||||||
drawTexture(matrices, bounds.x - 4, bounds.y - 4, 194, 26, width + 8, height + 8);
|
drawContext().drawTexture(GuiBuilder.defaultTextureSheet, bounds.x - 1, bounds.y - 1, 194, 82, width + 2, height + 2);
|
||||||
drawTexture(matrices, bounds.x - 1, bounds.y - 1, 194, 82, width + 2, height + 2);
|
|
||||||
int innerDisplayHeight;
|
int innerDisplayHeight;
|
||||||
if (animation.animationType != EntryAnimationType.NONE) {
|
if (animation.animationType != EntryAnimationType.NONE) {
|
||||||
innerDisplayHeight = MathHelper.ceil((System.currentTimeMillis() / (animation.duration / (float) height) % height));
|
innerDisplayHeight = MathHelper.ceil((System.currentTimeMillis() / (animation.duration / (float) height) % height));
|
||||||
|
@ -382,7 +385,7 @@ public class ReiPlugin implements REIClientPlugin {
|
||||||
while (offsetHeight != 0) {
|
while (offsetHeight != 0) {
|
||||||
final int curHeight = Math.min(offsetHeight, iconHeight);
|
final int curHeight = Math.min(offsetHeight, iconHeight);
|
||||||
|
|
||||||
drawSprite(matrixStack, x, y - offsetHeight, 0, width, curHeight, sprite);
|
drawContext().drawSprite(x, y - offsetHeight, 0, width, curHeight, sprite);
|
||||||
offsetHeight -= curHeight;
|
offsetHeight -= curHeight;
|
||||||
iteration++;
|
iteration++;
|
||||||
if (iteration > 50) {
|
if (iteration > 50) {
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
package techreborn.client.gui;
|
package techreborn.client.gui;
|
||||||
|
|
||||||
import net.minecraft.client.gui.DrawContext;
|
import net.minecraft.client.gui.DrawContext;
|
||||||
|
import net.minecraft.client.util.math.MatrixStack;
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.text.Text;
|
import net.minecraft.text.Text;
|
||||||
import reborncore.client.ClientNetworkManager;
|
import reborncore.client.ClientNetworkManager;
|
||||||
|
@ -71,8 +72,9 @@ public class GuiAESU extends GuiBase<BuiltScreenHandler> {
|
||||||
final Layer layer = Layer.FOREGROUND;
|
final Layer layer = Layer.FOREGROUND;
|
||||||
|
|
||||||
if (!hideGuiElements()) {
|
if (!hideGuiElements()) {
|
||||||
drawContext.push();
|
final MatrixStack matrices = drawContext.getMatrices();
|
||||||
drawContext.scale(0.6f, 0.6f, 1.0f);
|
matrices.push();
|
||||||
|
matrices.scale(0.6f, 0.6f, 1.0f);
|
||||||
Text text = Text.literal(PowerSystem.getLocalizedPowerNoSuffix(blockEntity.getEnergy()))
|
Text text = Text.literal(PowerSystem.getLocalizedPowerNoSuffix(blockEntity.getEnergy()))
|
||||||
.append("/")
|
.append("/")
|
||||||
.append(PowerSystem.getLocalizedPowerNoSuffix(blockEntity.getMaxStoredPower()))
|
.append(PowerSystem.getLocalizedPowerNoSuffix(blockEntity.getMaxStoredPower()))
|
||||||
|
@ -80,7 +82,7 @@ public class GuiAESU extends GuiBase<BuiltScreenHandler> {
|
||||||
.append(PowerSystem.getDisplayPower().abbreviation);
|
.append(PowerSystem.getDisplayPower().abbreviation);
|
||||||
|
|
||||||
drawCentredText(drawContext, text, 35, 0, 58, layer);
|
drawCentredText(drawContext, text, 35, 0, 58, layer);
|
||||||
drawContext.pop();
|
matrices.pop();
|
||||||
}
|
}
|
||||||
|
|
||||||
builder.drawMultiEnergyBar(drawContext, this, 81, 28, (int) blockEntity.getEnergy(), (int) blockEntity.getMaxStoredPower(), mouseX, mouseY, 0, layer);
|
builder.drawMultiEnergyBar(drawContext, this, 81, 28, (int) blockEntity.getEnergy(), (int) blockEntity.getMaxStoredPower(), mouseX, mouseY, 0, layer);
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
package techreborn.client.gui;
|
package techreborn.client.gui;
|
||||||
|
|
||||||
import net.minecraft.client.gui.DrawContext;
|
import net.minecraft.client.gui.DrawContext;
|
||||||
|
import net.minecraft.client.util.math.MatrixStack;
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.text.Text;
|
import net.minecraft.text.Text;
|
||||||
import reborncore.client.gui.builder.GuiBase;
|
import reborncore.client.gui.builder.GuiBase;
|
||||||
|
@ -56,14 +57,15 @@ public class GuiBatbox extends GuiBase<BuiltScreenHandler> {
|
||||||
final Layer layer = Layer.FOREGROUND;
|
final Layer layer = Layer.FOREGROUND;
|
||||||
|
|
||||||
if (!hideGuiElements()) {
|
if (!hideGuiElements()) {
|
||||||
drawContext.push();
|
final MatrixStack matrices = drawContext.getMatrices();
|
||||||
drawContext.scale(0.6f, 0.6f, 1.0f);
|
matrices.push();
|
||||||
|
matrices.scale(0.6f, 0.6f, 1.0f);
|
||||||
Text text = Text.literal(PowerSystem.getLocalizedPowerNoSuffix(blockEntity.getEnergy()))
|
Text text = Text.literal(PowerSystem.getLocalizedPowerNoSuffix(blockEntity.getEnergy()))
|
||||||
.append("/")
|
.append("/")
|
||||||
.append(PowerSystem.getLocalizedPower(blockEntity.getMaxStoredPower()));
|
.append(PowerSystem.getLocalizedPower(blockEntity.getMaxStoredPower()));
|
||||||
|
|
||||||
drawCentredText(drawContext, text, 35, 0, 58, layer);
|
drawCentredText(drawContext, text, 35, 0, 58, layer);
|
||||||
drawContext.pop();
|
matrices.pop();
|
||||||
}
|
}
|
||||||
|
|
||||||
builder.drawMultiEnergyBar(drawContext, this, 81, 28, (int) blockEntity.getEnergy(), (int) blockEntity.getMaxStoredPower(), mouseX, mouseY, 0, layer);
|
builder.drawMultiEnergyBar(drawContext, this, 81, 28, (int) blockEntity.getEnergy(), (int) blockEntity.getMaxStoredPower(), mouseX, mouseY, 0, layer);
|
||||||
|
|
|
@ -112,8 +112,8 @@ public class GuiFusionReactor extends GuiBase<BuiltScreenHandler> {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
drawTextWithShadow(drawContext, this.textRenderer, Text.literal("Size: ").append(String.valueOf(blockEntity.size)), 83, 81, 0xFFFFFF);
|
drawContext.drawText(this.textRenderer, Text.literal("Size: ").append(String.valueOf(blockEntity.size)), 83, 81, 0xFFFFFF, true);
|
||||||
drawTextWithShadow(drawContext, this.textRenderer, Text.literal(String.valueOf(blockEntity.getPowerMultiplier())).append("x"), 10, 81, 0xFFFFFF);
|
drawContext.drawText(this.textRenderer, Text.literal(String.valueOf(blockEntity.getPowerMultiplier())).append("x"), 10, 81, 0xFFFFFF, true);
|
||||||
|
|
||||||
builder.drawMultiEnergyBar(drawContext, this, 9, 19, this.blockEntity.getEnergy(), this.blockEntity.getMaxStoredPower(), mouseX, mouseY, 0, layer);
|
builder.drawMultiEnergyBar(drawContext, this, 9, 19, this.blockEntity.getEnergy(), this.blockEntity.getMaxStoredPower(), mouseX, mouseY, 0, layer);
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,9 +24,8 @@
|
||||||
|
|
||||||
package techreborn.client.gui;
|
package techreborn.client.gui;
|
||||||
|
|
||||||
import com.mojang.blaze3d.systems.RenderSystem;
|
|
||||||
import net.minecraft.client.resource.language.I18n;
|
|
||||||
import net.minecraft.client.gui.DrawContext;
|
import net.minecraft.client.gui.DrawContext;
|
||||||
|
import net.minecraft.client.resource.language.I18n;
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.text.Text;
|
import net.minecraft.text.Text;
|
||||||
import net.minecraft.util.Identifier;
|
import net.minecraft.util.Identifier;
|
||||||
|
@ -64,17 +63,14 @@ public class GuiGreenhouseController extends GuiBase<BuiltScreenHandler> {
|
||||||
drawSlot(drawContext, 48, gridYPos + 36, layer);
|
drawSlot(drawContext, 48, gridYPos + 36, layer);
|
||||||
|
|
||||||
if (!blockEntity.isMultiblockValid()) {
|
if (!blockEntity.isMultiblockValid()) {
|
||||||
RenderSystem.setShaderTexture(0, new Identifier("techreborn", "textures/item/part/digital_display.png"));
|
drawContext.drawTexture(new Identifier("techreborn", "textures/item/part/digital_display.png"), x + 68, y + 22, 0, 0, 16, 16, 16, 16);
|
||||||
drawTexture(drawContext, x + 68, y + 22, 0, 0, 16, 16, 16, 16);
|
|
||||||
if (isPointInRect(68, 22, 16, 16, mouseX, mouseY)) {
|
if (isPointInRect(68, 22, 16, 16, mouseX, mouseY)) {
|
||||||
List<Text> list = Arrays.stream(I18n.translate("techreborn.tooltip.greenhouse.upgrade_available")
|
List<Text> list = Arrays.stream(I18n.translate("techreborn.tooltip.greenhouse.upgrade_available")
|
||||||
.split("\\r?\\n"))
|
.split("\\r?\\n"))
|
||||||
.map(Text::literal)
|
.map(Text::literal)
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
drawContext.push();
|
drawContext.drawTooltip(getTextRenderer(), list, mouseX, mouseY);
|
||||||
renderTooltip(drawContext, list, mouseX, mouseY);
|
|
||||||
drawContext.pop();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -95,9 +91,7 @@ public class GuiGreenhouseController extends GuiBase<BuiltScreenHandler> {
|
||||||
.map(Text::literal)
|
.map(Text::literal)
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
drawContext.push();
|
drawContext.drawTooltip(getTextRenderer(), list, mouseX - getGuiLeft(), mouseY - getGuiTop());
|
||||||
renderTooltip(drawContext, list, mouseX - getGuiLeft(), mouseY - getGuiTop());
|
|
||||||
drawContext.pop();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -56,9 +56,6 @@ public class GuiIDSU extends GuiBase<BuiltScreenHandler> {
|
||||||
super.drawForeground(drawContext, mouseX, mouseY);
|
super.drawForeground(drawContext, mouseX, mouseY);
|
||||||
final Layer layer = Layer.FOREGROUND;
|
final Layer layer = Layer.FOREGROUND;
|
||||||
|
|
||||||
drawContext.push();
|
|
||||||
drawContext.scale(0.6f, 0.6f, 1.0f);
|
|
||||||
|
|
||||||
Text text = Text.literal(PowerSystem.getLocalizedPowerNoSuffix(idsu.getEnergy()))
|
Text text = Text.literal(PowerSystem.getLocalizedPowerNoSuffix(idsu.getEnergy()))
|
||||||
.append("/")
|
.append("/")
|
||||||
.append(PowerSystem.getLocalizedPowerNoSuffix(idsu.getMaxStoredPower()))
|
.append(PowerSystem.getLocalizedPowerNoSuffix(idsu.getMaxStoredPower()))
|
||||||
|
@ -66,7 +63,6 @@ public class GuiIDSU extends GuiBase<BuiltScreenHandler> {
|
||||||
.append(PowerSystem.getDisplayPower().abbreviation);
|
.append(PowerSystem.getDisplayPower().abbreviation);
|
||||||
|
|
||||||
drawCentredText(drawContext, text, 35, 0, 58, layer);
|
drawCentredText(drawContext, text, 35, 0, 58, layer);
|
||||||
drawContext.pop();
|
|
||||||
|
|
||||||
builder.drawMultiEnergyBar(drawContext, this, 81, 28, (int) idsu.getEnergy(), (int) idsu.getMaxStoredPower(), mouseX, mouseY, 0, layer);
|
builder.drawMultiEnergyBar(drawContext, this, 81, 28, (int) idsu.getEnergy(), (int) idsu.getMaxStoredPower(), mouseX, mouseY, 0, layer);
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
package techreborn.client.gui;
|
package techreborn.client.gui;
|
||||||
|
|
||||||
import net.minecraft.client.gui.DrawContext;
|
import net.minecraft.client.gui.DrawContext;
|
||||||
|
import net.minecraft.client.util.math.MatrixStack;
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.text.Text;
|
import net.minecraft.text.Text;
|
||||||
import reborncore.client.gui.builder.GuiBase;
|
import reborncore.client.gui.builder.GuiBase;
|
||||||
|
@ -55,16 +56,16 @@ public class GuiLESU extends GuiBase<BuiltScreenHandler> {
|
||||||
protected void drawForeground(DrawContext drawContext, final int mouseX, final int mouseY) {
|
protected void drawForeground(DrawContext drawContext, final int mouseX, final int mouseY) {
|
||||||
super.drawForeground(drawContext, mouseX, mouseY);
|
super.drawForeground(drawContext, mouseX, mouseY);
|
||||||
final Layer layer = Layer.FOREGROUND;
|
final Layer layer = Layer.FOREGROUND;
|
||||||
|
final MatrixStack matrices = drawContext.getMatrices();
|
||||||
drawContext.push();
|
matrices.push();
|
||||||
drawContext.scale(0.6f, 0.6f, 1.0f);
|
matrices.scale(0.6f, 0.6f, 1.0f);
|
||||||
drawCentredText(drawContext, Text.literal(PowerSystem.getLocalizedPowerNoSuffix( blockEntity.getEnergy()))
|
drawCentredText(drawContext, Text.literal(PowerSystem.getLocalizedPowerNoSuffix( blockEntity.getEnergy()))
|
||||||
.append("/")
|
.append("/")
|
||||||
.append(PowerSystem.getLocalizedPowerNoSuffix(blockEntity.getMaxStoredPower()))
|
.append(PowerSystem.getLocalizedPowerNoSuffix(blockEntity.getMaxStoredPower()))
|
||||||
.append(" ")
|
.append(" ")
|
||||||
.append(PowerSystem.getDisplayPower().abbreviation),
|
.append(PowerSystem.getDisplayPower().abbreviation),
|
||||||
35, 0, 58, layer);
|
35, 0, 58, layer);
|
||||||
drawContext.pop();
|
matrices.pop();
|
||||||
|
|
||||||
builder.drawMultiEnergyBar(drawContext, this, 81, 28, (int) blockEntity.getEnergy(), (int) blockEntity.getMaxStoredPower(), mouseX, mouseY, 0, layer);
|
builder.drawMultiEnergyBar(drawContext, this, 81, 28, (int) blockEntity.getEnergy(), (int) blockEntity.getMaxStoredPower(), mouseX, mouseY, 0, layer);
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
package techreborn.client.gui;
|
package techreborn.client.gui;
|
||||||
|
|
||||||
import net.minecraft.client.gui.DrawContext;
|
import net.minecraft.client.gui.DrawContext;
|
||||||
|
import net.minecraft.client.util.math.MatrixStack;
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.text.Text;
|
import net.minecraft.text.Text;
|
||||||
import reborncore.client.gui.builder.GuiBase;
|
import reborncore.client.gui.builder.GuiBase;
|
||||||
|
@ -57,15 +58,16 @@ public class GuiMFE extends GuiBase<BuiltScreenHandler> {
|
||||||
final Layer layer = Layer.FOREGROUND;
|
final Layer layer = Layer.FOREGROUND;
|
||||||
|
|
||||||
if (!hideGuiElements()) {
|
if (!hideGuiElements()) {
|
||||||
drawContext.push();
|
MatrixStack matrices = drawContext.getMatrices();
|
||||||
drawContext.scale(0.6f, 0.6f, 1.0f);
|
matrices.push();
|
||||||
|
matrices.scale(0.6f, 0.6f, 1.0f);
|
||||||
|
|
||||||
drawCentredText(drawContext, Text.literal(PowerSystem.getLocalizedPowerNoSuffix(mfe.getEnergy()))
|
drawCentredText(drawContext, Text.literal(PowerSystem.getLocalizedPowerNoSuffix(mfe.getEnergy()))
|
||||||
.append("/")
|
.append("/")
|
||||||
.append(PowerSystem.getLocalizedPower(mfe.getMaxStoredPower()))
|
.append(PowerSystem.getLocalizedPower(mfe.getMaxStoredPower()))
|
||||||
, 35, 0, 58, layer);
|
, 35, 0, 58, layer);
|
||||||
|
|
||||||
drawContext.pop();
|
matrices.pop();
|
||||||
}
|
}
|
||||||
|
|
||||||
builder.drawMultiEnergyBar(drawContext, this, 81, 28, (int) mfe.getEnergy(), (int) mfe.getMaxStoredPower(), mouseX, mouseY, 0, layer);
|
builder.drawMultiEnergyBar(drawContext, this, 81, 28, (int) mfe.getEnergy(), (int) mfe.getMaxStoredPower(), mouseX, mouseY, 0, layer);
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
package techreborn.client.gui;
|
package techreborn.client.gui;
|
||||||
|
|
||||||
import net.minecraft.client.gui.DrawContext;
|
import net.minecraft.client.gui.DrawContext;
|
||||||
|
import net.minecraft.client.util.math.MatrixStack;
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.text.Text;
|
import net.minecraft.text.Text;
|
||||||
import reborncore.client.gui.builder.GuiBase;
|
import reborncore.client.gui.builder.GuiBase;
|
||||||
|
@ -55,11 +56,11 @@ public class GuiMFSU extends GuiBase<BuiltScreenHandler> {
|
||||||
protected void drawForeground(DrawContext drawContext, final int mouseX, final int mouseY) {
|
protected void drawForeground(DrawContext drawContext, final int mouseX, final int mouseY) {
|
||||||
super.drawForeground(drawContext, mouseX, mouseY);
|
super.drawForeground(drawContext, mouseX, mouseY);
|
||||||
final Layer layer = Layer.FOREGROUND;
|
final Layer layer = Layer.FOREGROUND;
|
||||||
|
final MatrixStack matrices = drawContext.getMatrices();
|
||||||
drawContext.push();
|
matrices.push();
|
||||||
drawContext.scale(0.6f, 0.6f, 1.0f);
|
matrices.scale(0.6f, 0.6f, 1.0f);
|
||||||
drawCentredText(drawContext, Text.literal(PowerSystem.getLocalizedPowerNoSuffix(mfsu.getEnergy()) + "/" + PowerSystem.getLocalizedPower(mfsu.getMaxStoredPower())), 35, 0, 58, layer);
|
drawCentredText(drawContext, Text.literal(PowerSystem.getLocalizedPowerNoSuffix(mfsu.getEnergy()) + "/" + PowerSystem.getLocalizedPower(mfsu.getMaxStoredPower())), 35, 0, 58, layer);
|
||||||
drawContext.pop();
|
matrices.pop();
|
||||||
|
|
||||||
builder.drawMultiEnergyBar(drawContext, this, 81, 28, (int) mfsu.getEnergy(), (int) mfsu.getMaxStoredPower(), mouseX, mouseY, 0, layer);
|
builder.drawMultiEnergyBar(drawContext, this, 81, 28, (int) mfsu.getEnergy(), (int) mfsu.getMaxStoredPower(), mouseX, mouseY, 0, layer);
|
||||||
}
|
}
|
||||||
|
|
|
@ -83,10 +83,10 @@ public class GuiManual extends Screen {
|
||||||
int centerY = (height / 2) - guiHeight / 2;
|
int centerY = (height / 2) - guiHeight / 2;
|
||||||
drawContext.drawTexture(MANUAL_TEXTURE, centerX, centerY, 0, 0, guiWidth, guiHeight);
|
drawContext.drawTexture(MANUAL_TEXTURE, centerX, centerY, 0, 0, guiWidth, guiHeight);
|
||||||
|
|
||||||
drawContext.drawText(textRenderer, text1, (float) ((width / 2) - textRenderer.getWidth(text1) / 2), centerY + 40, 4210752);
|
drawContext.drawText(textRenderer, text1, (width / 2) - textRenderer.getWidth(text1) / 2, centerY + 40, 4210752, false);
|
||||||
drawContext.drawText(textRenderer, text2, (float) ((width / 2) - textRenderer.getWidth(text2) / 2), centerY + 90, 4210752);
|
drawContext.drawText(textRenderer, text2, (width / 2) - textRenderer.getWidth(text2) / 2, centerY + 90, 4210752, false);
|
||||||
if (TechRebornConfig.allowManualRefund) {
|
if (TechRebornConfig.allowManualRefund) {
|
||||||
drawContext.drawText(textRenderer, text3, (float) ((width / 2) - textRenderer.getWidth(text3) / 2), centerY + 140, 4210752);
|
drawContext.drawText(textRenderer, text3, (width / 2) - textRenderer.getWidth(text3) / 2, centerY + 140, 4210752, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
super.render(drawContext, mouseX, mouseY, partialTicks);
|
super.render(drawContext, mouseX, mouseY, partialTicks);
|
||||||
|
|
|
@ -66,19 +66,20 @@ public class GuiStorageUnit extends GuiBase<BuiltScreenHandler> {
|
||||||
int storedAmount = storageEntity.storedAmount;
|
int storedAmount = storageEntity.storedAmount;
|
||||||
|
|
||||||
if (storedAmount == 0 && !storageEntity.isLocked()) {
|
if (storedAmount == 0 && !storageEntity.isLocked()) {
|
||||||
textRenderer.draw(drawContext, Text.translatable("techreborn.tooltip.unit.empty"), 10, 20, 4210752);
|
|
||||||
} else {
|
|
||||||
textRenderer.draw(drawContext, Text.translatable("gui.techreborn.storage.store"), 10, 20, 4210752);
|
|
||||||
textRenderer.draw(drawContext, storageEntity.getDisplayedStack().getName(), 10, 30, 4210752);
|
|
||||||
|
|
||||||
textRenderer.draw(drawContext, Text.translatable("gui.techreborn.storage.amount"), 10, 50, 4210752);
|
drawContext.drawText(textRenderer, Text.translatable("techreborn.tooltip.unit.empty"), 10, 20, 4210752, false);
|
||||||
textRenderer.draw(drawContext, String.valueOf(storedAmount), 10, 60, 4210752);
|
} else {
|
||||||
|
drawContext.drawText(textRenderer, Text.translatable("gui.techreborn.storage.store"), 10, 20, 4210752, false);
|
||||||
|
drawContext.drawText(textRenderer, storageEntity.getDisplayedStack().getName(), 10, 30, 4210752, false);
|
||||||
|
|
||||||
|
drawContext.drawText(textRenderer, Text.translatable("gui.techreborn.storage.amount"), 10, 50, 4210752, false);
|
||||||
|
drawContext.drawText(textRenderer, String.valueOf(storedAmount), 10, 60, 4210752, false);
|
||||||
|
|
||||||
String percentFilled = String.valueOf((int) ((double) storedAmount / (double) storageEntity.getMaxCapacity() * 100));
|
String percentFilled = String.valueOf((int) ((double) storedAmount / (double) storageEntity.getMaxCapacity() * 100));
|
||||||
|
|
||||||
textRenderer.draw(drawContext, Text.translatable("gui.techreborn.unit.used").append(percentFilled + "%"), 10, 70, 4210752);
|
drawContext.drawText(textRenderer, Text.translatable("gui.techreborn.unit.used").append(percentFilled + "%"), 10, 70, 4210752, false);
|
||||||
|
|
||||||
textRenderer.draw(drawContext, Text.translatable("gui.techreborn.unit.wrenchtip"), 10, 80, 16711680);
|
drawContext.drawText(textRenderer, Text.translatable("gui.techreborn.unit.wrenchtip"), 10, 80, 16711680, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -64,20 +64,20 @@ public class GuiTankUnit extends GuiBase<BuiltScreenHandler> {
|
||||||
FluidInstance fluid = tankEntity.getTank().getFluidInstance();
|
FluidInstance fluid = tankEntity.getTank().getFluidInstance();
|
||||||
|
|
||||||
if (fluid.isEmpty()) {
|
if (fluid.isEmpty()) {
|
||||||
textRenderer.draw(drawContext, Text.translatable("techreborn.tooltip.unit.empty"), 10, 20, 4210752);
|
drawContext.drawText(textRenderer, Text.translatable("techreborn.tooltip.unit.empty"), 10, 20, 4210752, false);
|
||||||
} else {
|
} else {
|
||||||
textRenderer.draw(drawContext, Text.translatable("gui.techreborn.tank.type"), 10, 20, 4210752);
|
drawContext.drawText(textRenderer, Text.translatable("gui.techreborn.tank.type"), 10, 20, 4210752, false);
|
||||||
textRenderer.draw(drawContext, FluidUtils.getFluidName(fluid).replace("_", " "), 10, 30, 4210752);
|
drawContext.drawText(textRenderer, FluidUtils.getFluidName(fluid).replace("_", " "), 10, 30, 4210752, false);
|
||||||
|
|
||||||
|
|
||||||
textRenderer.draw(drawContext, Text.translatable("gui.techreborn.tank.amount"), 10, 50, 4210752);
|
drawContext.drawText(textRenderer, Text.translatable("gui.techreborn.tank.amount"), 10, 50, 4210752, false);
|
||||||
textRenderer.draw(drawContext, fluid.getAmount().toString(), 10, 60, 4210752);
|
drawContext.drawText(textRenderer, fluid.getAmount().toString(), 10, 60, 4210752, false);
|
||||||
|
|
||||||
String percentFilled = String.valueOf((int) ((double) fluid.getAmount().getRawValue() / (double) tankEntity.getTank().getFluidValueCapacity().getRawValue() * 100));
|
String percentFilled = String.valueOf((int) ((double) fluid.getAmount().getRawValue() / (double) tankEntity.getTank().getFluidValueCapacity().getRawValue() * 100));
|
||||||
|
|
||||||
textRenderer.draw(drawContext, Text.translatable("gui.techreborn.unit.used").append(percentFilled + "%"), 10, 70, 4210752);
|
drawContext.drawText(textRenderer, Text.translatable("gui.techreborn.unit.used").append(percentFilled + "%"), 10, 70, 4210752, false);
|
||||||
|
|
||||||
textRenderer.draw(drawContext, Text.translatable("gui.techreborn.unit.wrenchtip"), 10, 80, 16711680);
|
drawContext.drawText(textRenderer, Text.translatable("gui.techreborn.unit.wrenchtip"), 10, 80, 16711680, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -89,7 +89,6 @@ class ExtractorRecipesProvider extends TechRebornRecipesProvider {
|
||||||
power 10
|
power 10
|
||||||
time 300
|
time 300
|
||||||
criterion getCriterionName(item), getCriterionConditions(item)
|
criterion getCriterionName(item), getCriterionConditions(item)
|
||||||
feature FeatureFlags.UPDATE_1_20
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -138,7 +137,6 @@ class ExtractorRecipesProvider extends TechRebornRecipesProvider {
|
||||||
power 10
|
power 10
|
||||||
time 300
|
time 300
|
||||||
criterion getCriterionName(Items.CHERRY_LEAVES), getCriterionConditions(Items.CHERRY_LEAVES)
|
criterion getCriterionName(Items.CHERRY_LEAVES), getCriterionConditions(Items.CHERRY_LEAVES)
|
||||||
feature FeatureFlags.UPDATE_1_20
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -69,7 +69,6 @@ class IndustrialSawmillRecipesProvider extends TechRebornRecipesProvider {
|
||||||
power 40
|
power 40
|
||||||
time 200
|
time 200
|
||||||
fluidAmount 1000 // in millibuckets
|
fluidAmount 1000 // in millibuckets
|
||||||
feature FeatureFlags.UPDATE_1_20
|
|
||||||
}
|
}
|
||||||
offerIndustrialSawmillRecipe {
|
offerIndustrialSawmillRecipe {
|
||||||
ingredients ItemTags.BAMBOO_BLOCKS
|
ingredients ItemTags.BAMBOO_BLOCKS
|
||||||
|
@ -77,7 +76,6 @@ class IndustrialSawmillRecipesProvider extends TechRebornRecipesProvider {
|
||||||
power 40
|
power 40
|
||||||
time 100
|
time 100
|
||||||
fluidAmount 500 // in millibuckets
|
fluidAmount 500 // in millibuckets
|
||||||
feature FeatureFlags.UPDATE_1_20
|
|
||||||
}
|
}
|
||||||
[
|
[
|
||||||
(Items.ACACIA_STAIRS): Items.ACACIA_SLAB,
|
(Items.ACACIA_STAIRS): Items.ACACIA_SLAB,
|
||||||
|
@ -114,7 +112,6 @@ class IndustrialSawmillRecipesProvider extends TechRebornRecipesProvider {
|
||||||
fluidAmount 250 // in millibuckets
|
fluidAmount 250 // in millibuckets
|
||||||
source "stairs"
|
source "stairs"
|
||||||
criterion getCriterionName(stairs), getCriterionConditions(stairs)
|
criterion getCriterionName(stairs), getCriterionConditions(stairs)
|
||||||
feature FeatureFlags.UPDATE_1_20
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
[
|
[
|
||||||
|
@ -152,7 +149,6 @@ class IndustrialSawmillRecipesProvider extends TechRebornRecipesProvider {
|
||||||
fluidAmount 250 // in millibuckets
|
fluidAmount 250 // in millibuckets
|
||||||
source ((slab == Items.BAMBOO_MOSAIC_SLAB ? "mosaic_" : "") + "slab")
|
source ((slab == Items.BAMBOO_MOSAIC_SLAB ? "mosaic_" : "") + "slab")
|
||||||
criterion getCriterionName(slab), getCriterionConditions(slab)
|
criterion getCriterionName(slab), getCriterionConditions(slab)
|
||||||
feature FeatureFlags.UPDATE_1_20
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
[
|
[
|
||||||
|
|
|
@ -28,7 +28,7 @@ import com.google.common.collect.Maps;
|
||||||
import net.minecraft.enchantment.Enchantment;
|
import net.minecraft.enchantment.Enchantment;
|
||||||
import net.minecraft.enchantment.EnchantmentHelper;
|
import net.minecraft.enchantment.EnchantmentHelper;
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.inventory.CraftingInventory;
|
import net.minecraft.inventory.RecipeInputInventory;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.registry.Registries;
|
import net.minecraft.registry.Registries;
|
||||||
import reborncore.api.events.ItemCraftCallback;
|
import reborncore.api.events.ItemCraftCallback;
|
||||||
|
@ -48,7 +48,7 @@ public final class PoweredCraftingHandler implements ItemCraftCallback {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCraft(ItemStack stack, CraftingInventory craftingInventory, PlayerEntity playerEntity) {
|
public void onCraft(ItemStack stack, RecipeInputInventory craftingInventory, PlayerEntity playerEntity) {
|
||||||
if (stack.getItem() instanceof RcEnergyItem energyItem) {
|
if (stack.getItem() instanceof RcEnergyItem energyItem) {
|
||||||
long totalEnergy = IntStream.range(0, craftingInventory.size())
|
long totalEnergy = IntStream.range(0, craftingInventory.size())
|
||||||
.mapToObj(craftingInventory::getStack)
|
.mapToObj(craftingInventory::getStack)
|
||||||
|
|
|
@ -35,7 +35,7 @@
|
||||||
"reborncore": "*",
|
"reborncore": "*",
|
||||||
"team_reborn_energy": ">=3.0.0",
|
"team_reborn_energy": ">=3.0.0",
|
||||||
"fabric-biome-api-v1": ">=3.0.0",
|
"fabric-biome-api-v1": ">=3.0.0",
|
||||||
"minecraft": ">=1.19.4- <1.19.5-"
|
"minecraft": ">=1.20- <1.20.1-"
|
||||||
},
|
},
|
||||||
"accessWidener": "techreborn.accesswidener",
|
"accessWidener": "techreborn.accesswidener",
|
||||||
"authors": [
|
"authors": [
|
||||||
|
|
Loading…
Reference in a new issue