1
0
Fork 0

增加是否已经应用的标识

kcx-1614
聪聪 2017-06-27 14:16:11 +08:00
parent 42e2581b53
commit 6d76ac6545
1 changed files with 7 additions and 1 deletions

View File

@ -10,6 +10,8 @@ public class EntitySnapshot{
public final Entity mEntity;
public final SpawnReason mReason;
private boolean mApply=false;
public EntitySnapshot(World pWorld,Entity pEntity,SpawnReason pReason){
this.mWorld=pWorld;
this.mEntity=pEntity;
@ -17,7 +19,11 @@ public class EntitySnapshot{
}
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(){