mirror of
https://github.com/barkeser2002/CatServer.git
synced 2026-09-25 02:20:01 +03:00
131 lines
4.0 KiB
Diff
131 lines
4.0 KiB
Diff
--- ../src-base/minecraft/net/minecraft/tileentity/TileEntityShulkerBox.java
|
|
+++ ../src-work/minecraft/net/minecraft/tileentity/TileEntityShulkerBox.java
|
|
@@ -2,6 +2,10 @@
|
|
|
|
import java.util.List;
|
|
import javax.annotation.Nullable;
|
|
+
|
|
+import org.bukkit.craftbukkit.entity.CraftHumanEntity;
|
|
+import org.bukkit.entity.HumanEntity;
|
|
+
|
|
import net.minecraft.block.Block;
|
|
import net.minecraft.block.BlockShulkerBox;
|
|
import net.minecraft.block.material.EnumPushReaction;
|
|
@@ -36,12 +40,35 @@
|
|
private NonNullList<ItemStack> items;
|
|
private boolean hasBeenCleared;
|
|
private int openCount;
|
|
- private TileEntityShulkerBox.AnimationStatus animationStatus;
|
|
+ private AnimationStatus animationStatus;
|
|
private float progress;
|
|
private float progressOld;
|
|
private EnumDyeColor color;
|
|
private boolean destroyedByCreativePlayer;
|
|
-
|
|
+ // CraftBukkit start - add fields and methods
|
|
+ public List<HumanEntity> transaction = new java.util.ArrayList<HumanEntity>();
|
|
+ private int maxStack = MAX_STACK;
|
|
+
|
|
+ public List<ItemStack> getContents() {
|
|
+ return this.items;
|
|
+ }
|
|
+
|
|
+ public void onOpen(CraftHumanEntity who) {
|
|
+ transaction.add(who);
|
|
+ }
|
|
+
|
|
+ public void onClose(CraftHumanEntity who) {
|
|
+ transaction.remove(who);
|
|
+ }
|
|
+
|
|
+ public List<HumanEntity> getViewers() {
|
|
+ return transaction;
|
|
+ }
|
|
+
|
|
+ public void setMaxStackSize(int size) {
|
|
+ maxStack = size;
|
|
+ }
|
|
+ // CraftBukkit end
|
|
public TileEntityShulkerBox()
|
|
{
|
|
this((EnumDyeColor)null);
|
|
@@ -50,7 +77,7 @@
|
|
public TileEntityShulkerBox(@Nullable EnumDyeColor colorIn)
|
|
{
|
|
this.items = NonNullList.<ItemStack>withSize(27, ItemStack.EMPTY);
|
|
- this.animationStatus = TileEntityShulkerBox.AnimationStatus.CLOSED;
|
|
+ this.animationStatus = AnimationStatus.CLOSED;
|
|
this.color = colorIn;
|
|
}
|
|
|
|
@@ -58,7 +85,7 @@
|
|
{
|
|
this.updateAnimation();
|
|
|
|
- if (this.animationStatus == TileEntityShulkerBox.AnimationStatus.OPENING || this.animationStatus == TileEntityShulkerBox.AnimationStatus.CLOSING)
|
|
+ if (this.animationStatus == AnimationStatus.OPENING || this.animationStatus == AnimationStatus.CLOSING)
|
|
{
|
|
this.moveCollidedEntities();
|
|
}
|
|
@@ -79,7 +106,7 @@
|
|
if (this.progress >= 1.0F)
|
|
{
|
|
this.moveCollidedEntities();
|
|
- this.animationStatus = TileEntityShulkerBox.AnimationStatus.OPENED;
|
|
+ this.animationStatus = AnimationStatus.OPENED;
|
|
this.progress = 1.0F;
|
|
}
|
|
|
|
@@ -89,7 +116,7 @@
|
|
|
|
if (this.progress <= 0.0F)
|
|
{
|
|
- this.animationStatus = TileEntityShulkerBox.AnimationStatus.CLOSED;
|
|
+ this.animationStatus = AnimationStatus.CLOSED;
|
|
this.progress = 0.0F;
|
|
}
|
|
|
|
@@ -99,7 +126,7 @@
|
|
}
|
|
}
|
|
|
|
- public TileEntityShulkerBox.AnimationStatus getAnimationStatus()
|
|
+ public AnimationStatus getAnimationStatus()
|
|
{
|
|
return this.animationStatus;
|
|
}
|
|
@@ -199,7 +226,7 @@
|
|
|
|
public int getInventoryStackLimit()
|
|
{
|
|
- return 64;
|
|
+ return maxStack;
|
|
}
|
|
|
|
public boolean receiveClientEvent(int id, int type)
|
|
@@ -210,12 +237,12 @@
|
|
|
|
if (type == 0)
|
|
{
|
|
- this.animationStatus = TileEntityShulkerBox.AnimationStatus.CLOSING;
|
|
+ this.animationStatus = AnimationStatus.CLOSING;
|
|
}
|
|
|
|
if (type == 1)
|
|
{
|
|
- this.animationStatus = TileEntityShulkerBox.AnimationStatus.OPENING;
|
|
+ this.animationStatus = AnimationStatus.OPENING;
|
|
}
|
|
|
|
return true;
|
|
@@ -422,4 +449,9 @@
|
|
OPENED,
|
|
CLOSING;
|
|
}
|
|
+
|
|
+ protected net.minecraftforge.items.IItemHandler createUnSidedHandler()
|
|
+ {
|
|
+ return new net.minecraftforge.items.wrapper.SidedInvWrapper(this, EnumFacing.UP);
|
|
+ }
|
|
}
|