Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package dmz.icefeeling.ivi.tests;
- import net.minecraft.client.resources.I18n;
- import net.minecraft.entity.item.EntityItem;
- import net.minecraft.entity.player.EntityPlayer;
- import net.minecraft.entity.player.InventoryPlayer;
- import net.minecraft.inventory.Container;
- import net.minecraft.inventory.ContainerBrewingStand;
- import net.minecraft.inventory.ICrafting;
- import net.minecraft.inventory.IInventory;
- import net.minecraft.inventory.InventoryCrafting;
- import net.minecraft.inventory.Slot;
- import net.minecraft.item.ItemStack;
- import net.minecraft.item.crafting.FurnaceRecipes;
- import net.minecraft.tileentity.TileEntityFurnace;
- import net.minecraft.world.World;
- import net.minecraftforge.fml.relauncher.Side;
- import net.minecraftforge.fml.relauncher.SideOnly;
- public class ContainerObsidianAnvil extends Container {
- private TileEntityObsidianAnvil TEO;
- public ContainerObsidianAnvil(IInventory playerIn, TileEntityObsidianAnvil TEO) {
- this.TEO = TEO;
- this.addSlotToContainer(new Slot(TEO, 0, 1+9, 2+8));
- //Player Inventory
- /* for (int y = 0; y < 3; ++y) {
- for (int x = 0; x < 9; ++x) {
- this.addSlotToContainer(new Slot(playerIn, x + y * 9 + 9, 8 + x * 18, 41 + y * 18));
- }
- }
- //Player Hotbar
- for (int x = 0; x < 9; ++x) {
- this.addSlotToContainer(new Slot(playerIn, x, 8 + x * 18, 99));
- }*/
- for (int i = 0; i < 3; ++i)
- {
- for (int j = 0; j < 9; ++j)
- {
- this.addSlotToContainer(new Slot(playerIn, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
- }
- }
- for (int k = 0; k < 9; ++k)
- {
- this.addSlotToContainer(new Slot(playerIn, k, 8 + k * 18, 142));
- }
- }
- @Override
- public boolean canInteractWith(EntityPlayer playerIn) {
- return this.TEO.isUseableByPlayer(playerIn);
- }
- @Override
- public ItemStack transferStackInSlot(EntityPlayer playerIn, int fromSlot) {
- {
- ItemStack previous = null;
- Slot slot = (Slot) this.inventorySlots.get(fromSlot);
- if (slot != null && slot.getHasStack()) {
- ItemStack current = slot.getStack();
- previous = current.copy();
- if (fromSlot < 9) {
- // From TE Inventory to Player Inventory
- if (!this.mergeItemStack(current, 9, 45, true))
- return null;
- } else {
- // From Player Inventory to TE Inventory
- if (!this.mergeItemStack(current, 0, 9, false))
- return null;
- }
- if (current.stackSize == 0)
- slot.putStack((ItemStack) null);
- else
- slot.onSlotChanged();
- if (current.stackSize == previous.stackSize)
- return null;
- slot.onPickupFromSlot(playerIn, current);
- }
- return previous;
- }
- }
- }
Add Comment
Please, Sign In to add comment