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;
+ }

View File

@@ -15,7 +15,7 @@ import net.minecraft.core.registries.Registries;
import net.minecraft.resources.Identifier;
import net.minecraft.server.MinecraftServer;
import net.minecraft.world.entity.EntityDimensions;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.EntityTypes;
import net.minecraft.world.item.enchantment.Enchantment;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Blocks;
@@ -467,7 +467,7 @@ public class PurpurConfig {
public static boolean endermanShortHeight = false;
private static void entitySettings() {
endermanShortHeight = getBoolean("settings.entity.enderman.short-height", endermanShortHeight);
if (endermanShortHeight) EntityType.ENDERMAN.dimensions = EntityDimensions.scalable(0.6F, 1.9F);
if (endermanShortHeight) EntityTypes.ENDERMAN.dimensions = EntityDimensions.scalable(0.6F, 1.9F);
}
public static boolean allowWaterPlacementInTheEnd = true;

View File

@@ -5,6 +5,7 @@ import net.minecraft.server.level.ServerLevel;
import net.minecraft.util.Mth;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.EntityTypes;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.animal.dolphin.Dolphin;
import net.minecraft.world.entity.projectile.LlamaSpit;
@@ -26,7 +27,7 @@ public class DolphinSpit extends LlamaSpit {
}
public DolphinSpit(Level world, Dolphin dolphin) {
this(EntityType.LLAMA_SPIT, world);
this(EntityTypes.LLAMA_SPIT, world);
this.setOwner(dolphin.getRider() != null ? dolphin.getRider() : dolphin);
this.dolphin = dolphin;
this.setPos(

View File

@@ -5,6 +5,7 @@ import net.minecraft.server.level.ServerLevel;
import net.minecraft.util.Mth;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.EntityTypes;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.decoration.ArmorStand;
import net.minecraft.world.entity.monster.Phantom;
@@ -28,7 +29,7 @@ public class PhantomFlames extends LlamaSpit {
}
public PhantomFlames(Level world, Phantom phantom) {
this(EntityType.LLAMA_SPIT, world);
this(EntityTypes.LLAMA_SPIT, world);
setOwner(phantom.getRider() != null ? phantom.getRider() : phantom);
this.phantom = phantom;
this.setPos(

View File

@@ -5,6 +5,7 @@ import net.minecraft.network.FriendlyByteBuf;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.level.block.entity.BeehiveBlockEntity;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.phys.Vec3;
import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.entity.CraftPlayer;
import org.bukkit.entity.Player;
@@ -49,7 +50,7 @@ public class BeehiveTask implements PluginMessageListener {
ServerPlayer serverPlayer = ((CraftPlayer) player).getHandle();
// targeted block info max range specified in client at net.minecraft.client.gui.hud.DebugHud#render
if (!payload.pos().getCenter().closerThan(serverPlayer.position(), 20)) return; // Targeted Block info max range is 20
if (!Vec3.atCenterOf(payload.pos()).closerThan(serverPlayer.position(), 20)) return; // Targeted Block info max range is 20
if (serverPlayer.level().getChunkIfLoaded(payload.pos()) == null) return;
BlockEntity blockEntity = serverPlayer.level().getBlockEntity(payload.pos());