2015-01-29 21:26:20 +00:00
|
|
|
From 7fb18d989c5d335b8686f0ef4ba9f519a4ed0234 Mon Sep 17 00:00:00 2001
|
2014-12-19 22:35:01 +00:00
|
|
|
From: Aikar <aikar@aikar.co>
|
|
|
|
Date: Fri, 19 Dec 2014 16:28:22 -0600
|
|
|
|
Subject: [PATCH] Remove CraftBukkit "Feature" of ItemStack's having infinite
|
|
|
|
use if less than 0 stack size
|
|
|
|
|
|
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/DispenseBehaviorItem.java b/src/main/java/net/minecraft/server/DispenseBehaviorItem.java
|
2015-01-07 04:13:40 +00:00
|
|
|
index 63388cf..0195cdc 100644
|
2014-12-19 22:35:01 +00:00
|
|
|
--- a/src/main/java/net/minecraft/server/DispenseBehaviorItem.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/DispenseBehaviorItem.java
|
|
|
|
@@ -10,6 +10,7 @@ public class DispenseBehaviorItem implements IDispenseBehavior {
|
|
|
|
public DispenseBehaviorItem() {}
|
|
|
|
|
|
|
|
public final ItemStack a(ISourceBlock isourceblock, ItemStack itemstack) {
|
|
|
|
+ if (itemstack != null && itemstack.count < 0) itemstack.count = 0; // PaperSpigot - Remove CB 'feature' of infinite items
|
|
|
|
ItemStack itemstack1 = this.b(isourceblock, itemstack);
|
|
|
|
|
|
|
|
this.a(isourceblock);
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/EntityAgeable.java b/src/main/java/net/minecraft/server/EntityAgeable.java
|
|
|
|
index 23091bd..930682a 100644
|
|
|
|
--- a/src/main/java/net/minecraft/server/EntityAgeable.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/EntityAgeable.java
|
|
|
|
@@ -60,7 +60,7 @@ public abstract class EntityAgeable extends EntityCreature {
|
|
|
|
|
|
|
|
if (!entityhuman.abilities.canInstantlyBuild) {
|
|
|
|
--itemstack.count;
|
|
|
|
- if (itemstack.count == 0) { // CraftBukkit - allow less than 0 stacks as "infinite"
|
|
|
|
+ if (itemstack.count <= 0) { // PaperSpigot - Remove CB 'feature' of infinite items
|
|
|
|
entityhuman.inventory.setItem(entityhuman.inventory.itemInHandIndex, (ItemStack) null);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/EntityHorse.java b/src/main/java/net/minecraft/server/EntityHorse.java
|
|
|
|
index 326c043..f93a291 100644
|
|
|
|
--- a/src/main/java/net/minecraft/server/EntityHorse.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/EntityHorse.java
|
|
|
|
@@ -635,7 +635,7 @@ public class EntityHorse extends EntityAnimal implements IInventoryListener {
|
|
|
|
}
|
|
|
|
|
|
|
|
if (flag) {
|
|
|
|
- if (!entityhuman.abilities.canInstantlyBuild && --itemstack.count == 0) {
|
|
|
|
+ if (!entityhuman.abilities.canInstantlyBuild && --itemstack.count <= 0) { // PaperSpigot - Remove CB 'feature' of infinite items
|
|
|
|
entityhuman.inventory.setItem(entityhuman.inventory.itemInHandIndex, (ItemStack) null);
|
|
|
|
}
|
|
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java
|
|
|
|
index 0199856..4f3bc3c 100644
|
|
|
|
--- a/src/main/java/net/minecraft/server/EntityHuman.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/EntityHuman.java
|
|
|
|
@@ -563,7 +563,7 @@ public abstract class EntityHuman extends EntityLiving {
|
|
|
|
public EntityItem a(ItemStack itemstack, boolean flag, boolean flag1) {
|
|
|
|
if (itemstack == null) {
|
|
|
|
return null;
|
|
|
|
- } else if (itemstack.count == 0) {
|
|
|
|
+ } else if (itemstack.count <= 0) { // PaperSpigot - Remove CB 'feature' of infinite items
|
|
|
|
return null;
|
|
|
|
} else {
|
|
|
|
double d0 = this.locY - 0.30000001192092896D + (double) this.getHeadHeight();
|
|
|
|
@@ -920,7 +920,7 @@ public abstract class EntityHuman extends EntityLiving {
|
|
|
|
|
|
|
|
if (itemstack.a(this, (EntityLiving) entity)) {
|
|
|
|
// CraftBukkit - bypass infinite items; <= 0 -> == 0
|
|
|
|
- if (itemstack.count == 0 && !this.abilities.canInstantlyBuild) {
|
|
|
|
+ if (itemstack.count <= 0 && !this.abilities.canInstantlyBuild) { // PaperSpigot - Remove CB 'feature' of infinite items
|
|
|
|
this.bZ();
|
|
|
|
}
|
|
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/ItemStack.java b/src/main/java/net/minecraft/server/ItemStack.java
|
|
|
|
index e5af375..4084dd3 100644
|
|
|
|
--- a/src/main/java/net/minecraft/server/ItemStack.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/ItemStack.java
|
|
|
|
@@ -73,6 +73,7 @@ public final class ItemStack {
|
|
|
|
ItemStack itemstack = new ItemStack();
|
|
|
|
|
|
|
|
itemstack.c(nbttagcompound);
|
|
|
|
+ if (itemstack.count < 0) itemstack.count = 0; // PaperSpigot - Remove CB 'feature' of infinite items
|
|
|
|
return itemstack.getItem() != null ? itemstack : null;
|
|
|
|
}
|
|
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
|
2015-01-07 04:13:40 +00:00
|
|
|
index 69efb4f..b73fa58 100644
|
2014-12-19 22:35:01 +00:00
|
|
|
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
|
|
|
|
@@ -735,7 +735,7 @@ public class PlayerConnection implements PacketListenerPlayIn, IUpdatePlayerList
|
|
|
|
}
|
|
|
|
|
|
|
|
itemstack = this.player.inventory.getItemInHand();
|
|
|
|
- if (itemstack != null && itemstack.count == 0) {
|
|
|
|
+ if (itemstack != null && itemstack.count <= 0) { // PaperSpigot - Remove CB 'feature' of infinite items
|
|
|
|
this.player.inventory.items[this.player.inventory.itemInHandIndex] = null;
|
|
|
|
itemstack = null;
|
|
|
|
}
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/PlayerInteractManager.java b/src/main/java/net/minecraft/server/PlayerInteractManager.java
|
2015-01-07 04:13:40 +00:00
|
|
|
index 7b469e1..06cd711 100644
|
2014-12-19 22:35:01 +00:00
|
|
|
--- a/src/main/java/net/minecraft/server/PlayerInteractManager.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/PlayerInteractManager.java
|
|
|
|
@@ -342,7 +342,7 @@ public class PlayerInteractManager {
|
|
|
|
|
|
|
|
if (itemstack1 != null) {
|
|
|
|
itemstack1.a(this.world, iblockdata.getBlock(), blockposition, this.player);
|
|
|
|
- if (itemstack1.count == 0) {
|
|
|
|
+ if (itemstack1.count <= 0) { // PaperSpigot - Remove CB 'feature' of infinite items
|
|
|
|
this.player.bZ();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@@ -381,7 +381,7 @@ public class PlayerInteractManager {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
- if (itemstack1.count == 0) {
|
|
|
|
+ if (itemstack1.count <= 0) { // PaperSpigot - Remove CB 'feature' of infinite items
|
|
|
|
entityhuman.inventory.items[entityhuman.inventory.itemInHandIndex] = null;
|
|
|
|
}
|
|
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/PlayerInventory.java b/src/main/java/net/minecraft/server/PlayerInventory.java
|
|
|
|
index 1c27843..ea593e5 100644
|
|
|
|
--- a/src/main/java/net/minecraft/server/PlayerInventory.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/PlayerInventory.java
|
|
|
|
@@ -515,7 +515,7 @@ public class PlayerInventory implements IInventory {
|
|
|
|
|
|
|
|
public ItemStack getCarried() {
|
|
|
|
// CraftBukkit start
|
|
|
|
- if (this.f != null && this.f.count == 0) {
|
|
|
|
+ if (this.f != null && this.f.count <= 0) { // PaperSpigot - Remove CB 'feature' of infinite items
|
|
|
|
this.setCarried(null);
|
|
|
|
}
|
|
|
|
// CraftBukkit end
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/Slot.java b/src/main/java/net/minecraft/server/Slot.java
|
2015-01-07 04:13:40 +00:00
|
|
|
index 3e8e7af..6c246a5 100644
|
2014-12-19 22:35:01 +00:00
|
|
|
--- a/src/main/java/net/minecraft/server/Slot.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/Slot.java
|
2015-01-07 04:13:40 +00:00
|
|
|
@@ -52,6 +52,7 @@ public class Slot {
|
2014-12-19 22:35:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public void set(ItemStack itemstack) {
|
|
|
|
+ if (itemstack != null && itemstack.count < 0) itemstack.count = 0; // PaperSpigot - Remove CB 'feature' of infinite items
|
|
|
|
this.inventory.setItem(this.index, itemstack);
|
|
|
|
this.f();
|
|
|
|
}
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/TileEntityDispenser.java b/src/main/java/net/minecraft/server/TileEntityDispenser.java
|
|
|
|
index 040a69f..3269d39 100644
|
|
|
|
--- a/src/main/java/net/minecraft/server/TileEntityDispenser.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/TileEntityDispenser.java
|
|
|
|
@@ -100,6 +100,7 @@ public class TileEntityDispenser extends TileEntityContainer implements IInvento
|
|
|
|
|
|
|
|
public void setItem(int i, ItemStack itemstack) {
|
|
|
|
this.items[i] = itemstack;
|
|
|
|
+ if (itemstack != null && itemstack.count < 0) itemstack.count = 0; // PaperSpigot - Remove CB 'feature' of infinite items
|
|
|
|
if (itemstack != null && itemstack.count > this.getMaxStackSize()) {
|
|
|
|
itemstack.count = this.getMaxStackSize();
|
|
|
|
}
|
|
|
|
--
|
2015-01-29 21:26:20 +00:00
|
|
|
1.9.5.msysgit.0
|
2014-12-19 22:35:01 +00:00
|
|
|
|