Further modernise and remove legacy item classes

This commit is contained in:
Matthew Miller
2018-06-17 17:50:04 +10:00
parent c43109bde5
commit e2608bc0c9
35 changed files with 392 additions and 1045 deletions

View File

@ -20,6 +20,7 @@
package com.sk89q.worldedit.extent.inventory;
import com.sk89q.worldedit.blocks.*;
import com.sk89q.worldedit.blocks.type.ItemTypes;
import com.sk89q.worldedit.util.Location;
/**
@ -49,7 +50,7 @@ public abstract class BlockBag {
public void storeDroppedBlock(int id, int data) throws BlockBagException {
BaseItem dropped = BlockType.getBlockBagItem(id, data);
if (dropped == null) return;
if (dropped.getType() == BlockID.AIR) return;
if (dropped.getType() == ItemTypes.AIR) return;
storeItem(dropped);
}
@ -107,7 +108,7 @@ public abstract class BlockBag {
} catch (OutOfBlocksException e) {
BaseItem placed = BlockType.getBlockBagItem(id, data);
if (placed == null) throw e; // TODO: check
if (placed.getType() == BlockID.AIR) throw e; // TODO: check
if (placed.getType() == ItemTypes.AIR) throw e; // TODO: check
fetchItem(placed);
}
@ -134,7 +135,7 @@ public abstract class BlockBag {
* @throws BlockBagException on error
*/
public void fetchItem(BaseItem item) throws BlockBagException {
fetchBlock(item.getType());
fetchBlock(item.getLegacyId());
}
/**
@ -158,7 +159,7 @@ public abstract class BlockBag {
* @throws BlockBagException on error
*/
public void storeItem(BaseItem item) throws BlockBagException {
storeBlock(item.getType());
storeBlock(item.getLegacyId());
}
/**