public static class BlockEvent.HarvestDropsEvent extends BlockEvent
drops
array can be amended, as can the dropChance
.
Note well: the harvester
player field is null in a variety of scenarios. Code expecting null.
The dropChance
is used to determine which items in this array will actually drop, compared to a random number. If you wish, you
can pre-filter yourself, and set dropChance
to 1.0f to always drop the contents of the drops
array.
isSilkTouching
is set if this is considered a silk touch harvesting operation, vs a normal harvesting operation. Act accordingly.BlockEvent.BreakEvent, BlockEvent.CreateFluidSourceEvent, BlockEvent.CropGrowEvent, BlockEvent.HarvestDropsEvent, BlockEvent.MultiPlaceEvent, BlockEvent.NeighborNotifyEvent, BlockEvent.PlaceEvent
Event.HasResult, Event.Result
Constructor and Description |
---|
HarvestDropsEvent(World world,
BlockPos pos,
IBlockState state,
int fortuneLevel,
float dropChance,
java.util.List<ItemStack> drops,
EntityPlayer harvester,
boolean isSilkTouching) |
Modifier and Type | Method and Description |
---|---|
float |
getDropChance() |
java.util.List<ItemStack> |
getDrops() |
int |
getFortuneLevel() |
EntityPlayer |
getHarvester() |
boolean |
isSilkTouching() |
void |
setDropChance(float dropChance) |
getPos, getState, getWorld
getListenerList, getPhase, getResult, hasResult, isCancelable, isCanceled, setCanceled, setPhase, setResult, setup
public HarvestDropsEvent(World world, BlockPos pos, IBlockState state, int fortuneLevel, float dropChance, java.util.List<ItemStack> drops, EntityPlayer harvester, boolean isSilkTouching)
public int getFortuneLevel()
public java.util.List<ItemStack> getDrops()
public boolean isSilkTouching()
public float getDropChance()
public void setDropChance(float dropChance)
public EntityPlayer getHarvester()