mirror of
https://github.com/barkeser2002/CatServer.git
synced 2026-09-25 06:40:05 +03:00
83 lines
3.0 KiB
Diff
83 lines
3.0 KiB
Diff
--- ../src-base/minecraft/net/minecraft/inventory/ContainerBeacon.java
|
|
+++ ../src-work/minecraft/net/minecraft/inventory/ContainerBeacon.java
|
|
@@ -1,21 +1,26 @@
|
|
package net.minecraft.inventory;
|
|
|
|
import net.minecraft.entity.player.EntityPlayer;
|
|
-import net.minecraft.init.Items;
|
|
-import net.minecraft.item.Item;
|
|
+import net.minecraft.entity.player.InventoryPlayer;
|
|
import net.minecraft.item.ItemStack;
|
|
+import net.minecraft.tileentity.TileEntityBeacon;
|
|
import net.minecraftforge.fml.relauncher.Side;
|
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
|
+import org.bukkit.craftbukkit.inventory.CraftInventoryView;
|
|
|
|
public class ContainerBeacon extends Container
|
|
{
|
|
private final IInventory tileBeacon;
|
|
- private final ContainerBeacon.BeaconSlot beaconSlot;
|
|
+ private final BeaconSlot beaconSlot;
|
|
|
|
+ private CraftInventoryView bukkitEntity = null;
|
|
+ private InventoryPlayer player;
|
|
+
|
|
public ContainerBeacon(IInventory playerInventory, IInventory tileBeaconIn)
|
|
{
|
|
+ player = (InventoryPlayer) playerInventory; // CraftBukkit - TODO: check this
|
|
this.tileBeacon = tileBeaconIn;
|
|
- this.beaconSlot = new ContainerBeacon.BeaconSlot(tileBeaconIn, 0, 136, 110);
|
|
+ this.beaconSlot = new BeaconSlot(tileBeaconIn, 0, 136, 110);
|
|
this.addSlotToContainer(this.beaconSlot);
|
|
int i = 36;
|
|
int j = 137;
|
|
@@ -68,6 +73,7 @@
|
|
|
|
public boolean canInteractWith(EntityPlayer playerIn)
|
|
{
|
|
+ if (!this.checkReachable) return true;
|
|
return this.tileBeacon.isUsableByPlayer(playerIn);
|
|
}
|
|
|
|
@@ -90,12 +96,9 @@
|
|
|
|
slot.onSlotChange(itemstack1, itemstack);
|
|
}
|
|
- else if (!this.beaconSlot.getHasStack() && this.beaconSlot.isItemValid(itemstack1) && itemstack1.getCount() == 1)
|
|
+ else if (this.mergeItemStack(itemstack1, 0, 1, false)) //Forge Fix Shift Clicking in beacons with stacks larger then 1.
|
|
{
|
|
- if (!this.mergeItemStack(itemstack1, 0, 1, false))
|
|
- {
|
|
- return ItemStack.EMPTY;
|
|
- }
|
|
+ return ItemStack.EMPTY;
|
|
}
|
|
else if (index >= 1 && index < 28)
|
|
{
|
|
@@ -145,8 +148,7 @@
|
|
|
|
public boolean isItemValid(ItemStack stack)
|
|
{
|
|
- Item item = stack.getItem();
|
|
- return item == Items.EMERALD || item == Items.DIAMOND || item == Items.GOLD_INGOT || item == Items.IRON_INGOT;
|
|
+ return stack.getItem().isBeaconPayment(stack);
|
|
}
|
|
|
|
public int getSlotStackLimit()
|
|
@@ -154,4 +156,15 @@
|
|
return 1;
|
|
}
|
|
}
|
|
+
|
|
+ @Override
|
|
+ public CraftInventoryView getBukkitView() {
|
|
+ if (bukkitEntity != null) {
|
|
+ return bukkitEntity;
|
|
+ }
|
|
+
|
|
+ org.bukkit.craftbukkit.inventory.CraftInventory inventory = new org.bukkit.craftbukkit.inventory.CraftInventoryBeacon(this.tileBeacon); // CatServer
|
|
+ bukkitEntity = new CraftInventoryView(this.player.player.getBukkitEntity(), inventory, this);
|
|
+ return bukkitEntity;
|
|
+ }
|
|
}
|