mirror of
https://github.com/GTNewHorizons/Binnie.git
synced 2026-11-21 04:32:24 +00:00
* Finalize, minor alloc reduction Also enable Jabel and generic injection * Update dependencies.gradle * Clean up Machine a bit * spotless more enhanced instanceof * Update ModuleMachine.java * More clen * WARN: Removed exception catching * Many, many tiny patches + birthday fix * Spotless * Spotless again * Fix getLow and clamp tolerance value * Revert event -> ignored on unused event parameters * Rename instanceof variables * Update Machine.java * Use StringBuilder * Cache getStack() * Oops, Jabel can't handle that * Spotless * Spotless again My IDE was fighting with it * Remove unused elements + scream test success
43 lines
1.4 KiB
Java
43 lines
1.4 KiB
Java
package binnie.extratrees.craftgui;
|
|
|
|
import net.minecraft.item.ItemStack;
|
|
import net.minecraft.nbt.NBTTagCompound;
|
|
import net.minecraft.tileentity.TileEntity;
|
|
|
|
import binnie.core.craftgui.IWidget;
|
|
import binnie.core.craftgui.events.EventMouse;
|
|
import binnie.core.craftgui.minecraft.Window;
|
|
import binnie.core.craftgui.minecraft.control.ControlSlotBase;
|
|
import binnie.core.machines.Machine;
|
|
import binnie.core.machines.TileEntityMachine;
|
|
import binnie.core.machines.component.IComponentRecipe;
|
|
|
|
public class ControlRecipeSlot extends ControlSlotBase {
|
|
|
|
public ControlRecipeSlot(IWidget parent, int x, int y) {
|
|
super(parent, x, y, 50);
|
|
addSelfEventHandler(new MouseDownHandler());
|
|
setRotating();
|
|
}
|
|
|
|
@Override
|
|
public ItemStack getItemStack() {
|
|
IComponentRecipe recipe = Machine.getInterface(IComponentRecipe.class, Window.get(this).getInventory());
|
|
return recipe.isRecipe() ? recipe.getProduct() : null;
|
|
}
|
|
|
|
private class MouseDownHandler extends EventMouse.Down.Handler {
|
|
|
|
@Override
|
|
public void onEvent(EventMouse.Down event) {
|
|
TileEntity tile = (TileEntity) Window.get(getWidget()).getInventory();
|
|
if (!(tile instanceof TileEntityMachine)) {
|
|
return;
|
|
}
|
|
|
|
NBTTagCompound nbt = new NBTTagCompound();
|
|
Window.get(getWidget()).sendClientAction("recipe", nbt);
|
|
}
|
|
}
|
|
}
|