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.EntityMultiPlaceEvent, BlockEvent.EntityPlaceEvent, BlockEvent.FarmlandTrampleEvent, BlockEvent.FluidPlaceBlockEvent, BlockEvent.HarvestDropsEvent, BlockEvent.MultiPlaceEvent, BlockEvent.NeighborNotifyEvent, BlockEvent.PlaceEvent, BlockEvent.PortalSpawnEvent
Event.HasResult, Event.Result
Modifier and Type | Field and Description |
---|---|
private float |
dropChance |
private java.util.List<ItemStack> |
drops |
private int |
fortuneLevel |
private EntityPlayer |
harvester |
private boolean |
isSilkTouching |
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
private final int fortuneLevel
private final java.util.List<ItemStack> drops
private final boolean isSilkTouching
private float dropChance
private final EntityPlayer harvester
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()