Files
Binnie/src/main/java/binnie/extratrees/craftgui/ControlTankSlot.java
T
Alexander Kornilov fe56638f16 [1.7.10] Removed unfinished features (#118)
* Removed unused Honey Crystal

* Removed unfinished kitchen machines
Removed Alcohol

* Removed unused items

* Removed unused PNGs

* Fix README.md
2017-06-18 20:24:45 -07:00

41 lines
1.2 KiB
Java

package binnie.extratrees.craftgui;
import binnie.core.craftgui.IWidget;
import binnie.core.craftgui.events.EventMouse;
import binnie.core.craftgui.geometry.IArea;
import binnie.core.craftgui.minecraft.Window;
import net.minecraft.nbt.NBTTagCompound;
public class ControlTankSlot extends ControlSlotFluid {
protected int tankID;
public ControlTankSlot(IWidget parent, int x, int y, int i) {
super(parent, x, y, null);
tankID = 0;
tankID = i;
addSelfEventHandler(new EventMouse.Down.Handler() {
@Override
public void onEvent(EventMouse.Down event) {
if (event.getButton() == 0) {
NBTTagCompound nbt = new NBTTagCompound();
nbt.setByte("id", (byte) tankID);
Window.get(getWidget()).sendClientAction("tank-click", nbt);
}
}
});
}
@Override
public void onUpdateClient() {
fluidStack = Window.get(this).getContainer().getTankInfo(tankID).liquid;
int height = (int) (16.0f * (((fluidStack == null) ? 0 : fluidStack.amount) / 1000.0f));
itemDisplay.setCroppedZone(itemDisplay, new IArea(0.0f, 16 - height, 16.0f, 16.0f));
super.onUpdateClient();
}
@Override
public void onRenderBackground() {
super.onRenderBackground();
}
}