add summoner api to copper golem

This commit is contained in:
granny
2025-09-29 23:16:20 -07:00
parent 2c1d236c2e
commit 8befb59096
5 changed files with 106 additions and 7 deletions

View File

@@ -0,0 +1,44 @@
--- a/net/minecraft/world/entity/animal/coppergolem/CopperGolem.java
+++ b/net/minecraft/world/entity/animal/coppergolem/CopperGolem.java
@@ -84,6 +_,7 @@
private final AnimationState interactionDropItemAnimationState = new AnimationState();
private final AnimationState interactionDropNoItemAnimationState = new AnimationState();
public static final EquipmentSlot EQUIPMENT_SLOT_ANTENNA = EquipmentSlot.SADDLE;
+ @Nullable private UUID summoner; // Purpur - Summoner API
public CopperGolem(EntityType<? extends AbstractGolem> entityType, Level level) {
super(entityType, level);
@@ -97,6 +_,17 @@
this.getBrain().setMemory(MemoryModuleType.TRANSPORT_ITEMS_COOLDOWN_TICKS, this.getRandom().nextInt(60, 100));
}
+ // Purpur start - Summoner API
+ @Nullable
+ public UUID getSummoner() {
+ return summoner;
+ }
+
+ public void setSummoner(@Nullable UUID summoner) {
+ this.summoner = summoner;
+ }
+ // Purpur end - Summoner API
+
public static AttributeSupplier.Builder createAttributes() {
return Mob.createMobAttributes().add(Attributes.MOVEMENT_SPEED, 0.2F).add(Attributes.STEP_HEIGHT, 1.0).add(Attributes.MAX_HEALTH, 12.0);
}
@@ -172,6 +_,7 @@
super.addAdditionalSaveData(output);
output.putLong("next_weather_age", this.nextWeatheringTick);
output.store("weather_state", WeatheringCopper.WeatherState.CODEC, this.getWeatherState());
+ output.storeNullable("Purpur.Summoner", net.minecraft.core.UUIDUtil.CODEC, getSummoner()); // Purpur - Summoner API
}
@Override
@@ -179,6 +_,7 @@
super.readAdditionalSaveData(input);
this.nextWeatheringTick = input.getLongOr("next_weather_age", -1L);
this.setWeatherState(input.read("weather_state", WeatheringCopper.WeatherState.CODEC).orElse(WeatheringCopper.WeatherState.UNAFFECTED));
+ this.setSummoner(input.read("Purpur.Summoner", net.minecraft.core.UUIDUtil.CODEC).orElse(null)); // Purpur - Summoner API
}
@Override