use of net.minecraft.item.ItemMinecart in project Railcraft by Railcraft.
the class TileDispenserTrain method spawnNextCart.
private boolean spawnNextCart() {
ItemStack spawn = getPattern().getStackInSlot(patternIndex);
if (InvTools.isEmpty(spawn)) {
resetSpawnSequence();
return false;
}
Predicate<ItemStack> filter = new MinecartItemType(spawn);
if (InvTools.countItems(invStock, filter) == 0) {
resetSpawnSequence();
return false;
}
BlockPos offset = getPos().offset(facing);
if ((spawn.getItem() instanceof ItemMinecart || spawn.getItem() instanceof IMinecartItem) && CartToolsAPI.getMinecartOnSide(worldObj, getPos(), 0, facing) == null) {
ItemStack cartItem = InvTools.removeOneItem(invStock, filter);
if (!InvTools.isEmpty(cartItem)) {
EntityMinecart cartPlaced = CartTools.placeCart(getOwner(), cartItem, (WorldServer) worldObj, offset);
if (cartPlaced != null) {
CartToolsAPI.getLinkageManager(worldObj).createLink(cartPlaced, lastCart);
lastCart = cartPlaced;
patternIndex++;
if (patternIndex >= getPattern().getSizeInventory())
resetSpawnSequence();
return true;
} else
InvTools.moveItemStack(cartItem, invStock);
}
}
return false;
}
use of net.minecraft.item.ItemMinecart in project Railcraft by Railcraft.
the class TrackmanBackpack method setup.
public void setup() {
for (ResourceLocation id : Block.REGISTRY.getKeys()) {
Block block = Block.REGISTRY.getObject(id);
if (block == null)
continue;
if (TrackTools.isRailBlock(block))
add(block);
}
for (ResourceLocation id : Item.REGISTRY.getKeys()) {
Item item = Item.REGISTRY.getObject(id);
if (item instanceof ItemMinecart || item instanceof IMinecartItem)
add(item);
}
add(IToolCrowbar.ORE_TAG);
add(RailcraftBlocks.WORLDSPIKE);
add(RailcraftBlocks.WORLDSPIKE_POINT);
add(RailcraftItems.BOTTLE_CREOSOTE);
add(RailcraftItems.SPIKE_MAUL_IRON);
add(RailcraftItems.SPIKE_MAUL_STEEL);
add(RailcraftItems.CHARGE_METER);
add(RailcraftItems.RAIL);
add(RailcraftItems.RAILBED);
add(RailcraftItems.TICKET);
add(RailcraftItems.TICKET_GOLD);
add(RailcraftItems.TIE);
add(RailcraftItems.WHISTLE_TUNER);
add(RailcraftItems.OVERALLS);
add(RailcraftItems.TRACK_KIT);
add(RailcraftItems.TRACK_PARTS);
add(RailcraftBlocks.CHARGE_FEEDER);
add(RailcraftBlocks.MANIPULATOR);
add(RailcraftBlocks.TRACK_ELEVATOR);
add(RailcraftBlocks.WIRE);
}
Aggregations