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
Event.HasResult, Event.Result
コンストラクタと説明 |
---|
HarvestDropsEvent(World world,
BlockPos pos,
BlockState state,
int fortuneLevel,
float dropChance,
NonNullList<ItemStack> drops,
PlayerEntity harvester,
boolean isSilkTouching) |
修飾子とタイプ | メソッドと説明 |
---|---|
float |
getDropChance() |
java.util.List<ItemStack> |
getDrops() |
int |
getFortuneLevel() |
PlayerEntity |
getHarvester() |
boolean |
isSilkTouching() |
void |
setDropChance(float dropChance) |
getPos, getState, getWorld
getListenerList, getParentListenerList, getPhase, getResult, hasResult, isCancelable, isCanceled, setCanceled, setPhase, setResult, setup
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()