1
0
Fork 0

add new class

kcx-1614
聪聪 2017-06-25 20:22:28 +08:00
parent 19ff6c7845
commit 8b33262701
1 changed files with 27 additions and 0 deletions

View File

@ -0,0 +1,27 @@
package net.minecraftforge.common.util;
import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason;
import net.minecraft.entity.Entity;
import net.minecraft.world.World;
public class EntitySnapshot{
public final World mWorld;
public final Entity mEntity;
public final SpawnReason mReason;
public EntitySnapshot(World pWorld,Entity pEntity,SpawnReason pReason){
this.mWorld=pWorld;
this.mEntity=pEntity;
this.mReason=pReason==null?SpawnReason.CUSTOM:pReason;
}
public boolean apply(){
return this.mWorld.addEntity(this.mEntity,this.mReason);
}
public void cancel(){
this.mEntity.setDead();
this.mWorld.removeEntity(this.mEntity);
}
}