Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 5 additions & 10 deletions src/main/java/org/bukkit/craftbukkit/block/CraftBlockState.java
Original file line number Diff line number Diff line change
Expand Up @@ -175,20 +175,15 @@ public boolean equals(Object obj) {
if (getClass() != obj.getClass()) {
return false;
}
return blockStateEquals(obj);
}

public boolean blockStateEquals(Object obj){
final CraftBlockState other = (CraftBlockState) obj;
if (this.world != other.world && (this.world == null || !this.world.equals(other.world))) {
return false;
}
if (this.x != other.x) {
return false;
}
if (this.y != other.y) {
return false;
}
if (this.z != other.z) {
return false;
}
if (this.type != other.type) {
if (this.x != other.x || this.y != other.y || this.z != other.z || this.type != other.type) {
return false;
}
if (this.data != other.data && (this.data == null || !this.data.equals(other.data))) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,32 +62,41 @@ public ItemStack getItem(int i) {
}

public ItemStack splitStack(int i, int j) {
ItemStack stack = this.getItem(i);
ItemStack result;
if (stack == null) return null;
if (stack.count <= j) {
this.setItem(i, null);
result = stack;
} else {
result = CraftItemStack.copyNMSStack(stack, j);
stack.count -= j;
}
ItemStack result = ItemStackSet(i, j);
this.update();
return result;
}

public ItemStack splitWithoutUpdate(int i) {
private ItemStack ItemStackSet(int i, int j) {
ItemStack stack = this.getItem(i);
ItemStack result;
ItemStack result = null;
if (stack == null) return null;
if (stack.count <= 1) {
this.setItem(i, null);
result = stack;
} else {
result = CraftItemStack.copyNMSStack(stack, 1);
stack.count -= 1;
if(j == Integer.MAX_VALUE){
if (stack.count <= 1) {
this.setItem(i, null);
result = stack;
} else {
result = CraftItemStack.copyNMSStack(stack, 1);
stack.count -= 1;
}
}
else {
if (stack.count <= j) {
this.setItem(i, null);
result = stack;
} else {
result = CraftItemStack.copyNMSStack(stack, j);
stack.count -= j;
}
}
return result;

}

public ItemStack splitWithoutUpdate(int i) {
int j = Integer.MAX_VALUE;
ItemStack result = ItemStackSet(i, j);
return result;
}

public void setItem(int i, ItemStack itemstack) {
Expand Down