use of com.bluepowermod.tile.TileBPMultipart in project BluePower by Qmunity.
the class BlockBPMultipart method removedByPlayer.
@Override
public boolean removedByPlayer(BlockState state, World world, BlockPos pos, PlayerEntity player, boolean willHarvest, FluidState fluid) {
BlockState partState = MultipartUtils.getClosestState(player, pos);
TileEntity te = world.getBlockEntity(pos);
if (partState != null && partState.getBlock() instanceof IBPPartBlock && te instanceof TileBPMultipart) {
// Remove Selected Part
((TileBPMultipart) te).removeState(partState);
// Call onMultipartReplaced
((IBPPartBlock) partState.getBlock()).onMultipartReplaced(partState, world, pos, state, false);
// Play Break Sound
world.playSound(null, pos, SoundEvents.STONE_BREAK, SoundCategory.BLOCKS, 1.0F, 1.0F);
return false;
}
return false;
}
use of com.bluepowermod.tile.TileBPMultipart in project BluePower by Qmunity.
the class BlockBPMultipart method getDrops.
@Override
public List<ItemStack> getDrops(BlockState state, LootContext.Builder builder) {
TileEntity tileentity = builder.getParameter(LootParameters.BLOCK_ENTITY);
List<ItemStack> itemStacks = new ArrayList<>();
if (tileentity instanceof TileBPMultipart) {
((TileBPMultipart) tileentity).getStates().forEach(s -> itemStacks.addAll(s.getBlock().getDrops(s, builder)));
}
return itemStacks;
}
Aggregations