20w17a compile pass

This commit is contained in:
modmuss50 2020-04-26 16:29:38 +01:00
parent 178e0937d5
commit 7ccd5bcebd
68 changed files with 868 additions and 658 deletions

View file

@ -10,7 +10,7 @@ buildscript {
}
}
dependencies {
classpath "net.fabricmc:fabric-loom:0.2.7-SNAPSHOT"
classpath "net.fabricmc:fabric-loom:0.4.+"
classpath "gradle.plugin.net.minecrell:licenser:0.2.1"
classpath 'de.undercouch:gradle-download-task:3.4.3'
classpath "com.wynprice.cursemaven:CurseMaven:2.1.1"
@ -72,14 +72,14 @@ license {
group = 'TechReborn'
dependencies {
minecraft "com.mojang:minecraft:20w15a"
mappings "net.fabricmc:yarn:20w15a+build.2:v2"
minecraft "com.mojang:minecraft:20w17a"
mappings "net.fabricmc:yarn:20w17a+build.5:v2"
modImplementation "net.fabricmc:fabric-loader:0.8.2+build.194"
//Fabric api
modImplementation "net.fabricmc.fabric-api:fabric-api:0.5.9+build.319-1.16"
modImplementation "net.fabricmc.fabric-api:fabric-api:0.6.2+build.327-1.16"
optionalDependency ("me.shedaniel:RoughlyEnoughItems:4.1.1-unstable")
optionalDependency ("me.shedaniel:RoughlyEnoughItems:4.2.0-unstable")
disabledOptionalDependency ('io.github.cottonmc:LibCD:2.3.0+1.15.2')
disabledOptionalDependency ('com.github.emilyploszaj:trinkets:2.4.2')

View file

@ -49,7 +49,6 @@ import reborncore.common.blockentity.RedstoneConfiguration;
import reborncore.common.config.Configuration;
import reborncore.common.recipes.RecipeCrafter;
import reborncore.common.util.Torus;
import reborncore.common.world.DataAttachment;
import techreborn.blockentity.storage.energy.idsu.IDSUManager;
import techreborn.client.GuiType;
import techreborn.compat.trinkets.Trinkets;
@ -109,8 +108,6 @@ public class TechReborn implements ModInitializer {
Torus.genSizeMap(TechRebornConfig.fusionControlComputerMaxCoilSize);
DataAttachment.REGISTRY.register(IDSUManager.class, IDSUManager::new);
RedstoneConfiguration.fluidStack = DynamicCellItem.getCellWithFluid(Fluids.LAVA);
RedstoneConfiguration.powerStack = new ItemStack(TRContent.RED_CELL_BATTERY);

View file

@ -34,6 +34,7 @@ import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.NbtHelper;
import net.minecraft.text.LiteralText;
import net.minecraft.text.Text;
import net.minecraft.text.TranslatableText;
import net.minecraft.util.Formatting;
import net.minecraft.util.Tickable;
import net.minecraft.util.math.Direction;
@ -173,13 +174,27 @@ public class CableBlockEntity extends BlockEntity
// IListInfoProvider
@Override
public void addInfo(List<Text> info, boolean isReal, boolean hasData) {
info.add(new LiteralText(Formatting.GRAY + StringUtils.t("techreborn.tooltip.transferRate") + ": "
+ Formatting.GOLD
+ PowerSystem.getLocaliszedPowerFormatted(getCableType().transferRate) + "/t"));
info.add(new LiteralText(Formatting.GRAY + StringUtils.t("techreborn.tooltip.tier") + ": "
+ Formatting.GOLD + StringUtils.toFirstCapitalAllLowercase(getCableType().tier.toString())));
info.add(
new TranslatableText("techreborn.tooltip.transferRate")
.formatted(Formatting.GRAY)
.append(": ")
.append(PowerSystem.getLocaliszedPowerFormatted(getCableType().transferRate))
.formatted(Formatting.GOLD)
.append("/t")
);
info.add(
new TranslatableText("techreborn.tooltip.tier")
.formatted(Formatting.GRAY)
.append(": ")
.append(
new LiteralText(StringUtils.toFirstCapitalAllLowercase(getCableType().tier.toString()))
.formatted(Formatting.GOLD)
)
);
if (!getCableType().canKill) {
info.add(new LiteralText(Formatting.GRAY + StringUtils.t("techreborn.tooltip.cable.can_cover")));
info.add(new TranslatableText("techreborn.tooltip.cable.can_cover").formatted(Formatting.GRAY));
}
}

View file

@ -24,6 +24,7 @@
package techreborn.blockentity.data;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.player.PlayerEntity;
import reborncore.client.screen.builder.BuiltScreenHandler;
import reborncore.client.gui.builder.GuiBase;
@ -41,20 +42,20 @@ public class DataDrivenGui extends GuiBase<BuiltScreenHandler> {
}
@Override
protected void drawBackground(final float f, final int mouseX, final int mouseY) {
super.drawBackground(f, mouseX, mouseY);
protected void drawBackground(MatrixStack matrixStack, final float f, final int mouseX, final int mouseY) {
super.drawBackground(matrixStack, f, mouseX, mouseY);
final GuiBase.Layer layer = GuiBase.Layer.BACKGROUND;
final DataDrivenGui gui = this;
provider.getSlots().forEach(slot -> slot.draw(gui, layer));
provider.getSlots().forEach(slot -> slot.draw(matrixStack, gui, layer));
}
@Override
protected void drawForeground(final int mouseX, final int mouseY) {
super.drawForeground(mouseX, mouseY);
protected void drawForeground(MatrixStack matrixStack, final int mouseX, final int mouseY) {
super.drawForeground(matrixStack, mouseX, mouseY);
final GuiBase.Layer layer = GuiBase.Layer.FOREGROUND;
builder.drawProgressBar(this, blockEntity.getProgressScaled(100), 100, 76, 48, mouseX, mouseY, GuiBuilder.ProgressDirection.RIGHT, layer);
builder.drawMultiEnergyBar(this, 9, 19, (int) blockEntity.getEnergy(), (int) blockEntity.getMaxPower(), mouseX, mouseY, 0, layer);
builder.drawProgressBar(matrixStack, this, blockEntity.getProgressScaled(100), 100, 76, 48, mouseX, mouseY, GuiBuilder.ProgressDirection.RIGHT, layer);
builder.drawMultiEnergyBar(matrixStack, this, 9, 19, (int) blockEntity.getEnergy(), (int) blockEntity.getMaxPower(), mouseX, mouseY, 0, layer);
}
}

View file

@ -28,6 +28,7 @@ import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.util.JsonHelper;
import org.apache.commons.lang3.Validate;
import reborncore.client.screen.builder.BlockEntityScreenHandlerBuilder;
@ -82,12 +83,12 @@ public class DataDrivenSlot {
}
@Environment(EnvType.CLIENT)
public void draw(GuiBase<?> guiBase, GuiBase.Layer layer){
public void draw(MatrixStack matrixStack, GuiBase<?> guiBase, GuiBase.Layer layer){
//TODO find a better way to do this
if(getType() == SlotType.OUTPUT){
guiBase.drawOutputSlot(getX(), getY(), layer);
guiBase.drawOutputSlot(matrixStack, getX(), getY(), layer);
} else {
guiBase.drawSlot(getX(), getY(), layer);
guiBase.drawSlot(matrixStack, getX(), getY(), layer);
}
}
}

View file

@ -31,6 +31,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.text.LiteralText;
import net.minecraft.text.Text;
import net.minecraft.text.TranslatableText;
import net.minecraft.util.Formatting;
import net.minecraft.util.math.Direction;
import reborncore.api.IToolDrop;
@ -215,17 +216,46 @@ public class SolarPanelBlockEntity extends PowerAcceptorBlockEntity implements I
if (panel == SolarPanels.CREATIVE) {
return;
}
info.add(new LiteralText(Formatting.GRAY + StringUtils.t("reborncore.tooltip.energy.maxEnergy") + ": "
+ Formatting.GOLD + PowerSystem.getLocaliszedPowerFormatted(getMaxPower())));
info.add(new LiteralText(Formatting.GRAY + StringUtils.t("techreborn.tooltip.generationRate.day") + ": "
+ Formatting.GOLD + PowerSystem.getLocaliszedPowerFormatted(panel.generationRateD)));
info.add(
new TranslatableText("reborncore.tooltip.energy.maxEnergy")
.formatted(Formatting.GRAY)
.append(": ")
.append(
new LiteralText(PowerSystem.getLocaliszedPowerFormatted(getMaxPower()))
.formatted(Formatting.GOLD)
)
);
info.add(new LiteralText(Formatting.GRAY + StringUtils.t("techreborn.tooltip.generationRate.night") + ": "
+ Formatting.GOLD + PowerSystem.getLocaliszedPowerFormatted(panel.generationRateN)));
info.add(
new TranslatableText("techreborn.tooltip.generationRate.day")
.formatted(Formatting.GRAY)
.append(": ")
.append(
new LiteralText(PowerSystem.getLocaliszedPowerFormatted(panel.generationRateD))
.formatted(Formatting.GOLD)
)
);
info.add(new LiteralText(Formatting.GRAY + StringUtils.t("reborncore.tooltip.energy.tier") + ": "
+ Formatting.GOLD + StringUtils.toFirstCapitalAllLowercase(getTier().toString())));
info.add(
new TranslatableText("techreborn.tooltip.generationRate.night")
.formatted(Formatting.GRAY)
.append(": ")
.append(
new LiteralText(PowerSystem.getLocaliszedPowerFormatted(panel.generationRateN))
.formatted(Formatting.GOLD)
)
);
info.add(
new TranslatableText("reborncore.tooltip.energy.tier")
.formatted(Formatting.GRAY)
.append(": ")
.append(
new LiteralText(StringUtils.toFirstCapitalAllLowercase(getTier().toString()))
.formatted(Formatting.GOLD)
)
);
}
@Override

View file

@ -31,6 +31,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.sound.SoundCategory;
import net.minecraft.text.LiteralText;
import net.minecraft.text.TranslatableText;
import net.minecraft.util.Formatting;
import net.minecraft.util.Tickable;
import reborncore.api.IToolDrop;
@ -60,8 +61,11 @@ public class AlarmBlockEntity extends BlockEntity
} else {
selectedSound = 1;
}
ChatUtils.sendNoSpamMessages(MessageIDs.alarmID, new LiteralText(
Formatting.GRAY + StringUtils.t("techreborn.message.alarm") + " " + "Alarm " + selectedSound));
ChatUtils.sendNoSpamMessages(MessageIDs.alarmID, new TranslatableText("techreborn.message.alarm")
.formatted(Formatting.GRAY)
.append(" Alarm ")
.append(String.valueOf(selectedSound)));
}
// BlockEntity

View file

@ -28,6 +28,8 @@ import net.minecraft.block.BlockState;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.text.LiteralText;
import net.minecraft.text.Text;
import net.minecraft.util.Identifier;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
@ -41,6 +43,7 @@ import reborncore.common.crafting.ingredient.RebornIngredient;
import reborncore.common.powerSystem.PowerAcceptorBlockEntity;
import reborncore.common.util.ItemUtils;
import reborncore.common.util.RebornInventory;
import reborncore.common.util.StringUtils;
import reborncore.common.util.Torus;
import techreborn.api.recipe.recipes.FusionReactorRecipe;
import techreborn.config.TechRebornConfig;
@ -484,22 +487,23 @@ public class FusionControlComputerBlockEntity extends PowerAcceptorBlockEntity
.orElse(null);
}
public String getStateString(){
public Text getStateText(){
if(state == -1){
return "";
return LiteralText.EMPTY;
} else if (state == 0){
return "No recipe";
return new LiteralText("No recipe");
} else if (state == 1){
FusionReactorRecipe r = getCurrentRecipeFromID();
if(r == null) {
return "Charging";
return new LiteralText("Charging");
}
int percentage = percentage(r.getStartEnergy(), getEnergy());
return "Charging (" + percentage + "%)";
return new LiteralText("Charging (")
.append(StringUtils.getPercentageText(percentage));
} else if (state == 2){
return "Crafting";
return new LiteralText("Crafting");
}
return "";
return LiteralText.EMPTY;
}
private int percentage(double MaxValue, double CurrentValue) {

View file

@ -25,15 +25,21 @@
package techreborn.blockentity.storage.energy.idsu;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.world.PersistentState;
import net.minecraft.world.World;
import reborncore.common.util.NBTSerializable;
import reborncore.common.world.DataAttachment;
import reborncore.common.world.DataAttachmentProvider;
import javax.annotation.Nonnull;
import java.util.HashMap;
public class IDSUManager implements DataAttachment {
public class IDSUManager extends PersistentState {
private static final String KEY = "techreborn_idsu";
public IDSUManager() {
super(KEY);
}
@Nonnull
public static IDSUPlayer getPlayer(World world, String uuid){
@ -41,7 +47,8 @@ public class IDSUManager implements DataAttachment {
}
public static IDSUManager get(World world){
return DataAttachmentProvider.get(world, IDSUManager.class);
ServerWorld serverWorld = (ServerWorld) world;
return serverWorld.getPersistentStateManager().getOrCreate(IDSUManager::new, KEY);
}
private final HashMap<String, IDSUPlayer> playerHashMap = new HashMap<>();
@ -52,21 +59,19 @@ public class IDSUManager implements DataAttachment {
}
@Override
public void read(@Nonnull CompoundTag tag) {
public void fromTag(CompoundTag tag) {
for(String uuid : tag.getKeys()){
playerHashMap.put(uuid, new IDSUPlayer(tag.getCompound(uuid)));
}
}
@Nonnull
@Override
public CompoundTag write() {
CompoundTag tag = new CompoundTag();
public CompoundTag toTag(CompoundTag tag) {
playerHashMap.forEach((uuid, player) -> tag.put(uuid, player.write()));
return tag;
}
public static class IDSUPlayer implements NBTSerializable {
public class IDSUPlayer implements NBTSerializable {
private double energy;
@ -96,6 +101,7 @@ public class IDSUManager implements DataAttachment {
public void setEnergy(double energy) {
this.energy = energy;
markDirty();
}
}

View file

@ -155,12 +155,26 @@ public class TankUnitBaseBlockEntity extends MachineBaseBlockEntity implements I
public void addInfo(final List<Text> info, final boolean isReal, boolean hasData) {
if (isReal || hasData) {
if (!this.tank.getFluidInstance().isEmpty()) {
info.add(new LiteralText(this.tank.getFluidAmount() + StringUtils.t("techreborn.tooltip.unit.divider") + WordUtils.capitalize(FluidUtil.getFluidName(this.tank.getFluid()))));
info.add(
new LiteralText(String.valueOf(this.tank.getFluidAmount()))
.append(new TranslatableText("techreborn.tooltip.unit.divider"))
.append(WordUtils.capitalize(FluidUtil.getFluidName(this.tank.getFluid())))
);
} else {
info.add(new TranslatableText("techreborn.tooltip.unit.empty"));
}
}
info.add(new LiteralText(Formatting.GRAY + StringUtils.t("techreborn.tooltip.unit.capacity") + Formatting.GOLD + this.tank.getCapacity() + " (" + this.tank.getCapacity().getRawValue() / 1000 + ")"));
info.add(
new TranslatableText("techreborn.tooltip.unit.capacity")
.formatted(Formatting.GRAY)
.append(
new LiteralText(String.valueOf(this.tank.getCapacity()))
.formatted(Formatting.GOLD)
.append(" (")
.append(String.valueOf(this.tank.getCapacity().getRawValue() / 1000))
.append(")")
)
);
}
// IContainerProvider

View file

@ -332,14 +332,27 @@ public class StorageUnitBaseBlockEntity extends MachineBaseBlockEntity
public void addInfo(final List<Text> info, final boolean isReal, boolean hasData) {
if (isReal || hasData) {
if (!this.isEmpty()) {
info.add(new LiteralText(this.getCurrentCapacity() + StringUtils.t("techreborn.tooltip.unit.divider") + this.getStoredStack().getName().asString()));
info.add(
new LiteralText(String.valueOf(this.getCurrentCapacity()))
.append(new TranslatableText("techreborn.tooltip.unit.divider"))
.append(this.getStoredStack().getName())
);
} else {
info.add(new TranslatableText("techreborn.tooltip.unit.empty"));
}
}
info.add(new LiteralText(Formatting.GRAY + StringUtils.t("techreborn.tooltip.unit.capacity") + Formatting.GOLD + this.getMaxCapacity() +
" items (" + this.getMaxCapacity() / 64 + ")"));
info.add(
new TranslatableText("techreborn.tooltip.unit.capacity")
.formatted(Formatting.GRAY)
.append(
new LiteralText(String.valueOf(this.getMaxCapacity()))
.formatted(Formatting.GOLD)
.append(" items (")
.append(String.valueOf(this.getMaxCapacity() / 64))
.append(")")
)
);
}
@Override

View file

@ -25,6 +25,7 @@
package techreborn.blocks.machine.tier1;
import net.minecraft.text.LiteralText;
import net.minecraft.text.TranslatableText;
import net.minecraft.util.ActionResult;
import net.minecraft.util.Formatting;
import net.minecraft.block.Block;
@ -123,9 +124,15 @@ public class BlockPlayerDetector extends BlockMachineBase {
}
if (worldIn.isClient) {
ChatUtils.sendNoSpamMessages(MessageIDs.playerDetectorID, new LiteralText(
Formatting.GRAY + StringUtils.t("techreborn.message.detects") + " " + color
+ StringUtils.toFirstCapital(newType.asString())));
ChatUtils.sendNoSpamMessages(MessageIDs.playerDetectorID,
new TranslatableText("techreborn.message.detects")
.formatted(Formatting.GRAY)
.append(" ")
.append(
new LiteralText(StringUtils.toFirstCapital(newType.asString()))
.formatted(color)
)
);
}
return ActionResult.SUCCESS;
}

View file

@ -26,7 +26,10 @@ package techreborn.client.gui;
import com.mojang.blaze3d.systems.RenderSystem;
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 reborncore.client.screen.builder.BuiltScreenHandler;
import reborncore.client.gui.builder.GuiBase;
import reborncore.client.gui.builder.widget.GuiButtonUpDown;
@ -55,31 +58,35 @@ public class GuiAESU extends GuiBase<BuiltScreenHandler> {
}
@Override
protected void drawBackground(final float f, final int mouseX, final int mouseY) {
super.drawBackground(f, mouseX, mouseY);
protected void drawBackground(MatrixStack matrixStack, final float f, final int mouseX, final int mouseY) {
super.drawBackground(matrixStack, f, mouseX, mouseY);
final Layer layer = Layer.BACKGROUND;
this.drawSlot(62, 45, layer);
this.drawSlot(98, 45, layer);
this.drawArmourSlots(8, 18, layer);
this.builder.drawEnergyOutput(this, 155, 61, this.blockEntity.getCurrentOutput(), layer);
this.drawSlot(matrixStack, 62, 45, layer);
this.drawSlot(matrixStack, 98, 45, layer);
this.drawArmourSlots(matrixStack, 8, 18, layer);
this.builder.drawEnergyOutput(matrixStack, this, 155, 61, this.blockEntity.getCurrentOutput(), layer);
}
@Override
protected void drawForeground(final int mouseX, final int mouseY) {
super.drawForeground(mouseX, mouseY);
protected void drawForeground(MatrixStack matrixStack, final int mouseX, final int mouseY) {
super.drawForeground(matrixStack, mouseX, mouseY);
final Layer layer = Layer.FOREGROUND;
if(!hideGuiElements()){
RenderSystem.pushMatrix();
RenderSystem.scaled(0.6, 0.6, 1);
drawCentredString(PowerSystem.getLocaliszedPowerFormattedNoSuffix((int) blockEntity.getEnergy()) + "/"
+ PowerSystem.getLocaliszedPowerFormattedNoSuffix((int) blockEntity.getMaxPower()) + " "
+ PowerSystem.getDisplayPower().abbreviation, 35, 0, 58, layer);
Text text = new LiteralText(PowerSystem.getLocaliszedPowerFormattedNoSuffix((int) blockEntity.getEnergy()))
.append("/")
.append(PowerSystem.getLocaliszedPowerFormattedNoSuffix((int) blockEntity.getMaxPower()))
.append(" ")
.append(PowerSystem.getDisplayPower().abbreviation);
drawCentredText(matrixStack, text, 35, 0, 58, layer);
RenderSystem.popMatrix();
}
builder.drawMultiEnergyBar(this, 81, 28, (int) blockEntity.getEnergy(), (int) blockEntity.getMaxPower(), mouseX, mouseY, 0, layer);
builder.drawMultiEnergyBar(matrixStack, this, 81, 28, (int) blockEntity.getEnergy(), (int) blockEntity.getMaxPower(), mouseX, mouseY, 0, layer);
}
public void onClick(int amount){

View file

@ -24,6 +24,7 @@
package techreborn.client.gui;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.player.PlayerEntity;
import reborncore.client.screen.builder.BuiltScreenHandler;
import reborncore.client.gui.builder.GuiBase;
@ -40,25 +41,25 @@ public class GuiAlloyFurnace extends GuiBase<BuiltScreenHandler> {
}
@Override
protected void drawBackground(float lastFrameDuration, int mouseX, int mouseY) {
super.drawBackground(lastFrameDuration, mouseX, mouseY);
protected void drawBackground(MatrixStack matrixStack, float lastFrameDuration, int mouseX, int mouseY) {
super.drawBackground(matrixStack, lastFrameDuration, mouseX, mouseY);
GuiBase.Layer layer = GuiBase.Layer.BACKGROUND;
// Input slots
drawSlot(47, 17, layer);
drawSlot(65, 17, layer);
drawSlot(matrixStack, 47, 17, layer);
drawSlot(matrixStack, 65, 17, layer);
// Fuel slot
drawSlot(56, 53, layer);
drawSlot(matrixStack, 56, 53, layer);
drawOutputSlot(116, 35, layer);
drawOutputSlot(matrixStack, 116, 35, layer);
}
@Override
protected void drawForeground(int mouseX, int mouseY) {
super.drawForeground(mouseX, mouseY);
protected void drawForeground(MatrixStack matrixStack, int mouseX, int mouseY) {
super.drawForeground(matrixStack, mouseX, mouseY);
GuiBase.Layer layer = GuiBase.Layer.FOREGROUND;
builder.drawProgressBar(this, blockEntity.getProgressScaled(100), 100, 85, 36, mouseX, mouseY, GuiBuilder.ProgressDirection.RIGHT, layer);
builder.drawBurnBar(this, blockEntity.getBurnTimeRemainingScaled(100), 100, 56, 36, mouseX, mouseY, layer);
builder.drawProgressBar(matrixStack, this, blockEntity.getProgressScaled(100), 100, 85, 36, mouseX, mouseY, GuiBuilder.ProgressDirection.RIGHT, layer);
builder.drawBurnBar(matrixStack, this, blockEntity.getBurnTimeRemainingScaled(100), 100, 56, 36, mouseX, mouseY, layer);
}
}

View file

@ -24,6 +24,7 @@
package techreborn.client.gui;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.player.PlayerEntity;
import reborncore.client.screen.builder.BuiltScreenHandler;
import reborncore.client.gui.builder.GuiBase;
@ -41,26 +42,26 @@ public class GuiAlloySmelter extends GuiBase<BuiltScreenHandler> {
}
@Override
protected void drawBackground(final float f, final int mouseX, final int mouseY) {
super.drawBackground(f, mouseX, mouseY);
protected void drawBackground(MatrixStack matrixStack, final float f, final int mouseX, final int mouseY) {
super.drawBackground(matrixStack, f, mouseX, mouseY);
final GuiBase.Layer layer = GuiBase.Layer.BACKGROUND;
drawSlot(8, 72, layer);
drawSlot(matrixStack, 8, 72, layer);
drawSlot(34, 47, layer);
drawSlot(126, 47, layer);
drawOutputSlot(80, 47, layer);
drawSlot(matrixStack, 34, 47, layer);
drawSlot(matrixStack, 126, 47, layer);
drawOutputSlot(matrixStack, 80, 47, layer);
builder.drawJEIButton(this, 158, 5, layer);
builder.drawJEIButton(matrixStack, this, 158, 5, layer);
}
@Override
protected void drawForeground(final int mouseX, final int mouseY) {
super.drawForeground(mouseX, mouseY);
protected void drawForeground(MatrixStack matrixStack, final int mouseX, final int mouseY) {
super.drawForeground(matrixStack, mouseX, mouseY);
final GuiBase.Layer layer = GuiBase.Layer.FOREGROUND;
builder.drawProgressBar(this, blockEntity.getProgressScaled(100), 100, 55, 51, mouseX, mouseY, GuiBuilder.ProgressDirection.RIGHT, layer);
builder.drawProgressBar(this, blockEntity.getProgressScaled(100), 100, 105, 51, mouseX, mouseY, GuiBuilder.ProgressDirection.LEFT, layer);
builder.drawMultiEnergyBar(this, 9, 19, (int) blockEntity.getEnergy(), (int) blockEntity.getMaxPower(), mouseX, mouseY, 0, layer);
builder.drawProgressBar(matrixStack, this, blockEntity.getProgressScaled(100), 100, 55, 51, mouseX, mouseY, GuiBuilder.ProgressDirection.RIGHT, layer);
builder.drawProgressBar(matrixStack, this, blockEntity.getProgressScaled(100), 100, 105, 51, mouseX, mouseY, GuiBuilder.ProgressDirection.LEFT, layer);
builder.drawMultiEnergyBar(matrixStack, this, 9, 19, (int) blockEntity.getEnergy(), (int) blockEntity.getMaxPower(), mouseX, mouseY, 0, layer);
}
}

View file

@ -24,6 +24,7 @@
package techreborn.client.gui;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.player.PlayerEntity;
import reborncore.client.screen.builder.BuiltScreenHandler;
import reborncore.client.gui.builder.GuiBase;
@ -40,28 +41,28 @@ public class GuiAssemblingMachine extends GuiBase<BuiltScreenHandler> {
}
@Override
protected void drawBackground(final float partialTicks, final int mouseX, final int mouseY) {
super.drawBackground(partialTicks, mouseX, mouseY);
protected void drawBackground(MatrixStack matrixStack, final float partialTicks, final int mouseX, final int mouseY) {
super.drawBackground(matrixStack, partialTicks, mouseX, mouseY);
final GuiBase.Layer layer = GuiBase.Layer.BACKGROUND;
// Battery slot
drawSlot(8, 72, layer);
drawSlot(matrixStack, 8, 72, layer);
// Input slots
drawSlot(55, 35, layer);
drawSlot(55, 55, layer);
drawSlot(matrixStack, 55, 35, layer);
drawSlot(matrixStack, 55, 55, layer);
drawOutputSlot(101, 45, layer);
drawOutputSlot(matrixStack, 101, 45, layer);
builder.drawJEIButton(this, 158, 5, layer);
builder.drawJEIButton(matrixStack, this, 158, 5, layer);
}
@Override
protected void drawForeground(final int mouseX, final int mouseY) {
super.drawForeground(mouseX, mouseY);
protected void drawForeground(MatrixStack matrixStack, final int mouseX, final int mouseY) {
super.drawForeground(matrixStack, mouseX, mouseY);
final GuiBase.Layer layer = GuiBase.Layer.FOREGROUND;
builder.drawProgressBar(this, blockEntity.getProgressScaled(100), 100, 76, 48, mouseX, mouseY, GuiBuilder.ProgressDirection.RIGHT, layer);
builder.drawMultiEnergyBar(this, 9, 19, (int) blockEntity.getEnergy(), (int) blockEntity.getMaxPower(), mouseX, mouseY, 0, layer);
builder.drawProgressBar(matrixStack, this, blockEntity.getProgressScaled(100), 100, 76, 48, mouseX, mouseY, GuiBuilder.ProgressDirection.RIGHT, layer);
builder.drawMultiEnergyBar(matrixStack, this, 9, 19, (int) blockEntity.getEnergy(), (int) blockEntity.getMaxPower(), mouseX, mouseY, 0, layer);
}
}

View file

@ -25,9 +25,11 @@
package techreborn.client.gui;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.recipe.CraftingRecipe;
import net.minecraft.text.LiteralText;
import net.minecraft.util.Identifier;
import reborncore.client.screen.builder.BuiltScreenHandler;
import reborncore.client.gui.builder.GuiBase;
@ -55,32 +57,32 @@ public class GuiAutoCrafting extends GuiBase<BuiltScreenHandler> {
}
@Override
protected void drawForeground(int mouseX, int mouseY) {
super.drawForeground(mouseX, mouseY);
protected void drawForeground(MatrixStack matrixStack, int mouseX, int mouseY) {
super.drawForeground(matrixStack, mouseX, mouseY);
CraftingRecipe recipe = blockEntityAutoCraftingTable.getCurrentRecipe();
if (recipe != null) {
renderItemStack(recipe.getOutput(), 95, 42);
}
final Layer layer = Layer.FOREGROUND;
builder.drawProgressBar(this, blockEntityAutoCraftingTable.getProgress(), blockEntityAutoCraftingTable.getMaxProgress(), 120, 44, mouseX, mouseY, GuiBuilder.ProgressDirection.RIGHT, layer);
builder.drawMultiEnergyBar(this, 9, 26, (int) blockEntityAutoCraftingTable.getEnergy(), (int) blockEntityAutoCraftingTable.getMaxPower(), mouseX, mouseY, 0, layer);
builder.drawProgressBar(matrixStack, this, blockEntityAutoCraftingTable.getProgress(), blockEntityAutoCraftingTable.getMaxProgress(), 120, 44, mouseX, mouseY, GuiBuilder.ProgressDirection.RIGHT, layer);
builder.drawMultiEnergyBar(matrixStack, this, 9, 26, (int) blockEntityAutoCraftingTable.getEnergy(), (int) blockEntityAutoCraftingTable.getMaxPower(), mouseX, mouseY, 0, layer);
}
@Override
protected void drawBackground(final float f, int mouseX, int mouseY) {
super.drawBackground(f, mouseX, mouseY);
protected void drawBackground(MatrixStack matrixStack, final float f, int mouseX, int mouseY) {
super.drawBackground(matrixStack, f, mouseX, mouseY);
final Layer layer = Layer.BACKGROUND;
for (int i = 0; i < 3; i++) {
for (int j = 0; j < 3; j++) {
drawSlot(28 + (i * 18), 25 + (j * 18), layer);
drawSlot(matrixStack, 28 + (i * 18), 25 + (j * 18), layer);
}
}
drawOutputSlot(145, 42, layer);
drawOutputSlot(95, 42, layer);
drawString("Inventory", 8, 82, 4210752, layer);
drawOutputSlot(matrixStack, 145, 42, layer);
drawOutputSlot(matrixStack, 95, 42, layer);
method_27534(matrixStack, client.textRenderer, new LiteralText("Inventory"), 8, 82, 4210752);
builder.drawLockButton(this, 145, 4, mouseX, mouseY, layer, blockEntityAutoCraftingTable.locked);
builder.drawLockButton(matrixStack, this, 145, 4, mouseX, mouseY, layer, blockEntityAutoCraftingTable.locked);
}
@Override

View file

@ -25,7 +25,10 @@
package techreborn.client.gui;
import com.mojang.blaze3d.systems.RenderSystem;
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.screen.builder.BuiltScreenHandler;
import reborncore.client.gui.builder.GuiBase;
import reborncore.common.powerSystem.PowerSystem;
@ -41,26 +44,33 @@ public class GuiBatbox extends GuiBase<BuiltScreenHandler> {
}
@Override
protected void drawBackground(final float f, final int mouseX, final int mouseY) {
super.drawBackground(f, mouseX, mouseY);
protected void drawBackground(MatrixStack matrixStack, final float f, final int mouseX, final int mouseY) {
super.drawBackground(matrixStack, f, mouseX, mouseY);
final Layer layer = Layer.BACKGROUND;
drawSlot(62, 45, layer);
drawSlot(98, 45, layer);
drawSlot(matrixStack, 62, 45, layer);
drawSlot(matrixStack, 98, 45, layer);
}
@Override
protected void drawForeground(final int mouseX, final int mouseY) {
super.drawForeground(mouseX, mouseY);
protected void drawForeground(MatrixStack matrixStack, final int mouseX, final int mouseY) {
super.drawForeground(matrixStack, mouseX, mouseY);
final Layer layer = Layer.FOREGROUND;
if(!hideGuiElements()){
RenderSystem.pushMatrix();
RenderSystem.scaled(0.6, 0.6, 5);
drawCentredString(PowerSystem.getLocaliszedPowerFormattedNoSuffix((int) blockEntity.getEnergy()) + "/" + PowerSystem.getLocaliszedPowerFormattedNoSuffix((int) blockEntity.getMaxPower()) + " " + PowerSystem.getDisplayPower().abbreviation, 35, 0, 58, layer);
Text text = new LiteralText(PowerSystem.getLocaliszedPowerFormattedNoSuffix((int) blockEntity.getEnergy()))
.append("/")
.append(PowerSystem.getLocaliszedPowerFormattedNoSuffix((int) blockEntity.getMaxPower()))
.append(" ")
.append(PowerSystem.getDisplayPower().abbreviation);
drawCentredText(matrixStack, text, 35, 0, 58, layer);
RenderSystem.popMatrix();
}
builder.drawMultiEnergyBar(this, 81, 28, (int) blockEntity.getEnergy(), (int) blockEntity.getMaxPower(), mouseX, mouseY, 0, layer);
builder.drawMultiEnergyBar(matrixStack, this, 81, 28, (int) blockEntity.getEnergy(), (int) blockEntity.getMaxPower(), mouseX, mouseY, 0, layer);
}
}

View file

@ -26,6 +26,7 @@ package techreborn.client.gui;
import com.mojang.blaze3d.systems.RenderSystem;
import net.minecraft.block.BlockState;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
@ -54,42 +55,42 @@ public class GuiBlastFurnace extends GuiBase<BuiltScreenHandler> {
}
@Override
protected void drawBackground(final float f, final int mouseX, final int mouseY) {
super.drawBackground(f, mouseX, mouseY);
protected void drawBackground(MatrixStack matrixStack, final float f, final int mouseX, final int mouseY) {
super.drawBackground(matrixStack, f, mouseX, mouseY);
this.hasMultiBlock = this.blockEntity.getCachedHeat() != 0;
RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
final GuiBase.Layer layer = Layer.BACKGROUND;
drawSlot(8, 72, layer);
drawSlot(matrixStack, 8, 72, layer);
drawSlot(50, 27, layer);
drawSlot(50, 47, layer);
drawOutputSlotBar(92, 36, 2, layer);
drawSlot(matrixStack, 50, 27, layer);
drawSlot(matrixStack, 50, 47, layer);
drawOutputSlotBar(matrixStack, 92, 36, 2, layer);
builder.drawJEIButton(this, 158, 5, layer);
builder.drawJEIButton(matrixStack, this, 158, 5, layer);
if (hasMultiBlock) {
builder.drawHologramButton(this, 6, 4, mouseX, mouseY, layer);
builder.drawHologramButton(matrixStack, this, 6, 4, mouseX, mouseY, layer);
}
}
@Override
protected void drawForeground(final int mouseX, final int mouseY) {
super.drawForeground(mouseX, mouseY);
protected void drawForeground(MatrixStack matrixStack, final int mouseX, final int mouseY) {
super.drawForeground(matrixStack, mouseX, mouseY);
this.hasMultiBlock = blockEntity.getCachedHeat() != 0;
final GuiBase.Layer layer = GuiBase.Layer.FOREGROUND;
builder.drawProgressBar(this, blockEntity.getProgressScaled(100), 100, 71, 40, mouseX, mouseY, GuiBuilder.ProgressDirection.RIGHT, layer);
builder.drawProgressBar(matrixStack, this, blockEntity.getProgressScaled(100), 100, 71, 40, mouseX, mouseY, GuiBuilder.ProgressDirection.RIGHT, layer);
builder.drawBigHeatBar(this, 31, 71, blockEntity.getCachedHeat(), 3230, layer);
builder.drawBigHeatBar(matrixStack, this, 31, 71, blockEntity.getCachedHeat(), 3230, layer);
if (hasMultiBlock) {
addHologramButton(4, 4, 212, layer).clickHandler(this::onClick);
} else {
builder.drawMultiblockMissingBar(this, layer);
builder.drawMultiblockMissingBar(matrixStack, this, layer);
addHologramButton(76, 56, 212, layer).clickHandler(this::onClick);
builder.drawHologramButton(this, 76, 56, mouseX, mouseY, layer);
builder.drawHologramButton(matrixStack, this, 76, 56, mouseX, mouseY, layer);
}
builder.drawMultiEnergyBar(this, 9, 19, (int) blockEntity.getEnergy(), (int) blockEntity.getMaxPower(), mouseX, mouseY, 0, layer);
builder.drawMultiEnergyBar(matrixStack, this, 9, 19, (int) blockEntity.getEnergy(), (int) blockEntity.getMaxPower(), mouseX, mouseY, 0, layer);
}
public void onClick(GuiButtonExtended button, Double x, Double y){

View file

@ -24,6 +24,7 @@
package techreborn.client.gui;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.player.PlayerEntity;
import reborncore.client.screen.builder.BuiltScreenHandler;
import reborncore.client.gui.builder.GuiBase;
@ -40,29 +41,29 @@ public class GuiCentrifuge extends GuiBase<BuiltScreenHandler> {
}
@Override
protected void drawBackground(final float f, final int mouseX, final int mouseY) {
super.drawBackground(f, mouseX, mouseY);
protected void drawBackground(MatrixStack matrixStack, final float f, final int mouseX, final int mouseY) {
super.drawBackground(matrixStack, f, mouseX, mouseY);
final Layer layer = Layer.BACKGROUND;
drawSlot(8, 72, layer);
drawSlot(matrixStack, 8, 72, layer);
drawSlot(40, 34, layer);
drawSlot(40, 54, layer);
drawSlot(matrixStack, 40, 34, layer);
drawSlot(matrixStack, 40, 54, layer);
drawSlot(82, 44, layer);
drawSlot(101, 25, layer);
drawSlot(120, 44, layer);
drawSlot(101, 63, layer);
drawSlot(matrixStack, 82, 44, layer);
drawSlot(matrixStack, 101, 25, layer);
drawSlot(matrixStack, 120, 44, layer);
drawSlot(matrixStack, 101, 63, layer);
builder.drawJEIButton(this, 158, 5, layer);
builder.drawJEIButton(matrixStack, this, 158, 5, layer);
}
@Override
protected void drawForeground(final int mouseX, final int mouseY) {
super.drawForeground(mouseX, mouseY);
protected void drawForeground(MatrixStack matrixStack, final int mouseX, final int mouseY) {
super.drawForeground(matrixStack, mouseX, mouseY);
final Layer layer = Layer.FOREGROUND;
builder.drawProgressBar(this, blockEntity.getProgressScaled(100), 100, 61, 47, mouseX, mouseY, GuiBuilder.ProgressDirection.RIGHT, layer);
builder.drawMultiEnergyBar(this, 9, 19, (int) blockEntity.getEnergy(), (int) blockEntity.getMaxPower(), mouseX, mouseY, 0, layer);
builder.drawProgressBar(matrixStack, this, blockEntity.getProgressScaled(100), 100, 61, 47, mouseX, mouseY, GuiBuilder.ProgressDirection.RIGHT, layer);
builder.drawMultiEnergyBar(matrixStack, this, 9, 19, (int) blockEntity.getEnergy(), (int) blockEntity.getMaxPower(), mouseX, mouseY, 0, layer);
}
}

View file

@ -24,6 +24,7 @@
package techreborn.client.gui;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.player.PlayerEntity;
import reborncore.client.screen.builder.BuiltScreenHandler;
import reborncore.client.gui.builder.GuiBase;
@ -39,23 +40,23 @@ public class GuiChargeBench extends GuiBase<BuiltScreenHandler> {
}
@Override
protected void drawBackground(final float f, final int mouseX, final int mouseY) {
super.drawBackground(f, mouseX, mouseY);
protected void drawBackground(MatrixStack matrixStack, final float f, final int mouseX, final int mouseY) {
super.drawBackground(matrixStack, f, mouseX, mouseY);
final Layer layer = Layer.BACKGROUND;
drawSlot(62, 25, layer);
drawSlot(98, 25, layer);
drawSlot(62, 45, layer);
drawSlot(98, 45, layer);
drawSlot(62, 65, layer);
drawSlot(98, 65, layer);
drawSlot(matrixStack, 62, 25, layer);
drawSlot(matrixStack, 98, 25, layer);
drawSlot(matrixStack, 62, 45, layer);
drawSlot(matrixStack, 98, 45, layer);
drawSlot(matrixStack, 62, 65, layer);
drawSlot(matrixStack, 98, 65, layer);
}
@Override
protected void drawForeground(final int mouseX, final int mouseY) {
super.drawForeground(mouseX, mouseY);
protected void drawForeground(MatrixStack matrixStack, final int mouseX, final int mouseY) {
super.drawForeground(matrixStack, mouseX, mouseY);
final Layer layer = Layer.FOREGROUND;
builder.drawMultiEnergyBar(this, 81, 28, (int) blockEntity.getEnergy(), (int) blockEntity.getMaxPower(), mouseX, mouseY, 0, layer);
builder.drawMultiEnergyBar(matrixStack, this, 81, 28, (int) blockEntity.getEnergy(), (int) blockEntity.getMaxPower(), mouseX, mouseY, 0, layer);
}
}

View file

@ -24,6 +24,7 @@
package techreborn.client.gui;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.player.PlayerEntity;
import reborncore.client.screen.builder.BuiltScreenHandler;
import reborncore.client.gui.builder.GuiBase;
@ -40,26 +41,26 @@ public class GuiChemicalReactor extends GuiBase<BuiltScreenHandler> {
}
@Override
protected void drawBackground(final float f, final int mouseX, final int mouseY) {
super.drawBackground(f, mouseX, mouseY);
protected void drawBackground(MatrixStack matrixStack, final float f, final int mouseX, final int mouseY) {
super.drawBackground(matrixStack, f, mouseX, mouseY);
final GuiBase.Layer layer = GuiBase.Layer.BACKGROUND;
drawSlot(8, 72, layer);
drawSlot(matrixStack, 8, 72, layer);
drawSlot(34, 47, layer);
drawSlot(126, 47, layer);
drawOutputSlot(80, 47, layer);
drawSlot(matrixStack, 34, 47, layer);
drawSlot(matrixStack, 126, 47, layer);
drawOutputSlot(matrixStack, 80, 47, layer);
builder.drawJEIButton(this, 158, 5, layer);
builder.drawJEIButton(matrixStack, this, 158, 5, layer);
}
@Override
protected void drawForeground(final int mouseX, final int mouseY) {
super.drawForeground(mouseX, mouseY);
protected void drawForeground(MatrixStack matrixStack, final int mouseX, final int mouseY) {
super.drawForeground(matrixStack, mouseX, mouseY);
final GuiBase.Layer layer = GuiBase.Layer.FOREGROUND;
builder.drawProgressBar(this, blockEntity.getProgressScaled(100), 100, 55, 51, mouseX, mouseY, GuiBuilder.ProgressDirection.RIGHT, layer);
builder.drawProgressBar(this, blockEntity.getProgressScaled(100), 100, 105, 51, mouseX, mouseY, GuiBuilder.ProgressDirection.LEFT, layer);
builder.drawMultiEnergyBar(this, 9, 19, (int) blockEntity.getEnergy(), (int) blockEntity.getMaxPower(), mouseX, mouseY, 0, layer);
builder.drawProgressBar(matrixStack, this, blockEntity.getProgressScaled(100), 100, 55, 51, mouseX, mouseY, GuiBuilder.ProgressDirection.RIGHT, layer);
builder.drawProgressBar(matrixStack, this, blockEntity.getProgressScaled(100), 100, 105, 51, mouseX, mouseY, GuiBuilder.ProgressDirection.LEFT, layer);
builder.drawMultiEnergyBar(matrixStack, this, 9, 19, (int) blockEntity.getEnergy(), (int) blockEntity.getMaxPower(), mouseX, mouseY, 0, layer);
}
}

View file

@ -24,7 +24,10 @@
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.ClientChunkManager;
import reborncore.client.screen.builder.BuiltScreenHandler;
import reborncore.client.gui.builder.GuiBase;
@ -51,18 +54,19 @@ public class GuiChunkLoader extends GuiBase<BuiltScreenHandler> {
addButton(new GuiButtonUpDown(x + 64 + 24, y + 40, this, b -> onClick(-1), UpDownButtonType.REWIND));
addButton(new GuiButtonUpDown(x + 64 + 36, y + 40, this, b -> onClick(-5), UpDownButtonType.FASTREWIND));
addButton(new GuiButtonSimple(x + 10, y + 70, 155, 20, "Toggle Loaded Chunks", b -> ClientChunkManager.toggleLoadedChunks(blockEntity.getPos())));
addButton(new GuiButtonSimple(x + 10, y + 70, 155, 20, new LiteralText("Toggle Loaded Chunks"), b -> ClientChunkManager.toggleLoadedChunks(blockEntity.getPos())));
}
@Override
protected void drawBackground(float partialTicks, int mouseX, int mouseY) {
super.drawBackground(partialTicks, mouseX, mouseY);
protected void drawBackground(MatrixStack matrixStack, float partialTicks, int mouseX, int mouseY) {
super.drawBackground(matrixStack, partialTicks, mouseX, mouseY);
final Layer layer = Layer.BACKGROUND;
if (hideGuiElements()) return;
String text = "Radius: " + blockEntity.getRadius();
drawCentredString(text, 25, 4210752, layer);
Text text = new LiteralText("Radius: ")
.append(String.valueOf(blockEntity.getRadius()));
drawCentredText(matrixStack, text, 25, 4210752, layer);
}
public void onClick(int amount){

View file

@ -24,6 +24,7 @@
package techreborn.client.gui;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.player.PlayerEntity;
import reborncore.client.screen.builder.BuiltScreenHandler;
import reborncore.client.gui.builder.GuiBase;
@ -40,24 +41,24 @@ public class GuiCompressor extends GuiBase<BuiltScreenHandler> {
}
@Override
protected void drawBackground(final float f, final int mouseX, final int mouseY) {
super.drawBackground(f, mouseX, mouseY);
protected void drawBackground(MatrixStack matrixStack, final float f, final int mouseX, final int mouseY) {
super.drawBackground(matrixStack, f, mouseX, mouseY);
final GuiBase.Layer layer = GuiBase.Layer.BACKGROUND;
drawSlot(8, 72, layer);
drawSlot(matrixStack, 8, 72, layer);
drawSlot(55, 45, layer);
drawOutputSlot(101, 45, layer);
drawSlot(matrixStack, 55, 45, layer);
drawOutputSlot(matrixStack, 101, 45, layer);
builder.drawJEIButton(this, 158, 5, layer);
builder.drawJEIButton(matrixStack, this, 158, 5, layer);
}
@Override
protected void drawForeground(final int mouseX, final int mouseY) {
super.drawForeground(mouseX, mouseY);
protected void drawForeground(MatrixStack matrixStack, final int mouseX, final int mouseY) {
super.drawForeground(matrixStack, mouseX, mouseY);
final GuiBase.Layer layer = GuiBase.Layer.FOREGROUND;
this.builder.drawProgressBar(this, blockEntity.getProgressScaled(100), 100, 76, 48, mouseX, mouseY, GuiBuilder.ProgressDirection.RIGHT, layer);
this.builder.drawMultiEnergyBar(this, 9, 19, (int) blockEntity.getEnergy(), (int) blockEntity.getMaxPower(), mouseX, mouseY, 0, layer);
this.builder.drawProgressBar(matrixStack, this, blockEntity.getProgressScaled(100), 100, 76, 48, mouseX, mouseY, GuiBuilder.ProgressDirection.RIGHT, layer);
this.builder.drawMultiEnergyBar(matrixStack, this, 9, 19, (int) blockEntity.getEnergy(), (int) blockEntity.getMaxPower(), mouseX, mouseY, 0, layer);
}
}

View file

@ -26,6 +26,7 @@ package techreborn.client.gui;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.player.PlayerEntity;
import reborncore.client.screen.builder.BuiltScreenHandler;
import reborncore.client.gui.builder.GuiBase;
@ -43,23 +44,23 @@ public class GuiDieselGenerator extends GuiBase<BuiltScreenHandler> {
}
@Override
protected void drawBackground(final float f, final int mouseX, final int mouseY) {
super.drawBackground(f, mouseX, mouseY);
protected void drawBackground(MatrixStack matrixStack, final float f, final int mouseX, final int mouseY) {
super.drawBackground(matrixStack, f, mouseX, mouseY);
final GuiBase.Layer layer = GuiBase.Layer.BACKGROUND;
drawSlot(25, 35, layer);
drawSlot(25, 55, layer);
builder.drawJEIButton(this, 158, 5, layer);
drawSlot(matrixStack, 25, 35, layer);
drawSlot(matrixStack, 25, 55, layer);
builder.drawJEIButton(matrixStack, this, 158, 5, layer);
}
@Override
protected void drawForeground(final int mouseX, final int mouseY) {
super.drawForeground(mouseX, mouseY);
protected void drawForeground(MatrixStack matrixStack, final int mouseX, final int mouseY) {
super.drawForeground(matrixStack, mouseX, mouseY);
final GuiBase.Layer layer = GuiBase.Layer.FOREGROUND;
builder.drawProgressBar(this, blockEntity.getProgressScaled(10), 100, 83, 48, mouseX, mouseY, GuiBuilder.ProgressDirection.RIGHT, layer);
builder.drawMultiEnergyBar(this, 130, 28, (int) blockEntity.getEnergy(), (int) blockEntity.getMaxPower(), mouseX, mouseY, 0, layer);
builder.drawTank(this, 44, 25, mouseX, mouseY, blockEntity.tank.getFluidInstance(), blockEntity.tank.getCapacity(), blockEntity.tank.isEmpty(), layer);
builder.drawProgressBar(matrixStack, this, blockEntity.getProgressScaled(10), 100, 83, 48, mouseX, mouseY, GuiBuilder.ProgressDirection.RIGHT, layer);
builder.drawMultiEnergyBar(matrixStack, this, 130, 28, (int) blockEntity.getEnergy(), (int) blockEntity.getMaxPower(), mouseX, mouseY, 0, layer);
builder.drawTank(matrixStack, this, 44, 25, mouseX, mouseY, blockEntity.tank.getFluidInstance(), blockEntity.tank.getCapacity(), blockEntity.tank.isEmpty(), layer);
}

View file

@ -26,6 +26,7 @@ package techreborn.client.gui;
import com.mojang.blaze3d.systems.RenderSystem;
import net.minecraft.block.BlockState;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
@ -47,37 +48,37 @@ public class GuiDistillationTower extends GuiBase<BuiltScreenHandler> {
}
@Override
protected void drawBackground(final float f, final int mouseX, final int mouseY) {
super.drawBackground(f, mouseX, mouseY);
protected void drawBackground(MatrixStack matrixStack, final float f, final int mouseX, final int mouseY) {
super.drawBackground(matrixStack, f, mouseX, mouseY);
RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
final GuiBase.Layer layer = Layer.BACKGROUND;
// Battery slot
drawSlot(8, 72, layer);
drawSlot(matrixStack, 8, 72, layer);
// Input slots
drawSlot(35, 27, layer);
drawSlot(35, 47, layer);
drawSlot(matrixStack, 35, 27, layer);
drawSlot(matrixStack, 35, 47, layer);
// Four output slots
drawOutputSlotBar(78, 36, 4, layer);
drawOutputSlotBar(matrixStack, 78, 36, 4, layer);
// JEI Button
builder.drawJEIButton(this, 158, 5, layer);
builder.drawJEIButton(matrixStack, this, 158, 5, layer);
}
@Override
protected void drawForeground(final int mouseX, final int mouseY) {
super.drawForeground(mouseX, mouseY);
protected void drawForeground(MatrixStack matrixStack, final int mouseX, final int mouseY) {
super.drawForeground(matrixStack, mouseX, mouseY);
final GuiBase.Layer layer = Layer.FOREGROUND;
builder.drawProgressBar(this, blockEntity.getProgressScaled(100), 100, 55, 40, mouseX, mouseY, GuiBuilder.ProgressDirection.RIGHT, layer);
builder.drawProgressBar(matrixStack, this, blockEntity.getProgressScaled(100), 100, 55, 40, mouseX, mouseY, GuiBuilder.ProgressDirection.RIGHT, layer);
if (blockEntity.getMutliBlock()) {
addHologramButton(6, 4, 212, layer).clickHandler(this::onClick);
builder.drawHologramButton(this, 6, 4, mouseX, mouseY, layer);
builder.drawHologramButton(matrixStack, this, 6, 4, mouseX, mouseY, layer);
} else {
builder.drawMultiblockMissingBar(this, layer);
builder.drawMultiblockMissingBar(matrixStack, this, layer);
addHologramButton(76, 56, 212, layer).clickHandler(this::onClick);
builder.drawHologramButton(this, 76, 56, mouseX, mouseY, layer);
builder.drawHologramButton(matrixStack, this, 76, 56, mouseX, mouseY, layer);
}
builder.drawMultiEnergyBar(this, 9, 19, (int) blockEntity.getEnergy(), (int) blockEntity.getMaxPower(), mouseX, mouseY, 0, layer);
builder.drawMultiEnergyBar(matrixStack, this, 9, 19, (int) blockEntity.getEnergy(), (int) blockEntity.getMaxPower(), mouseX, mouseY, 0, layer);
}

View file

@ -24,6 +24,7 @@
package techreborn.client.gui;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.player.PlayerEntity;
import reborncore.client.screen.builder.BuiltScreenHandler;
import reborncore.client.gui.builder.GuiBase;
@ -40,24 +41,24 @@ public class GuiElectricFurnace extends GuiBase<BuiltScreenHandler> {
}
@Override
protected void drawBackground(float partialTicks, int mouseX, int mouseY) {
super.drawBackground(partialTicks, mouseX, mouseY);
protected void drawBackground(MatrixStack matrixStack, float partialTicks, int mouseX, int mouseY) {
super.drawBackground(matrixStack, partialTicks, mouseX, mouseY);
Layer layer = Layer.BACKGROUND;
drawSlot(8, 72, layer);
drawSlot(matrixStack, 8, 72, layer);
drawSlot(55, 45, layer);
drawOutputSlot(101, 45, layer);
drawSlot(matrixStack, 55, 45, layer);
drawOutputSlot(matrixStack, 101, 45, layer);
builder.drawJEIButton(this, 158, 5, layer);
builder.drawJEIButton(matrixStack, this, 158, 5, layer);
}
@Override
protected void drawForeground(int mouseX, int mouseY) {
super.drawForeground(mouseX, mouseY);
protected void drawForeground(MatrixStack matrixStack, int mouseX, int mouseY) {
super.drawForeground(matrixStack, mouseX, mouseY);
Layer layer = Layer.FOREGROUND;
builder.drawProgressBar(this, blockEntity.getProgressScaled(100), 100, 76, 48, mouseX, mouseY, GuiBuilder.ProgressDirection.RIGHT, layer);
builder.drawMultiEnergyBar(this, 9, 19, (int) blockEntity.getEnergy(), (int) blockEntity.getMaxPower(), mouseX, mouseY, 0, layer);
builder.drawProgressBar(matrixStack, this, blockEntity.getProgressScaled(100), 100, 76, 48, mouseX, mouseY, GuiBuilder.ProgressDirection.RIGHT, layer);
builder.drawMultiEnergyBar(matrixStack, this, 9, 19, (int) blockEntity.getEnergy(), (int) blockEntity.getMaxPower(), mouseX, mouseY, 0, layer);
}
}

View file

@ -24,6 +24,7 @@
package techreborn.client.gui;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.player.PlayerEntity;
import reborncore.client.screen.builder.BuiltScreenHandler;
import reborncore.client.gui.builder.GuiBase;
@ -40,24 +41,24 @@ public class GuiExtractor extends GuiBase<BuiltScreenHandler> {
}
@Override
protected void drawBackground(final float f, final int mouseX, final int mouseY) {
super.drawBackground(f, mouseX, mouseY);
protected void drawBackground(MatrixStack matrixStack, final float f, final int mouseX, final int mouseY) {
super.drawBackground(matrixStack, f, mouseX, mouseY);
final GuiBase.Layer layer = GuiBase.Layer.BACKGROUND;
drawSlot(8, 72, layer);
drawSlot(matrixStack, 8, 72, layer);
drawSlot(55, 45, layer);
drawOutputSlot(101, 45, layer);
drawSlot(matrixStack, 55, 45, layer);
drawOutputSlot(matrixStack, 101, 45, layer);
builder.drawJEIButton(this, 158, 5, layer);
builder.drawJEIButton(matrixStack, this, 158, 5, layer);
}
@Override
protected void drawForeground(final int mouseX, final int mouseY) {
super.drawForeground(mouseX, mouseY);
protected void drawForeground(MatrixStack matrixStack, final int mouseX, final int mouseY) {
super.drawForeground(matrixStack, mouseX, mouseY);
final GuiBase.Layer layer = GuiBase.Layer.FOREGROUND;
builder.drawProgressBar(this, blockEntity.getProgressScaled(100), 100, 76, 48, mouseX, mouseY, GuiBuilder.ProgressDirection.RIGHT, layer);
builder.drawMultiEnergyBar(this, 9, 19, (int) blockEntity.getEnergy(), (int) blockEntity.getMaxPower(), mouseX, mouseY, 0, layer);
builder.drawProgressBar(matrixStack, this, blockEntity.getProgressScaled(100), 100, 76, 48, mouseX, mouseY, GuiBuilder.ProgressDirection.RIGHT, layer);
builder.drawMultiEnergyBar(matrixStack, this, 9, 19, (int) blockEntity.getEnergy(), (int) blockEntity.getMaxPower(), mouseX, mouseY, 0, layer);
}
}

View file

@ -25,6 +25,7 @@
package techreborn.client.gui;
import net.minecraft.block.BlockState;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
@ -50,39 +51,39 @@ public class GuiFluidReplicator extends GuiBase<BuiltScreenHandler> {
}
@Override
protected void drawBackground(final float f, final int mouseX, final int mouseY) {
super.drawBackground(f, mouseX, mouseY);
protected void drawBackground(MatrixStack matrixStack, final float f, final int mouseX, final int mouseY) {
super.drawBackground(matrixStack, f, mouseX, mouseY);
final GuiBase.Layer layer = GuiBase.Layer.BACKGROUND;
// Battery slot
drawSlot(8, 72, layer);
drawSlot(matrixStack, 8, 72, layer);
// Input slot
drawSlot(55, 45, layer);
drawSlot(matrixStack, 55, 45, layer);
// Liquid input slot
drawSlot(124, 35, layer);
drawSlot(matrixStack, 124, 35, layer);
// Liquid output slot
drawSlot(124, 55, layer);
drawSlot(matrixStack, 124, 55, layer);
// JEI button
builder.drawJEIButton(this, 158, 5, layer);
builder.drawJEIButton(matrixStack, this, 158, 5, layer);
if (blockEntity.getMultiBlock()) {
builder.drawHologramButton(this, 6, 4, mouseX, mouseY, layer);
builder.drawHologramButton(matrixStack, this, 6, 4, mouseX, mouseY, layer);
}
}
@Override
protected void drawForeground(final int mouseX, final int mouseY) {
super.drawForeground(mouseX, mouseY);
protected void drawForeground(MatrixStack matrixStack, final int mouseX, final int mouseY) {
super.drawForeground(matrixStack, mouseX, mouseY);
final GuiBase.Layer layer = GuiBase.Layer.FOREGROUND;
builder.drawTank(this, 99, 25, mouseX, mouseY, blockEntity.tank.getFluidInstance(), blockEntity.tank.getCapacity(), blockEntity.tank.isEmpty(), layer);
builder.drawProgressBar(this, blockEntity.getProgressScaled(100), 100, 76, 48, mouseX, mouseY, GuiBuilder.ProgressDirection.RIGHT, layer);
builder.drawTank(matrixStack, this, 99, 25, mouseX, mouseY, blockEntity.tank.getFluidInstance(), blockEntity.tank.getCapacity(), blockEntity.tank.isEmpty(), layer);
builder.drawProgressBar(matrixStack, this, blockEntity.getProgressScaled(100), 100, 76, 48, mouseX, mouseY, GuiBuilder.ProgressDirection.RIGHT, layer);
if (blockEntity.getMultiBlock()) {
addHologramButton(6, 4, 212, layer).clickHandler(this::onClick);
} else {
builder.drawMultiblockMissingBar(this, layer);
builder.drawMultiblockMissingBar(matrixStack, this, layer);
addHologramButton(76, 56, 212, layer).clickHandler(this::onClick);
builder.drawHologramButton(this, 76, 56, mouseX, mouseY, layer);
builder.drawHologramButton(matrixStack, this, 76, 56, mouseX, mouseY, layer);
}
builder.drawMultiEnergyBar(this, 9, 19, (int) blockEntity.getEnergy(), (int) blockEntity.getMaxPower(), mouseX, mouseY, 0, layer);
builder.drawMultiEnergyBar(matrixStack, this, 9, 19, (int) blockEntity.getEnergy(), (int) blockEntity.getMaxPower(), mouseX, mouseY, 0, layer);
}
// GuiScreen

View file

@ -26,7 +26,10 @@ package techreborn.client.gui;
import net.minecraft.block.BlockState;
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.util.math.BlockPos;
import org.apache.commons.lang3.tuple.Pair;
import reborncore.client.screen.builder.BuiltScreenHandler;
@ -65,53 +68,59 @@ public class GuiFusionReactor extends GuiBase<BuiltScreenHandler> {
}
@Override
protected void drawBackground(final float partialTicks, final int mouseX, final int mouseY) {
super.drawBackground(partialTicks, mouseX, mouseY);
protected void drawBackground(MatrixStack matrixStack, final float partialTicks, final int mouseX, final int mouseY) {
super.drawBackground(matrixStack, partialTicks, mouseX, mouseY);
final GuiBase.Layer layer = GuiBase.Layer.BACKGROUND;
drawSlot(34, 47, layer);
drawSlot(126, 47, layer);
drawOutputSlot(80, 47, layer);
drawSlot(matrixStack, 34, 47, layer);
drawSlot(matrixStack, 126, 47, layer);
drawOutputSlot(matrixStack, 80, 47, layer);
builder.drawJEIButton(this, 158, 5, layer);
builder.drawJEIButton(matrixStack, this, 158, 5, layer);
if (blockEntity.getCoilStatus() > 0) {
builder.drawHologramButton(this, 6, 4, mouseX, mouseY, layer);
builder.drawHologramButton(matrixStack, this, 6, 4, mouseX, mouseY, layer);
}
}
@Override
protected void drawForeground(final int mouseX, final int mouseY) {
super.drawForeground(mouseX, mouseY);
protected void drawForeground(MatrixStack matrixStack, final int mouseX, final int mouseY) {
super.drawForeground(matrixStack, mouseX, mouseY);
final GuiBase.Layer layer = GuiBase.Layer.FOREGROUND;
builder.drawProgressBar(this, blockEntity.getProgressScaled(100), 100, 55, 51, mouseX, mouseY, GuiBuilder.ProgressDirection.RIGHT, layer);
builder.drawProgressBar(this, blockEntity.getProgressScaled(100), 100, 105, 51, mouseX, mouseY, GuiBuilder.ProgressDirection.LEFT, layer);
builder.drawProgressBar(matrixStack, this, blockEntity.getProgressScaled(100), 100, 55, 51, mouseX, mouseY, GuiBuilder.ProgressDirection.RIGHT, layer);
builder.drawProgressBar(matrixStack, this, blockEntity.getProgressScaled(100), 100, 105, 51, mouseX, mouseY, GuiBuilder.ProgressDirection.LEFT, layer);
if (blockEntity.getCoilStatus() > 0) {
addHologramButton(6, 4, 212, layer).clickHandler(this::hologramToggle);
drawCentredString(blockEntity.getStateString(), 20, Color.BLUE.darker().getColor(), layer);
drawCentredText(matrixStack, blockEntity.getStateText(), 20, Color.BLUE.darker().getColor(), layer);
if(blockEntity.state == 2){
drawCentredString( PowerSystem.getLocaliszedPowerFormatted((int) blockEntity.getPowerChange()) + "/t", 30, Color.GREEN.darker().getColor(), layer);
drawCentredText(matrixStack, new LiteralText(PowerSystem.getLocaliszedPowerFormatted((int) blockEntity.getPowerChange())).append("/t"), 30, Color.GREEN.darker().getColor(), layer);
}
} else {
builder.drawMultiblockMissingBar(this, layer);
builder.drawMultiblockMissingBar(matrixStack, this, layer);
addHologramButton(76, 56, 212, layer).clickHandler(this::hologramToggle);
builder.drawHologramButton(this, 76, 56, mouseX, mouseY, layer);
builder.drawHologramButton(matrixStack, this, 76, 56, mouseX, mouseY, layer);
Optional<Pair<Integer, Integer>> stackSize = getCoilStackCount();
if(stackSize.isPresent()){
if(stackSize.get().getLeft() > 0){
drawCentredString("Required Coils: " + stackSize.get().getLeft() + "x64 +" + stackSize.get().getRight(), 25, 0xFFFFFF, layer);
drawCentredText(matrixStack,
new LiteralText("Required Coils: ")
.append(String.valueOf(stackSize.get().getLeft()))
.append("x64 +")
.append(String.valueOf(stackSize.get().getRight()))
, 25, 0xFFFFFF, layer);
} else {
drawCentredString("Required Coils: " + stackSize.get().getRight(), 25, 0xFFFFFF, layer);
drawCentredText(matrixStack, new LiteralText("Required Coils: ").append(String.valueOf(stackSize.get().getRight())), 25, 0xFFFFFF, layer);
}
}
}
drawString("Size: " + blockEntity.size, 83, 81, 0xFFFFFF, layer);
drawString("" + blockEntity.getPowerMultiplier() + "x", 10, 81, 0xFFFFFF, layer);
method_27535(matrixStack, client.textRenderer, new LiteralText("Size: ").append(String.valueOf(blockEntity.size)), 83, 81, 0xFFFFFF);
method_27535(matrixStack, client.textRenderer,new LiteralText(String.valueOf(blockEntity.getPowerMultiplier())).append("x"), 10, 81, 0xFFFFFF);
builder.drawMultiEnergyBar(this, 9, 19, (int) this.blockEntity.getEnergy(), (int) this.blockEntity.getMaxPower(), mouseX, mouseY, 0, layer);
builder.drawMultiEnergyBar(matrixStack, this, 9, 19, (int) this.blockEntity.getEnergy(), (int) this.blockEntity.getMaxPower(), mouseX, mouseY, 0, layer);
}
public void hologramToggle(GuiButtonExtended button, double x, double y){

View file

@ -24,6 +24,7 @@
package techreborn.client.gui;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.player.PlayerEntity;
import reborncore.client.screen.builder.BuiltScreenHandler;
import reborncore.client.gui.builder.GuiBase;
@ -40,23 +41,23 @@ public class GuiGasTurbine extends GuiBase<BuiltScreenHandler> {
}
@Override
protected void drawBackground(final float f, final int mouseX, final int mouseY) {
super.drawBackground(f, mouseX, mouseY);
protected void drawBackground(MatrixStack matrixStack, final float f, final int mouseX, final int mouseY) {
super.drawBackground(matrixStack, f, mouseX, mouseY);
final GuiBase.Layer layer = GuiBase.Layer.BACKGROUND;
drawSlot(25, 35, layer);
drawSlot(25, 55, layer);
builder.drawJEIButton(this, 158, 5, layer);
drawSlot(matrixStack, 25, 35, layer);
drawSlot(matrixStack, 25, 55, layer);
builder.drawJEIButton(matrixStack, this, 158, 5, layer);
}
@Override
protected void drawForeground(final int mouseX, final int mouseY) {
super.drawForeground(mouseX, mouseY);
protected void drawForeground(MatrixStack matrixStack, final int mouseX, final int mouseY) {
super.drawForeground(matrixStack, mouseX, mouseY);
final GuiBase.Layer layer = GuiBase.Layer.FOREGROUND;
builder.drawProgressBar(this, blockEntity.getProgressScaled(10), 100, 83, 48, mouseX, mouseY, GuiBuilder.ProgressDirection.RIGHT, layer);
builder.drawMultiEnergyBar(this, 130, 28, (int) blockEntity.getEnergy(), (int) blockEntity.getMaxPower(), mouseX, mouseY, 0, layer);
builder.drawTank(this, 44, 25, mouseX, mouseY, blockEntity.tank.getFluidInstance(), blockEntity.tank.getCapacity(), blockEntity.tank.isEmpty(), layer);
builder.drawProgressBar(matrixStack, this, blockEntity.getProgressScaled(10), 100, 83, 48, mouseX, mouseY, GuiBuilder.ProgressDirection.RIGHT, layer);
builder.drawMultiEnergyBar(matrixStack, this, 130, 28, (int) blockEntity.getEnergy(), (int) blockEntity.getMaxPower(), mouseX, mouseY, 0, layer);
builder.drawTank(matrixStack, this, 44, 25, mouseX, mouseY, blockEntity.tank.getFluidInstance(), blockEntity.tank.getCapacity(), blockEntity.tank.isEmpty(), layer);
}
}

View file

@ -24,6 +24,7 @@
package techreborn.client.gui;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.player.PlayerEntity;
import reborncore.client.screen.builder.BuiltScreenHandler;
import reborncore.client.gui.builder.GuiBase;
@ -39,23 +40,23 @@ public class GuiGenerator extends GuiBase<BuiltScreenHandler> {
}
@Override
protected void drawBackground(final float f, final int mouseX, final int mouseY) {
super.drawBackground(f, mouseX, mouseY);
protected void drawBackground(MatrixStack matrixStack, final float f, final int mouseX, final int mouseY) {
super.drawBackground(matrixStack, f, mouseX, mouseY);
final Layer layer = Layer.BACKGROUND;
drawSlot(8, 72, layer);
drawSlot(matrixStack, 8, 72, layer);
drawSlot(80, 54, layer);
drawSlot(matrixStack, 80, 54, layer);
builder.drawJEIButton(this, 158, 5, layer);
builder.drawJEIButton(matrixStack, this, 158, 5, layer);
}
@Override
protected void drawForeground(final int mouseX, final int mouseY) {
super.drawForeground(mouseX, mouseY);
protected void drawForeground(MatrixStack matrixStack, final int mouseX, final int mouseY) {
super.drawForeground(matrixStack, mouseX, mouseY);
final Layer layer = Layer.FOREGROUND;
builder.drawBurnBar(this, blockEntity.getScaledBurnTime(100), 100, 81, 38, mouseX, mouseY, layer);
builder.drawMultiEnergyBar(this, 9, 19, (int) blockEntity.getEnergy(), (int) blockEntity.getMaxPower(), mouseX, mouseY, 0, layer);
builder.drawBurnBar(matrixStack, this, blockEntity.getScaledBurnTime(100), 100, 81, 38, mouseX, mouseY, layer);
builder.drawMultiEnergyBar(matrixStack, this, 9, 19, (int) blockEntity.getEnergy(), (int) blockEntity.getMaxPower(), mouseX, mouseY, 0, layer);
}
}

View file

@ -27,8 +27,12 @@ package techreborn.client.gui;
import com.mojang.blaze3d.systems.RenderSystem;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.state.property.Properties;
import net.minecraft.text.LiteralText;
import net.minecraft.text.Text;
import net.minecraft.text.TranslatableText;
import net.minecraft.util.Identifier;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
@ -42,6 +46,8 @@ import techreborn.init.TRContent;
import java.util.Arrays;
import java.util.List;
import java.util.function.Function;
import java.util.stream.Collectors;
public class GuiGreenhouseController extends GuiBase<BuiltScreenHandler> {
@ -53,27 +59,31 @@ public class GuiGreenhouseController extends GuiBase<BuiltScreenHandler> {
}
@Override
protected void drawBackground(final float f, final int mouseX, final int mouseY) {
super.drawBackground(f, mouseX, mouseY);
protected void drawBackground(MatrixStack matrixStack, final float f, final int mouseX, final int mouseY) {
super.drawBackground(matrixStack, f, mouseX, mouseY);
final GuiBase.Layer layer = GuiBase.Layer.BACKGROUND;
drawSlot(8, 72, layer);
drawSlot(matrixStack, 8, 72, layer);
int gridYPos = 22;
drawSlot(30, gridYPos, layer);
drawSlot(48, gridYPos, layer);
drawSlot(30, gridYPos + 18, layer);
drawSlot(48, gridYPos + 18, layer);
drawSlot(30, gridYPos + 36, layer);
drawSlot(48, gridYPos + 36, layer);
drawSlot(matrixStack, 30, gridYPos, layer);
drawSlot(matrixStack, 48, gridYPos, layer);
drawSlot(matrixStack, 30, gridYPos + 18, layer);
drawSlot(matrixStack, 48, gridYPos + 18, layer);
drawSlot(matrixStack, 30, gridYPos + 36, layer);
drawSlot(matrixStack, 48, gridYPos + 36, layer);
if (!blockEntity.getMultiBlock()) {
getMinecraft().getTextureManager().bindTexture(new Identifier("techreborn", "textures/item/part/digital_display.png"));
drawTexture(x + 68, y + 22, 0, 0, 16, 16, 16, 16);
drawTexture(matrixStack, x + 68, y + 22, 0, 0, 16, 16, 16, 16);
if (isPointInRect(68, 22, 16, 16, mouseX, mouseY)) {
List<String> list = Arrays.asList(StringUtils.t("techreborn.tooltip.greenhouse.upgrade_available").split("\\r?\\n"));
List<Text> list = Arrays.stream(new TranslatableText("techreborn.tooltip.greenhouse.upgrade_available").asString()
.split("\\r?\\n"))
.map(LiteralText::new)
.collect(Collectors.toList());
RenderSystem.pushMatrix();
renderTooltip(list, mouseX, mouseY);
renderTooltip(matrixStack, list, mouseX, mouseY);
RenderSystem.popMatrix();
}
}
@ -81,23 +91,27 @@ public class GuiGreenhouseController extends GuiBase<BuiltScreenHandler> {
}
@Override
protected void drawForeground(final int mouseX, final int mouseY) {
super.drawForeground(mouseX, mouseY);
protected void drawForeground(MatrixStack matrixStack, final int mouseX, final int mouseY) {
super.drawForeground(matrixStack, mouseX, mouseY);
final GuiBase.Layer layer = GuiBase.Layer.FOREGROUND;
addHologramButton(90, 24, 212, layer).clickHandler(this::onClick);
builder.drawHologramButton(this, 90, 24, mouseX, mouseY, layer);
builder.drawHologramButton(matrixStack, this, 90, 24, mouseX, mouseY, layer);
if (!blockEntity.getMultiBlock()) {
if (isPointInRect(68, 22, 16, 16, mouseX, mouseY)) {
List<String> list = Arrays.asList(StringUtils.t("techreborn.tooltip.greenhouse.upgrade_available").split("\\r?\\n"));
List<Text> list = Arrays.stream(new TranslatableText("techreborn.tooltip.greenhouse.upgrade_available").asString()
.split("\\r?\\n"))
.map(LiteralText::new)
.collect(Collectors.toList());
RenderSystem.pushMatrix();
renderTooltip(list, mouseX - getGuiLeft(), mouseY - getGuiTop());
renderTooltip(matrixStack, list, mouseX - getGuiLeft(), mouseY - getGuiTop());
RenderSystem.popMatrix();
}
}
builder.drawMultiEnergyBar(this, 9, 19, (int) blockEntity.getEnergy(), (int) blockEntity.getMaxPower(), mouseX, mouseY, 0, layer);
builder.drawMultiEnergyBar(matrixStack, this, 9, 19, (int) blockEntity.getEnergy(), (int) blockEntity.getMaxPower(), mouseX, mouseY, 0, layer);
}
public void onClick(GuiButtonExtended button, Double x, Double y) {

View file

@ -25,7 +25,10 @@
package techreborn.client.gui;
import com.mojang.blaze3d.systems.RenderSystem;
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.screen.builder.BuiltScreenHandler;
import reborncore.client.gui.builder.GuiBase;
import reborncore.common.powerSystem.PowerSystem;
@ -41,26 +44,33 @@ public class GuiIDSU extends GuiBase<BuiltScreenHandler> {
}
@Override
protected void drawBackground(final float f, final int mouseX, final int mouseY) {
super.drawBackground(f, mouseX, mouseY);
protected void drawBackground(MatrixStack matrixStack, final float f, final int mouseX, final int mouseY) {
super.drawBackground(matrixStack, f, mouseX, mouseY);
final Layer layer = Layer.BACKGROUND;
drawSlot(62, 45, layer);
drawSlot(98, 45, layer);
drawArmourSlots(8, 18, layer);
drawSlot(matrixStack, 62, 45, layer);
drawSlot(matrixStack, 98, 45, layer);
drawArmourSlots(matrixStack, 8, 18, layer);
}
@Override
protected void drawForeground(final int mouseX, final int mouseY) {
super.drawForeground(mouseX, mouseY);
protected void drawForeground(MatrixStack matrixStack, final int mouseX, final int mouseY) {
super.drawForeground(matrixStack, mouseX, mouseY);
final Layer layer = Layer.FOREGROUND;
RenderSystem.pushMatrix();
RenderSystem.scaled(0.6, 0.6, 1);
drawCentredString(PowerSystem.getLocaliszedPowerFormattedNoSuffix((int) idsu.getEnergy()) + "/" + PowerSystem.getLocaliszedPowerFormattedNoSuffix((int) idsu.getMaxPower()) + " " + PowerSystem.getDisplayPower().abbreviation, 35, 0, 58, layer);
Text text = new LiteralText(PowerSystem.getLocaliszedPowerFormattedNoSuffix((int) idsu.getEnergy()))
.append("/")
.append(PowerSystem.getLocaliszedPowerFormattedNoSuffix((int) idsu.getMaxPower()))
.append(" ")
.append(PowerSystem.getDisplayPower().abbreviation);
drawCentredText(matrixStack, text, 35, 0, 58, layer);
RenderSystem.popMatrix();
builder.drawMultiEnergyBar(this, 81, 28, (int) idsu.getEnergy(), (int) idsu.getMaxPower(), mouseX, mouseY, 0, layer);
builder.drawMultiEnergyBar(matrixStack, this, 81, 28, (int) idsu.getEnergy(), (int) idsu.getMaxPower(), mouseX, mouseY, 0, layer);
}
}

View file

@ -26,6 +26,7 @@ package techreborn.client.gui;
import com.mojang.blaze3d.systems.RenderSystem;
import net.minecraft.block.BlockState;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.util.math.BlockPos;
import reborncore.client.screen.builder.BuiltScreenHandler;
@ -46,40 +47,40 @@ public class GuiImplosionCompressor extends GuiBase<BuiltScreenHandler> {
}
@Override
protected void drawBackground(final float f, final int mouseX, final int mouseY) {
super.drawBackground(f, mouseX, mouseY);
protected void drawBackground(MatrixStack matrixStack, final float f, final int mouseX, final int mouseY) {
super.drawBackground(matrixStack, f, mouseX, mouseY);
RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
final GuiBase.Layer layer = Layer.BACKGROUND;
drawSlot(8, 72, layer);
drawSlot(matrixStack, 8, 72, layer);
drawSlot(50, 27, layer);
drawSlot(50, 47, layer);
drawSlot(92, 36, layer);
drawSlot(110, 36, layer);
drawSlot(matrixStack, 50, 27, layer);
drawSlot(matrixStack, 50, 47, layer);
drawSlot(matrixStack, 92, 36, layer);
drawSlot(matrixStack, 110, 36, layer);
if (blockEntity.getMutliBlock()) {
builder.drawHologramButton(this, 6, 4, mouseX, mouseY, layer);
builder.drawHologramButton(matrixStack, this, 6, 4, mouseX, mouseY, layer);
}
builder.drawJEIButton(this, 158, 5, layer);
builder.drawJEIButton(matrixStack, this, 158, 5, layer);
}
@Override
protected void drawForeground(final int mouseX, final int mouseY) {
super.drawForeground(mouseX, mouseY);
protected void drawForeground(MatrixStack matrixStack, final int mouseX, final int mouseY) {
super.drawForeground(matrixStack, mouseX, mouseY);
final GuiBase.Layer layer = Layer.FOREGROUND;
builder.drawProgressBar(this, blockEntity.getProgressScaled(100), 100, 71, 40, mouseX, mouseY, GuiBuilder.ProgressDirection.RIGHT, layer);
builder.drawProgressBar(matrixStack, this, blockEntity.getProgressScaled(100), 100, 71, 40, mouseX, mouseY, GuiBuilder.ProgressDirection.RIGHT, layer);
if (blockEntity.getMutliBlock()) {
addHologramButton(6, 4, 212, layer).clickHandler(this::onClick);
} else {
builder.drawMultiblockMissingBar(this, layer);
builder.drawMultiblockMissingBar(matrixStack, this, layer);
addHologramButton(76, 56, 212, layer).clickHandler(this::onClick);
builder.drawHologramButton(this, 76, 56, mouseX, mouseY, layer);
builder.drawHologramButton(matrixStack, this, 76, 56, mouseX, mouseY, layer);
}
builder.drawMultiEnergyBar(this, 9, 19, (int) blockEntity.getEnergy(), (int) blockEntity.getMaxPower(), mouseX, mouseY, 0, layer);
builder.drawMultiEnergyBar(matrixStack, this, 9, 19, (int) blockEntity.getEnergy(), (int) blockEntity.getMaxPower(), mouseX, mouseY, 0, layer);
}

View file

@ -24,6 +24,7 @@
package techreborn.client.gui;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.player.PlayerEntity;
import reborncore.client.screen.builder.BuiltScreenHandler;
import reborncore.client.gui.builder.GuiBase;
@ -40,27 +41,27 @@ public class GuiIndustrialElectrolyzer extends GuiBase<BuiltScreenHandler> {
}
@Override
protected void drawBackground(final float f, final int mouseX, final int mouseY) {
super.drawBackground(f, mouseX, mouseY);
protected void drawBackground(MatrixStack matrixStack, final float f, final int mouseX, final int mouseY) {
super.drawBackground(matrixStack, f, mouseX, mouseY);
final GuiBase.Layer layer = GuiBase.Layer.BACKGROUND;
//Battery slot
drawSlot(8, 72, layer);
drawSlot(matrixStack, 8, 72, layer);
//Input slots
drawSlot(47, 72, layer);
drawSlot(81, 72, layer);
drawSlot(matrixStack, 47, 72, layer);
drawSlot(matrixStack, 81, 72, layer);
//Output slots
drawOutputSlotBar(50, 23, 4, layer);
builder.drawJEIButton(this, 158, 5, layer);
drawOutputSlotBar(matrixStack, 50, 23, 4, layer);
builder.drawJEIButton(matrixStack, this, 158, 5, layer);
}
@Override
protected void drawForeground(final int mouseX, final int mouseY) {
super.drawForeground(mouseX, mouseY);
protected void drawForeground(MatrixStack matrixStack, final int mouseX, final int mouseY) {
super.drawForeground(matrixStack, mouseX, mouseY);
final GuiBase.Layer layer = GuiBase.Layer.FOREGROUND;
builder.drawProgressBar(this, blockEntity.getProgressScaled(100), 100, 84, 52, mouseX, mouseY, GuiBuilder.ProgressDirection.UP, layer);
builder.drawMultiEnergyBar(this, 9, 19, (int) blockEntity.getEnergy(), (int) blockEntity.getMaxPower(), mouseX, mouseY, 0, layer);
builder.drawProgressBar(matrixStack, this, blockEntity.getProgressScaled(100), 100, 84, 52, mouseX, mouseY, GuiBuilder.ProgressDirection.UP, layer);
builder.drawMultiEnergyBar(matrixStack, this, 9, 19, (int) blockEntity.getEnergy(), (int) blockEntity.getMaxPower(), mouseX, mouseY, 0, layer);
}

View file

@ -26,6 +26,7 @@ package techreborn.client.gui;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
@ -47,45 +48,45 @@ public class GuiIndustrialGrinder extends GuiBase<BuiltScreenHandler> {
}
@Override
protected void drawBackground(final float f, final int mouseX, final int mouseY) {
super.drawBackground(f, mouseX, mouseY);
protected void drawBackground(MatrixStack matrixStack, final float f, final int mouseX, final int mouseY) {
super.drawBackground(matrixStack, f, mouseX, mouseY);
final Layer layer = Layer.BACKGROUND;
// Battery slot
drawSlot(8, 72, layer);
drawSlot(matrixStack, 8, 72, layer);
// Liquid input slot
drawSlot(34, 35, layer);
drawSlot(matrixStack, 34, 35, layer);
// Liquid output slot
drawSlot(34, 55, layer);
drawSlot(matrixStack, 34, 55, layer);
// Solid material input slot
drawSlot(84, 43, layer);
drawSlot(matrixStack, 84, 43, layer);
// Output slots
drawSlot(126, 18, layer);
drawSlot(126, 36, layer);
drawSlot(126, 54, layer);
drawSlot(126, 72, layer);
drawSlot(matrixStack, 126, 18, layer);
drawSlot(matrixStack, 126, 36, layer);
drawSlot(matrixStack, 126, 54, layer);
drawSlot(matrixStack, 126, 72, layer);
builder.drawJEIButton(this, 158, 5, layer);
builder.drawJEIButton(matrixStack, this, 158, 5, layer);
if (blockEntity.getMultiBlock()) {
builder.drawHologramButton(this, 6, 4, mouseX, mouseY, layer);
builder.drawHologramButton(matrixStack, this, 6, 4, mouseX, mouseY, layer);
}
}
@Override
protected void drawForeground(final int mouseX, final int mouseY) {
super.drawForeground(mouseX, mouseY);
protected void drawForeground(MatrixStack matrixStack, final int mouseX, final int mouseY) {
super.drawForeground(matrixStack, mouseX, mouseY);
final Layer layer = Layer.FOREGROUND;
builder.drawProgressBar(this, blockEntity.getProgressScaled(100), 100, 105, 47, mouseX, mouseY, GuiBuilder.ProgressDirection.RIGHT, layer);
builder.drawTank(this, 53, 25, mouseX, mouseY, blockEntity.tank.getFluidInstance(), blockEntity.tank.getCapacity(), blockEntity.tank.isEmpty(), layer);
builder.drawProgressBar(matrixStack, this, blockEntity.getProgressScaled(100), 100, 105, 47, mouseX, mouseY, GuiBuilder.ProgressDirection.RIGHT, layer);
builder.drawTank(matrixStack, this, 53, 25, mouseX, mouseY, blockEntity.tank.getFluidInstance(), blockEntity.tank.getCapacity(), blockEntity.tank.isEmpty(), layer);
if (blockEntity.getMultiBlock()) {
addHologramButton(6, 4, 212, layer).clickHandler(this::onClick);
} else {
builder.drawMultiblockMissingBar(this, layer);
builder.drawMultiblockMissingBar(matrixStack, this, layer);
addHologramButton(76, 56, 212, layer).clickHandler(this::onClick);
builder.drawHologramButton(this, 76, 56, mouseX, mouseY, layer);
builder.drawHologramButton(matrixStack, this, 76, 56, mouseX, mouseY, layer);
}
builder.drawMultiEnergyBar(this, 9, 19, (int) blockEntity.getEnergy(), (int) blockEntity.getMaxPower(), mouseX, mouseY, 0, layer);
builder.drawMultiEnergyBar(matrixStack, this, 9, 19, (int) blockEntity.getEnergy(), (int) blockEntity.getMaxPower(), mouseX, mouseY, 0, layer);
}
public void onClick(GuiButtonExtended button, double mouseX, double mouseY){

View file

@ -26,6 +26,7 @@ package techreborn.client.gui;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
@ -53,44 +54,44 @@ public class GuiIndustrialSawmill extends GuiBase<BuiltScreenHandler> {
}
@Override
protected void drawBackground(final float partialTicks, final int mouseX, final int mouseY) {
super.drawBackground(partialTicks, mouseX, mouseY);
protected void drawBackground(MatrixStack matrixStack, final float partialTicks, final int mouseX, final int mouseY) {
super.drawBackground(matrixStack, partialTicks, mouseX, mouseY);
final Layer layer = Layer.BACKGROUND;
// Battery slot
drawSlot(8, 72, layer);
drawSlot(matrixStack, 8, 72, layer);
// Liquid input slot
drawSlot(34, 35, layer);
drawSlot(matrixStack, 34, 35, layer);
// Liquid output slot
drawSlot(34, 55, layer);
drawSlot(matrixStack, 34, 55, layer);
// Solid material input slot
drawSlot(84, 43, layer);
drawSlot(matrixStack, 84, 43, layer);
// Output slots
drawSlot(126, 25, layer);
drawSlot(126, 43, layer);
drawSlot(126, 61, layer);
drawSlot(matrixStack, 126, 25, layer);
drawSlot(matrixStack, 126, 43, layer);
drawSlot(matrixStack, 126, 61, layer);
builder.drawJEIButton(this, 158, 5, layer);
builder.drawJEIButton(matrixStack, this, 158, 5, layer);
if (blockEntity.getMutliBlock()) {
builder.drawHologramButton(this, 6, 4, mouseX, mouseY, layer);
builder.drawHologramButton(matrixStack, this, 6, 4, mouseX, mouseY, layer);
}
}
@Override
protected void drawForeground(final int mouseX, final int mouseY) {
super.drawForeground(mouseX, mouseY);
protected void drawForeground(MatrixStack matrixStack, final int mouseX, final int mouseY) {
super.drawForeground(matrixStack, mouseX, mouseY);
final Layer layer = Layer.FOREGROUND;
builder.drawProgressBar(this, blockEntity.getProgressScaled(100), 100, 105, 47, mouseX, mouseY, GuiBuilder.ProgressDirection.RIGHT, layer);
builder.drawTank(this, 53, 25, mouseX, mouseY, blockEntity.tank.getFluidInstance(), blockEntity.tank.getCapacity(), blockEntity.tank.isEmpty(), layer);
builder.drawProgressBar(matrixStack, this, blockEntity.getProgressScaled(100), 100, 105, 47, mouseX, mouseY, GuiBuilder.ProgressDirection.RIGHT, layer);
builder.drawTank(matrixStack, this, 53, 25, mouseX, mouseY, blockEntity.tank.getFluidInstance(), blockEntity.tank.getCapacity(), blockEntity.tank.isEmpty(), layer);
if (blockEntity.getMutliBlock()) {
addHologramButton(6, 4, 212, layer).clickHandler(this::onClick);
} else {
builder.drawMultiblockMissingBar(this, layer);
builder.drawMultiblockMissingBar(matrixStack, this, layer);
addHologramButton(76, 56, 212, layer).clickHandler(this::onClick);
builder.drawHologramButton(this, 76, 56, mouseX, mouseY, layer);
builder.drawHologramButton(matrixStack, this, 76, 56, mouseX, mouseY, layer);
}
builder.drawMultiEnergyBar(this, 9, 19, (int) blockEntity.getEnergy(), (int) blockEntity.getMaxPower(), mouseX, mouseY, 0, layer);
builder.drawMultiEnergyBar(matrixStack, this, 9, 19, (int) blockEntity.getEnergy(), (int) blockEntity.getMaxPower(), mouseX, mouseY, 0, layer);
}
public void onClick(GuiButtonExtended button, Double mouseX, Double mouseY){

View file

@ -30,9 +30,12 @@ import java.util.List;
import com.mojang.blaze3d.platform.GlStateManager;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.text.LiteralText;
import net.minecraft.text.Text;
import reborncore.client.screen.builder.BuiltScreenHandler;
import reborncore.client.gui.builder.GuiBase;
import reborncore.client.gui.builder.widget.GuiButtonSimple;
@ -58,10 +61,10 @@ public class GuiIronFurnace extends GuiBase<BuiltScreenHandler> {
@Override
public void init() {
super.init();
addButton(new GuiButtonSimple(getGuiLeft() + 116, getGuiTop() + 57, 18, 18, "", b -> onClick()) {
addButton(new GuiButtonSimple(getGuiLeft() + 116, getGuiTop() + 57, 18, 18, LiteralText.EMPTY, b -> onClick()) {
@Override
public void renderToolTip(int mouseX, int mouseY) {
public void renderToolTip(MatrixStack matrixStack, int mouseX, int mouseY) {
PlayerEntity player = playerInventory.player;
if (player == null) {
return;
@ -89,40 +92,40 @@ public class GuiIronFurnace extends GuiBase<BuiltScreenHandler> {
}
}
List<String> list = new ArrayList<>();
list.add(message);
renderTooltip(list, mouseX, mouseY);
List<Text> list = new ArrayList<>();
list.add(new LiteralText(message));
renderTooltip(matrixStack, list, mouseX, mouseY);
GlStateManager.disableLighting();
GlStateManager.color4f(1, 1, 1, 1);
}
@Override
public void renderBg(MinecraftClient mc, int mouseX, int mouseY) {
public void renderBg(MatrixStack matrixStack, MinecraftClient mc, int mouseX, int mouseY) {
mc.getItemRenderer().renderGuiItem(new ItemStack(Items.EXPERIENCE_BOTTLE), x, y);
}
});
}
@Override
protected void drawBackground(float lastFrameDuration, int mouseX, int mouseY) {
super.drawBackground(lastFrameDuration, mouseX, mouseY);
protected void drawBackground(MatrixStack matrixStack, float lastFrameDuration, int mouseX, int mouseY) {
super.drawBackground(matrixStack, lastFrameDuration, mouseX, mouseY);
final GuiBase.Layer layer = GuiBase.Layer.BACKGROUND;
// Input slot
drawSlot(56, 17, layer);
drawSlot(matrixStack, 56, 17, layer);
// Fuel slot
drawSlot(56, 53, layer);
drawSlot(matrixStack, 56, 53, layer);
drawOutputSlot(116, 35, layer);
drawOutputSlot(matrixStack, 116, 35, layer);
}
@Override
protected void drawForeground(int mouseX, int mouseY) {
super.drawForeground(mouseX, mouseY);
protected void drawForeground(MatrixStack matrixStack, int mouseX, int mouseY) {
super.drawForeground(matrixStack, mouseX, mouseY);
final GuiBase.Layer layer = GuiBase.Layer.FOREGROUND;
builder.drawProgressBar(this, blockEntity.getProgressScaled(100), 100, 85, 36, mouseX, mouseY, GuiBuilder.ProgressDirection.RIGHT, layer);
builder.drawBurnBar(this, blockEntity.getBurnTimeRemainingScaled(100), 100, 56, 36, mouseX, mouseY, layer);
builder.drawProgressBar(matrixStack, this, blockEntity.getProgressScaled(100), 100, 85, 36, mouseX, mouseY, GuiBuilder.ProgressDirection.RIGHT, layer);
builder.drawBurnBar(matrixStack, this, blockEntity.getBurnTimeRemainingScaled(100), 100, 56, 36, mouseX, mouseY, layer);
}
}

View file

@ -25,7 +25,9 @@
package techreborn.client.gui;
import com.mojang.blaze3d.systems.RenderSystem;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.text.LiteralText;
import reborncore.client.screen.builder.BuiltScreenHandler;
import reborncore.client.gui.builder.GuiBase;
import reborncore.common.powerSystem.PowerSystem;
@ -41,27 +43,27 @@ public class GuiLESU extends GuiBase<BuiltScreenHandler> {
}
@Override
protected void drawBackground(final float f, final int mouseX, final int mouseY) {
super.drawBackground(f, mouseX, mouseY);
protected void drawBackground(MatrixStack matrixStack, final float f, final int mouseX, final int mouseY) {
super.drawBackground(matrixStack, f, mouseX, mouseY);
final Layer layer = Layer.BACKGROUND;
drawSlot(62, 45, layer);
drawSlot(98, 45, layer);
drawArmourSlots(8, 18, layer);
drawSlot(matrixStack, 62, 45, layer);
drawSlot(matrixStack, 98, 45, layer);
drawArmourSlots(matrixStack, 8, 18, layer);
}
@Override
protected void drawForeground(final int mouseX, final int mouseY) {
super.drawForeground(mouseX, mouseY);
protected void drawForeground(MatrixStack matrixStack, final int mouseX, final int mouseY) {
super.drawForeground(matrixStack, mouseX, mouseY);
final Layer layer = Layer.FOREGROUND;
RenderSystem.pushMatrix();
RenderSystem.scaled(0.6, 0.6, 1);
drawCentredString(PowerSystem.getLocaliszedPowerFormattedNoSuffix((int) blockEntity.getEnergy()) + "/"
drawCentredText(matrixStack, new LiteralText(PowerSystem.getLocaliszedPowerFormattedNoSuffix((int) blockEntity.getEnergy()) + "/"
+ PowerSystem.getLocaliszedPowerFormattedNoSuffix((int) blockEntity.getMaxPower()) + " "
+ PowerSystem.getDisplayPower().abbreviation, 35, 0, 58, layer);
+ PowerSystem.getDisplayPower().abbreviation), 35, 0, 58, layer);
RenderSystem.popMatrix();
builder.drawMultiEnergyBar(this, 81, 28, (int) blockEntity.getEnergy(), (int) blockEntity.getMaxPower(), mouseX, mouseY, 0, layer);
builder.drawMultiEnergyBar(matrixStack, this, 81, 28, (int) blockEntity.getEnergy(), (int) blockEntity.getMaxPower(), mouseX, mouseY, 0, layer);
}
}

View file

@ -25,7 +25,9 @@
package techreborn.client.gui;
import com.mojang.blaze3d.systems.RenderSystem;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.text.LiteralText;
import reborncore.client.screen.builder.BuiltScreenHandler;
import reborncore.client.gui.builder.GuiBase;
import reborncore.common.powerSystem.PowerSystem;
@ -41,27 +43,34 @@ public class GuiMFE extends GuiBase<BuiltScreenHandler> {
}
@Override
protected void drawBackground(final float f, final int mouseX, final int mouseY) {
super.drawBackground(f, mouseX, mouseY);
protected void drawBackground(MatrixStack matrixStack, final float f, final int mouseX, final int mouseY) {
super.drawBackground(matrixStack, f, mouseX, mouseY);
final Layer layer = Layer.BACKGROUND;
drawSlot(62, 45, layer);
drawSlot(98, 45, layer);
drawArmourSlots(8, 18, layer);
drawSlot(matrixStack, 62, 45, layer);
drawSlot(matrixStack, 98, 45, layer);
drawArmourSlots(matrixStack, 8, 18, layer);
}
@Override
protected void drawForeground(final int mouseX, final int mouseY) {
super.drawForeground(mouseX, mouseY);
protected void drawForeground(MatrixStack matrixStack, final int mouseX, final int mouseY) {
super.drawForeground(matrixStack, mouseX, mouseY);
final Layer layer = Layer.FOREGROUND;
if(!hideGuiElements()){
RenderSystem.pushMatrix();
RenderSystem.scaled(0.6, 0.6, 1);
drawCentredString(PowerSystem.getLocaliszedPowerFormattedNoSuffix((int) mfe.getEnergy()) + "/" + PowerSystem.getLocaliszedPowerFormattedNoSuffix((int) mfe.getMaxPower()) + " " + PowerSystem.getDisplayPower().abbreviation, 35, 0, 58, layer);
drawCentredText(matrixStack, new LiteralText(PowerSystem.getLocaliszedPowerFormattedNoSuffix((int) mfe.getEnergy()))
.append("/")
.append(PowerSystem.getLocaliszedPowerFormattedNoSuffix((int) mfe.getMaxPower()))
.append(" ")
.append(PowerSystem.getDisplayPower().abbreviation)
, 35, 0, 58, layer);
RenderSystem.popMatrix();
}
builder.drawMultiEnergyBar(this, 81, 28, (int) mfe.getEnergy(), (int) mfe.getMaxPower(), mouseX, mouseY, 0, layer);
builder.drawMultiEnergyBar(matrixStack, this, 81, 28, (int) mfe.getEnergy(), (int) mfe.getMaxPower(), mouseX, mouseY, 0, layer);
}
}

View file

@ -25,7 +25,9 @@
package techreborn.client.gui;
import com.mojang.blaze3d.systems.RenderSystem;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.text.LiteralText;
import reborncore.client.screen.builder.BuiltScreenHandler;
import reborncore.client.gui.builder.GuiBase;
import reborncore.common.powerSystem.PowerSystem;
@ -41,25 +43,25 @@ public class GuiMFSU extends GuiBase<BuiltScreenHandler> {
}
@Override
protected void drawBackground(final float f, final int mouseX, final int mouseY) {
super.drawBackground(f, mouseX, mouseY);
protected void drawBackground(MatrixStack matrixStack, final float f, final int mouseX, final int mouseY) {
super.drawBackground(matrixStack, f, mouseX, mouseY);
final Layer layer = Layer.BACKGROUND;
drawSlot(62, 45, layer);
drawSlot(98, 45, layer);
drawArmourSlots(8, 18, layer);
drawSlot(matrixStack, 62, 45, layer);
drawSlot(matrixStack, 98, 45, layer);
drawArmourSlots(matrixStack, 8, 18, layer);
}
@Override
protected void drawForeground(final int mouseX, final int mouseY) {
super.drawForeground(mouseX, mouseY);
protected void drawForeground(MatrixStack matrixStack, final int mouseX, final int mouseY) {
super.drawForeground(matrixStack, mouseX, mouseY);
final Layer layer = Layer.FOREGROUND;
RenderSystem.pushMatrix();
RenderSystem.scaled(0.6, 0.6, 1);
drawCentredString(PowerSystem.getLocaliszedPowerFormattedNoSuffix((int) mfsu.getEnergy()) + "/" + PowerSystem.getLocaliszedPowerFormattedNoSuffix((int) mfsu.getMaxPower()) + " " + PowerSystem.getDisplayPower().abbreviation, 35, 0, 58, layer);
drawCentredText(matrixStack, new LiteralText(PowerSystem.getLocaliszedPowerFormattedNoSuffix((int) mfsu.getEnergy()) + "/" + PowerSystem.getLocaliszedPowerFormattedNoSuffix((int) mfsu.getMaxPower()) + " " + PowerSystem.getDisplayPower().abbreviation), 35, 0, 58, layer);
RenderSystem.popMatrix();
builder.drawMultiEnergyBar(this, 81, 28, (int) mfsu.getEnergy(), (int) mfsu.getMaxPower(), mouseX, mouseY, 0, layer);
builder.drawMultiEnergyBar(matrixStack, this, 81, 28, (int) mfsu.getEnergy(), (int) mfsu.getMaxPower(), mouseX, mouseY, 0, layer);
}
}

View file

@ -26,6 +26,9 @@ package techreborn.client.gui;
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.Text;
import net.minecraft.text.TranslatableText;
import reborncore.common.util.StringUtils;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.text.LiteralText;
@ -45,9 +48,9 @@ public class GuiManual extends Screen {
private static final Identifier texture = new Identifier("techreborn", "textures/gui/manual.png");
int guiWidth = 207;
int guiHeight = 195;
private static final String text1 = StringUtils.t("techreborn.manual.wiki");
private static final String text2 = StringUtils.t("techreborn.manual.discord");
private static final String text3 = StringUtils.t("techreborn.manual.refund");
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");
public GuiManual(PlayerEntity player) {
super(new LiteralText("gui.manual"));
@ -58,7 +61,7 @@ public class GuiManual extends Screen {
public void init() {
int y = (height / 2) - guiHeight / 2;
y+= 40;
addButton(new GuiButtonExtended((width / 2 - 30), y + 10, 60, 20, StringUtils.t("techreborn.manual.wikibtn"), var1 -> client.openScreen(new ConfirmChatLinkScreen(t -> {
addButton(new GuiButtonExtended((width / 2 - 30), y + 10, 60, 20, new TranslatableText("techreborn.manual.wikibtn"), var1 -> client.openScreen(new ConfirmChatLinkScreen(t -> {
if(t){
Util.getOperatingSystem().open("http://wiki.techreborn.ovh");
this.client.openScreen(this);
@ -66,7 +69,7 @@ public class GuiManual extends Screen {
this.client.openScreen(this);
}
}, "http://wiki.techreborn.ovh", false))));
addButton(new GuiButtonExtended((width / 2 - 30), y + 60, 60, 20, StringUtils.t("techreborn.manual.discordbtn"), var1 -> client.openScreen(new ConfirmChatLinkScreen(t -> {
addButton(new GuiButtonExtended((width / 2 - 30), y + 60, 60, 20, new TranslatableText("techreborn.manual.discordbtn"), var1 -> client.openScreen(new ConfirmChatLinkScreen(t -> {
if(t){
Util.getOperatingSystem().open("https://discord.gg/teamreborn");
this.client.openScreen(this);
@ -75,7 +78,7 @@ public class GuiManual extends Screen {
}
}, "https://discord.gg/teamreborn", false))));
if(TechRebornConfig.allowManualRefund){
addButton(new GuiButtonExtended((width / 2 - 30), y + 110, 60, 20, StringUtils.t("techreborn.manual.refundbtn"), var1 -> {
addButton(new GuiButtonExtended((width / 2 - 30), y + 110, 60, 20, new TranslatableText("techreborn.manual.refundbtn"), var1 -> {
NetworkManager.sendToServer(ServerboundPackets.createRefundPacket());
this.client.openScreen(null);
}));
@ -83,18 +86,18 @@ public class GuiManual extends Screen {
}
@Override
public void render(int mouseX, int mouseY, float partialTicks) {
renderBackground();
public void render(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) {
renderBackground(matrixStack);
client.getTextureManager().bindTexture(GuiManual.texture);
int centerX = (width / 2) - guiWidth / 2;
int centerY = (height / 2) - guiHeight / 2;
drawTexture(centerX, centerY, 0, 0, guiWidth, guiHeight);
textRenderer.draw(text1, ((width / 2) - textRenderer.getStringWidth(text1) / 2), centerY + 40, 4210752);
textRenderer.draw(text2, ((width / 2) - textRenderer.getStringWidth(text2) / 2), centerY + 90, 4210752);
drawTexture(matrixStack, centerX, centerY, 0, 0, guiWidth, guiHeight);
textRenderer.draw(matrixStack, text1, ((width / 2) - textRenderer.getWidth(text1) / 2), centerY + 40, 4210752);
textRenderer.draw(matrixStack, text2, ((width / 2) - textRenderer.getWidth(text2) / 2), centerY + 90, 4210752);
if (TechRebornConfig.allowManualRefund) {
textRenderer.draw(text3, ((width / 2) - textRenderer.getStringWidth(text3) / 2), centerY + 140, 4210752);
textRenderer.draw(matrixStack, text3, ((width / 2) - textRenderer.getWidth(text3) / 2), centerY + 140, 4210752);
}
super.render(mouseX, mouseY, partialTicks);
super.render(matrixStack, mouseX, mouseY, partialTicks);
}
}

View file

@ -24,6 +24,7 @@
package techreborn.client.gui;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.player.PlayerEntity;
import reborncore.client.screen.builder.BuiltScreenHandler;
import reborncore.client.gui.builder.GuiBase;
@ -40,28 +41,28 @@ public class GuiMatterFabricator extends GuiBase<BuiltScreenHandler> {
}
@Override
protected void drawBackground(final float f, final int mouseX, final int mouseY) {
super.drawBackground(f, mouseX, mouseY);
protected void drawBackground(MatrixStack matrixStack, final float f, final int mouseX, final int mouseY) {
super.drawBackground(matrixStack, f, mouseX, mouseY);
final Layer layer = Layer.BACKGROUND;
drawSlot(8, 72, layer);
drawSlot(matrixStack, 8, 72, layer);
drawSlot(30, 20, layer);
drawSlot(50, 20, layer);
drawSlot(70, 20, layer);
drawSlot(90, 20, layer);
drawSlot(110, 20, layer);
drawSlot(130, 20, layer);
drawOutputSlotBar(39, 65, 5, layer);
drawSlot(matrixStack, 30, 20, layer);
drawSlot(matrixStack, 50, 20, layer);
drawSlot(matrixStack, 70, 20, layer);
drawSlot(matrixStack, 90, 20, layer);
drawSlot(matrixStack, 110, 20, layer);
drawSlot(matrixStack, 130, 20, layer);
drawOutputSlotBar(matrixStack, 39, 65, 5, layer);
}
@Override
protected void drawForeground(final int mouseX, final int mouseY) {
super.drawForeground(mouseX, mouseY);
protected void drawForeground(MatrixStack matrixStack, final int mouseX, final int mouseY) {
super.drawForeground(matrixStack, mouseX, mouseY);
final Layer layer = Layer.FOREGROUND;
builder.drawProgressBar(this, blockEntity.getProgressScaled(100), 100, 83, 41, mouseX, mouseY, GuiBuilder.ProgressDirection.DOWN, layer);
builder.drawMultiEnergyBar(this, 9, 19, (int) blockEntity.getEnergy(), (int) blockEntity.getMaxPower(), mouseX, mouseY, 0, layer);
builder.drawProgressBar(matrixStack, this, blockEntity.getProgressScaled(100), 100, 83, 41, mouseX, mouseY, GuiBuilder.ProgressDirection.DOWN, layer);
builder.drawMultiEnergyBar(matrixStack, this, 9, 19, (int) blockEntity.getEnergy(), (int) blockEntity.getMaxPower(), mouseX, mouseY, 0, layer);
}
}

View file

@ -26,6 +26,7 @@ package techreborn.client.gui;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.player.PlayerEntity;
import reborncore.client.screen.builder.BuiltScreenHandler;
import reborncore.client.gui.builder.GuiBase;
@ -52,23 +53,23 @@ public class GuiPlasmaGenerator extends GuiBase<BuiltScreenHandler> {
}
@Override
protected void drawBackground(final float f, final int mouseX, final int mouseY) {
super.drawBackground(f, mouseX, mouseY);
protected void drawBackground(MatrixStack matrixStack, final float f, final int mouseX, final int mouseY) {
super.drawBackground(matrixStack, f, mouseX, mouseY);
final GuiBase.Layer layer = GuiBase.Layer.BACKGROUND;
drawSlot(25, 35, layer);
drawSlot(25, 55, layer);
builder.drawJEIButton(this, 158, 5, layer);
drawSlot(matrixStack, 25, 35, layer);
drawSlot(matrixStack, 25, 55, layer);
builder.drawJEIButton(matrixStack, this, 158, 5, layer);
}
@Override
protected void drawForeground(final int mouseX, final int mouseY) {
super.drawForeground(mouseX, mouseY);
protected void drawForeground(MatrixStack matrixStack, final int mouseX, final int mouseY) {
super.drawForeground(matrixStack, mouseX, mouseY);
final GuiBase.Layer layer = GuiBase.Layer.FOREGROUND;
builder.drawProgressBar(this, blockEntity.getProgressScaled(10), 100, 83, 48, mouseX, mouseY, GuiBuilder.ProgressDirection.RIGHT, layer);
builder.drawMultiEnergyBar(this, 130, 28, (int) blockEntity.getEnergy(), (int) blockEntity.getMaxPower(), mouseX, mouseY, 0, layer);
builder.drawTank(this, 44, 25, mouseX, mouseY, blockEntity.tank.getFluidInstance(), blockEntity.tank.getCapacity(), blockEntity.tank.isEmpty(), layer);
builder.drawProgressBar(matrixStack, this, blockEntity.getProgressScaled(10), 100, 83, 48, mouseX, mouseY, GuiBuilder.ProgressDirection.RIGHT, layer);
builder.drawMultiEnergyBar(matrixStack, this, 130, 28, (int) blockEntity.getEnergy(), (int) blockEntity.getMaxPower(), mouseX, mouseY, 0, layer);
builder.drawTank(matrixStack, this, 44, 25, mouseX, mouseY, blockEntity.tank.getFluidInstance(), blockEntity.tank.getCapacity(), blockEntity.tank.isEmpty(), layer);
}

View file

@ -24,6 +24,7 @@
package techreborn.client.gui;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.player.PlayerEntity;
import reborncore.client.screen.builder.BuiltScreenHandler;
import reborncore.client.gui.builder.GuiBase;
@ -40,22 +41,22 @@ public class GuiRecycler extends GuiBase<BuiltScreenHandler> {
}
@Override
protected void drawBackground(final float f, final int mouseX, final int mouseY) {
super.drawBackground(f, mouseX, mouseY);
protected void drawBackground(MatrixStack matrixStack, final float f, final int mouseX, final int mouseY) {
super.drawBackground(matrixStack, f, mouseX, mouseY);
final GuiBase.Layer layer = GuiBase.Layer.BACKGROUND;
drawSlot(8, 72, layer);
drawSlot(matrixStack, 8, 72, layer);
drawSlot(55, 45, layer);
drawOutputSlot(101, 45, layer);
drawSlot(matrixStack, 55, 45, layer);
drawOutputSlot(matrixStack, 101, 45, layer);
}
@Override
protected void drawForeground(final int mouseX, final int mouseY) {
super.drawForeground(mouseX, mouseY);
protected void drawForeground(MatrixStack matrixStack, final int mouseX, final int mouseY) {
super.drawForeground(matrixStack, mouseX, mouseY);
final GuiBase.Layer layer = GuiBase.Layer.FOREGROUND;
builder.drawProgressBar(this, blockEntity.gaugeProgressScaled(100), 100, 76, 48, mouseX, mouseY, GuiBuilder.ProgressDirection.RIGHT, layer);
builder.drawMultiEnergyBar(this, 9, 19, (int) blockEntity.getEnergy(), (int) blockEntity.getMaxPower(), mouseX, mouseY, 0, layer);
builder.drawProgressBar(matrixStack, this, blockEntity.gaugeProgressScaled(100), 100, 76, 48, mouseX, mouseY, GuiBuilder.ProgressDirection.RIGHT, layer);
builder.drawMultiEnergyBar(matrixStack, this, 9, 19, (int) blockEntity.getEnergy(), (int) blockEntity.getMaxPower(), mouseX, mouseY, 0, layer);
}
}

View file

@ -24,6 +24,7 @@
package techreborn.client.gui;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.player.PlayerEntity;
import reborncore.client.screen.builder.BuiltScreenHandler;
import reborncore.client.gui.builder.GuiBase;
@ -42,35 +43,35 @@ public class GuiRollingMachine extends GuiBase<BuiltScreenHandler> {
}
@Override
protected void drawBackground(final float f, final int mouseX, final int mouseY) {
super.drawBackground(f, mouseX, mouseY);
protected void drawBackground(MatrixStack matrixStack, final float f, final int mouseX, final int mouseY) {
super.drawBackground(matrixStack, f, mouseX, mouseY);
final GuiBase.Layer layer = GuiBase.Layer.BACKGROUND;
int gridYPos = 22;
drawSlot(30, gridYPos, layer);
drawSlot(48, gridYPos, layer);
drawSlot(66, gridYPos, layer);
drawSlot(30, gridYPos + 18, layer);
drawSlot(48, gridYPos + 18, layer);
drawSlot(66, gridYPos + 18, layer);
drawSlot(30, gridYPos + 36, layer);
drawSlot(48, gridYPos + 36, layer);
drawSlot(66, gridYPos + 36, layer);
drawSlot(matrixStack, 30, gridYPos, layer);
drawSlot(matrixStack, 48, gridYPos, layer);
drawSlot(matrixStack, 66, gridYPos, layer);
drawSlot(matrixStack, 30, gridYPos + 18, layer);
drawSlot(matrixStack, 48, gridYPos + 18, layer);
drawSlot(matrixStack, 66, gridYPos + 18, layer);
drawSlot(matrixStack, 30, gridYPos + 36, layer);
drawSlot(matrixStack, 48, gridYPos + 36, layer);
drawSlot(matrixStack, 66, gridYPos + 36, layer);
drawSlot(8, 70, layer);
drawOutputSlot(124, gridYPos + 18, layer);
drawSlot(matrixStack, 8, 70, layer);
drawOutputSlot(matrixStack, 124, gridYPos + 18, layer);
builder.drawJEIButton(this, 158, 5, layer);
builder.drawLockButton(this, 130, 4, mouseX, mouseY, layer,rollingMachine.locked);
builder.drawJEIButton(matrixStack, this, 158, 5, layer);
builder.drawLockButton(matrixStack, this, 130, 4, mouseX, mouseY, layer,rollingMachine.locked);
}
@Override
protected void drawForeground(final int mouseX, final int mouseY) {
super.drawForeground(mouseX, mouseY);
protected void drawForeground(MatrixStack matrixStack, final int mouseX, final int mouseY) {
super.drawForeground(matrixStack, mouseX, mouseY);
final GuiBase.Layer layer = GuiBase.Layer.FOREGROUND;
builder.drawProgressBar(this, rollingMachine.getProgressScaled(100), 100, 92, 43, mouseX, mouseY, GuiBuilder.ProgressDirection.RIGHT, layer);
builder.drawMultiEnergyBar(this, 9, 17, (int) rollingMachine.getEnergy(), (int) rollingMachine.getMaxPower(), mouseX, mouseY, 0, layer);
builder.drawProgressBar(matrixStack, this, rollingMachine.getProgressScaled(100), 100, 92, 43, mouseX, mouseY, GuiBuilder.ProgressDirection.RIGHT, layer);
builder.drawMultiEnergyBar(matrixStack, this, 9, 17, (int) rollingMachine.getEnergy(), (int) rollingMachine.getMaxPower(), mouseX, mouseY, 0, layer);
}
@Override

View file

@ -24,6 +24,7 @@
package techreborn.client.gui;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.player.PlayerEntity;
import reborncore.client.screen.builder.BuiltScreenHandler;
import reborncore.client.gui.builder.GuiBase;
@ -40,26 +41,26 @@ public class GuiScrapboxinator extends GuiBase<BuiltScreenHandler> {
}
@Override
protected void drawBackground(float partialTicks, int mouseX, int mouseY) {
super.drawBackground(partialTicks, mouseX, mouseY);
protected void drawBackground(MatrixStack matrixStack, float partialTicks, int mouseX, int mouseY) {
super.drawBackground(matrixStack, partialTicks, mouseX, mouseY);
final GuiBase.Layer layer = GuiBase.Layer.BACKGROUND;
// Battery slot
drawSlot(8, 72, layer);
drawSlot(matrixStack, 8, 72, layer);
// Scrapboxes input slot
drawSlot(55, 45, layer);
drawSlot(matrixStack, 55, 45, layer);
// Output slot
drawOutputSlot(101, 45, layer);
drawOutputSlot(matrixStack, 101, 45, layer);
builder.drawJEIButton(this, 158, 5, layer);
builder.drawJEIButton(matrixStack, this, 158, 5, layer);
}
@Override
protected void drawForeground(final int mouseX, final int mouseY) {
super.drawForeground(mouseX, mouseY);
protected void drawForeground(MatrixStack matrixStack, final int mouseX, final int mouseY) {
super.drawForeground(matrixStack, mouseX, mouseY);
final GuiBase.Layer layer = GuiBase.Layer.FOREGROUND;
builder.drawProgressBar(this, blockEntity.getProgressScaled(100), 100, 76, 48, mouseX, mouseY, GuiBuilder.ProgressDirection.RIGHT, layer);
builder.drawMultiEnergyBar(this, 9, 19, (int) blockEntity.getEnergy(), (int) blockEntity.getMaxPower(), mouseX, mouseY, 0, layer);
builder.drawProgressBar(matrixStack, this, blockEntity.getProgressScaled(100), 100, 76, 48, mouseX, mouseY, GuiBuilder.ProgressDirection.RIGHT, layer);
builder.drawMultiEnergyBar(matrixStack, this, 9, 19, (int) blockEntity.getEnergy(), (int) blockEntity.getMaxPower(), mouseX, mouseY, 0, layer);
}
}

View file

@ -24,6 +24,7 @@
package techreborn.client.gui;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.player.PlayerEntity;
import reborncore.client.screen.builder.BuiltScreenHandler;
import reborncore.client.gui.builder.GuiBase;
@ -40,23 +41,23 @@ public class GuiSemifluidGenerator extends GuiBase<BuiltScreenHandler> {
}
@Override
protected void drawBackground(final float f, final int mouseX, final int mouseY) {
super.drawBackground(f, mouseX, mouseY);
protected void drawBackground(MatrixStack matrixStack, final float f, final int mouseX, final int mouseY) {
super.drawBackground(matrixStack, f, mouseX, mouseY);
final GuiBase.Layer layer = GuiBase.Layer.BACKGROUND;
drawSlot(25, 35, layer);
drawSlot(25, 55, layer);
builder.drawJEIButton(this, 158, 5, layer);
drawSlot(matrixStack, 25, 35, layer);
drawSlot(matrixStack, 25, 55, layer);
builder.drawJEIButton(matrixStack, this, 158, 5, layer);
}
@Override
protected void drawForeground(final int mouseX, final int mouseY) {
super.drawForeground(mouseX, mouseY);
protected void drawForeground(MatrixStack matrixStack, final int mouseX, final int mouseY) {
super.drawForeground(matrixStack, mouseX, mouseY);
final GuiBase.Layer layer = GuiBase.Layer.FOREGROUND;
builder.drawProgressBar(this, blockEntity.getProgressScaled(10), 100, 83, 48, mouseX, mouseY, GuiBuilder.ProgressDirection.RIGHT, layer);
builder.drawMultiEnergyBar(this, 130, 28, (int) blockEntity.getEnergy(), (int) blockEntity.getMaxPower(), mouseX, mouseY, 0, layer);
builder.drawTank(this, 44, 25, mouseX, mouseY, blockEntity.tank.getFluidInstance(), blockEntity.tank.getCapacity(), blockEntity.tank.isEmpty(), layer);
builder.drawProgressBar(matrixStack, this, blockEntity.getProgressScaled(10), 100, 83, 48, mouseX, mouseY, GuiBuilder.ProgressDirection.RIGHT, layer);
builder.drawMultiEnergyBar(matrixStack, this, 130, 28, (int) blockEntity.getEnergy(), (int) blockEntity.getMaxPower(), mouseX, mouseY, 0, layer);
builder.drawTank(matrixStack, this, 44, 25, mouseX, mouseY, blockEntity.tank.getFluidInstance(), blockEntity.tank.getCapacity(), blockEntity.tank.isEmpty(), layer);
}
}

View file

@ -24,7 +24,10 @@
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 reborncore.client.screen.builder.BuiltScreenHandler;
import reborncore.client.gui.builder.GuiBase;
import reborncore.common.util.StringUtils;
@ -40,31 +43,31 @@ public class GuiSolar extends GuiBase<BuiltScreenHandler> {
}
@Override
protected void drawBackground(float lastFrameDuration, int mouseX, int mouseY) {
super.drawBackground(lastFrameDuration, mouseX, mouseY);
protected void drawBackground(MatrixStack matrixStack, float lastFrameDuration, int mouseX, int mouseY) {
super.drawBackground(matrixStack, lastFrameDuration, mouseX, mouseY);
final GuiBase.Layer layer = GuiBase.Layer.BACKGROUND;
}
@Override
protected void drawForeground(int mouseX, int mouseY) {
super.drawForeground(mouseX, mouseY);
protected void drawForeground(MatrixStack matrixStack, int mouseX, int mouseY) {
super.drawForeground(matrixStack, mouseX, mouseY);
final GuiBase.Layer layer = GuiBase.Layer.FOREGROUND;
builder.drawMultiEnergyBar(this, 156, 19, (int) blockEntity.getEnergy(), (int) blockEntity.getMaxPower(), mouseX, mouseY, 0, layer);
builder.drawMultiEnergyBar(matrixStack, this, 156, 19, (int) blockEntity.getEnergy(), (int) blockEntity.getMaxPower(), mouseX, mouseY, 0, layer);
switch (blockEntity.getSunState()) {
case SolarPanelBlockEntity.DAYGEN:
builder.drawString(this, StringUtils.t("techreborn.message.daygen"), 10, 20, 15129632);
builder.drawText(matrixStack, this, new TranslatableText("techreborn.message.daygen"), 10, 20, 15129632);
break;
case SolarPanelBlockEntity.NIGHTGEN:
builder.drawString(this, StringUtils.t("techreborn.message.nightgen"), 10, 20, 7566195);
builder.drawText(matrixStack, this, new TranslatableText("techreborn.message.nightgen"), 10, 20, 7566195);
break;
case SolarPanelBlockEntity.ZEROGEN:
builder.drawString(this, StringUtils.t("techreborn.message.zerogen"), 10, 20, 12066591);
builder.drawText(matrixStack, this, new TranslatableText("techreborn.message.zerogen"), 10, 20, 12066591);
break;
}
builder.drawString(this, "Generating: " + blockEntity.getGenerationRate() + " E/t", 10, 30, 0);
builder.drawText(matrixStack, this, new LiteralText("Generating: " + blockEntity.getGenerationRate() + " E/t"), 10, 30, 0);
}
}

View file

@ -24,6 +24,7 @@
package techreborn.client.gui;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.player.PlayerEntity;
import reborncore.client.screen.builder.BuiltScreenHandler;
import reborncore.client.gui.builder.GuiBase;
@ -41,26 +42,26 @@ public class GuiSolidCanningMachine extends GuiBase<BuiltScreenHandler> {
}
@Override
protected void drawBackground(final float f, final int mouseX, final int mouseY) {
super.drawBackground(f, mouseX, mouseY);
protected void drawBackground(MatrixStack matrixStack, final float f, final int mouseX, final int mouseY) {
super.drawBackground(matrixStack, f, mouseX, mouseY);
final Layer layer = Layer.BACKGROUND;
drawSlot(8, 72, layer);
drawSlot(matrixStack, 8, 72, layer);
drawSlot(34, 47, layer);
drawSlot(126, 47, layer);
drawOutputSlot(80, 47, layer);
drawSlot(matrixStack, 34, 47, layer);
drawSlot(matrixStack, 126, 47, layer);
drawOutputSlot(matrixStack, 80, 47, layer);
builder.drawJEIButton(this, 158, 5, layer);
builder.drawJEIButton(matrixStack, this, 158, 5, layer);
}
@Override
protected void drawForeground(final int mouseX, final int mouseY) {
super.drawForeground(mouseX, mouseY);
protected void drawForeground(MatrixStack matrixStack, final int mouseX, final int mouseY) {
super.drawForeground(matrixStack, mouseX, mouseY);
final Layer layer = Layer.FOREGROUND;
builder.drawProgressBar(this, blockEntity.getProgressScaled(100), 100, 55, 51, mouseX, mouseY, GuiBuilder.ProgressDirection.RIGHT, layer);
builder.drawProgressBar(this, blockEntity.getProgressScaled(100), 100, 105, 51, mouseX, mouseY, GuiBuilder.ProgressDirection.LEFT, layer);
builder.drawMultiEnergyBar(this, 9, 19, (int) blockEntity.getEnergy(), (int) blockEntity.getMaxPower(), mouseX, mouseY, 0, layer);
builder.drawProgressBar(matrixStack, this, blockEntity.getProgressScaled(100), 100, 55, 51, mouseX, mouseY, GuiBuilder.ProgressDirection.RIGHT, layer);
builder.drawProgressBar(matrixStack, this, blockEntity.getProgressScaled(100), 100, 105, 51, mouseX, mouseY, GuiBuilder.ProgressDirection.LEFT, layer);
builder.drawMultiEnergyBar(matrixStack, this, 9, 19, (int) blockEntity.getEnergy(), (int) blockEntity.getMaxPower(), mouseX, mouseY, 0, layer);
}
}

View file

@ -24,7 +24,9 @@
package techreborn.client.gui;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.text.TranslatableText;
import reborncore.client.screen.builder.BuiltScreenHandler;
import reborncore.client.gui.builder.GuiBase;
import reborncore.common.util.StringUtils;
@ -40,36 +42,36 @@ public class GuiStorageUnit extends GuiBase<BuiltScreenHandler> {
}
@Override
protected void drawBackground(final float f, final int mouseX, final int mouseY) {
super.drawBackground(f, mouseX, mouseY);
protected void drawBackground(MatrixStack matrixStack, final float f, final int mouseX, final int mouseY) {
super.drawBackground(matrixStack, f, mouseX, mouseY);
final Layer layer = Layer.BACKGROUND;
drawString(StringUtils.t("gui.techreborn.unit.in"), 100, 43, 4210752, layer);
drawSlot(100, 53, layer);
client.textRenderer.draw(matrixStack, new TranslatableText("gui.techreborn.unit.in"), 100, 43, 4210752);
drawSlot(matrixStack, 100, 53, layer);
drawString(StringUtils.t("gui.techreborn.unit.out"), 140, 43, 4210752, layer);
drawSlot(140, 53, layer);
client.textRenderer.draw(matrixStack, new TranslatableText("gui.techreborn.unit.out"), 140, 43, 4210752);
drawSlot(matrixStack, 140, 53, layer);
}
@Override
protected void drawForeground(final int mouseX, final int mouseY) {
super.drawForeground(mouseX, mouseY);
protected void drawForeground(MatrixStack matrixStack, final int mouseX, final int mouseY) {
super.drawForeground(matrixStack, mouseX, mouseY);
if (storageEntity.isEmpty()) {
textRenderer.draw(StringUtils.t("techreborn.tooltip.unit.empty"), 10, 20, 4210752);
textRenderer.draw(matrixStack, new TranslatableText("techreborn.tooltip.unit.empty"), 10, 20, 4210752);
} else {
textRenderer.draw(StringUtils.t("gui.techreborn.storage.store"), 10, 20, 4210752);
textRenderer.draw(storageEntity.getStoredStack().getName().asString(), 10, 30, 4210752);
textRenderer.draw(matrixStack, new TranslatableText("gui.techreborn.storage.store"), 10, 20, 4210752);
textRenderer.draw(matrixStack, storageEntity.getStoredStack().getName().asString(), 10, 30, 4210752);
textRenderer.draw(StringUtils.t("gui.techreborn.storage.amount"), 10, 50, 4210752);
textRenderer.draw(String.valueOf(storageEntity.getCurrentCapacity()), 10, 60, 4210752);
textRenderer.draw(matrixStack, new TranslatableText("gui.techreborn.storage.amount"), 10, 50, 4210752);
textRenderer.draw(matrixStack, String.valueOf(storageEntity.getCurrentCapacity()), 10, 60, 4210752);
String percentFilled = String.valueOf((int) ((double) storageEntity.getCurrentCapacity() / (double) storageEntity.getMaxCapacity() * 100));
textRenderer.draw(StringUtils.t("gui.techreborn.unit.used") + percentFilled + "%", 10, 70, 4210752);
textRenderer.draw(matrixStack, new TranslatableText("gui.techreborn.unit.used") + percentFilled + "%", 10, 70, 4210752);
textRenderer.draw(StringUtils.t("gui.techreborn.unit.wrenchtip"), 10, 80, 16711680);
textRenderer.draw(matrixStack, new TranslatableText("gui.techreborn.unit.wrenchtip"), 10, 80, 16711680);
}
}
}

View file

@ -24,7 +24,9 @@
package techreborn.client.gui;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.text.TranslatableText;
import reborncore.client.screen.builder.BuiltScreenHandler;
import reborncore.client.gui.builder.GuiBase;
import reborncore.common.fluid.FluidUtil;
@ -42,44 +44,44 @@ public class GuiTankUnit extends GuiBase<BuiltScreenHandler> {
}
@Override
protected void drawBackground(final float f, final int mouseX, final int mouseY) {
super.drawBackground(f, mouseX, mouseY);
protected void drawBackground(MatrixStack matrixStack, final float f, final int mouseX, final int mouseY) {
super.drawBackground(matrixStack, f, mouseX, mouseY);
final GuiBase.Layer layer = GuiBase.Layer.BACKGROUND;
drawString(StringUtils.t("gui.techreborn.unit.in"), 100, 43, 4210752, layer);
drawSlot(100, 53, layer);
method_27534(matrixStack, client.textRenderer, new TranslatableText("gui.techreborn.unit.in"), 100, 43, 4210752);
drawSlot(matrixStack, 100, 53, layer);
drawString(StringUtils.t("gui.techreborn.unit.out"), 140, 43, 4210752, layer);
drawSlot(140, 53, layer);
method_27534(matrixStack, client.textRenderer, new TranslatableText("gui.techreborn.unit.out"), 140, 43, 4210752);
drawSlot(matrixStack, 140, 53, layer);
}
@Override
protected void drawForeground(final int mouseX, final int mouseY) {
super.drawForeground(mouseX, mouseY);
protected void drawForeground(MatrixStack matrixStack, final int mouseX, final int mouseY) {
super.drawForeground(matrixStack, mouseX, mouseY);
FluidInstance fluid = tankEntity.getTank().getFluidInstance();
if (fluid.isEmpty()) {
textRenderer.draw(StringUtils.t("techreborn.tooltip.unit.empty"), 10, 20, 4210752);
textRenderer.draw(matrixStack, new TranslatableText("techreborn.tooltip.unit.empty"), 10, 20, 4210752);
} else {
textRenderer.draw(StringUtils.t("gui.techreborn.tank.type"), 10, 20, 4210752);
textRenderer.draw(FluidUtil.getFluidName(fluid).replace("_", " "), 10, 30, 4210752);
textRenderer.draw(matrixStack, new TranslatableText("gui.techreborn.tank.type"), 10, 20, 4210752);
textRenderer.draw(matrixStack, FluidUtil.getFluidName(fluid).replace("_", " "), 10, 30, 4210752);
textRenderer.draw(StringUtils.t("gui.techreborn.tank.amount"), 10, 50, 4210752);
textRenderer.draw(fluid.getAmount().toString(), 10, 60, 4210752);
textRenderer.draw(matrixStack, new TranslatableText("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().getCapacity().getRawValue() * 100));
textRenderer.draw(StringUtils.t("gui.techreborn.unit.used") + percentFilled + "%", 10, 70, 4210752);
textRenderer.draw(matrixStack, new TranslatableText("gui.techreborn.unit.used") + percentFilled + "%", 10, 70, 4210752);
textRenderer.draw(StringUtils.t("gui.techreborn.unit.wrenchtip"), 10, 80, 16711680);
textRenderer.draw(matrixStack, new TranslatableText("gui.techreborn.unit.wrenchtip"), 10, 80, 16711680);
}
}
@Override
public void render(int mouseX, int mouseY, float partialTicks) {
super.render(mouseX, mouseY, partialTicks);
drawMouseoverTooltip(mouseX, mouseY);
public void render(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) {
super.render(matrixStack, mouseX, mouseY, partialTicks);
drawMouseoverTooltip(matrixStack, mouseX, mouseY);
}
}

View file

@ -24,6 +24,7 @@
package techreborn.client.gui;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.player.PlayerEntity;
import reborncore.client.screen.builder.BuiltScreenHandler;
import reborncore.client.gui.builder.GuiBase;
@ -40,23 +41,23 @@ public class GuiThermalGenerator extends GuiBase<BuiltScreenHandler> {
}
@Override
protected void drawBackground(final float f, final int mouseX, final int mouseY) {
super.drawBackground(f, mouseX, mouseY);
protected void drawBackground(MatrixStack matrixStack, final float f, final int mouseX, final int mouseY) {
super.drawBackground(matrixStack, f, mouseX, mouseY);
final GuiBase.Layer layer = GuiBase.Layer.BACKGROUND;
drawSlot(25, 35, layer);
drawSlot(25, 55, layer);
builder.drawJEIButton(this, 158, 5, layer);
drawSlot(matrixStack, 25, 35, layer);
drawSlot(matrixStack, 25, 55, layer);
builder.drawJEIButton(matrixStack, this, 158, 5, layer);
}
@Override
protected void drawForeground(final int mouseX, final int mouseY) {
super.drawForeground(mouseX, mouseY);
protected void drawForeground(MatrixStack matrixStack, final int mouseX, final int mouseY) {
super.drawForeground(matrixStack, mouseX, mouseY);
final GuiBase.Layer layer = GuiBase.Layer.FOREGROUND;
builder.drawProgressBar(this, blockEntity.getProgressScaled(10), 100, 83, 48, mouseX, mouseY, GuiBuilder.ProgressDirection.RIGHT, layer);
builder.drawMultiEnergyBar(this, 130, 28, (int) blockEntity.getEnergy(), (int) blockEntity.getMaxPower(), mouseX, mouseY, 0, layer);
builder.drawTank(this, 44, 25, mouseX, mouseY, blockEntity.tank.getFluidInstance(), blockEntity.tank.getCapacity(), blockEntity.tank.isEmpty(), layer);
builder.drawProgressBar(matrixStack, this, blockEntity.getProgressScaled(10), 100, 83, 48, mouseX, mouseY, GuiBuilder.ProgressDirection.RIGHT, layer);
builder.drawMultiEnergyBar(matrixStack, this, 130, 28, (int) blockEntity.getEnergy(), (int) blockEntity.getMaxPower(), mouseX, mouseY, 0, layer);
builder.drawTank(matrixStack, this, 44, 25, mouseX, mouseY, blockEntity.tank.getFluidInstance(), blockEntity.tank.getCapacity(), blockEntity.tank.isEmpty(), layer);
}
}

View file

@ -25,6 +25,7 @@
package techreborn.client.gui;
import net.minecraft.block.BlockState;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.util.math.BlockPos;
import reborncore.client.screen.builder.BuiltScreenHandler;
@ -45,38 +46,38 @@ public class GuiVacuumFreezer extends GuiBase<BuiltScreenHandler> {
}
@Override
protected void drawBackground(final float f, final int mouseX, final int mouseY) {
super.drawBackground(f, mouseX, mouseY);
protected void drawBackground(MatrixStack matrixStack, final float f, final int mouseX, final int mouseY) {
super.drawBackground(matrixStack, f, mouseX, mouseY);
final GuiBase.Layer layer = GuiBase.Layer.BACKGROUND;
// Battery slot
drawSlot(8, 72, layer);
drawSlot(matrixStack, 8, 72, layer);
// Input slots
drawSlot(8, 72, layer);
drawSlot(55, 45, layer);
drawSlot(matrixStack, 8, 72, layer);
drawSlot(matrixStack, 55, 45, layer);
// Output slot
drawOutputSlot(101, 45, layer);
drawOutputSlot(matrixStack, 101, 45, layer);
builder.drawJEIButton(this, 158, 5, layer);
builder.drawJEIButton(matrixStack, this, 158, 5, layer);
if (blockEntity.getMultiBlock()) {
builder.drawHologramButton(this, 6, 4, mouseX, mouseY, layer);
builder.drawHologramButton(matrixStack, this, 6, 4, mouseX, mouseY, layer);
}
}
@Override
protected void drawForeground(final int mouseX, final int mouseY) {
super.drawForeground(mouseX, mouseY);
protected void drawForeground(MatrixStack matrixStack, final int mouseX, final int mouseY) {
super.drawForeground(matrixStack, mouseX, mouseY);
final GuiBase.Layer layer = GuiBase.Layer.FOREGROUND;
builder.drawProgressBar(this, blockEntity.getProgressScaled(100), 100, 76, 48, mouseX, mouseY, GuiBuilder.ProgressDirection.RIGHT, layer);
builder.drawProgressBar(matrixStack, this, blockEntity.getProgressScaled(100), 100, 76, 48, mouseX, mouseY, GuiBuilder.ProgressDirection.RIGHT, layer);
if (blockEntity.getMultiBlock()) {
addHologramButton(6, 4, 212, layer).clickHandler(this::onClick);
} else {
builder.drawMultiblockMissingBar(this, layer);
builder.drawMultiblockMissingBar(matrixStack, this, layer);
addHologramButton(76, 56, 212, layer).clickHandler(this::onClick);
builder.drawHologramButton(this, 76, 56, mouseX, mouseY, layer);
builder.drawHologramButton(matrixStack, this, 76, 56, mouseX, mouseY, layer);
}
builder.drawMultiEnergyBar(this, 9, 19, (int) blockEntity.getEnergy(), (int) blockEntity.getMaxPower(), mouseX, mouseY, 0, layer);
builder.drawMultiEnergyBar(matrixStack, this, 9, 19, (int) blockEntity.getEnergy(), (int) blockEntity.getMaxPower(), mouseX, mouseY, 0, layer);
}
public void onClick(GuiButtonExtended button, Double mouseX, Double mouseY){

View file

@ -24,6 +24,7 @@
package techreborn.client.gui;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.player.PlayerEntity;
import reborncore.client.screen.builder.BuiltScreenHandler;
import reborncore.client.gui.builder.GuiBase;
@ -40,28 +41,28 @@ public class GuiWireMill extends GuiBase<BuiltScreenHandler> {
}
@Override
protected void drawBackground(final float partialTicks, final int mouseX, final int mouseY) {
super.drawBackground(partialTicks, mouseX, mouseY);
protected void drawBackground(MatrixStack matrixStack, final float partialTicks, final int mouseX, final int mouseY) {
super.drawBackground(matrixStack, partialTicks, mouseX, mouseY);
final Layer layer = Layer.BACKGROUND;
// Battery slot
drawSlot(8, 72, layer);
drawSlot(matrixStack, 8, 72, layer);
// Input slots
drawSlot(55, 45, layer);
drawSlot(101, 45, layer);
drawSlot(matrixStack, 55, 45, layer);
drawSlot(matrixStack, 101, 45, layer);
drawOutputSlot(101, 45, layer);
drawOutputSlot(matrixStack, 101, 45, layer);
builder.drawJEIButton(this, 158, 5, layer);
builder.drawJEIButton(matrixStack, this, 158, 5, layer);
}
@Override
protected void drawForeground(final int mouseX, final int mouseY) {
super.drawForeground(mouseX, mouseY);
protected void drawForeground(MatrixStack matrixStack, final int mouseX, final int mouseY) {
super.drawForeground(matrixStack, mouseX, mouseY);
final Layer layer = Layer.FOREGROUND;
builder.drawProgressBar(this, blockEntity.getProgressScaled(100), 100, 76, 48, mouseX, mouseY, GuiBuilder.ProgressDirection.RIGHT, layer);
builder.drawMultiEnergyBar(this, 9, 19, (int) blockEntity.getEnergy(), (int) blockEntity.getMaxPower(), mouseX, mouseY, 0, layer);
builder.drawProgressBar(matrixStack, this, blockEntity.getProgressScaled(100), 100, 76, 48, mouseX, mouseY, GuiBuilder.ProgressDirection.RIGHT, layer);
builder.drawMultiEnergyBar(matrixStack, this, 9, 19, (int) blockEntity.getEnergy(), (int) blockEntity.getMaxPower(), mouseX, mouseY, 0, layer);
}
}

View file

@ -34,6 +34,7 @@ import me.shedaniel.rei.gui.entries.RecipeEntry;
import me.shedaniel.rei.gui.entries.SimpleRecipeEntry;
import me.shedaniel.rei.gui.widget.Widget;
import net.minecraft.item.Items;
import net.minecraft.text.LiteralText;
import net.minecraft.text.Text;
import net.minecraft.text.TranslatableText;
import net.minecraft.util.Identifier;
@ -66,7 +67,7 @@ public class MachineRecipeCategory<R extends RebornRecipe> implements RecipeCate
@Override
public String getCategoryName() {
return StringUtils.t(rebornRecipeType.getName().toString());
return new TranslatableText(rebornRecipeType.getName().toString()).asString();
}
@Override
@ -94,7 +95,7 @@ public class MachineRecipeCategory<R extends RebornRecipe> implements RecipeCate
Text energyPerTick = new TranslatableText("techreborn.jei.recipe.running.cost", "E", machineRecipe.getEnergy());
Label costLabel;
widgets.add(costLabel = Widgets.createLabel(new Point(startPoint.x + 1, startPoint.y + 1 + (i++ * 20)), energyPerTick.asFormattedString()));
widgets.add(costLabel = Widgets.createLabel(new Point(startPoint.x + 1, startPoint.y + 1 + (i++ * 20)), energyPerTick));
costLabel.shadow(false);
costLabel.color(0xFF404040, 0xFFBBBBBB);
@ -105,7 +106,7 @@ public class MachineRecipeCategory<R extends RebornRecipe> implements RecipeCate
int heat = machineRecipe.getHeat();
if (heat > 0) {
String neededHeat = heat + " " + StringUtils.t("techreborn.jei.recipe.heat");
Text neededHeat = new LiteralText(String.valueOf(heat)).append(" ").append(new TranslatableText("techreborn.jei.recipe.heat"));
Label heatLabel;
widgets.add(heatLabel = Widgets.createLabel(new Point(startPoint.x + 61, startPoint.y + 1 + (i++ * 20)), neededHeat));
heatLabel.shadow(false);

View file

@ -24,7 +24,7 @@
package techreborn.compat.rei;
import me.shedaniel.math.api.Rectangle;
import me.shedaniel.math.Rectangle;
import me.shedaniel.rei.api.BaseBoundsHandler;
import me.shedaniel.rei.api.DisplayHelper;
import me.shedaniel.rei.api.EntryRegistry;
@ -32,8 +32,6 @@ import me.shedaniel.rei.api.EntryStack;
import me.shedaniel.rei.api.RecipeDisplay;
import me.shedaniel.rei.api.RecipeHelper;
import me.shedaniel.rei.api.plugins.REIPluginV0;
import net.fabricmc.loader.api.SemanticVersion;
import net.fabricmc.loader.util.version.VersionParsingException;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.item.ItemConvertible;

View file

@ -58,7 +58,7 @@ public class FluidGeneratorRecipeCategory implements RecipeCategory<FluidGenerat
@Override
public String getCategoryName() {
return StringUtils.t(identifier.toString());
return new TranslatableText(identifier.toString()).asString();
}
@Override
@ -80,7 +80,7 @@ public class FluidGeneratorRecipeCategory implements RecipeCategory<FluidGenerat
Text energyPerTick = new TranslatableText("techreborn.jei.recipe.generator.total", machineRecipe.getTotalEnergy());
Label costLabel;
widgets.add(costLabel = Widgets.createLabel(new Point(bounds.getCenterX(), startPoint.y + 20), energyPerTick.asFormattedString()));
widgets.add(costLabel = Widgets.createLabel(new Point(bounds.getCenterX(), startPoint.y + 20), energyPerTick));
costLabel.shadow(false);
costLabel.color(0xFF404040, 0xFFBBBBBB);

View file

@ -59,7 +59,7 @@ public class FluidReplicatorRecipeCategory implements RecipeCategory<FluidReplic
@Override
public String getCategoryName() {
return StringUtils.t(rebornRecipeType.getName().toString());
return new TranslatableText(rebornRecipeType.getName().toString()).asString();
}
@Override
@ -82,7 +82,7 @@ public class FluidReplicatorRecipeCategory implements RecipeCategory<FluidReplic
Text energyPerTick = new TranslatableText("techreborn.jei.recipe.running.cost", "E", machineRecipe.getEnergy());
Label costLabel;
widgets.add(costLabel = Widgets.createLabel(new Point(startPoint.x + 1, startPoint.y + 1 + (i++ * 20)), energyPerTick.asFormattedString()));
widgets.add(costLabel = Widgets.createLabel(new Point(startPoint.x + 1, startPoint.y + 1 + (i++ * 20)), energyPerTick));
costLabel.shadow(false);
costLabel.color(0xFF404040, 0xFFBBBBBB);

View file

@ -27,6 +27,7 @@ package techreborn.compat.rei.rollingmachine;
import me.shedaniel.rei.api.EntryStack;
import me.shedaniel.rei.plugin.crafting.DefaultCraftingCategory;
import net.minecraft.item.Items;
import net.minecraft.text.TranslatableText;
import net.minecraft.util.Identifier;
import reborncore.common.crafting.RebornRecipeType;
import reborncore.common.util.StringUtils;
@ -48,7 +49,7 @@ public class RollingMachineCategory extends DefaultCraftingCategory {
@Override
public String getCategoryName() {
return StringUtils.t(rebornRecipeType.getName().toString());
return new TranslatableText(rebornRecipeType.getName().toString()).asString();
}
@Override

View file

@ -36,6 +36,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.text.LiteralText;
import net.minecraft.text.Text;
import net.minecraft.text.TranslatableText;
import net.minecraft.util.Formatting;
import net.minecraft.util.registry.Registry;
import reborncore.api.IListInfoProvider;
@ -75,7 +76,7 @@ public class StackToolTipHandler implements ItemTooltipCallback {
Block block = Block.getBlockFromItem(item);
if(wipBlocks.contains(block) || block instanceof WIP){
components.add(new LiteralText(Formatting.RED + StringUtils.t("techreborn.tooltip.wip")));
components.add(new TranslatableText("techreborn.tooltip.wip").formatted(Formatting.RED));
}
if(block instanceof BaseBlockEntityProvider){

View file

@ -33,7 +33,9 @@ import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemUsageContext;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.text.LiteralText;
import net.minecraft.text.MutableText;
import net.minecraft.text.Text;
import net.minecraft.text.TranslatableText;
import net.minecraft.util.*;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.registry.Registry;
@ -75,16 +77,16 @@ public class FrequencyTransmitterItem extends Item {
stack.getOrCreateTag().putInt("dim", world.getDimension().getType().getRawId());
if (!world.isClient) {
ChatUtils.sendNoSpamMessages(MessageIDs.freqTransmitterID, new LiteralText(
Formatting.GRAY + StringUtils.t("techreborn.message.setTo") + " X: " +
Formatting.GOLD + pos.getX() +
Formatting.GRAY + " Y: " +
Formatting.GOLD + pos.getY() +
Formatting.GRAY + " Z: " +
Formatting.GOLD + pos.getZ() +
Formatting.GRAY + " " + StringUtils.t("techreborn.message.in") + " " +
Formatting.GOLD + getDimName(world.getDimension().getType())
+ " (" + getDimName(world.getDimension().getType()) + ")"));
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))
.append(" ")
.append(new TranslatableText("techreborn.message.in").formatted(Formatting.GRAY))
.append(new LiteralText(getDimName(world.getDimension().getType()).toString()).formatted(Formatting.GOLD));
}
return ActionResult.SUCCESS;
}
@ -96,9 +98,16 @@ public class FrequencyTransmitterItem extends Item {
if (player.isSneaking()) {
stack.setTag(null);
if (!world.isClient) {
ChatUtils.sendNoSpamMessages(MessageIDs.freqTransmitterID, new LiteralText(
Formatting.GRAY + StringUtils.t("techreborn.message.coordsHaveBeen") + " "
+ Formatting.GOLD + StringUtils.t("techreborn.message.cleared")));
ChatUtils.sendNoSpamMessages(MessageIDs.freqTransmitterID,
new TranslatableText("techreborn.message.coordsHaveBeen")
.formatted(Formatting.GRAY)
.append(" ")
.append(
new TranslatableText("techreborn.message.cleared")
.formatted(Formatting.GOLD)
)
);
}
}
@ -120,7 +129,7 @@ public class FrequencyTransmitterItem extends Item {
tooltip.add(new LiteralText(Formatting.DARK_GRAY + getDimName(Registry.DIMENSION_TYPE.get(dim)).toString()));
} else {
tooltip.add(new LiteralText(Formatting.GRAY + StringUtils.t("techreborn.message.noCoordsSet")));
tooltip.add(new TranslatableText("techreborn.message.noCoordsSet").formatted(Formatting.GRAY));
}
}
@ -134,8 +143,8 @@ public class FrequencyTransmitterItem extends Item {
}
@Override
public String getText(ItemStack stack) {
String text = "";
public Text getText(ItemStack stack) {
MutableText text = new LiteralText("");
Formatting gold = Formatting.GOLD;
Formatting grey = Formatting.GRAY;
if (stack.getItem() instanceof FrequencyTransmitterItem) {
@ -144,9 +153,9 @@ public class FrequencyTransmitterItem extends Item {
int coordY = stack.getTag().getInt("y");
int coordZ = stack.getTag().getInt("z");
int coordDim = stack.getTag().getInt("dim");
text = grey + "X: " + gold + coordX + grey + " Y: " + gold + coordY + grey + " Z: " + gold + coordZ + grey + " Dim: " + gold + getDimName(Registry.DIMENSION_TYPE.get(coordDim)).toString() + " (" + coordDim + ")";
text = text.append(new LiteralText(grey + "X: " + gold + coordX + grey + " Y: " + gold + coordY + grey + " Z: " + gold + coordZ + grey + " Dim: " + gold + getDimName(Registry.DIMENSION_TYPE.get(coordDim)).toString() + " (" + coordDim + ")"));
} else {
text = grey + StringUtils.t("techreborn.message.noCoordsSet");
text = text.append(new TranslatableText("techreborn.message.noCoordsSet").formatted(Formatting.GRAY));
}
}
return text;

View file

@ -74,7 +74,7 @@ public class DebugToolItem extends Item {
private void sendMessage(ItemUsageContext context, Text string) {
if (!context.getWorld().isClient) {
context.getPlayer().sendMessage(string);
context.getPlayer().sendSystemMessage(string);
}
}

View file

@ -35,6 +35,7 @@ import net.minecraft.item.Items;
import net.minecraft.item.ToolMaterials;
import net.minecraft.text.LiteralText;
import net.minecraft.text.Text;
import net.minecraft.text.TranslatableText;
import net.minecraft.util.ActionResult;
import net.minecraft.util.Formatting;
import net.minecraft.util.Hand;
@ -67,7 +68,7 @@ public class IndustrialJackhammerItem extends JackhammerItem {
ItemUtils.switchActive(stack, cost, isClient, messageId);
stack.getOrCreateTag().putBoolean("AOE5", false);
if (isClient) {
ChatUtils.sendNoSpamMessages(messageId, new LiteralText(Formatting.GRAY + StringUtils.t("techreborn.message.setTo") + " " + Formatting.GOLD + "3*3"));
ChatUtils.sendNoSpamMessages(messageId, new TranslatableText("techreborn.message.setTo").formatted(Formatting.GRAY).append(" ").append(new LiteralText("3*3").formatted(Formatting.GOLD)));
}
} else {
if (isAOE5(stack)) {
@ -76,7 +77,7 @@ public class IndustrialJackhammerItem extends JackhammerItem {
} else {
stack.getOrCreateTag().putBoolean("AOE5", true);
if (isClient) {
ChatUtils.sendNoSpamMessages(messageId, new LiteralText(Formatting.GRAY + StringUtils.t("techreborn.message.setTo") + " " + Formatting.GOLD + "5*5"));
ChatUtils.sendNoSpamMessages(messageId, new TranslatableText("techreborn.message.setTo").formatted(Formatting.GRAY).append(" ").append(new LiteralText("5*5").formatted(Formatting.GOLD)));
}
}
}

View file

@ -25,24 +25,17 @@
package techreborn.world;
import net.minecraft.block.sapling.SaplingGenerator;
import net.minecraft.world.gen.feature.BranchedTreeFeatureConfig;
import net.minecraft.world.gen.feature.ConfiguredFeature;
import net.minecraft.world.gen.feature.TreeFeatureConfig;
import javax.annotation.Nullable;
import java.util.Random;
public class RubberSaplingGenerator extends SaplingGenerator {
//TODO remove with 1.16, backwards compat for 1.15/1.15.1
@Nullable
protected ConfiguredFeature<BranchedTreeFeatureConfig, ?> method_11430(Random random) {
return createTreeFeature(random, false);
}
//1.15.2 method
@Nullable
@Override
protected ConfiguredFeature<BranchedTreeFeatureConfig, ?> createTreeFeature(Random random, boolean bl) {
protected ConfiguredFeature<TreeFeatureConfig, ?> createTreeFeature(Random random, boolean bl) {
return WorldGenerator.RUBBER_TREE_FEATURE.configure(WorldGenerator.RUBBER_TREE_CONFIG);
}
}

View file

@ -29,8 +29,9 @@ import net.minecraft.block.BlockState;
import net.minecraft.util.math.BlockBox;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.ModifiableTestableWorld;
import net.minecraft.world.gen.feature.BranchedTreeFeatureConfig;
import net.minecraft.world.gen.feature.OakTreeFeature;
import net.minecraft.world.gen.feature.AbstractTreeFeature;
import net.minecraft.world.gen.feature.TreeFeatureConfig;
import techreborn.config.TechRebornConfig;
import techreborn.init.TRContent;
@ -42,20 +43,21 @@ import java.util.function.Function;
* @author drcrazy
*
*/
public class RubberTreeFeature extends OakTreeFeature {
public class RubberTreeFeature extends AbstractTreeFeature {
public RubberTreeFeature(Function<Dynamic<?>, ? extends BranchedTreeFeatureConfig> configFactory) {
public RubberTreeFeature(Function<Dynamic<?>, ? extends TreeFeatureConfig> configFactory) {
super(configFactory);
}
@Override
public boolean generate(ModifiableTestableWorld world, Random random, BlockPos blockPos, Set<BlockPos> set, Set<BlockPos> set2, BlockBox blockBox, BranchedTreeFeatureConfig branchedTreeFeatureConfig) {
if(super.generate(world, random, blockPos, set, set2, blockBox, branchedTreeFeatureConfig)) {
spawnSpike(world, blockPos);
return true;
}
return false;
}
// @Override
// public boolean generate(ModifiableTestableWorld world, Random random, BlockPos blockPos, Set<BlockPos> set, Set<BlockPos> set2, BlockBox blockBox, TreeFeatureConfig branchedTreeFeatureConfig) {
// if(super.generate(world, random, blockPos, set, set2, blockBox, branchedTreeFeatureConfig)) {
// spawnSpike(world, blockPos);
// return true;
// }
// return false;
// }
private void spawnSpike(ModifiableTestableWorld world, BlockPos pos) {
final int startScan = pos.getY();

View file

@ -27,20 +27,21 @@ package techreborn.world;
import com.google.common.collect.ImmutableList;
import net.fabricmc.fabric.api.event.registry.RegistryEntryAddedCallback;
import net.minecraft.block.Blocks;
import net.minecraft.class_5201;
import net.minecraft.class_5204;
import net.minecraft.util.Identifier;
import net.minecraft.util.math.Direction;
import net.minecraft.util.registry.Registry;
import net.minecraft.world.biome.Biome;
import net.minecraft.world.biome.Biome.Category;
import net.minecraft.world.gen.GenerationStep;
import net.minecraft.world.gen.decorator.BeehiveTreeDecorator;
import net.minecraft.world.gen.decorator.CountExtraChanceDecoratorConfig;
import net.minecraft.world.gen.decorator.Decorator;
import net.minecraft.world.gen.decorator.RangeDecoratorConfig;
import net.minecraft.world.gen.feature.BranchedTreeFeatureConfig;
import net.minecraft.world.gen.feature.Feature;
import net.minecraft.world.gen.feature.OreFeatureConfig;
import net.minecraft.world.gen.feature.OreFeatureConfig.Target;
import net.minecraft.world.gen.feature.TreeFeatureConfig;
import net.minecraft.world.gen.foliage.BlobFoliagePlacer;
import net.minecraft.world.gen.stateprovider.SimpleBlockStateProvider;
import net.minecraft.world.gen.stateprovider.WeightedBlockStateProvider;
@ -61,9 +62,9 @@ import java.util.List;
*/
public class WorldGenerator {
public static Feature<BranchedTreeFeatureConfig> RUBBER_TREE_FEATURE;
public static Feature<TreeFeatureConfig> RUBBER_TREE_FEATURE;
public static BranchedTreeFeatureConfig RUBBER_TREE_CONFIG;
public static TreeFeatureConfig RUBBER_TREE_CONFIG;
private static List<Biome> checkedBiomes = new ArrayList<>();
@ -79,7 +80,7 @@ public class WorldGenerator {
}
private static void setupTrees() {
RUBBER_TREE_FEATURE = Registry.register(Registry.FEATURE, new Identifier("techreborn:rubber_tree"), new RubberTreeFeature(BranchedTreeFeatureConfig::deserialize));
RUBBER_TREE_FEATURE = Registry.register(Registry.FEATURE, new Identifier("techreborn:rubber_tree"), new RubberTreeFeature(TreeFeatureConfig::deserialize));
WeightedBlockStateProvider logProvider = new WeightedBlockStateProvider();
logProvider.addState(TRContent.RUBBER_LOG.getDefaultState(), 10);
@ -92,13 +93,13 @@ public class WorldGenerator {
)
.forEach(state -> logProvider.addState(state, 1));
RUBBER_TREE_CONFIG = new BranchedTreeFeatureConfig.Builder(
RUBBER_TREE_CONFIG = new TreeFeatureConfig.Builder(
logProvider,
new SimpleBlockStateProvider(TRContent.RUBBER_LEAVES.getDefaultState()),
new BlobFoliagePlacer(2, 0, 0, 0, 3),
new StraightTrunkPlacer(TechRebornConfig.RubberTreeBaseHeight, 3, 0))
.noVines()
.build();
new StraightTrunkPlacer(TechRebornConfig.RubberTreeBaseHeight, 3, 0),
new class_5204(1, 0, 1)
).build();
}
private static void addToBiome(Biome biome){