net.minecraft.entity.item.EntityMinecartChest Java Examples

The following examples show how to use net.minecraft.entity.item.EntityMinecartChest. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: StructureTofuMineshaftPieces.java    From TofuCraftReload with MIT License 5 votes vote down vote up
/**
 * Adds chest to the structure and sets its contents
 */
protected boolean generateChest(World worldIn, StructureBoundingBox structurebb, Random randomIn, int x, int y, int z, ResourceLocation loot) {
    BlockPos blockpos = new BlockPos(this.getXWithOffset(x, z), this.getYWithOffset(y), this.getZWithOffset(x, z));

    if (structurebb.isVecInside(blockpos) && worldIn.getBlockState(blockpos).getMaterial() == Material.AIR && worldIn.getBlockState(blockpos.down()).getMaterial() != Material.AIR) {
        IBlockState iblockstate = Blocks.RAIL.getDefaultState().withProperty(BlockRail.SHAPE, randomIn.nextBoolean() ? BlockRailBase.EnumRailDirection.NORTH_SOUTH : BlockRailBase.EnumRailDirection.EAST_WEST);
        this.setBlockState(worldIn, iblockstate, x, y, z, structurebb);
        EntityMinecartChest entityminecartchest = new EntityMinecartChest(worldIn, (double) ((float) blockpos.getX() + 0.5F), (double) ((float) blockpos.getY() + 0.5F), (double) ((float) blockpos.getZ() + 0.5F));
        entityminecartchest.setLootTable(loot, randomIn.nextLong());
        worldIn.spawnEntity(entityminecartchest);
        return true;
    } else {
        return false;
    }
}
 
Example #2
Source File: StorageESPMod.java    From ForgeHax with MIT License 5 votes vote down vote up
private int getEntityColor(Entity entity) {
  if (entity instanceof EntityMinecartChest) {
    return Colors.ORANGE.toBuffer();
  } else if (entity instanceof EntityItemFrame
      && ((EntityItemFrame) entity).getDisplayedItem().getItem() instanceof ItemShulkerBox) {
    return Colors.YELLOW.toBuffer();
  } else {
    return -1;
  }
}
 
Example #3
Source File: CraftMinecartChest.java    From Kettle with GNU General Public License v3.0 4 votes vote down vote up
public CraftMinecartChest(CraftServer server, EntityMinecartChest entity) {
    super(server, entity);
    inventory = new CraftInventory(entity);
}