mirror of
https://github.com/barkeser2002/CatServer.git
synced 2026-09-25 13:46:10 +03:00
85 lines
3.6 KiB
Diff
85 lines
3.6 KiB
Diff
--- ../src-base/minecraft/net/minecraft/inventory/ContainerRepair.java
|
|
+++ ../src-work/minecraft/net/minecraft/inventory/ContainerRepair.java
|
|
@@ -18,6 +18,7 @@
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.logging.log4j.LogManager;
|
|
import org.apache.logging.log4j.Logger;
|
|
+import org.bukkit.craftbukkit.inventory.CraftInventoryView;
|
|
|
|
public class ContainerRepair extends Container
|
|
{
|
|
@@ -30,7 +31,21 @@
|
|
public int materialCost;
|
|
private String repairedItemName;
|
|
private final EntityPlayer thePlayer;
|
|
+ // CraftBukkit start
|
|
+ private CraftInventoryView bukkitEntity = null;
|
|
+ private InventoryPlayer player;
|
|
|
|
+ public CraftInventoryView getBukkitView() {
|
|
+ if (bukkitEntity != null) {
|
|
+ return bukkitEntity;
|
|
+ }
|
|
+
|
|
+ org.bukkit.craftbukkit.inventory.CraftInventory inventory = new org.bukkit.craftbukkit.inventory.CraftInventoryAnvil(
|
|
+ new org.bukkit.Location(theWorld.getWorld(), selfPosition.getX(), selfPosition.getY(), selfPosition.getZ()), this.inputSlots, this.outputSlot);
|
|
+ bukkitEntity = new CraftInventoryView(this.player.player.getBukkitEntity(), inventory, this);
|
|
+ return bukkitEntity;
|
|
+ }
|
|
+ // CraftBukkit end
|
|
@SideOnly(Side.CLIENT)
|
|
public ContainerRepair(InventoryPlayer playerInventory, World worldIn, EntityPlayer player)
|
|
{
|
|
@@ -39,6 +54,7 @@
|
|
|
|
public ContainerRepair(InventoryPlayer playerInventory, final World worldIn, final BlockPos blockPosIn, EntityPlayer player)
|
|
{
|
|
+ this.player = playerInventory; // CraftBukkit
|
|
this.outputSlot = new InventoryCraftResult();
|
|
this.inputSlots = new InventoryBasic("Repair", true, 2)
|
|
{
|
|
@@ -153,7 +169,7 @@
|
|
|
|
if (itemstack == null)
|
|
{
|
|
- this.outputSlot.setInventorySlotContents(0, (ItemStack)null);
|
|
+ org.bukkit.craftbukkit.event.CraftEventFactory.callPrepareAnvilEvent(getBukkitView(), null); // CraftBukkit
|
|
this.maximumCost = 0;
|
|
}
|
|
else
|
|
@@ -176,7 +192,7 @@
|
|
|
|
if (j2 <= 0)
|
|
{
|
|
- this.outputSlot.setInventorySlotContents(0, (ItemStack)null);
|
|
+ org.bukkit.craftbukkit.event.CraftEventFactory.callPrepareAnvilEvent(getBukkitView(), null); // CraftBukkit
|
|
this.maximumCost = 0;
|
|
return;
|
|
}
|
|
@@ -197,7 +213,7 @@
|
|
{
|
|
if (!flag && (itemstack1.getItem() != itemstack2.getItem() || !itemstack1.isItemStackDamageable()))
|
|
{
|
|
- this.outputSlot.setInventorySlotContents(0, (ItemStack)null);
|
|
+ org.bukkit.craftbukkit.event.CraftEventFactory.callPrepareAnvilEvent(getBukkitView(), null); // CraftBukkit
|
|
this.maximumCost = 0;
|
|
return;
|
|
}
|
|
@@ -337,7 +353,7 @@
|
|
EnchantmentHelper.setEnchantments(map, itemstack1);
|
|
}
|
|
|
|
- this.outputSlot.setInventorySlotContents(0, itemstack1);
|
|
+ org.bukkit.craftbukkit.event.CraftEventFactory.callPrepareAnvilEvent(getBukkitView(), itemstack1); // CraftBukkit
|
|
this.detectAndSendChanges();
|
|
}
|
|
}
|
|
@@ -377,6 +393,7 @@
|
|
|
|
public boolean canInteractWith(EntityPlayer playerIn)
|
|
{
|
|
+ if (!this.checkReachable) return true; // CraftBukkit
|
|
return this.theWorld.getBlockState(this.selfPosition).getBlock() != Blocks.ANVIL ? false : playerIn.getDistanceSq((double)this.selfPosition.getX() + 0.5D, (double)this.selfPosition.getY() + 0.5D, (double)this.selfPosition.getZ() + 0.5D) <= 64.0D;
|
|
}
|
|
|