mirror of
https://github.com/barkeser2002/CatServer.git
synced 2026-09-25 02:20:01 +03:00
99 lines
4.2 KiB
Diff
99 lines
4.2 KiB
Diff
--- ../src-base/minecraft/net/minecraft/inventory/ContainerBrewingStand.java
|
|
+++ ../src-work/minecraft/net/minecraft/inventory/ContainerBrewingStand.java
|
|
@@ -12,6 +12,8 @@
|
|
import net.minecraft.potion.PotionUtils;
|
|
import net.minecraftforge.fml.relauncher.Side;
|
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
|
+import org.bukkit.craftbukkit.inventory.CraftInventoryBrewer;
|
|
+import org.bukkit.craftbukkit.inventory.CraftInventoryView;
|
|
|
|
public class ContainerBrewingStand extends Container
|
|
{
|
|
@@ -20,14 +22,18 @@
|
|
private int prevBrewTime;
|
|
private int prevFuel;
|
|
|
|
+ private CraftInventoryView bukkitEntity = null;
|
|
+ private InventoryPlayer player;
|
|
+
|
|
public ContainerBrewingStand(InventoryPlayer playerInventory, IInventory tileBrewingStandIn)
|
|
{
|
|
+ this.player = playerInventory;
|
|
this.tileBrewingStand = tileBrewingStandIn;
|
|
- this.addSlotToContainer(new ContainerBrewingStand.Potion(tileBrewingStandIn, 0, 56, 51));
|
|
- this.addSlotToContainer(new ContainerBrewingStand.Potion(tileBrewingStandIn, 1, 79, 58));
|
|
- this.addSlotToContainer(new ContainerBrewingStand.Potion(tileBrewingStandIn, 2, 102, 51));
|
|
- this.slot = this.addSlotToContainer(new ContainerBrewingStand.Ingredient(tileBrewingStandIn, 3, 79, 17));
|
|
- this.addSlotToContainer(new ContainerBrewingStand.Fuel(tileBrewingStandIn, 4, 17, 17));
|
|
+ this.addSlotToContainer(new Potion(tileBrewingStandIn, 0, 56, 51));
|
|
+ this.addSlotToContainer(new Potion(tileBrewingStandIn, 1, 79, 58));
|
|
+ this.addSlotToContainer(new Potion(tileBrewingStandIn, 2, 102, 51));
|
|
+ this.slot = this.addSlotToContainer(new Ingredient(tileBrewingStandIn, 3, 79, 17));
|
|
+ this.addSlotToContainer(new Fuel(tileBrewingStandIn, 4, 17, 17));
|
|
|
|
for (int i = 0; i < 3; ++i)
|
|
{
|
|
@@ -80,6 +86,7 @@
|
|
|
|
public boolean canInteractWith(EntityPlayer playerIn)
|
|
{
|
|
+ if (!this.checkReachable) return true;
|
|
return this.tileBrewingStand.isUsableByPlayer(playerIn);
|
|
}
|
|
|
|
@@ -102,14 +109,14 @@
|
|
return ItemStack.EMPTY;
|
|
}
|
|
}
|
|
- else if (ContainerBrewingStand.Potion.canHoldPotion(itemstack) && itemstack.getCount() == 1)
|
|
+ else if (Potion.canHoldPotion(itemstack) && itemstack.getCount() == 1)
|
|
{
|
|
if (!this.mergeItemStack(itemstack1, 0, 3, false))
|
|
{
|
|
return ItemStack.EMPTY;
|
|
}
|
|
}
|
|
- else if (ContainerBrewingStand.Fuel.isValidBrewingFuel(itemstack))
|
|
+ else if (Fuel.isValidBrewingFuel(itemstack))
|
|
{
|
|
if (!this.mergeItemStack(itemstack1, 4, 5, false))
|
|
{
|
|
@@ -197,7 +204,7 @@
|
|
|
|
public boolean isItemValid(ItemStack stack)
|
|
{
|
|
- return PotionHelper.isReagent(stack);
|
|
+ return net.minecraftforge.common.brewing.BrewingRecipeRegistry.isValidIngredient(stack);
|
|
}
|
|
|
|
public int getSlotStackLimit()
|
|
@@ -229,6 +236,7 @@
|
|
|
|
if (thePlayer instanceof EntityPlayerMP)
|
|
{
|
|
+ net.minecraftforge.event.ForgeEventFactory.onPlayerBrewedPotion(thePlayer, stack);
|
|
CriteriaTriggers.BREWED_POTION.trigger((EntityPlayerMP)thePlayer, potiontype);
|
|
}
|
|
|
|
@@ -238,8 +246,18 @@
|
|
|
|
public static boolean canHoldPotion(ItemStack stack)
|
|
{
|
|
- Item item = stack.getItem();
|
|
- return item == Items.POTIONITEM || item == Items.SPLASH_POTION || item == Items.LINGERING_POTION || item == Items.GLASS_BOTTLE;
|
|
+ return net.minecraftforge.common.brewing.BrewingRecipeRegistry.isValidInput(stack);
|
|
}
|
|
}
|
|
+
|
|
+ @Override
|
|
+ public CraftInventoryView getBukkitView() {
|
|
+ if (bukkitEntity != null) {
|
|
+ return bukkitEntity;
|
|
+ }
|
|
+
|
|
+ CraftInventoryBrewer inventory = new CraftInventoryBrewer(this.tileBrewingStand);
|
|
+ bukkitEntity = new CraftInventoryView(this.player.player.getBukkitEntity(), inventory, this);
|
|
+ return bukkitEntity;
|
|
+ }
|
|
}
|