3
0

增加是否已经应用的标识

This commit is contained in:
聪聪 2017-06-27 14:16:11 +08:00
parent 42e2581b53
commit 6d76ac6545

View File

@ -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,7 +19,11 @@ public class EntitySnapshot{
} }
public boolean apply(){ public boolean apply(){
return this.mWorld.addEntity(this.mEntity,this.mReason); if(!this.mApply){
this.mApply=true;
return this.mWorld.addEntity(this.mEntity,this.mReason);
}
return true;
} }
public void cancel(){ public void cancel(){