This repository has been archived by the owner on Jul 21, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed #29 and added missing Redstone change event to TitleEntityChest…
… also added missing ContainerChest patches
- Loading branch information
Showing
4 changed files
with
103 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
--- ../src-base/minecraft/net/minecraft/inventory/ContainerChest.java | ||
+++ ../src-work/minecraft/net/minecraft/inventory/ContainerChest.java | ||
@@ -1,13 +1,19 @@ | ||
package net.minecraft.inventory; | ||
|
||
import net.minecraft.entity.player.EntityPlayer; | ||
+import net.minecraft.entity.player.InventoryPlayer; | ||
import net.minecraft.item.ItemStack; | ||
+import org.bukkit.craftbukkit.v1_12_R1.inventory.CraftInventory; | ||
+import org.bukkit.craftbukkit.v1_12_R1.inventory.CraftInventoryView; | ||
|
||
public class ContainerChest extends Container | ||
{ | ||
private final IInventory lowerChestInventory; | ||
private final int numRows; | ||
|
||
+ private CraftInventoryView bukkitEntity = null; | ||
+ private InventoryPlayer player; | ||
+ | ||
public ContainerChest(IInventory playerInventory, IInventory chestInventory, EntityPlayer player) | ||
{ | ||
this.lowerChestInventory = chestInventory; | ||
@@ -15,6 +21,8 @@ | ||
chestInventory.openInventory(player); | ||
int i = (this.numRows - 4) * 18; | ||
|
||
+ this.player = (InventoryPlayer) playerInventory; | ||
+ | ||
for (int j = 0; j < this.numRows; ++j) | ||
{ | ||
for (int k = 0; k < 9; ++k) | ||
@@ -39,6 +47,7 @@ | ||
|
||
public boolean canInteractWith(EntityPlayer playerIn) | ||
{ | ||
+ if (!this.checkReachable) return true; | ||
return this.lowerChestInventory.isUsableByPlayer(playerIn); | ||
} | ||
|
||
@@ -87,4 +96,26 @@ | ||
{ | ||
return this.lowerChestInventory; | ||
} | ||
+ | ||
+ @Override | ||
+ public CraftInventoryView getBukkitView() { | ||
+ if (bukkitEntity != null) { | ||
+ return bukkitEntity; | ||
+ } | ||
+ | ||
+ CraftInventory inventory; | ||
+ if (this.lowerChestInventory instanceof InventoryPlayer) { | ||
+ inventory = new org.bukkit.craftbukkit.v1_12_R1.inventory.CraftInventoryPlayer( | ||
+ (InventoryPlayer) this.lowerChestInventory); | ||
+ } else if (this.lowerChestInventory instanceof InventoryLargeChest) { | ||
+ inventory = new org.bukkit.craftbukkit.v1_12_R1.inventory.CraftInventoryDoubleChest( | ||
+ (InventoryLargeChest) this.lowerChestInventory); | ||
+ } else { | ||
+ inventory = new CraftInventory(this.lowerChestInventory); | ||
+ } | ||
+ | ||
+ bukkitEntity = new CraftInventoryView(this.player.player.getBukkitEntity(), inventory, | ||
+ this); | ||
+ return bukkitEntity; | ||
+ } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters