added some method to ItemWorldHelper
I really need a better name for this collection of helper methods but can't think of one. So if you guys have a more usable name i'm open to suggestions.
This commit is contained in:
parent
11a5b7315a
commit
cbf3a1848f
2 changed files with 29 additions and 2 deletions
|
@ -32,7 +32,9 @@ public class CommandPowerTo extends Command
|
|||
Block block = Block.blocksList[this.world.getBlockId(tileEntity.getHandPosition().intX(), tileEntity.getHandPosition().intY(), tileEntity.getHandPosition().intZ())];
|
||||
TileEntity targetTile = this.tileEntity.getHandPosition().getTileEntity(this.world);
|
||||
|
||||
if (tileEntity.getGrabbedEntities().size() > 0 && tileEntity.getGrabbedEntities().get(0) instanceof EntityItem && ((EntityItem) tileEntity.getGrabbedEntities().get(0)).getEntityItem().itemID == Block.torchRedstoneIdle.blockID)
|
||||
if (tileEntity.getGrabbedEntities().size() > 0
|
||||
&& tileEntity.getGrabbedEntities().get(0) instanceof EntityItem
|
||||
&& ((EntityItem) tileEntity.getGrabbedEntities().get(0)).getEntityItem().itemID == Block.torchRedstoneIdle.blockID)
|
||||
{
|
||||
// TODO have armbot cause redstone power at location
|
||||
DebugToPlayer.SendToClosest(this.tileEntity, 10, "powering");
|
||||
|
|
|
@ -2,8 +2,8 @@ package dark.minecraft.helpers;
|
|||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
|
@ -33,6 +33,14 @@ public class ItemWorldHelper
|
|||
public static List<EntityItem> findSelectItems(World world, Vector3 start, Vector3 end, List<ItemStack> disiredItems)
|
||||
{
|
||||
List<EntityItem> entityItems = ItemWorldHelper.findAllItemIn(world, start, end);
|
||||
return filterEntityItemsList(entityItems, disiredItems);
|
||||
}
|
||||
|
||||
/**
|
||||
* filters an EntityItem List to a List of Items
|
||||
*/
|
||||
public static List<EntityItem> filterEntityItemsList(List<EntityItem> entityItems, List<ItemStack> disiredItems)
|
||||
{
|
||||
List<EntityItem> newItemList = new ArrayList<EntityItem>();
|
||||
|
||||
for (EntityItem entityItem : entityItems)
|
||||
|
@ -48,6 +56,23 @@ public class ItemWorldHelper
|
|||
}
|
||||
return newItemList;
|
||||
}
|
||||
/**
|
||||
* filters out EnittyItems from an Entity list
|
||||
*/
|
||||
public static List<EntityItem> filterOutItems(List<Entity> entities)
|
||||
{
|
||||
List<EntityItem> newEntityList = new ArrayList<EntityItem>();
|
||||
|
||||
for (Entity entity : entities)
|
||||
{
|
||||
if(entity instanceof EntityItem)
|
||||
{
|
||||
newEntityList.add((EntityItem) entity);
|
||||
}
|
||||
|
||||
}
|
||||
return newEntityList;
|
||||
}
|
||||
|
||||
/**
|
||||
* Drops an item stack at the exact center of the location without any velocity or random throw angle
|
||||
|
|
Loading…
Reference in a new issue