Skip to content

Commit

Permalink
Revert "Don't use unnecessary getItemStack() calls by using native co…
Browse files Browse the repository at this point in the history
…de. #441"

This reverts commit 6848daa.
  • Loading branch information
Hidendra committed Feb 1, 2013
1 parent 4af362f commit 86ed63d
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions src/main/java/com/griefcraft/modules/flag/MagnetModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
import org.bukkit.World;
import org.bukkit.block.Block;
import org.bukkit.craftbukkit.CraftWorld;
import org.bukkit.craftbukkit.entity.CraftItem;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Item;
import org.bukkit.inventory.InventoryHolder;
Expand Down Expand Up @@ -98,17 +97,15 @@ public void run() {
}

Item item = (Item) entity;

// native stack handle
net.minecraft.server.ItemStack stackHandle = ((net.minecraft.server.EntityItem) ((CraftItem) item).getHandle()).itemStack;
ItemStack stack = item.getItemStack();

// check if it is in the blacklist
if (itemBlacklist.contains(stackHandle.id)) {
if (itemBlacklist.contains(stack.getTypeId())) {
continue;
}

// check if the item is valid
if (stackHandle.count <= 0) {
if (stack.getAmount() <= 0) {
continue;
}

Expand All @@ -133,6 +130,7 @@ public void run() {

while ((item = items.poll()) != null) {
World world = item.getWorld();
ItemStack itemStack = item.getItemStack();

if (item.isDead()) {
continue;
Expand All @@ -155,8 +153,6 @@ public void run() {
continue;
}

ItemStack itemStack = item.getItemStack();

// Remove the items and suck them up :3
Map<Integer, ItemStack> remaining = lwc.depositItems(block, itemStack);

Expand Down

0 comments on commit 86ed63d

Please sign in to comment.