Java Code Examples for net.minecraft.block.Block#dropStack()

The following examples show how to use net.minecraft.block.Block#dropStack() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AnvilBlockMixin.java    From the-hallow with MIT License 5 votes vote down vote up
@Inject(method = "onLanding(Lnet/minecraft/world/World;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/BlockState;Lnet/minecraft/block/BlockState;)V", at = @At("HEAD"))
protected void onLanding(World world, BlockPos upPosition, BlockState blockState_1, BlockState blockState_2, CallbackInfo info) {
	BlockPos downPosition = upPosition.offset(Direction.DOWN);
	Block checkBlock = world.getBlockState(downPosition).getBlock();
	Block anvilBlock = world.getBlockState(upPosition).getBlock();
	if (checkBlock instanceof PumpkinBlock) {
		Block.dropStack(world, upPosition, anvilBlock.getPickStack(world, upPosition, world.getBlockState(downPosition)));
		world.removeBlock(upPosition, true);
		Block.dropStack(world, downPosition, new ItemStack(HallowedBlocks.TINY_PUMPKIN));
		world.removeBlock(downPosition, true);
	}
}
 
Example 2
Source File: RestlessCactusEntity.java    From the-hallow with MIT License 4 votes vote down vote up
@Override
public void onDeath(DamageSource source) {
	Block.dropStack(this.world, new BlockPos(this), new ItemStack(HallowedBlocks.RESTLESS_CACTUS, getCactusHeight()));
}
 
Example 3
Source File: InfusionPillarBlock.java    From the-hallow with MIT License 4 votes vote down vote up
@Override
public void afterBreak(World world, PlayerEntity playerEntity, BlockPos blockPos, BlockState blockState, @Nullable BlockEntity blockEntity, ItemStack itemStack) {
	Block.dropStack(world, blockPos, ((InfusionPillarBlockEntity) blockEntity).storedStack);
	super.afterBreak(world, playerEntity, blockPos, blockState, blockEntity, itemStack);
}
 
Example 4
Source File: InfusionAltarBlock.java    From the-hallow with MIT License 4 votes vote down vote up
public void createDrop(InfusionAltarBlockEntity alterEntity, ItemStack outputStack) {
	Block.dropStack(alterEntity.getWorld(), alterEntity.getPos(), outputStack.copy());
}
 
Example 5
Source File: InfusionAltarBlock.java    From the-hallow with MIT License 4 votes vote down vote up
@Override
public void afterBreak(World world, PlayerEntity playerEntity, BlockPos blockPos, BlockState blockState, @Nullable BlockEntity blockEntity, ItemStack itemStack) {
	Block.dropStack(world, blockPos, ((InfusionAltarBlockEntity) blockEntity).storedStack);
	super.afterBreak(world, playerEntity, blockPos, blockState, blockEntity, itemStack);
}