summaryrefslogtreecommitdiffstats
path: root/nms-patches
diff options
context:
space:
mode:
authormd_5 <git@md-5.net>2017-04-19 18:04:32 +1000
committermd_5 <git@md-5.net>2017-04-19 18:04:32 +1000
commitbe9ef980b9aa272acf298a337da8157c6a620e95 (patch)
tree912af53e1361cea82c76121c6ccaf7e28561a414 /nms-patches
parente04a1793ae35519baf1f9e1b94c812a6e6712d5a (diff)
downloadcraftbukkit-be9ef980b9aa272acf298a337da8157c6a620e95.tar
craftbukkit-be9ef980b9aa272acf298a337da8157c6a620e95.tar.gz
craftbukkit-be9ef980b9aa272acf298a337da8157c6a620e95.tar.lz
craftbukkit-be9ef980b9aa272acf298a337da8157c6a620e95.tar.xz
craftbukkit-be9ef980b9aa272acf298a337da8157c6a620e95.zip
Implement cooldown API
Diffstat (limited to 'nms-patches')
-rw-r--r--nms-patches/ItemCooldown.patch26
-rw-r--r--nms-patches/PlayerInteractManager.patch21
2 files changed, 38 insertions, 9 deletions
diff --git a/nms-patches/ItemCooldown.patch b/nms-patches/ItemCooldown.patch
new file mode 100644
index 00000000..8925a837
--- /dev/null
+++ b/nms-patches/ItemCooldown.patch
@@ -0,0 +1,26 @@
+--- a/net/minecraft/server/ItemCooldown.java
++++ b/net/minecraft/server/ItemCooldown.java
+@@ -7,8 +7,8 @@
+
+ public class ItemCooldown {
+
+- private final Map<Item, ItemCooldown.Info> a = Maps.newHashMap();
+- private int b;
++ public final Map<Item, ItemCooldown.Info> a = Maps.newHashMap(); // PAIL: private->public
++ public int b; // PAIL: currentTick, private->public
+
+ public ItemCooldown() {}
+
+@@ -55,10 +55,10 @@
+
+ protected void c(Item item) {}
+
+- class Info {
++ public class Info { // PAIL: private->public
+
+ final int a;
+- final int b;
++ public final int b; // PAIL: endTick, private->public
+
+ private Info(int i, int j) {
+ this.a = i;
diff --git a/nms-patches/PlayerInteractManager.patch b/nms-patches/PlayerInteractManager.patch
index ba41f0f4..3db81a13 100644
--- a/nms-patches/PlayerInteractManager.patch
+++ b/nms-patches/PlayerInteractManager.patch
@@ -52,7 +52,7 @@
if (this.isCreative()) {
if (!this.world.douseFire((EntityHuman) null, blockposition, enumdirection)) {
this.breakBlock(blockposition);
-@@ -125,15 +146,49 @@
+@@ -125,14 +146,48 @@
}
}
@@ -79,8 +79,8 @@
f = iblockdata.a((EntityHuman) this.player, this.player.world, blockposition);
+ // Allow fire punching to be blocked
+ this.world.douseFire((EntityHuman) null, blockposition, enumdirection);
- }
-
++ }
++
+ if (event.useItemInHand() == Event.Result.DENY) {
+ // If we 'insta destroyed' then the client needs to be informed.
+ if (f > 1.0f) {
@@ -98,12 +98,11 @@
+
+ if (blockEvent.getInstaBreak()) {
+ f = 2.0f;
-+ }
+ }
+ // CraftBukkit end
-+
+
if (iblockdata.getMaterial() != Material.AIR && f >= 1.0F) {
this.breakBlock(blockposition);
- } else {
@@ -150,6 +205,7 @@
public void a(BlockPosition blockposition) {
@@ -224,7 +223,7 @@
return flag;
}
}
-@@ -280,63 +419,86 @@
+@@ -280,63 +419,90 @@
}
}
@@ -250,12 +249,16 @@
- if (itileinventory instanceof TileEntityChest && block instanceof BlockChest) {
- itileinventory = ((BlockChest) block).c(world, blockposition);
- }
-+ if (itemstack.getItem() instanceof ItemBlock && !entityhuman.dk()) { // PAIL: creativeAndOp
-+ Block block1 = ((ItemBlock) itemstack.getItem()).getBlock();
++ if (entityhuman.di().a(itemstack.getItem())) {
++ cancelledBlock = true;
++ }
- if (itileinventory != null) {
- entityhuman.openContainer(itileinventory);
- return EnumInteractionResult.SUCCESS;
++ if (itemstack.getItem() instanceof ItemBlock && !entityhuman.dk()) { // PAIL: creativeAndOp
++ Block block1 = ((ItemBlock) itemstack.getItem()).getBlock();
++
+ if (block1 instanceof BlockCommand || block1 instanceof BlockStructure) {
+ cancelledBlock = true;
}