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.NeighborNotifyEvent, BlockEvent.PortalSpawnEvent| Modifier and Type | Field and Description |
|---|---|
private float |
dropChance |
private NonNullList<ItemStack> |
drops |
private int |
fortuneLevel |
private PlayerEntity |
harvester |
private boolean |
isSilkTouching |
| Constructor and Description |
|---|
HarvestDropsEvent(World world,
BlockPos pos,
BlockState state,
int fortuneLevel,
float dropChance,
NonNullList<ItemStack> drops,
PlayerEntity harvester,
boolean isSilkTouching) |
| Modifier and Type | Method and Description |
|---|---|
float |
getDropChance() |
java.util.List<ItemStack> |
getDrops() |
int |
getFortuneLevel() |
PlayerEntity |
getHarvester() |
boolean |
isSilkTouching() |
void |
setDropChance(float dropChance) |
getPos, getState, getWorldprivate final int fortuneLevel
private final NonNullList<ItemStack> drops
private final boolean isSilkTouching
private float dropChance
private final PlayerEntity harvester
public HarvestDropsEvent(World world, BlockPos pos, BlockState state, int fortuneLevel, float dropChance, NonNullList<ItemStack> drops, PlayerEntity harvester, boolean isSilkTouching)
public int getFortuneLevel()
public java.util.List<ItemStack> getDrops()
public boolean isSilkTouching()
public float getDropChance()
public void setDropChance(float dropChance)
public PlayerEntity getHarvester()