fix compile errors

This commit is contained in:
granny
2026-06-10 16:19:43 -07:00
parent e3f5a93f1c
commit 779f1f2613
9 changed files with 25 additions and 12 deletions

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/EntityType.java
+++ b/net/minecraft/world/entity/EntityType.java
@@ -74,6 +_,16 @@
@@ -74,10 +_,26 @@
private final FeatureFlagSet requiredFeatures;
private final boolean allowedInPeaceful;
@@ -17,6 +17,16 @@
public static Identifier getKey(final EntityType<?> type) {
return BuiltInRegistries.ENTITY_TYPE.getKey(type);
}
+ // Purpur start
+ public static Optional<EntityType<?>> byString(String key) {
+ return BuiltInRegistries.ENTITY_TYPE.getOptional(Identifier.tryParse(key));
+ }
+ // Purpur end
+
public EntityType(
final EntityType.EntityFactory<T> factory,
final MobCategory category,
@@ -329,6 +_,16 @@
return this.category;
}

View File

@@ -7,7 +7,7 @@
- body.startSleeping(body.getBrain().getMemory(MemoryModuleType.HOME).get().pos());
+ // Purpur start - Option for beds to explode on villager sleep
+ net.minecraft.core.BlockPos bedPosition = body.getBrain().getMemory(net.minecraft.world.entity.ai.memory.MemoryModuleType.HOME).get().pos();
+ if (level.purpurConfig.bedExplodeOnVillagerSleep && body.is(net.minecraft.world.entity.EntityType.VILLAGER) && level.getBlockState(bedPosition).getBlock() instanceof net.minecraft.world.level.block.BedBlock) {
+ if (level.purpurConfig.bedExplodeOnVillagerSleep && body.is(net.minecraft.world.entity.EntityTypes.VILLAGER) && level.getBlockState(bedPosition).getBlock() instanceof net.minecraft.world.level.block.BedBlock) {
+ level.explode(null, (double) bedPosition.getX() + 0.5D, (double) bedPosition.getY() + 0.5D, (double) bedPosition.getZ() + 0.5D, (float) level.purpurConfig.bedExplosionPower, level.purpurConfig.bedExplosionFire, level.purpurConfig.bedExplosionEffect);
+ return;
+ }

View File

@@ -14,7 +14,7 @@
player.setItemInHand(hand, bucketOrMilkBucket);
return InteractionResult.SUCCESS;
+ // Purpur start - Cows eat mushrooms - feed mushroom to change to mooshroom
+ } else if (level().purpurConfig.cowFeedMushrooms > 0 && this.getType() != EntityType.MOOSHROOM && isMushroom(itemStack)) {
+ } else if (level().purpurConfig.cowFeedMushrooms > 0 && this.getType() != EntityTypes.MOOSHROOM && isMushroom(itemStack)) {
+ return this.feedMushroom(player, itemStack);
+ // Purpur end - Cows eat mushrooms
} else {
@@ -50,7 +50,7 @@
+ }
+ return InteractionResult.CONSUME; // require 5 mushrooms to transform (prevents mushroom duping)
+ }
+ MushroomCow mooshroom = EntityType.MOOSHROOM.create(level(), net.minecraft.world.entity.EntitySpawnReason.CONVERSION);
+ MushroomCow mooshroom = EntityTypes.MOOSHROOM.create(level(), net.minecraft.world.entity.EntitySpawnReason.CONVERSION);
+ if (mooshroom == null) {
+ return InteractionResult.PASS;
+ }

View File

@@ -45,7 +45,7 @@
@Override
public @Nullable AgeableMob getBreedOffspring(final ServerLevel level, final AgeableMob partner) {
- return null;
+ return level.purpurConfig.parrotBreedable ? EntityType.PARROT.create(level, EntitySpawnReason.BREEDING) : null; // Purpur - Breedable parrots
+ return level.purpurConfig.parrotBreedable ? EntityTypes.PARROT.create(level, EntitySpawnReason.BREEDING) : null; // Purpur - Breedable parrots
}
@Override

View File

@@ -12,7 +12,7 @@
+ public net.minecraft.world.InteractionResult mobInteract(net.minecraft.world.entity.player.Player player, net.minecraft.world.InteractionHand hand) {
+ net.minecraft.world.item.ItemStack stack = player.getItemInHand(hand);
+
+ if (level().purpurConfig.skeletonFeedWitherRoses > 0 && this.getType() != EntityType.WITHER_SKELETON && stack.getItem() == net.minecraft.world.level.block.Blocks.WITHER_ROSE.asItem()) {
+ if (level().purpurConfig.skeletonFeedWitherRoses > 0 && this.getType() != EntityTypes.WITHER_SKELETON && stack.getItem() == net.minecraft.world.level.block.Blocks.WITHER_ROSE.asItem()) {
+ return this.feedWitherRose(player, stack);
+ }
+
@@ -27,7 +27,7 @@
+ return net.minecraft.world.InteractionResult.CONSUME;
+ }
+
+ WitherSkeleton skeleton = EntityType.WITHER_SKELETON.create(level(), net.minecraft.world.entity.EntitySpawnReason.CONVERSION);
+ WitherSkeleton skeleton = EntityTypes.WITHER_SKELETON.create(level(), net.minecraft.world.entity.EntitySpawnReason.CONVERSION);
+ if (skeleton == null) {
+ return net.minecraft.world.InteractionResult.PASS;
+ }