mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-25 22:44:32 +00:00
Add PlayerEvent.HarvestCheck and PlayerEvent.BreakSpeed for dealing with things related to a player harvesting a block.
This commit is contained in:
1 parent
44e3843edb
commit
63aa706dcf
3 files changed
+89
-17
No files matched your search
@@ -0,0 +1,20 @@
|
||||
package net.minecraftforge.event;
|
||||
import net.minecraft.src.*;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.entity.player.PlayerEvent;
|
||||
|
||||
public class ForgeEventFactory
|
||||
{
|
||||
public static boolean doPlayerHarvestCheck(EntityPlayer player, Block block, boolean success)
|
||||
{
|
||||
PlayerEvent.HarvestCheck event = new PlayerEvent.HarvestCheck(player, block, success);
|
||||
MinecraftForge.EVENT_BUS.post(event);
|
||||
return event.success;
|
||||
}
|
||||
|
||||
public static float getBreakSpeed(EntityPlayer player, Block block, int metadata, float original)
|
||||
{
|
||||
PlayerEvent.BreakSpeed event = new PlayerEvent.BreakSpeed(player, block, metadata, original);
|
||||
return (MinecraftForge.EVENT_BUS.post(event) ? -1 : event.newSpeed);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user