Search in sources :

Example 6 with TileEntityFlowerPot

use of net.minecraft.tileentity.TileEntityFlowerPot in project SpongeCommon by SpongePowered.

the class FlowerPotDataProcessor method removeFrom.

@Override
public DataTransactionResult removeFrom(ValueContainer<?> container) {
    if (!(container instanceof TileEntityFlowerPot)) {
        return DataTransactionResult.failNoData();
    }
    TileEntityFlowerPot flowerPot = (TileEntityFlowerPot) container;
    Optional<ItemStackSnapshot> old = getVal(flowerPot);
    if (!old.isPresent()) {
        return DataTransactionResult.successNoData();
    }
    flowerPot.setItemStack(ItemStack.EMPTY);
    flowerPot.markDirty();
    return DataTransactionResult.successRemove(constructImmutableValue(old.get()));
}
Also used : ItemStackSnapshot(org.spongepowered.api.item.inventory.ItemStackSnapshot) TileEntityFlowerPot(net.minecraft.tileentity.TileEntityFlowerPot)

Aggregations

TileEntityFlowerPot (net.minecraft.tileentity.TileEntityFlowerPot)6 ArrayList (java.util.ArrayList)2 TileEntity (net.minecraft.tileentity.TileEntity)2 TileEntityLockable (net.minecraft.tileentity.TileEntityLockable)2 BlockCandle (com.bewitchment.common.block.tools.BlockCandle)1 IBlockState (net.minecraft.block.state.IBlockState)1 ItemStack (net.minecraft.item.ItemStack)1 TileEntitySkull (net.minecraft.tileentity.TileEntitySkull)1 ItemStackSnapshot (org.spongepowered.api.item.inventory.ItemStackSnapshot)1