增加是否已经应用的标识
This commit is contained in:
parent
42e2581b53
commit
6d76ac6545
@ -10,6 +10,8 @@ public class EntitySnapshot{
|
|||||||
public final Entity mEntity;
|
public final Entity mEntity;
|
||||||
public final SpawnReason mReason;
|
public final SpawnReason mReason;
|
||||||
|
|
||||||
|
private boolean mApply=false;
|
||||||
|
|
||||||
public EntitySnapshot(World pWorld,Entity pEntity,SpawnReason pReason){
|
public EntitySnapshot(World pWorld,Entity pEntity,SpawnReason pReason){
|
||||||
this.mWorld=pWorld;
|
this.mWorld=pWorld;
|
||||||
this.mEntity=pEntity;
|
this.mEntity=pEntity;
|
||||||
@ -17,8 +19,12 @@ public class EntitySnapshot{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean apply(){
|
public boolean apply(){
|
||||||
|
if(!this.mApply){
|
||||||
|
this.mApply=true;
|
||||||
return this.mWorld.addEntity(this.mEntity,this.mReason);
|
return this.mWorld.addEntity(this.mEntity,this.mReason);
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
public void cancel(){
|
public void cancel(){
|
||||||
this.mEntity.setDead();
|
this.mEntity.setDead();
|
||||||
|
Loading…
Reference in New Issue
Block a user