Magnet now attracts XP orbs.

This commit is contained in:
CrazyPants committed 2014-07-23 19:53:47 +08:00
1 parent 9ee66daf2f
commit 2f399453ac
2 files changed
+7 -7

No files matched your search

@@ -132,11 +132,6 @@ public class ItemMagnet extends ItemEnergyContainer implements IResourceTooltipP
return res;
}
void extractInternal(ItemStack item, int powerUse) {
int res = Math.max(0, getEnergyStored(item) - powerUse);
setEnergy(item, res);
}
void setEnergy(ItemStack container, int energy) {
if(container.stackTagCompound == null) {
container.stackTagCompound = new NBTTagCompound();
@@ -5,6 +5,7 @@ import java.util.List;
import net.minecraft.command.IEntitySelector;
import net.minecraft.entity.Entity;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.item.EntityXPOrb;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.AxisAlignedBB;
@@ -45,9 +46,13 @@ public class MagnetController implements IEntitySelector {
player.posX - Config.magnetRange, player.posY - Config.magnetRange, player.posZ - Config.magnetRange,
player.posX + Config.magnetRange, player.posY + Config.magnetRange, player.posZ + Config.magnetRange);
List<EntityItem> interestingItems = player.worldObj.selectEntitiesWithinAABB(EntityItem.class, aabb, this);
List<Entity> interestingItems = player.worldObj.selectEntitiesWithinAABB(EntityItem.class, aabb, this);
List<Entity> xp = player.worldObj.selectEntitiesWithinAABB(EntityXPOrb.class, aabb, this);
if(xp != null) {
interestingItems.addAll(xp);
}
for (EntityItem entity : interestingItems) {
for (Entity entity : interestingItems) {
double x = player.posX + 0.5D - entity.posX;
double y = player.posY + 1D - entity.posY;
double z = player.posZ + 0.5D - entity.posZ;