Merge remote-tracking branch 'remotes/origin/1.14' into 1.15
This commit is contained in:
commit
6e53132c59
285 changed files with 667 additions and 615 deletions
|
@ -30,6 +30,7 @@ import net.minecraft.entity.player.PlayerEntity;
|
|||
import reborncore.client.containerBuilder.builder.BuiltContainer;
|
||||
import reborncore.client.gui.builder.GuiBase;
|
||||
import reborncore.client.gui.builder.widget.GuiButtonUpDown;
|
||||
import reborncore.client.gui.builder.widget.GuiButtonUpDown.UpDownButtonType;
|
||||
import reborncore.common.network.NetworkManager;
|
||||
import reborncore.common.powerSystem.PowerSystem;
|
||||
import techreborn.packets.ServerboundPackets;
|
||||
|
@ -43,6 +44,15 @@ public class GuiAESU extends GuiBase<BuiltContainer> {
|
|||
super(player, aesu, aesu.createContainer(syncID, player));
|
||||
this.blockEntity = aesu;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init() {
|
||||
super.init();
|
||||
addButton(new GuiButtonUpDown(left + 121, top + 79, this, b -> onClick(256), UpDownButtonType.FASTFORWARD));
|
||||
addButton(new GuiButtonUpDown(left + 121 + 12, top + 79, this, b -> onClick(64), UpDownButtonType.FORWARD));
|
||||
addButton(new GuiButtonUpDown(left + 121 + 24, top + 79, this, b -> onClick(-64), UpDownButtonType.REWIND));
|
||||
addButton(new GuiButtonUpDown(left + 121 + 36, top + 79, this, b -> onClick(-256), UpDownButtonType.FASTREWIND));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawBackground(final float f, final int mouseX, final int mouseY) {
|
||||
|
@ -53,7 +63,6 @@ public class GuiAESU extends GuiBase<BuiltContainer> {
|
|||
this.drawSlot(98, 45, layer);
|
||||
this.drawArmourSlots(8, 18, layer);
|
||||
this.builder.drawEnergyOutput(this, 155, 61, this.blockEntity.getCurrentOutput(), layer);
|
||||
this.builder.drawUpDownButtons(this, 121, 79, layer);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -71,13 +80,6 @@ public class GuiAESU extends GuiBase<BuiltContainer> {
|
|||
}
|
||||
|
||||
builder.drawMultiEnergyBar(this, 81, 28, (int) blockEntity.getEnergy(), (int) blockEntity.getMaxPower(), mouseX, mouseY, 0, layer);
|
||||
|
||||
addButton(new GuiButtonUpDown(left + 121, top + 79, this, b -> onClick(256)));
|
||||
addButton(new GuiButtonUpDown(left + 121 + 12, top + 79, this, b -> onClick(64)));
|
||||
addButton(new GuiButtonUpDown(left + 121 + 24, top + 79, this, b -> onClick(-64)));
|
||||
addButton(new GuiButtonUpDown(left + 121 + 36, top + 79, this, b -> onClick(-256)));
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void onClick(int amount){
|
||||
|
|
|
@ -42,7 +42,6 @@ public class GuiAlloyFurnace extends GuiBase<BuiltContainer> {
|
|||
@Override
|
||||
protected void drawBackground(float lastFrameDuration, int mouseX, int mouseY) {
|
||||
super.drawBackground(lastFrameDuration, mouseX, mouseY);
|
||||
|
||||
GuiBase.Layer layer = GuiBase.Layer.BACKGROUND;
|
||||
|
||||
// Input slots
|
||||
|
@ -59,13 +58,7 @@ public class GuiAlloyFurnace extends GuiBase<BuiltContainer> {
|
|||
super.drawForeground(mouseX, mouseY);
|
||||
GuiBase.Layer layer = GuiBase.Layer.FOREGROUND;
|
||||
|
||||
builder.drawProgressBar(this, blockEntity.getCookProgressScaled(100), 100, 85, 36, mouseX, mouseY, GuiBuilder.ProgressDirection.RIGHT, layer);
|
||||
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);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(int mouseX, int mouseY, float lastFrameDuration) {
|
||||
super.render(mouseX, mouseY, lastFrameDuration);
|
||||
this.drawMouseoverTooltip(mouseX, mouseY);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,9 +25,12 @@
|
|||
package techreborn.client.gui;
|
||||
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import reborncore.client.ClientChunkManager;
|
||||
import reborncore.client.containerBuilder.builder.BuiltContainer;
|
||||
import reborncore.client.gui.builder.GuiBase;
|
||||
import reborncore.client.gui.builder.widget.GuiButtonSimple;
|
||||
import reborncore.client.gui.builder.widget.GuiButtonUpDown;
|
||||
import reborncore.client.gui.builder.widget.GuiButtonUpDown.UpDownButtonType;
|
||||
import reborncore.common.network.NetworkManager;
|
||||
import techreborn.blockentity.machine.tier3.ChunkLoaderBlockEntity;
|
||||
import techreborn.packets.ServerboundPackets;
|
||||
|
@ -41,34 +44,29 @@ public class GuiChunkLoader extends GuiBase<BuiltContainer> {
|
|||
this.blockEntity = blockEntity;
|
||||
}
|
||||
|
||||
public void init() {
|
||||
super.init();
|
||||
addButton(new GuiButtonUpDown(left + 64, top + 40, this, b -> onClick(5), UpDownButtonType.FASTFORWARD));
|
||||
addButton(new GuiButtonUpDown(left + 64 + 12, top + 40, this, b -> onClick(1), UpDownButtonType.FORWARD));
|
||||
addButton(new GuiButtonUpDown(left + 64 + 24, top + 40, this, b -> onClick(-1), UpDownButtonType.REWIND));
|
||||
addButton(new GuiButtonUpDown(left + 64 + 36, top + 40, this, b -> onClick(-5), UpDownButtonType.FASTREWIND));
|
||||
|
||||
addButton(new GuiButtonSimple(left + 10, top + 70, 155, 20, "Toggle Loaded Chunks", b -> ClientChunkManager.toggleLoadedChunks(blockEntity.getPos())));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawBackground(float partialTicks, int mouseX, int mouseY) {
|
||||
super.drawBackground(partialTicks, mouseX, mouseY);
|
||||
final Layer layer = Layer.BACKGROUND;
|
||||
|
||||
// Battery slot
|
||||
drawSlot(8, 72, layer);
|
||||
builder.drawUpDownButtons(this, 64, 40, layer);
|
||||
|
||||
if (GuiBase.slotConfigType != GuiBase.SlotConfigType.NONE) {
|
||||
return;
|
||||
}
|
||||
String text = "Raidus: " + String.valueOf(blockEntity.getRadius());
|
||||
String text = "Radius: " + blockEntity.getRadius();
|
||||
drawCentredString(text, 25, 4210752, layer);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawForeground(final int mouseX, final int mouseY) {
|
||||
super.drawForeground(mouseX, mouseY);
|
||||
final GuiBase.Layer layer = GuiBase.Layer.FOREGROUND;
|
||||
|
||||
builder.drawMultiEnergyBar(this, 9, 19, (int) blockEntity.getEnergy(), (int) blockEntity.getMaxPower(), mouseX, mouseY, 0, layer);
|
||||
addButton(new GuiButtonUpDown(left + 64, top + 40, this, b -> onClick(5)));
|
||||
addButton(new GuiButtonUpDown(left + 64 + 12, top + 40, this, b -> onClick(1)));
|
||||
addButton(new GuiButtonUpDown(left + 64 + 24, top + 40, this, b -> onClick(-1)));
|
||||
addButton(new GuiButtonUpDown(left + 64 + 36, top + 40, this, b -> onClick(-5)));
|
||||
}
|
||||
|
||||
public void onClick(int amount){
|
||||
NetworkManager.sendToServer(ServerboundPackets.createPacketChunkloader(amount, blockEntity));
|
||||
NetworkManager.sendToServer(ServerboundPackets.createPacketChunkloader(amount, blockEntity, ClientChunkManager.hasChunksForLoader(blockEntity.getPos())));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,6 +34,7 @@ import reborncore.client.containerBuilder.builder.BuiltContainer;
|
|||
import reborncore.client.gui.builder.GuiBase;
|
||||
import reborncore.client.gui.builder.widget.GuiButtonExtended;
|
||||
import reborncore.client.gui.builder.widget.GuiButtonUpDown;
|
||||
import reborncore.client.gui.builder.widget.GuiButtonUpDown.UpDownButtonType;
|
||||
import reborncore.client.gui.guibuilder.GuiBuilder;
|
||||
import reborncore.client.multiblock.Multiblock;
|
||||
import reborncore.client.multiblock.MultiblockRenderEvent;
|
||||
|
@ -56,6 +57,15 @@ public class GuiFusionReactor extends GuiBase<BuiltContainer> {
|
|||
super(player, blockEntity, blockEntity.createContainer(syncID, player));
|
||||
this.blockEntity = blockEntity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init() {
|
||||
super.init();
|
||||
addButton(new GuiButtonUpDown(left + 121, top + 79, this, (ButtonWidget buttonWidget) -> sendSizeChange(5), UpDownButtonType.FASTFORWARD));
|
||||
addButton(new GuiButtonUpDown(left + 121 + 12, top + 79, this, (ButtonWidget buttonWidget) -> sendSizeChange(1), UpDownButtonType.FORWARD));
|
||||
addButton(new GuiButtonUpDown(left + 121 + 24, top + 79, this, (ButtonWidget buttonWidget) -> sendSizeChange(-5), UpDownButtonType.REWIND));
|
||||
addButton(new GuiButtonUpDown(left + 121 + 36, top + 79, this, (ButtonWidget buttonWidget) -> sendSizeChange(-1), UpDownButtonType.FASTREWIND));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawBackground(final float partialTicks, final int mouseX, final int mouseY) {
|
||||
|
@ -101,15 +111,9 @@ public class GuiFusionReactor extends GuiBase<BuiltContainer> {
|
|||
|
||||
}
|
||||
}
|
||||
builder.drawUpDownButtons(this, 121, 79, layer);
|
||||
drawString("Size: " + blockEntity.size, 83, 81, 0xFFFFFF, layer);
|
||||
drawString("" + blockEntity.getPowerMultiplier() + "x", 10, 81, 0xFFFFFF, layer);
|
||||
|
||||
addButton(new GuiButtonUpDown(left + 121, top + 79, this, (ButtonWidget buttonWidget) -> sendSizeChange(5)));
|
||||
addButton(new GuiButtonUpDown(left + 121 + 12, top + 79, this, (ButtonWidget buttonWidget) -> sendSizeChange(1)));
|
||||
addButton(new GuiButtonUpDown(left + 121 + 24, top + 79, this, (ButtonWidget buttonWidget) -> sendSizeChange(-5)));
|
||||
addButton(new GuiButtonUpDown(left + 121 + 36, top + 79, this, (ButtonWidget buttonWidget) -> sendSizeChange(-1)));
|
||||
|
||||
builder.drawMultiEnergyBar(this, 9, 19, (int) this.blockEntity.getEnergy(), (int) this.blockEntity.getMaxPower(), mouseX, mouseY, 0, layer);
|
||||
}
|
||||
|
||||
|
|
|
@ -24,13 +24,23 @@
|
|||
|
||||
package techreborn.client.gui;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.Items;
|
||||
import reborncore.client.containerBuilder.builder.BuiltContainer;
|
||||
import reborncore.client.gui.builder.GuiBase;
|
||||
import reborncore.client.gui.builder.widget.GuiButtonSimple;
|
||||
import reborncore.client.gui.guibuilder.GuiBuilder;
|
||||
import reborncore.common.network.NetworkManager;
|
||||
import techreborn.blockentity.machine.iron.IronFurnaceBlockEntity;
|
||||
import techreborn.packets.ServerboundPackets;
|
||||
import techreborn.utils.PlayerUtils;
|
||||
|
||||
public class GuiIronFurnace extends GuiBase<BuiltContainer> {
|
||||
|
||||
|
@ -41,10 +51,59 @@ public class GuiIronFurnace extends GuiBase<BuiltContainer> {
|
|||
this.blockEntity = furnace;
|
||||
}
|
||||
|
||||
public void onClick(int amount){
|
||||
public void onClick(){
|
||||
NetworkManager.sendToServer(ServerboundPackets.createPacketExperience(blockEntity));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init() {
|
||||
super.init();
|
||||
addButton(new GuiButtonSimple(getGuiLeft() + 116, getGuiTop() + 57, 18, 18, "", b -> onClick()) {
|
||||
|
||||
@Override
|
||||
public void renderToolTip(int mouseX, int mouseY) {
|
||||
PlayerEntity player = playerInventory.player;
|
||||
if (player == null) {
|
||||
return;
|
||||
}
|
||||
String message = "Experience: ";
|
||||
|
||||
float furnaceExp = blockEntity.experience;
|
||||
if (furnaceExp <= 0) {
|
||||
message = message + "0";
|
||||
} else {
|
||||
float expTillLevel = (1.0F - player.experienceProgress) * player.getNextLevelExperience();
|
||||
if (furnaceExp <= expTillLevel) {
|
||||
int percentage = (int) (blockEntity.experience * 100 / player.getNextLevelExperience());
|
||||
message = message + "+"
|
||||
+ (percentage > 0 ? String.valueOf(percentage) : "<1")
|
||||
+ "%";
|
||||
} else {
|
||||
int levels = 0;
|
||||
furnaceExp -= expTillLevel;
|
||||
while (furnaceExp > 0) {
|
||||
furnaceExp -= PlayerUtils.getLevelExperience(player.experienceLevel);
|
||||
++levels;
|
||||
}
|
||||
message = message + "+" + String.valueOf(levels) + "L";
|
||||
}
|
||||
}
|
||||
|
||||
List<String> list = new ArrayList<>();
|
||||
list.add(message);
|
||||
renderTooltip(list, mouseX, mouseY);
|
||||
GlStateManager.disableLighting();
|
||||
GlStateManager.color4f(1, 1, 1, 1);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderBg(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);
|
||||
|
@ -59,17 +118,11 @@ public class GuiIronFurnace extends GuiBase<BuiltContainer> {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void drawForeground(final int mouseX, final int mouseY) {
|
||||
protected void drawForeground(int mouseX, int mouseY) {
|
||||
super.drawForeground(mouseX, mouseY);
|
||||
final GuiBase.Layer layer = GuiBase.Layer.FOREGROUND;
|
||||
|
||||
builder.drawProgressBar(this, blockEntity.gaugeProgressScaled(100), 100, 85, 36, mouseX, mouseY, GuiBuilder.ProgressDirection.RIGHT, layer);
|
||||
builder.drawBurnBar(this, blockEntity.gaugeFuelScaled(100), 100, 56, 36, mouseX, mouseY, layer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(int mouseX, int mouseY, float lastFrameDuration) {
|
||||
super.render(mouseX, mouseY, lastFrameDuration);
|
||||
this.drawMouseoverTooltip(mouseX, mouseY);
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue