Skip to content

Commit

Permalink
Right-clicking on Slimelings will initiate hatching. Fixes #1354
Browse files Browse the repository at this point in the history
  • Loading branch information
micdoodle8 committed Mar 28, 2015
1 parent 4b68442 commit f53543d
Showing 1 changed file with 28 additions and 14 deletions.
Expand Up @@ -68,22 +68,12 @@ public boolean canBlockStay(World par1World, int par2, int par3, int par4)
Block block = par1World.getBlock(par2, par3 - 1, par4);
return block.isSideSolid(par1World, par2, par3, par4, ForgeDirection.UP);
}

@Override
public boolean removedByPlayer(World world, EntityPlayer player, int x, int y, int z, boolean willHarvest)

private boolean beginHatch(World world, int x, int y, int z, EntityPlayer player)
{
ItemStack currentStack = player.getCurrentEquippedItem();
int l = world.getBlockMetadata(x, y, z);

if (currentStack != null && currentStack.getItem() instanceof ItemPickaxe)
{
return world.setBlockToAir(x, y, z);
}
else if (player.capabilities.isCreativeMode)
{
return world.setBlockToAir(x, y, z);
}
else if (l < 3)
if (l < 3)
{
world.setBlockMetadataWithNotify(x, y, z, l + 3, 2);

Expand All @@ -96,14 +86,38 @@ else if (l < 3)
((TileEntitySlimelingEgg) tile).lastTouchedPlayerName = player.getCommandSenderName();
}

return false;
return true;
}
else
{
return false;
}
}

@Override
public boolean removedByPlayer(World world, EntityPlayer player, int x, int y, int z, boolean willHarvest)
{
ItemStack currentStack = player.getCurrentEquippedItem();
if (currentStack != null && currentStack.getItem() instanceof ItemPickaxe)
{
return world.setBlockToAir(x, y, z);
}
else if (player.capabilities.isCreativeMode)
{
return world.setBlockToAir(x, y, z);
}
else
{
beginHatch(world, x, y, z, player);
return false;
}
}

public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ)
{
return beginHatch(world, x, y, z, player);
}

@Override
public void harvestBlock(World world, EntityPlayer par2EntityPlayer, int x, int y, int z, int par6)
{
Expand Down

0 comments on commit f53543d

Please sign in to comment.