Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 14 additions & 4 deletions src/main/java/thebetweenlands/common/block/terrain/BlockWisp.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@
import thebetweenlands.common.world.storage.location.LocationSpiritTree;
import thebetweenlands.util.AdvancedStateMap.Builder;

import net.minecraft.util.NonNullList;

public class BlockWisp extends BlockContainer implements IStateMappedBlock {
protected static final AxisAlignedBB WISP_AABB = new AxisAlignedBB(0.2F, 0.2F, 0.2F, 0.8F, 0.8F, 0.8F);

Expand Down Expand Up @@ -73,11 +75,19 @@ public Item getItemDropped(IBlockState state, Random rand, int fortune) {
return null;
}

// @Override
// public void onPlayerDestroy(World world, BlockPos pos, IBlockState state) {
// if(!world.isRemote && state.getValue(VISIBLE)) {
// EntityItem wispItem = new EntityItem(world, pos.getX() + 0.5D, pos.getY() + 0.5D, pos.getZ() + 0.5D, new ItemStack(Item.getItemFromBlock(this), 1));
// world.spawnEntity(wispItem);
// }
// }

@Override
public void onPlayerDestroy(World world, BlockPos pos, IBlockState state) {
if(!world.isRemote && state.getValue(VISIBLE)) {
EntityItem wispItem = new EntityItem(world, pos.getX() + 0.5D, pos.getY() + 0.5D, pos.getZ() + 0.5D, new ItemStack(Item.getItemFromBlock(this), 1));
world.spawnEntity(wispItem);
public void getDrops(NonNullList<ItemStack> drops, IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
super.getDrops(drops, world, pos, state, fortune);
if(state.getValue(VISIBLE) && harvesters.get() != null) {
drops.add(new ItemStack(Item.getItemFromBlock(this), 1));
}
}

Expand Down