Skip to content

Commit

Permalink
Heads now have an ID
Browse files Browse the repository at this point in the history
  • Loading branch information
Pedro270707 committed Jan 28, 2024
1 parent 490460b commit 9c8f49e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/client/java/net/pedroricardo/content/HeadedHead.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import java.nio.charset.StandardCharsets;
import java.util.Collection;
import java.util.Collections;
import java.util.Random;
import java.util.function.Function;

public class HeadedHead {
Expand Down Expand Up @@ -88,6 +89,8 @@ public ItemStack toStack() {
list.add(textureValueCompound);
propertyTextures.put("textures", list);
skullOwner.put("Properties", propertyTextures);
Random random = new Random(this.getName().hashCode());
skullOwner.putIntArray("Id", new int[]{random.nextInt(Integer.MIN_VALUE, Integer.MAX_VALUE), random.nextInt(Integer.MIN_VALUE, Integer.MAX_VALUE), random.nextInt(Integer.MIN_VALUE, Integer.MAX_VALUE), random.nextInt(Integer.MIN_VALUE, Integer.MAX_VALUE)});
itemStack.setSubNbt("SkullOwner", skullOwner);
if (this.getNoteBlockSound() != null) {
NbtCompound noteBlockSound = new NbtCompound();
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/net/pedroricardo/content/HeadedServerHead.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

import java.nio.charset.StandardCharsets;
import java.util.Base64;
import java.util.Random;

public class HeadedServerHead {
private final String originalTexture;
Expand Down Expand Up @@ -49,6 +50,8 @@ public ItemStack toStack() {
list.add(textureValueCompound);
propertyTextures.put("textures", list);
skullOwner.put("Properties", propertyTextures);
Random random = new Random(this.getName().hashCode());
skullOwner.putIntArray("Id", new int[]{random.nextInt(Integer.MIN_VALUE, Integer.MAX_VALUE), random.nextInt(Integer.MIN_VALUE, Integer.MAX_VALUE), random.nextInt(Integer.MIN_VALUE, Integer.MAX_VALUE), random.nextInt(Integer.MIN_VALUE, Integer.MAX_VALUE)});
itemStack.setSubNbt("SkullOwner", skullOwner);
if (this.getNoteBlockSound() != null) {
NbtCompound noteBlockSound = new NbtCompound();
Expand Down

0 comments on commit 9c8f49e

Please sign in to comment.