use of com.infinityraider.agricraft.tiles.storage.TileEntitySeedStorage in project AgriCraft by AgriCraft.
the class BlockSeedStorage method getActualState.
@Override
@SuppressWarnings("deprecation")
public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos) {
Optional<TileEntitySeedStorage> tile = WorldHelper.getTile(worldIn, pos, TileEntitySeedStorage.class);
if (tile.isPresent()) {
TileEntitySeedStorage storage = tile.get();
state = AgriProperties.FACING.applyToBlockState(state, storage.getOrientation());
}
return state;
}
use of com.infinityraider.agricraft.tiles.storage.TileEntitySeedStorage in project AgriCraft by AgriCraft.
the class MessageTileEntitySeedStorage method processMessage.
@Override
protected void processMessage(MessageContext ctx) {
TileEntity te = FMLClientHandler.instance().getClient().world.getTileEntity(this.pos);
if (te instanceof TileEntitySeedStorage) {
TileEntitySeedStorage storage = (TileEntitySeedStorage) te;
ItemStack stack = storage.getLockedSeed().map(s -> s.toStack()).orElse(null);
if (stack != null) {
stack.setCount(this.amount);
NBTTagCompound tag = new NBTTagCompound();
stats.writeToNBT(tag);
stack.setTagCompound(tag);
storage.setSlotContents(this.slotId, stack);
}
}
}
Aggregations