mirror of
https://github.com/GTNewHorizons/NotEnoughEnergistics.git
synced 2026-11-27 23:33:13 +00:00
47 lines
1.3 KiB
Java
47 lines
1.3 KiB
Java
package com.github.vfyjxf.nee.container;
|
|
|
|
import net.minecraft.entity.player.EntityPlayer;
|
|
import net.minecraft.entity.player.InventoryPlayer;
|
|
|
|
import com.github.vfyjxf.nee.block.tile.TilePatternInterface;
|
|
|
|
import appeng.api.storage.ITerminalHost;
|
|
import appeng.container.implementations.ContainerCraftConfirm;
|
|
import appeng.util.Platform;
|
|
|
|
public class ContainerCraftingConfirm extends ContainerCraftConfirm {
|
|
|
|
private TilePatternInterface tile;
|
|
private int patternIndex;
|
|
private boolean hasWorkCommitted = false;
|
|
|
|
public ContainerCraftingConfirm(InventoryPlayer ip, ITerminalHost te) {
|
|
super(ip, te);
|
|
}
|
|
|
|
@Override
|
|
public void startJob() {
|
|
if (Platform.isServer()) {
|
|
hasWorkCommitted = true;
|
|
}
|
|
super.startJob();
|
|
}
|
|
|
|
@Override
|
|
public void onContainerClosed(EntityPlayer par1EntityPlayer) {
|
|
super.onContainerClosed(par1EntityPlayer);
|
|
if (Platform.isServer() && tile != null && !hasWorkCommitted) {
|
|
this.tile.getPatternInventory().setInventorySlotContents(patternIndex, null);
|
|
this.tile.updateCraftingList();
|
|
}
|
|
}
|
|
|
|
public void setTile(TilePatternInterface tile) {
|
|
this.tile = tile;
|
|
}
|
|
|
|
public void setPatternIndex(int patternIndex) {
|
|
this.patternIndex = patternIndex;
|
|
}
|
|
}
|