Search in sources :

Example 1 with TileEntityJukebox

use of net.minecraft.block.BlockJukebox.TileEntityJukebox in project SpongeCommon by SpongePowered.

the class JukeboxDataProcessor method removeFrom.

@Override
public DataTransactionResult removeFrom(ValueContainer<?> container) {
    if (!(container instanceof BlockJukebox.TileEntityJukebox)) {
        return DataTransactionResult.failNoData();
    }
    BlockJukebox.TileEntityJukebox jukebox = (TileEntityJukebox) container;
    Optional<ItemStackSnapshot> old = getVal(jukebox);
    if (!old.isPresent()) {
        return DataTransactionResult.successNoData();
    }
    if (remove(jukebox)) {
        return DataTransactionResult.successRemove(constructImmutableValue(old.get()));
    }
    return DataTransactionResult.builder().result(DataTransactionResult.Type.ERROR).build();
}
Also used : TileEntityJukebox(net.minecraft.block.BlockJukebox.TileEntityJukebox) TileEntityJukebox(net.minecraft.block.BlockJukebox.TileEntityJukebox) BlockJukebox(net.minecraft.block.BlockJukebox) ItemStackSnapshot(org.spongepowered.api.item.inventory.ItemStackSnapshot)

Aggregations

BlockJukebox (net.minecraft.block.BlockJukebox)1 TileEntityJukebox (net.minecraft.block.BlockJukebox.TileEntityJukebox)1 ItemStackSnapshot (org.spongepowered.api.item.inventory.ItemStackSnapshot)1