Skip to content

Commit

Permalink
Sync "Sitting" nbt
Browse files Browse the repository at this point in the history
  • Loading branch information
nyuppo committed Apr 19, 2024
1 parent 4c2a5e6 commit 34d1bda
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/main/java/com/github/nyuppo/MoreMobVariants.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import net.minecraft.entity.SpawnGroup;
import net.minecraft.entity.passive.PigEntity;
import net.minecraft.entity.passive.SheepEntity;
import net.minecraft.entity.passive.TameableEntity;
import net.minecraft.nbt.NbtCompound;
import net.minecraft.network.PacketByteBuf;
import net.minecraft.registry.RegistryKeys;
Expand Down Expand Up @@ -89,6 +90,11 @@ public void onInitialize() {
responseBuf.writeInt(entity.getId());
responseBuf.writeString(nbt.getString(NBT_KEY));

// For some reason, "Sitting" syncing breaks, so send that too I guess
if (entity instanceof TameableEntity) {
responseBuf.writeBoolean(nbt.getBoolean("Sitting"));
}

// Muddy pigs
if (entity instanceof PigEntity) {
responseBuf.writeBoolean(nbt.getBoolean(MUDDY_NBT_KEY));
Expand Down
6 changes: 6 additions & 0 deletions src/main/java/com/github/nyuppo/MoreMobVariantsClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import net.minecraft.entity.passive.CatEntity;
import net.minecraft.entity.passive.PigEntity;
import net.minecraft.entity.passive.SheepEntity;
import net.minecraft.entity.passive.TameableEntity;
import net.minecraft.nbt.NbtCompound;
import net.minecraft.network.PacketByteBuf;
import org.slf4j.Logger;
Expand Down Expand Up @@ -65,6 +66,11 @@ public void onInitializeClient() {

nbt.putString(MoreMobVariants.NBT_KEY, variantId);

// For some reason, "Sitting" syncing breaks, so get that too I guess
if (entity instanceof TameableEntity) {
nbt.putBoolean("Sitting", buf.readBoolean());
}

// Muddy pigs
boolean isMuddy;
int muddyTimeLeft;
Expand Down

0 comments on commit 34d1bda

Please sign in to comment.