Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change Wisps to drop with getDrops #1402

Open
wants to merge 2 commits into
base: 1.12-fixes
Choose a base branch
from
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