Skip to content

Commit

Permalink
Fix goomba data flags not saving
Browse files Browse the repository at this point in the history
  • Loading branch information
WenXin20 committed Jan 7, 2025
1 parent 0e57b32 commit 7fbcc87
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/main/java/com/wenxin2/marioverse/entities/GoombaEntity.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import net.minecraft.core.particles.BlockParticleOption;
import net.minecraft.core.particles.ParticleTypes;
import net.minecraft.core.registries.Registries;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.syncher.EntityDataAccessor;
import net.minecraft.network.syncher.EntityDataSerializers;
import net.minecraft.network.syncher.SynchedEntityData;
Expand Down Expand Up @@ -232,6 +233,24 @@ public AnimatableInstanceCache getAnimatableInstanceCache() {
return cache;
}

@Override
public void readAdditionalSaveData(CompoundTag tag) {
super.readAdditionalSaveData(tag);
this.entityData.set(DATA_ID_RIDE_FLAGS, tag.getByte("RideFlags"));
this.entityData.set(DATA_ID_SCARE_FLAGS, tag.getByte("ScareFlags"));
this.entityData.set(DATA_ID_SIT_FLAGS, tag.getByte("SitFlags"));
this.entityData.set(DATA_ID_SLEEP_FLAGS, tag.getByte("SleepFlags"));
}

@Override
public void addAdditionalSaveData(CompoundTag tag) {
super.addAdditionalSaveData(tag);
tag.putByte("RideFlags", this.entityData.get(DATA_ID_RIDE_FLAGS));
tag.putByte("ScareFlags", this.entityData.get(DATA_ID_SCARE_FLAGS));
tag.putByte("SitFlags", this.entityData.get(DATA_ID_SIT_FLAGS));
tag.putByte("SleepFlags", this.entityData.get(DATA_ID_SLEEP_FLAGS));
}

public boolean isSitting() {
return this.getSitFlag(8);
}
Expand Down

0 comments on commit 7fbcc87

Please sign in to comment.