mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-06-21 09:47:45 +02:00
fix compile errors
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
--- a/net/minecraft/world/entity/EntityType.java
|
--- a/net/minecraft/world/entity/EntityType.java
|
||||||
+++ b/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 FeatureFlagSet requiredFeatures;
|
||||||
private final boolean allowedInPeaceful;
|
private final boolean allowedInPeaceful;
|
||||||
|
|
||||||
@@ -17,6 +17,16 @@
|
|||||||
public static Identifier getKey(final EntityType<?> type) {
|
public static Identifier getKey(final EntityType<?> type) {
|
||||||
return BuiltInRegistries.ENTITY_TYPE.getKey(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 @@
|
@@ -329,6 +_,16 @@
|
||||||
return this.category;
|
return this.category;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
- body.startSleeping(body.getBrain().getMemory(MemoryModuleType.HOME).get().pos());
|
- body.startSleeping(body.getBrain().getMemory(MemoryModuleType.HOME).get().pos());
|
||||||
+ // Purpur start - Option for beds to explode on villager sleep
|
+ // 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();
|
+ 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);
|
+ 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;
|
+ return;
|
||||||
+ }
|
+ }
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
player.setItemInHand(hand, bucketOrMilkBucket);
|
player.setItemInHand(hand, bucketOrMilkBucket);
|
||||||
return InteractionResult.SUCCESS;
|
return InteractionResult.SUCCESS;
|
||||||
+ // Purpur start - Cows eat mushrooms - feed mushroom to change to mooshroom
|
+ // 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);
|
+ return this.feedMushroom(player, itemStack);
|
||||||
+ // Purpur end - Cows eat mushrooms
|
+ // Purpur end - Cows eat mushrooms
|
||||||
} else {
|
} else {
|
||||||
@@ -50,7 +50,7 @@
|
|||||||
+ }
|
+ }
|
||||||
+ return InteractionResult.CONSUME; // require 5 mushrooms to transform (prevents mushroom duping)
|
+ 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) {
|
+ if (mooshroom == null) {
|
||||||
+ return InteractionResult.PASS;
|
+ return InteractionResult.PASS;
|
||||||
+ }
|
+ }
|
||||||
|
|||||||
@@ -45,7 +45,7 @@
|
|||||||
@Override
|
@Override
|
||||||
public @Nullable AgeableMob getBreedOffspring(final ServerLevel level, final AgeableMob partner) {
|
public @Nullable AgeableMob getBreedOffspring(final ServerLevel level, final AgeableMob partner) {
|
||||||
- return null;
|
- 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
|
@Override
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
+ public net.minecraft.world.InteractionResult mobInteract(net.minecraft.world.entity.player.Player player, net.minecraft.world.InteractionHand hand) {
|
+ 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);
|
+ 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);
|
+ return this.feedWitherRose(player, stack);
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
@@ -27,7 +27,7 @@
|
|||||||
+ return net.minecraft.world.InteractionResult.CONSUME;
|
+ 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) {
|
+ if (skeleton == null) {
|
||||||
+ return net.minecraft.world.InteractionResult.PASS;
|
+ return net.minecraft.world.InteractionResult.PASS;
|
||||||
+ }
|
+ }
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ import net.minecraft.core.registries.Registries;
|
|||||||
import net.minecraft.resources.Identifier;
|
import net.minecraft.resources.Identifier;
|
||||||
import net.minecraft.server.MinecraftServer;
|
import net.minecraft.server.MinecraftServer;
|
||||||
import net.minecraft.world.entity.EntityDimensions;
|
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.item.enchantment.Enchantment;
|
||||||
import net.minecraft.world.level.block.Block;
|
import net.minecraft.world.level.block.Block;
|
||||||
import net.minecraft.world.level.block.Blocks;
|
import net.minecraft.world.level.block.Blocks;
|
||||||
@@ -467,7 +467,7 @@ public class PurpurConfig {
|
|||||||
public static boolean endermanShortHeight = false;
|
public static boolean endermanShortHeight = false;
|
||||||
private static void entitySettings() {
|
private static void entitySettings() {
|
||||||
endermanShortHeight = getBoolean("settings.entity.enderman.short-height", endermanShortHeight);
|
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;
|
public static boolean allowWaterPlacementInTheEnd = true;
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import net.minecraft.server.level.ServerLevel;
|
|||||||
import net.minecraft.util.Mth;
|
import net.minecraft.util.Mth;
|
||||||
import net.minecraft.world.entity.Entity;
|
import net.minecraft.world.entity.Entity;
|
||||||
import net.minecraft.world.entity.EntityType;
|
import net.minecraft.world.entity.EntityType;
|
||||||
|
import net.minecraft.world.entity.EntityTypes;
|
||||||
import net.minecraft.world.entity.LivingEntity;
|
import net.minecraft.world.entity.LivingEntity;
|
||||||
import net.minecraft.world.entity.animal.dolphin.Dolphin;
|
import net.minecraft.world.entity.animal.dolphin.Dolphin;
|
||||||
import net.minecraft.world.entity.projectile.LlamaSpit;
|
import net.minecraft.world.entity.projectile.LlamaSpit;
|
||||||
@@ -26,7 +27,7 @@ public class DolphinSpit extends LlamaSpit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public DolphinSpit(Level world, Dolphin dolphin) {
|
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.setOwner(dolphin.getRider() != null ? dolphin.getRider() : dolphin);
|
||||||
this.dolphin = dolphin;
|
this.dolphin = dolphin;
|
||||||
this.setPos(
|
this.setPos(
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import net.minecraft.server.level.ServerLevel;
|
|||||||
import net.minecraft.util.Mth;
|
import net.minecraft.util.Mth;
|
||||||
import net.minecraft.world.entity.Entity;
|
import net.minecraft.world.entity.Entity;
|
||||||
import net.minecraft.world.entity.EntityType;
|
import net.minecraft.world.entity.EntityType;
|
||||||
|
import net.minecraft.world.entity.EntityTypes;
|
||||||
import net.minecraft.world.entity.LivingEntity;
|
import net.minecraft.world.entity.LivingEntity;
|
||||||
import net.minecraft.world.entity.decoration.ArmorStand;
|
import net.minecraft.world.entity.decoration.ArmorStand;
|
||||||
import net.minecraft.world.entity.monster.Phantom;
|
import net.minecraft.world.entity.monster.Phantom;
|
||||||
@@ -28,7 +29,7 @@ public class PhantomFlames extends LlamaSpit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public PhantomFlames(Level world, Phantom phantom) {
|
public PhantomFlames(Level world, Phantom phantom) {
|
||||||
this(EntityType.LLAMA_SPIT, world);
|
this(EntityTypes.LLAMA_SPIT, world);
|
||||||
setOwner(phantom.getRider() != null ? phantom.getRider() : phantom);
|
setOwner(phantom.getRider() != null ? phantom.getRider() : phantom);
|
||||||
this.phantom = phantom;
|
this.phantom = phantom;
|
||||||
this.setPos(
|
this.setPos(
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import net.minecraft.network.FriendlyByteBuf;
|
|||||||
import net.minecraft.server.level.ServerPlayer;
|
import net.minecraft.server.level.ServerPlayer;
|
||||||
import net.minecraft.world.level.block.entity.BeehiveBlockEntity;
|
import net.minecraft.world.level.block.entity.BeehiveBlockEntity;
|
||||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||||
|
import net.minecraft.world.phys.Vec3;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.craftbukkit.entity.CraftPlayer;
|
import org.bukkit.craftbukkit.entity.CraftPlayer;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@@ -49,7 +50,7 @@ public class BeehiveTask implements PluginMessageListener {
|
|||||||
ServerPlayer serverPlayer = ((CraftPlayer) player).getHandle();
|
ServerPlayer serverPlayer = ((CraftPlayer) player).getHandle();
|
||||||
|
|
||||||
// targeted block info max range specified in client at net.minecraft.client.gui.hud.DebugHud#render
|
// 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;
|
if (serverPlayer.level().getChunkIfLoaded(payload.pos()) == null) return;
|
||||||
|
|
||||||
BlockEntity blockEntity = serverPlayer.level().getBlockEntity(payload.pos());
|
BlockEntity blockEntity = serverPlayer.level().getBlockEntity(payload.pos());
|
||||||
|
|||||||
Reference in New Issue
Block a user