summaryrefslogtreecommitdiffstats
path: root/src/main/java/net/minecraft/server/ContainerBrewingStand.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/net/minecraft/server/ContainerBrewingStand.java')
-rw-r--r--src/main/java/net/minecraft/server/ContainerBrewingStand.java53
1 files changed, 33 insertions, 20 deletions
diff --git a/src/main/java/net/minecraft/server/ContainerBrewingStand.java b/src/main/java/net/minecraft/server/ContainerBrewingStand.java
index b7d11dba..fa068f6c 100644
--- a/src/main/java/net/minecraft/server/ContainerBrewingStand.java
+++ b/src/main/java/net/minecraft/server/ContainerBrewingStand.java
@@ -1,5 +1,7 @@
package net.minecraft.server;
+import java.util.Iterator;
+
// CraftBukkit start
import org.bukkit.craftbukkit.inventory.CraftInventory;
import org.bukkit.craftbukkit.inventory.CraftInventoryView;
@@ -8,7 +10,8 @@ import org.bukkit.craftbukkit.inventory.CraftInventoryView;
public class ContainerBrewingStand extends Container {
private TileEntityBrewingStand brewingStand;
- private int b = 0;
+ private final Slot f;
+ private int g = 0;
// CraftBukkit start
private CraftInventoryView bukkitEntity = null;
private PlayerInventory player;
@@ -17,10 +20,10 @@ public class ContainerBrewingStand extends Container {
public ContainerBrewingStand(PlayerInventory playerinventory, TileEntityBrewingStand tileentitybrewingstand) {
player = playerinventory; // CraftBukkit
this.brewingStand = tileentitybrewingstand;
- this.a(new SlotPotionBottle(this, playerinventory.player, tileentitybrewingstand, 0, 56, 46));
- this.a(new SlotPotionBottle(this, playerinventory.player, tileentitybrewingstand, 1, 79, 53));
- this.a(new SlotPotionBottle(this, playerinventory.player, tileentitybrewingstand, 2, 102, 46));
- this.a(new SlotBrewing(this, tileentitybrewingstand, 3, 79, 17));
+ this.a(new SlotPotionBottle(playerinventory.player, tileentitybrewingstand, 0, 56, 46));
+ this.a(new SlotPotionBottle(playerinventory.player, tileentitybrewingstand, 1, 79, 53));
+ this.a(new SlotPotionBottle(playerinventory.player, tileentitybrewingstand, 2, 102, 46));
+ this.f = this.a(new SlotBrewing(this, tileentitybrewingstand, 3, 79, 17));
int i;
@@ -37,38 +40,47 @@ public class ContainerBrewingStand extends Container {
public void addSlotListener(ICrafting icrafting) {
super.addSlotListener(icrafting);
- icrafting.setContainerData(this, 0, this.brewingStand.i());
+ icrafting.setContainerData(this, 0, this.brewingStand.t_());
}
- public void a() {
- super.a();
+ public void b() {
+ super.b();
+ Iterator iterator = this.listeners.iterator();
- for (int i = 0; i < this.listeners.size(); ++i) {
- ICrafting icrafting = (ICrafting) this.listeners.get(i);
+ while (iterator.hasNext()) {
+ ICrafting icrafting = (ICrafting) iterator.next();
- if (this.b != this.brewingStand.i()) {
- icrafting.setContainerData(this, 0, this.brewingStand.i());
+ if (this.g != this.brewingStand.t_()) {
+ icrafting.setContainerData(this, 0, this.brewingStand.t_());
}
}
- this.b = this.brewingStand.i();
+ this.g = this.brewingStand.t_();
}
- public boolean b(EntityHuman entityhuman) {
+ public boolean c(EntityHuman entityhuman) {
if (!this.checkReachable) return true; // CraftBukkit
return this.brewingStand.a(entityhuman);
}
- public ItemStack a(int i) {
+ public ItemStack b(int i) {
ItemStack itemstack = null;
- Slot slot = (Slot) this.e.get(i);
+ Slot slot = (Slot) this.b.get(i);
- if (slot != null && slot.c()) {
+ if (slot != null && slot.d()) {
ItemStack itemstack1 = slot.getItem();
itemstack = itemstack1.cloneItemStack();
if ((i < 0 || i > 2) && i != 3) {
- if (i >= 4 && i < 31) {
+ if (!this.f.d() && this.f.isAllowed(itemstack1)) {
+ if (!this.a(itemstack1, 3, 4, false)) {
+ return null;
+ }
+ } else if (SlotPotionBottle.a_(itemstack)) {
+ if (!this.a(itemstack1, 0, 3, false)) {
+ return null;
+ }
+ } else if (i >= 4 && i < 31) {
if (!this.a(itemstack1, 31, 40, false)) {
return null;
}
@@ -90,14 +102,14 @@ public class ContainerBrewingStand extends Container {
if (itemstack1.count == 0) {
slot.set((ItemStack) null);
} else {
- slot.d();
+ slot.e();
}
if (itemstack1.count == itemstack.count) {
return null;
}
- slot.c(itemstack1);
+ slot.b(itemstack1);
}
return itemstack;
@@ -108,6 +120,7 @@ public class ContainerBrewingStand extends Container {
if (bukkitEntity != null) {
return bukkitEntity;
}
+
CraftInventory inventory = new CraftInventory(this.brewingStand);
bukkitEntity = new CraftInventoryView(this.player.player.getBukkitEntity(), inventory, this);
return bukkitEntity;