Java Code Examples for net.minecraft.world.World.removeTileEntity()

The following are Jave code examples for showing how to use removeTileEntity() of the net.minecraft.world.World class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: harshencastle   File: BloodVessel.java   View Source Code Vote up 6 votes
@Override
public void breakBlock(World worldIn, BlockPos pos, IBlockState state) {
	TileEntityBloodVessel te = (TileEntityBloodVessel) worldIn.getTileEntity(pos);
	int amount = te.getPossibleRemove();
	int max = te.getMax();
	worldIn.removeTileEntity(pos);
	ItemStack stack = new ItemStack(this);
	if(amount != 0)
	{
		NBTTagCompound nbttagcompound = new NBTTagCompound();
        nbttagcompound.setInteger("BloodLevel", amount);
        stack.setTagCompound(nbttagcompound);
        stack.setStackDisplayName("�r" + getLocalizedName() + " [" + amount + "/" + max + "]");
	}
	if(!creativeBreakMap.containsKey(pos) || !creativeBreakMap.get(pos))
		worldIn.spawnEntity(new EntityItem(worldIn, pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, stack));
	creativeBreakMap.remove(pos);
}
 
Example 2
Project: MeeCreeps   File: MoveStuffActionWorker.java   View Source Code Vote up 6 votes
private void pickupBlock() {
    EntityMeeCreeps meeCreep = (EntityMeeCreeps) helper.getMeeCreep();

    World world = meeCreep.getWorld();
    BlockPos pos = options.getTargetPos();
    IBlockState state = world.getBlockState(pos);
    if (!helper.allowedToHarvest(state, world, pos, options.getPlayer())) {
        helper.showMessage("message.meecreeps.cant_pickup_block");
        helper.taskIsDone();
        return;
    }
    meeCreep.setHeldBlockState(state);

    TileEntity tileEntity = world.getTileEntity(pos);
    if (tileEntity != null) {
        NBTTagCompound tc = new NBTTagCompound();
        tileEntity.writeToNBT(tc);
        world.removeTileEntity(pos);
        tc.removeTag("x");
        tc.removeTag("y");
        tc.removeTag("z");
        meeCreep.setCarriedNBT(tc);
    }
    world.setBlockToAir(pos);
}
 
Example 3
Project: CustomWorldGen   File: BlockRedstoneComparator.java   View Source Code Vote up 5 votes
/**
 * Called serverside after this block is replaced with another in Chunk, but before the Tile Entity is updated
 */
public void breakBlock(World worldIn, BlockPos pos, IBlockState state)
{
    super.breakBlock(worldIn, pos, state);
    worldIn.removeTileEntity(pos);
    this.notifyNeighbors(worldIn, pos, state);
}
 
Example 4
Project: Bewitchment   File: BlockOven.java   View Source Code Vote up 5 votes
@Override
public void breakBlock(World worldIn, BlockPos pos, IBlockState state) {
	final TileEntity tile1 = worldIn.getTileEntity(pos);
	if (tile1 != null && tile1 instanceof TileOven) {
		((TileOven) tile1).dropItems();
	}
	worldIn.removeTileEntity(pos);
}
 
Example 5
Project: uniquecrops   File: Artisia.java   View Source Code Vote up 5 votes
@Override
public void breakBlock(World world, BlockPos pos, IBlockState state) {
	
	if (world.getTileEntity(pos) != null && world.getTileEntity(pos) instanceof TileArtisia) {
		ItemStack stack = ((TileArtisia)world.getTileEntity(pos)).getItem();
		if (stack != null) {
			world.removeTileEntity(pos);
			spawnAsEntity(world, pos, stack);
		}
	}
	super.breakBlock(world, pos, state);
}
 
Example 6
Project: chesttransporter   File: ItemChestTransporter.java   View Source Code Vote up 5 votes
private void grabChest(TransportableChest chest, ItemStack stack, EntityPlayer player, World world, BlockPos pos)
{
    TileEntity tile = world.getTileEntity(pos);
    if (tile != null)
    {
        IBlockState iblockstate = world.getBlockState(pos);
        Block chestBlock = iblockstate.getBlock();

        getTagCompound(stack).setString("ChestName", chest.getRegistryName().toString());
        if (chest.copyTileEntity())
        {
            NBTTagCompound nbt = new NBTTagCompound();
            tile.writeToNBT(nbt);
            getTagCompound(stack).setTag("ChestTile", nbt);
            world.removeTileEntity(pos);
        } else
        {
            IInventory inv = (IInventory) tile;
            moveItemsIntoStack(inv, stack);
        }

        chest.preRemoveChest(world, pos, player, stack);

        world.setBlockToAir(pos);
        SoundType soundType = chestBlock.getSoundType();
        world.playSound(player, pos, soundType.getPlaceSound(), SoundCategory.BLOCKS, (soundType.getVolume() + 1.0F) / 2.0F, soundType.getPitch() * 0.8F);
    }
}
 
Example 7
Project: CustomWorldGen   File: BlockContainer.java   View Source Code Vote up 4 votes
/**
 * Called serverside after this block is replaced with another in Chunk, but before the Tile Entity is updated
 */
public void breakBlock(World worldIn, BlockPos pos, IBlockState state)
{
    super.breakBlock(worldIn, pos, state);
    worldIn.removeTileEntity(pos);
}
 
Example 8
Project: pnc-repressurized   File: BlockDroneRedstoneEmitter.java   View Source Code Vote up 4 votes
@Override
public void breakBlock(World world, BlockPos pos, IBlockState state) {
    super.breakBlock(world, pos, state);
    world.removeTileEntity(pos);
}
 
Example 9
Project: Firma   File: OreBlock.java   View Source Code Vote up 4 votes
@Override
public void breakBlock(World worldIn, BlockPos pos, IBlockState state) {
	super.breakBlock(worldIn, pos, state);
	worldIn.removeTileEntity(pos);
}
 
Example 10
Project: FoodCraft-Reloaded   File: BlockSmeltingDrinkMachine.java   View Source Code Vote up 4 votes
@Override
public void breakBlock(@Nonnull World worldIn, @Nonnull BlockPos pos, @Nonnull IBlockState state) {
    worldIn.removeTileEntity(pos);
}
 
Example 11
Project: FoodCraft-Reloaded   File: BlockDrinkMachine.java   View Source Code Vote up 4 votes
@Override
public void breakBlock(@Nonnull World worldIn, @Nonnull BlockPos pos, @Nonnull IBlockState state) {
    worldIn.removeTileEntity(pos);
}
 
Example 12
Project: Backmemed   File: BlockContainer.java   View Source Code Vote up 4 votes
/**
 * Called serverside after this block is replaced with another in Chunk, but before the Tile Entity is updated
 */
public void breakBlock(World worldIn, BlockPos pos, IBlockState state)
{
    super.breakBlock(worldIn, pos, state);
    worldIn.removeTileEntity(pos);
}
 
Example 13
Project: DecompiledMinecraft   File: BlockContainer.java   View Source Code Vote up 4 votes
public void breakBlock(World worldIn, BlockPos pos, IBlockState state)
{
    super.breakBlock(worldIn, pos, state);
    worldIn.removeTileEntity(pos);
}
 
Example 14
Project: FoodCraft-Reloaded   File: BlockPressureCooker.java   View Source Code Vote up 4 votes
@Override
public void breakBlock(@Nonnull World worldIn, @Nonnull BlockPos pos, @Nonnull IBlockState state) {
    worldIn.removeTileEntity(pos);
}
 
Example 15
Project: DecompiledMinecraft   File: BlockContainer.java   View Source Code Vote up 4 votes
public void breakBlock(World worldIn, BlockPos pos, IBlockState state)
{
    super.breakBlock(worldIn, pos, state);
    worldIn.removeTileEntity(pos);
}
 
Example 16
Project: BaseClient   File: BlockRedstoneComparator.java   View Source Code Vote up 4 votes
public void breakBlock(World worldIn, BlockPos pos, IBlockState state)
{
    super.breakBlock(worldIn, pos, state);
    worldIn.removeTileEntity(pos);
    this.notifyNeighbors(worldIn, pos, state);
}
 
Example 17
Project: BaseClient   File: BlockContainer.java   View Source Code Vote up 4 votes
public void breakBlock(World worldIn, BlockPos pos, IBlockState state)
{
    super.breakBlock(worldIn, pos, state);
    worldIn.removeTileEntity(pos);
}
 
Example 18
Project: BaseClient   File: BlockRedstoneComparator.java   View Source Code Vote up 4 votes
public void breakBlock(World worldIn, BlockPos pos, IBlockState state)
{
    super.breakBlock(worldIn, pos, state);
    worldIn.removeTileEntity(pos);
    this.notifyNeighbors(worldIn, pos, state);
}
 
Example 19
Project: BaseClient   File: BlockContainer.java   View Source Code Vote up 4 votes
public void breakBlock(World worldIn, BlockPos pos, IBlockState state)
{
    super.breakBlock(worldIn, pos, state);
    worldIn.removeTileEntity(pos);
}
 
Example 20
Project: MagicWinds   File: ModBlockTileEntity.java   View Source Code Vote up 4 votes
@Override
public void breakBlock(World world, BlockPos pos, IBlockState state) {
    super.breakBlock(world, pos, state);
    world.removeTileEntity(pos);
}