Skip to content

Commit

Permalink
Small fix
Browse files Browse the repository at this point in the history
  • Loading branch information
wu-vincent committed Jan 29, 2016
1 parent baa986c commit 6087b6c
Show file tree
Hide file tree
Showing 9 changed files with 609 additions and 191 deletions.
5 changes: 5 additions & 0 deletions src/main/java/cn/nukkit/Player.java
Original file line number Diff line number Diff line change
Expand Up @@ -2829,6 +2829,11 @@ public void handleDataPacket(DataPacket packet) {
} else if (this.windowIndex.containsKey(containerSetSlotPacket.windowid)) {
this.craftingType = 0;
Inventory inv = this.windowIndex.get(containerSetSlotPacket.windowid);

if (inv instanceof EnchantInventory && containerSetSlotPacket.item.hasEnchantments()) {
((EnchantInventory) inv).onEnchant(this, inv.getItem(containerSetSlotPacket.slot), containerSetSlotPacket.item);
}

transaction = new BaseTransaction(inv, containerSetSlotPacket.slot, inv.getItem(containerSetSlotPacket.slot), containerSetSlotPacket.item);
} else {
break;
Expand Down
4 changes: 3 additions & 1 deletion src/main/java/cn/nukkit/block/EnchantingTable.java
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,9 @@ public boolean canBeActivated() {
@Override
public int[][] getDrops(Item item) {
if (item.isPickaxe()) {
return new int[][]{{Item.ENCHANTING_TABLE, 0, 1}};
return new int[][]{
{Item.ENCHANTING_TABLE, 0, 1}
};
}
return new int[][]{{}};
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/cn/nukkit/inventory/BaseInventory.java
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public Item getItem(int index) {

@Override
public Map<Integer, Item> getContents() {
return this.slots;
return new HashMap<>(this.slots);
}

@Override
Expand Down
Loading

0 comments on commit 6087b6c

Please sign in to comment.