Gui fixes, 393

This commit is contained in:
modmuss50 2019-02-22 14:02:04 +00:00
parent 06632be822
commit d68c65641d
20 changed files with 189 additions and 452 deletions

View file

@ -28,6 +28,7 @@ import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.entity.player.EntityPlayer;
import reborncore.client.gui.builder.GuiBase;
import reborncore.client.gui.builder.widget.GuiButtonExtended;
import reborncore.common.network.NetworkManager;
import reborncore.common.powerSystem.PowerSystem;
import reborncore.client.gui.builder.widget.GuiButtonUpDown;
@ -73,17 +74,15 @@ public class GuiAESU extends GuiBase {
builder.drawMultiEnergyBar(this, 81, 28, (int) tile.getEnergy(), (int) tile.getMaxPower(), mouseX, mouseY, 0, layer);
buttons.add(new GuiButtonUpDown(300, 121, 79, this, layer));
buttons.add(new GuiButtonUpDown(301, 121 + 12, 79, this, layer));
buttons.add(new GuiButtonUpDown(302, 121 + 24, 79, this, layer));
buttons.add(new GuiButtonUpDown(303, 121 + 36, 79, this, layer));
buttons.add(new GuiButtonUpDown(300, 121, 79, this, layer).clickHandler(this::onClick));
buttons.add(new GuiButtonUpDown(301, 121 + 12, 79, this, layer).clickHandler(this::onClick));
buttons.add(new GuiButtonUpDown(302, 121 + 24, 79, this, layer).clickHandler(this::onClick));
buttons.add(new GuiButtonUpDown(303, 121 + 36, 79, this, layer).clickHandler(this::onClick));
}
@Override
public void actionPerformed(final GuiButton button) throws IOException {
super.actionPerformed(button);
public void onClick(GuiButtonExtended button, Double x, Double y){
if (button.id >= 300 && button.id <= 303) {
NetworkManager.sendToServer(ServerboundPackets.createPacketAesu(button.id, tile));
}
}
}
}

View file

@ -32,6 +32,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.IRecipe;
import net.minecraft.util.ResourceLocation;
import reborncore.client.gui.builder.GuiBase;
import reborncore.client.gui.builder.widget.GuiButtonExtended;
import reborncore.client.gui.guibuilder.GuiBuilder;
import reborncore.common.network.NetworkManager;
import techreborn.packets.ServerboundPackets;
@ -103,11 +104,11 @@ public class GuiAutoCrafting extends GuiBase {
}
@Override
protected void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException {
public boolean mouseClicked(double mouseX, double mouseY, int mouseButton) {
if (isPointInRect(145, 4, 20, 12, mouseX, mouseY)) {
NetworkManager.sendToServer(ServerboundPackets.createPacketAutoCraftingTableLock(tileAutoCraftingTable, !tileAutoCraftingTable.locked));
return;
return true;
}
super.mouseClicked(mouseX, mouseY, mouseButton);
return super.mouseClicked(mouseX, mouseY, mouseButton);
}
}

View file

@ -32,6 +32,7 @@ import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
import reborncore.ClientProxy;
import reborncore.client.gui.builder.GuiBase;
import reborncore.client.gui.builder.widget.GuiButtonExtended;
import reborncore.client.gui.guibuilder.GuiBuilder;
import reborncore.client.multiblock.Multiblock;
import reborncore.client.multiblock.MultiblockRenderEvent;
@ -89,18 +90,16 @@ public class GuiBlastFurnace extends GuiBase {
builder.drawBigHeatBar(this, 31, 71, tile.getCachedHeat(), 3230, layer);
if (hasMultiBlock) {
addHologramButton(4, 4, 212, layer);
addHologramButton(4, 4, 212, layer).clickHandler(this::onClick);
} else {
builder.drawMultiblockMissingBar(this, layer);
addHologramButton(76, 56, 212, layer);
addHologramButton(76, 56, 212, layer).clickHandler(this::onClick);
builder.drawHologramButton(this, 76, 56, mouseX, mouseY, layer);
}
builder.drawMultiEnergyBar(this, 9, 19, (int) tile.getEnergy(), (int) tile.getMaxPower(), mouseX, mouseY, 0, layer);
}
@Override
public void actionPerformed(final GuiButton button) throws IOException {
super.actionPerformed(button);
public void onClick(GuiButtonExtended button, Double x, Double y){
if (button.id == 212 && GuiBase.slotConfigType == SlotConfigType.NONE) {
if (ClientProxy.multiblockRenderEvent.currentMultiblock == null) {
{

View file

@ -32,6 +32,7 @@ import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
import reborncore.ClientProxy;
import reborncore.client.gui.builder.GuiBase;
import reborncore.client.gui.builder.widget.GuiButtonExtended;
import reborncore.client.gui.guibuilder.GuiBuilder;
import reborncore.client.multiblock.Multiblock;
import reborncore.client.multiblock.MultiblockRenderEvent;
@ -81,20 +82,18 @@ public class GuiDistillationTower extends GuiBase {
builder.drawProgressBar(this, tile.getProgressScaled(100), 100, 55, 40, mouseX, mouseY, GuiBuilder.ProgressDirection.RIGHT, layer);
if (tile.getMutliBlock()) {
addHologramButton(6, 4, 212, layer);
addHologramButton(6, 4, 212, layer).clickHandler(this::onClick);
builder.drawHologramButton(this, 6, 4, mouseX, mouseY, layer);
} else {
builder.drawMultiblockMissingBar(this, layer);
addHologramButton(76, 56, 212, layer);
addHologramButton(76, 56, 212, layer).clickHandler(this::onClick);
builder.drawHologramButton(this, 76, 56, mouseX, mouseY, layer);
}
builder.drawMultiEnergyBar(this, 9, 19, (int) tile.getEnergy(), (int) tile.getMaxPower(), mouseX, mouseY, 0, layer);
}
@Override
public void actionPerformed(final GuiButton button) throws IOException {
super.actionPerformed(button);
public void onClick(GuiButtonExtended button, Double x, Double y){
if (button.id == 212 && GuiBase.slotConfigType == SlotConfigType.NONE) {
if (ClientProxy.multiblockRenderEvent.currentMultiblock == null) {
{

View file

@ -31,6 +31,7 @@ import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
import reborncore.ClientProxy;
import reborncore.client.gui.builder.GuiBase;
import reborncore.client.gui.builder.widget.GuiButtonExtended;
import reborncore.client.gui.guibuilder.GuiBuilder;
import reborncore.client.multiblock.Multiblock;
import reborncore.client.multiblock.MultiblockRenderEvent;
@ -93,19 +94,17 @@ public class GuiFluidReplicator extends GuiBase {
builder.drawTank(this, 99, 25, mouseX, mouseY, tile.tank.getFluid(), tile.tank.getCapacity(), tile.tank.isEmpty(), layer);
builder.drawProgressBar(this, tile.getProgressScaled(100), 100, 76, 48, mouseX, mouseY, GuiBuilder.ProgressDirection.RIGHT, layer);
if (tile.getMultiBlock()) {
addHologramButton(6, 4, 212, layer);
addHologramButton(6, 4, 212, layer).clickHandler(this::onClick);
} else {
builder.drawMultiblockMissingBar(this, layer);
addHologramButton(76, 56, 212, layer);
addHologramButton(76, 56, 212, layer).clickHandler(this::onClick);
builder.drawHologramButton(this, 76, 56, mouseX, mouseY, layer);
}
builder.drawMultiEnergyBar(this, 9, 19, (int) tile.getEnergy(), (int) tile.getMaxPower(), mouseX, mouseY, 0, layer);
}
// GuiScreen
@Override
public void actionPerformed(final GuiButton button) throws IOException {
super.actionPerformed(button);
public void onClick(GuiButtonExtended button, Double x, Double y){
if (button.id == 212 && GuiBase.slotConfigType == SlotConfigType.NONE) {
if (ClientProxy.multiblockRenderEvent.currentMultiblock == null) {
{

View file

@ -31,6 +31,7 @@ import net.minecraft.util.math.BlockPos;
import org.apache.commons.lang3.tuple.Pair;
import reborncore.ClientProxy;
import reborncore.client.gui.builder.GuiBase;
import reborncore.client.gui.builder.widget.GuiButtonExtended;
import reborncore.client.gui.guibuilder.GuiBuilder;
import reborncore.client.multiblock.Multiblock;
import reborncore.client.multiblock.MultiblockRenderEvent;
@ -80,14 +81,14 @@ public class GuiFusionReactor extends GuiBase {
builder.drawProgressBar(this, tile.getProgressScaled(100), 100, 55, 51, mouseX, mouseY, GuiBuilder.ProgressDirection.RIGHT, layer);
builder.drawProgressBar(this, tile.getProgressScaled(100), 100, 105, 51, mouseX, mouseY, GuiBuilder.ProgressDirection.LEFT, layer);
if (tile.getCoilStatus() > 0) {
addHologramButton(6, 4, 212, layer);
addHologramButton(6, 4, 212, layer).clickHandler(this::onClick);
drawCentredString(tile.getStateString(), 20, Color.BLUE.darker().getRGB(), layer);
if(tile.state == 2){
drawCentredString( PowerSystem.getLocaliszedPowerFormatted((int) tile.getPowerChange()) + "/t", 30, Color.GREEN.darker().getRGB(), layer);
}
} else {
builder.drawMultiblockMissingBar(this, layer);
addHologramButton(76, 56, 212, layer);
addHologramButton(76, 56, 212, layer).clickHandler(this::onClick);
builder.drawHologramButton(this, 76, 56, mouseX, mouseY, layer);
Optional<Pair<Integer, Integer>> stackSize = getCoilStackCount();
@ -111,10 +112,8 @@ public class GuiFusionReactor extends GuiBase {
builder.drawMultiEnergyBar(this, 9, 19, (int) this.tile.getEnergy(), (int) this.tile.getMaxPower(), mouseX, mouseY, 0, layer);
}
@Override
public void actionPerformed(final GuiButton button) throws IOException {
super.actionPerformed(button);
public void onClick(GuiButtonExtended button, Double x, Double y){
if (button.id == 212 && GuiBase.slotConfigType == SlotConfigType.NONE) {
if (ClientProxy.multiblockRenderEvent.currentMultiblock == null) {
updateMultiBlockRender();

View file

@ -31,6 +31,7 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.math.BlockPos;
import reborncore.ClientProxy;
import reborncore.client.gui.builder.GuiBase;
import reborncore.client.gui.builder.widget.GuiButtonExtended;
import reborncore.client.gui.guibuilder.GuiBuilder;
import reborncore.client.multiblock.Multiblock;
import reborncore.client.multiblock.MultiblockRenderEvent;
@ -85,19 +86,17 @@ public class GuiImplosionCompressor extends GuiBase {
builder.drawProgressBar(this, tile.getProgressScaled(100), 100, 71, 40, mouseX, mouseY, GuiBuilder.ProgressDirection.RIGHT, layer);
if (tile.getMutliBlock()) {
addHologramButton(6, 4, 212, layer);
addHologramButton(6, 4, 212, layer).clickHandler(this::onClick);
} else {
builder.drawMultiblockMissingBar(this, layer);
addHologramButton(76, 56, 212, layer);
addHologramButton(76, 56, 212, layer).clickHandler(this::onClick);
builder.drawHologramButton(this, 76, 56, mouseX, mouseY, layer);
}
builder.drawMultiEnergyBar(this, 9, 19, (int) tile.getEnergy(), (int) tile.getMaxPower(), mouseX, mouseY, 0, layer);
}
@Override
public void actionPerformed(final GuiButton button) throws IOException {
super.actionPerformed(button);
public void onClick(GuiButtonExtended button, Double mouseX, Double mouseY){
if (button.id == 212 && GuiBase.slotConfigType == SlotConfigType.NONE) {
if (ClientProxy.multiblockRenderEvent.currentMultiblock == null) {
{

View file

@ -32,6 +32,7 @@ import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
import reborncore.ClientProxy;
import reborncore.client.gui.builder.GuiBase;
import reborncore.client.gui.builder.widget.GuiButtonExtended;
import reborncore.client.gui.guibuilder.GuiBuilder;
import reborncore.client.multiblock.Multiblock;
import reborncore.client.multiblock.MultiblockRenderEvent;
@ -91,18 +92,16 @@ public class GuiIndustrialGrinder extends GuiBase {
builder.drawProgressBar(this, tile.getProgressScaled(100), 100, 105, 47, mouseX, mouseY, GuiBuilder.ProgressDirection.RIGHT, layer);
builder.drawTank(this, 53, 25, mouseX, mouseY, tile.tank.getFluid(), tile.tank.getCapacity(), tile.tank.isEmpty(), layer);
if (tile.getMultiBlock()) {
addHologramButton(6, 4, 212, layer);
addHologramButton(6, 4, 212, layer).clickHandler(this::onClick);
} else {
builder.drawMultiblockMissingBar(this, layer);
addHologramButton(76, 56, 212, layer);
addHologramButton(76, 56, 212, layer).clickHandler(this::onClick);
builder.drawHologramButton(this, 76, 56, mouseX, mouseY, layer);
}
builder.drawMultiEnergyBar(this, 9, 19, (int) tile.getEnergy(), (int) tile.getMaxPower(), mouseX, mouseY, 0, layer);
}
@Override
public void actionPerformed(final GuiButton button) throws IOException {
super.actionPerformed(button);
public void onClick(GuiButtonExtended button, Double mouseX, Double mouseY){
if (button.id == 212 && GuiBase.slotConfigType == SlotConfigType.NONE) {
if (ClientProxy.multiblockRenderEvent.currentMultiblock == null) {
{

View file

@ -32,6 +32,7 @@ import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
import reborncore.ClientProxy;
import reborncore.client.gui.builder.GuiBase;
import reborncore.client.gui.builder.widget.GuiButtonExtended;
import reborncore.client.gui.guibuilder.GuiBuilder;
import reborncore.client.multiblock.Multiblock;
import reborncore.client.multiblock.MultiblockRenderEvent;
@ -89,18 +90,16 @@ public class GuiIndustrialSawmill extends GuiBase {
builder.drawProgressBar(this, tile.getProgressScaled(100), 100, 105, 47, mouseX, mouseY, GuiBuilder.ProgressDirection.RIGHT, layer);
builder.drawTank(this, 53, 25, mouseX, mouseY, tile.tank.getFluid(), tile.tank.getCapacity(), tile.tank.isEmpty(), layer);
if (tile.getMutliBlock()) {
addHologramButton(6, 4, 212, layer);
addHologramButton(6, 4, 212, layer).clickHandler(this::onClick);
} else {
builder.drawMultiblockMissingBar(this, layer);
addHologramButton(76, 56, 212, layer);
addHologramButton(76, 56, 212, layer).clickHandler(this::onClick);
builder.drawHologramButton(this, 76, 56, mouseX, mouseY, layer);
}
builder.drawMultiEnergyBar(this, 9, 19, (int) tile.getEnergy(), (int) tile.getMaxPower(), mouseX, mouseY, 0, layer);
}
@Override
public void actionPerformed(final GuiButton button) throws IOException {
super.actionPerformed(button);
public void onClick(GuiButtonExtended button, Double mouseX, Double mouseY){
if (button.id == 212 && GuiBase.slotConfigType == SlotConfigType.NONE) {
if (ClientProxy.multiblockRenderEvent.currentMultiblock == null) {
{

View file

@ -30,6 +30,7 @@ import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.ResourceLocation;
import reborncore.client.gui.builder.widget.GuiButtonExtended;
import techreborn.items.ItemManual;
import java.awt.*;
@ -57,8 +58,8 @@ public class GuiManual extends GuiScreen {
@Override
public void initGui() {
buttons.add(new GuiButton(1, (width / 2 - 30), (height / 2 - (guiHeight / 4)) + 17, 60, 20, I18n.format("techreborn.manual.wikibtn")));
buttons.add(new GuiButton(2, (width / 2 - 30), (height / 2) + 22, 60, 20, I18n.format("techreborn.manual.discordbtn")));
buttons.add(new GuiButtonExtended(1, (width / 2 - 30), (height / 2 - (guiHeight / 4)) + 17, 60, 20, I18n.format("techreborn.manual.wikibtn")).clickHandler(this::onClick));
buttons.add(new GuiButtonExtended(2, (width / 2 - 30), (height / 2) + 22, 60, 20, I18n.format("techreborn.manual.discordbtn")).clickHandler(this::onClick));
}
@Override
@ -73,8 +74,7 @@ public class GuiManual extends GuiScreen {
super.render(mouseX, mouseY, partialTicks);
}
@Override
protected void actionPerformed(GuiButton button) {
public void onClick(GuiButtonExtended button, Double mouseX, Double mouseY){
switch (button.id) {
case 1:
mc.displayGuiScreen(new GuiConfirmOpenLink(this, "http://wiki.techreborn.ovh", 1, false));
@ -86,7 +86,7 @@ public class GuiManual extends GuiScreen {
}
@Override
public void confirmClicked(boolean result, int id) {
public void confirmResult(boolean result, int id) {
switch(id) {
case 1:
if(result == true) {

View file

@ -75,11 +75,12 @@ public class GuiRollingMachine extends GuiBase {
}
@Override
protected void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException {
public boolean mouseClicked(double mouseX, double mouseY, int mouseButton) {
if(isPointInRect(130, 4, 20, 12, mouseX, mouseY)){
NetworkManager.sendToServer(ServerboundPackets.createPacketRollingMachineLock(rollingMachine, !rollingMachine.locked));
return;
return true;
}
super.mouseClicked(mouseX, mouseY, mouseButton);
return super.mouseClicked(mouseX, mouseY, mouseButton);
}
}

View file

@ -30,6 +30,7 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.math.BlockPos;
import reborncore.ClientProxy;
import reborncore.client.gui.builder.GuiBase;
import reborncore.client.gui.builder.widget.GuiButtonExtended;
import reborncore.client.gui.guibuilder.GuiBuilder;
import reborncore.client.multiblock.Multiblock;
import reborncore.client.multiblock.MultiblockRenderEvent;
@ -81,18 +82,16 @@ public class GuiVacuumFreezer extends GuiBase {
builder.drawProgressBar(this, tile.getProgressScaled(100), 100, 76, 48, mouseX, mouseY, GuiBuilder.ProgressDirection.RIGHT, layer);
if (tile.getMultiBlock()) {
addHologramButton(6, 4, 212, layer);
addHologramButton(6, 4, 212, layer).clickHandler(this::onClick);
} else {
builder.drawMultiblockMissingBar(this, layer);
addHologramButton(76, 56, 212, layer);
addHologramButton(76, 56, 212, layer).clickHandler(this::onClick);
builder.drawHologramButton(this, 76, 56, mouseX, mouseY, layer);
}
builder.drawMultiEnergyBar(this, 9, 19, (int) tile.getEnergy(), (int) tile.getMaxPower(), mouseX, mouseY, 0, layer);
}
@Override
public void actionPerformed(final GuiButton button) throws IOException {
super.actionPerformed(button);
public void onClick(GuiButtonExtended button, Double mouseX, Double mouseY){
if (button.id == 212 && GuiBase.slotConfigType == SlotConfigType.NONE) {
if (ClientProxy.multiblockRenderEvent.currentMultiblock == null) {
{