Updated AESU GUI
This commit is contained in:
parent
45d2df8650
commit
58aac2ce0b
8 changed files with 238 additions and 259 deletions
|
@ -1,102 +0,0 @@
|
|||
/*
|
||||
* This file is part of TechReborn, licensed under the MIT License (MIT).
|
||||
*
|
||||
* Copyright (c) 2017 TechReborn
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package techreborn.client.container;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IContainerListener;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import reborncore.client.gui.slots.BaseSlot;
|
||||
import reborncore.common.container.RebornContainer;
|
||||
import techreborn.tiles.storage.TileAdjustableSU;
|
||||
|
||||
public class ContainerAESU extends RebornContainer {
|
||||
|
||||
public int euOut;
|
||||
public int storedEu;
|
||||
public int euChange;
|
||||
EntityPlayer player;
|
||||
TileAdjustableSU tile;
|
||||
|
||||
public ContainerAESU(TileAdjustableSU tileaesu, EntityPlayer player) {
|
||||
tile = tileaesu;
|
||||
this.player = player;
|
||||
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 3; ++i) {
|
||||
for (int j = 0; j < 9; ++j) {
|
||||
this.addSlotToContainer(new BaseSlot(player.inventory, j + i * 9 + 9, 8 + j * 18, 115 + i * 18));
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < 9; ++i) {
|
||||
this.addSlotToContainer(new BaseSlot(player.inventory, i, 8 + i * 18, 173));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInteractWith(EntityPlayer player) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void detectAndSendChanges() {
|
||||
super.detectAndSendChanges();
|
||||
for (int i = 0; i < this.listeners.size(); i++) {
|
||||
IContainerListener IContainerListener = this.listeners.get(i);
|
||||
if (this.euOut != tile.getMaxOutput()) {
|
||||
IContainerListener.sendWindowProperty(this, 0, (int) tile.getMaxOutput());
|
||||
}
|
||||
if (this.storedEu != tile.getEnergy()) {
|
||||
IContainerListener.sendWindowProperty(this, 1, (int) tile.getEnergy());
|
||||
}
|
||||
if (this.euChange != tile.getEuChange() && tile.getEuChange() != -1) {
|
||||
IContainerListener.sendWindowProperty(this, 2, (int) tile.getEuChange());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addListener(IContainerListener crafting) {
|
||||
super.addListener(crafting);
|
||||
crafting.sendWindowProperty(this, 0, (int) tile.getMaxOutput());
|
||||
crafting.sendWindowProperty(this, 1, (int) tile.getEnergy());
|
||||
crafting.sendWindowProperty(this, 2, (int) tile.getEuChange());
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void updateProgressBar(int id, int value) {
|
||||
if (id == 0) {
|
||||
this.euOut = value;
|
||||
} else if (id == 1) {
|
||||
this.storedEu = value;
|
||||
} else if (id == 2) {
|
||||
this.euChange = value;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue