Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added event hooks to control to allow mod control of mob spawning. PR: …
…#337 Deprecated LivingSpecialSpawnEvent in favor of new LivingSpawnEvent.SpecialSpawn
- Loading branch information
Showing
4 changed files
with
94 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
common/net/minecraftforge/event/entity/living/LivingSpawnEvent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
package net.minecraftforge.event.entity.living; | ||
|
||
import net.minecraft.entity.EntityLiving; | ||
import net.minecraft.world.World; | ||
import net.minecraftforge.event.Cancelable; | ||
import net.minecraftforge.event.Event.HasResult; | ||
|
||
public class LivingSpawnEvent extends LivingEvent | ||
{ | ||
public final World world; | ||
public final float x; | ||
public final float y; | ||
public final float z; | ||
|
||
public LivingSpawnEvent(EntityLiving entity, World world, float x, float y, float z) | ||
{ | ||
super(entity); | ||
this.world = world; | ||
this.x = x; | ||
this.y = y; | ||
this.z = z; | ||
} | ||
|
||
/** | ||
* Fires before mob spawn events. | ||
* | ||
* Result is significant: | ||
* DEFAULT: use vanilla spawn rules | ||
* ALLOW: allow the spawn | ||
* DENY: deny the spawn | ||
* | ||
*/ | ||
@HasResult | ||
public static class CheckSpawn extends LivingSpawnEvent | ||
{ | ||
public CheckSpawn(EntityLiving entity, World world, float x, float y, float z) | ||
{ | ||
super(entity, world, x, y, z); | ||
} | ||
} | ||
|
||
@Cancelable | ||
public static class SpecialSpawn extends LivingSpawnEvent | ||
{ | ||
public SpecialSpawn(EntityLiving entity, World world, float x, float y, float z) | ||
{ | ||
super(entity, world, x, y, z); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters