mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-17 16:37:43 +01:00
fix some compilation issues
This commit is contained in:
@@ -5,8 +5,8 @@
|
|||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
|
|
||||||
+ // Purpur start - Gamemode extra permissions
|
+ // Purpur start - Gamemode extra permissions
|
||||||
+ public boolean testPermission(int i, String bukkitPermission) {
|
+ public boolean testPermission(net.minecraft.server.permissions.Permission permission, String bukkitPermission) {
|
||||||
+ if (hasPermission(i, bukkitPermission)) {
|
+ if (hasPermission(permission, bukkitPermission)) {
|
||||||
+ return true;
|
+ return true;
|
||||||
+ }
|
+ }
|
||||||
+ net.kyori.adventure.text.Component permissionMessage = getLevel().getServer().server.permissionMessage();
|
+ net.kyori.adventure.text.Component permissionMessage = getLevel().getServer().server.permissionMessage();
|
||||||
@@ -37,11 +37,11 @@
|
|||||||
+ sendSuccess(net.kyori.adventure.text.minimessage.MiniMessage.miniMessage().deserialize(message), broadcastToOps);
|
+ sendSuccess(net.kyori.adventure.text.minimessage.MiniMessage.miniMessage().deserialize(message), broadcastToOps);
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ public void sendSuccess(@Nullable net.kyori.adventure.text.Component message) {
|
+ public void sendSuccess(net.kyori.adventure.text.@Nullable Component message) {
|
||||||
+ sendSuccess(message, false);
|
+ sendSuccess(message, false);
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ public void sendSuccess(@Nullable net.kyori.adventure.text.Component message, boolean broadcastToOps) {
|
+ public void sendSuccess(net.kyori.adventure.text.@Nullable Component message, boolean broadcastToOps) {
|
||||||
+ if (message == null) {
|
+ if (message == null) {
|
||||||
+ return;
|
+ return;
|
||||||
+ }
|
+ }
|
||||||
|
|||||||
@@ -8,10 +8,10 @@
|
|||||||
+ if (org.purpurmc.purpur.PurpurConfig.commandGamemodeRequiresPermission) {
|
+ if (org.purpurmc.purpur.PurpurConfig.commandGamemodeRequiresPermission) {
|
||||||
+ String gamemode = gameType.getName();
|
+ String gamemode = gameType.getName();
|
||||||
+ CommandSourceStack sender = context.getSource();
|
+ CommandSourceStack sender = context.getSource();
|
||||||
+ if (!sender.testPermission(2, "minecraft.command.gamemode." + gamemode)) {
|
+ if (!sender.testPermission(Permissions.COMMANDS_GAMEMASTER, "minecraft.command.gamemode." + gamemode)) {
|
||||||
+ return 0;
|
+ return 0;
|
||||||
+ }
|
+ }
|
||||||
+ if (sender.getEntity() instanceof ServerPlayer player && (players.size() > 1 || !players.contains(player)) && !sender.testPermission(2, "minecraft.command.gamemode." + gamemode + ".other")) {
|
+ if (sender.getEntity() instanceof ServerPlayer player && (players.size() > 1 || !players.contains(player)) && !sender.testPermission(Permissions.COMMANDS_GAMEMASTER, "minecraft.command.gamemode." + gamemode + ".other")) {
|
||||||
+ return 0;
|
+ return 0;
|
||||||
+ }
|
+ }
|
||||||
+ }
|
+ }
|
||||||
|
|||||||
@@ -30,7 +30,7 @@
|
|||||||
+ this.customSpawners.add(new net.minecraft.world.entity.ai.village.VillageSiege());
|
+ this.customSpawners.add(new net.minecraft.world.entity.ai.village.VillageSiege());
|
||||||
+ }
|
+ }
|
||||||
+ if (purpurConfig.villagerTraderSpawning) {
|
+ if (purpurConfig.villagerTraderSpawning) {
|
||||||
+ this.customSpawners.add(new net.minecraft.world.entity.npc.WanderingTraderSpawner(serverLevelData));
|
+ this.customSpawners.add(new net.minecraft.world.entity.npc.wanderingtrader.WanderingTraderSpawner(serverLevelData));
|
||||||
+ }
|
+ }
|
||||||
+ // Purpur end - Allow toggling special MobSpawners per world
|
+ // Purpur end - Allow toggling special MobSpawners per world
|
||||||
ChunkGenerator chunkGenerator = levelStem.generator();
|
ChunkGenerator chunkGenerator = levelStem.generator();
|
||||||
@@ -94,7 +94,7 @@
|
|||||||
if (flag) {
|
if (flag) {
|
||||||
- SkeletonHorse skeletonHorse = EntityType.SKELETON_HORSE.create(this, EntitySpawnReason.EVENT);
|
- SkeletonHorse skeletonHorse = EntityType.SKELETON_HORSE.create(this, EntitySpawnReason.EVENT);
|
||||||
+ // Purpur start - Special mobs naturally spawn
|
+ // Purpur start - Special mobs naturally spawn
|
||||||
+ net.minecraft.world.entity.animal.horse.AbstractHorse skeletonHorse;
|
+ net.minecraft.world.entity.animal.equine.AbstractHorse skeletonHorse;
|
||||||
+ if (purpurConfig.zombieHorseSpawnChance > 0D && random.nextDouble() <= purpurConfig.zombieHorseSpawnChance) {
|
+ if (purpurConfig.zombieHorseSpawnChance > 0D && random.nextDouble() <= purpurConfig.zombieHorseSpawnChance) {
|
||||||
+ skeletonHorse = EntityType.ZOMBIE_HORSE.create(this, EntitySpawnReason.EVENT);
|
+ skeletonHorse = EntityType.ZOMBIE_HORSE.create(this, EntitySpawnReason.EVENT);
|
||||||
+ } else {
|
+ } else {
|
||||||
@@ -174,7 +174,7 @@
|
|||||||
+ if (!org.purpurmc.purpur.PurpurConfig.sleepingPlayersPercent.equalsIgnoreCase("default")) {
|
+ if (!org.purpurmc.purpur.PurpurConfig.sleepingPlayersPercent.equalsIgnoreCase("default")) {
|
||||||
+ component = io.papermc.paper.adventure.PaperAdventure.asVanilla(net.kyori.adventure.text.minimessage.MiniMessage.miniMessage().deserialize(org.purpurmc.purpur.PurpurConfig.sleepingPlayersPercent,
|
+ component = io.papermc.paper.adventure.PaperAdventure.asVanilla(net.kyori.adventure.text.minimessage.MiniMessage.miniMessage().deserialize(org.purpurmc.purpur.PurpurConfig.sleepingPlayersPercent,
|
||||||
+ net.kyori.adventure.text.minimessage.tag.resolver.Placeholder.parsed("count", Integer.toString(this.sleepStatus.amountSleeping())),
|
+ net.kyori.adventure.text.minimessage.tag.resolver.Placeholder.parsed("count", Integer.toString(this.sleepStatus.amountSleeping())),
|
||||||
+ net.kyori.adventure.text.minimessage.tag.resolver.Placeholder.parsed("total", Integer.toString(this.sleepStatus.sleepersNeeded(_int)))));
|
+ net.kyori.adventure.text.minimessage.tag.resolver.Placeholder.parsed("total", Integer.toString(this.sleepStatus.sleepersNeeded(i)))));
|
||||||
+ } else
|
+ } else
|
||||||
+ // Purpur end - Customizable sleeping actionbar messages
|
+ // Purpur end - Customizable sleeping actionbar messages
|
||||||
component = Component.translatable("sleep.players_sleeping", this.sleepStatus.amountSleeping(), this.sleepStatus.sleepersNeeded(i));
|
component = Component.translatable("sleep.players_sleeping", this.sleepStatus.amountSleeping(), this.sleepStatus.sleepersNeeded(i));
|
||||||
@@ -201,7 +201,7 @@
|
|||||||
case NONE -> Explosion.BlockInteraction.KEEP;
|
case NONE -> Explosion.BlockInteraction.KEEP;
|
||||||
case BLOCK -> this.getDestroyType(GameRules.BLOCK_EXPLOSION_DROP_DECAY);
|
case BLOCK -> this.getDestroyType(GameRules.BLOCK_EXPLOSION_DROP_DECAY);
|
||||||
- case MOB -> this.getGameRules().get(GameRules.MOB_GRIEFING)
|
- case MOB -> this.getGameRules().get(GameRules.MOB_GRIEFING)
|
||||||
+ case MOB -> ((source instanceof net.minecraft.world.entity.projectile.LargeFireball) ? this.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING, this.purpurConfig.fireballsMobGriefingOverride) : this.getGameRules().get(GameRules.MOB_GRIEFING)) // Purpur - Add mobGriefing override to everything affected
|
+ case MOB -> ((source instanceof net.minecraft.world.entity.projectile.hurtingprojectile.LargeFireball) ? this.getGameRules().getBoolean(GameRules.MOB_GRIEFING, this.purpurConfig.fireballsMobGriefingOverride) : this.getGameRules().get(GameRules.MOB_GRIEFING)) // Purpur - Add mobGriefing override to everything affected
|
||||||
? this.getDestroyType(GameRules.MOB_EXPLOSION_DROP_DECAY)
|
? this.getDestroyType(GameRules.MOB_EXPLOSION_DROP_DECAY)
|
||||||
: Explosion.BlockInteraction.KEEP;
|
: Explosion.BlockInteraction.KEEP;
|
||||||
case TNT -> this.getDestroyType(GameRules.TNT_EXPLOSION_DROP_DECAY);
|
case TNT -> this.getDestroyType(GameRules.TNT_EXPLOSION_DROP_DECAY);
|
||||||
|
|||||||
@@ -44,7 +44,7 @@
|
|||||||
} else {
|
} else {
|
||||||
+ // Purpur start - Add boat fall damage config
|
+ // Purpur start - Add boat fall damage config
|
||||||
+ if (damageSource.is(net.minecraft.tags.DamageTypeTags.IS_FALL)) {
|
+ if (damageSource.is(net.minecraft.tags.DamageTypeTags.IS_FALL)) {
|
||||||
+ if (getRootVehicle() instanceof net.minecraft.world.entity.vehicle.Boat && !level().purpurConfig.boatsDoFallDamage) {
|
+ if (getRootVehicle() instanceof net.minecraft.world.entity.vehicle.boat.Boat && !level().purpurConfig.boatsDoFallDamage) {
|
||||||
+ return false;
|
+ return false;
|
||||||
+ }
|
+ }
|
||||||
+ }
|
+ }
|
||||||
@@ -109,7 +109,7 @@
|
|||||||
+ }
|
+ }
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ public void sendActionBarMessage(@Nullable net.kyori.adventure.text.Component message) {
|
+ public void sendActionBarMessage(net.kyori.adventure.text.@Nullable Component message) {
|
||||||
+ if (message != null) {
|
+ if (message != null) {
|
||||||
+ sendActionBarMessage(io.papermc.paper.adventure.PaperAdventure.asVanilla(message));
|
+ sendActionBarMessage(io.papermc.paper.adventure.PaperAdventure.asVanilla(message));
|
||||||
+ }
|
+ }
|
||||||
@@ -136,7 +136,7 @@
|
|||||||
+ }
|
+ }
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ public void sendMessage(@Nullable net.kyori.adventure.text.Component message) {
|
+ public void sendMessage(net.kyori.adventure.text.@Nullable Component message) {
|
||||||
+ if (message != null) {
|
+ if (message != null) {
|
||||||
+ this.sendSystemMessage(io.papermc.paper.adventure.PaperAdventure.asVanilla(message));
|
+ this.sendSystemMessage(io.papermc.paper.adventure.PaperAdventure.asVanilla(message));
|
||||||
+ }
|
+ }
|
||||||
|
|||||||
@@ -27,7 +27,7 @@
|
|||||||
+ }
|
+ }
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ public void broadcastMessage(@Nullable net.kyori.adventure.text.Component message, boolean overlay) {
|
+ public void broadcastMessage(net.kyori.adventure.text.@Nullable Component message, boolean overlay) {
|
||||||
+ if (message != null) {
|
+ if (message != null) {
|
||||||
+ this.broadcastSystemMessage(io.papermc.paper.adventure.PaperAdventure.asVanilla(message), overlay);
|
+ this.broadcastSystemMessage(io.papermc.paper.adventure.PaperAdventure.asVanilla(message), overlay);
|
||||||
+ }
|
+ }
|
||||||
|
|||||||
@@ -103,7 +103,7 @@
|
|||||||
if (this.isAlive() && this instanceof Leashable leashable2) {
|
if (this.isAlive() && this instanceof Leashable leashable2) {
|
||||||
if (leashable2.getLeashHolder() == player) {
|
if (leashable2.getLeashHolder() == player) {
|
||||||
if (!this.level().isClientSide()) {
|
if (!this.level().isClientSide()) {
|
||||||
+ if (hand == InteractionHand.OFF_HAND && (level().purpurConfig.villagerCanBeLeashed || level().purpurConfig.wanderingTraderCanBeLeashed) && this instanceof net.minecraft.world.entity.npc.AbstractVillager) return InteractionResult.CONSUME; // Purpur - Allow leashing villagers
|
+ if (hand == InteractionHand.OFF_HAND && (level().purpurConfig.villagerCanBeLeashed || level().purpurConfig.wanderingTraderCanBeLeashed) && this instanceof net.minecraft.world.entity.npc.villager.AbstractVillager) return InteractionResult.CONSUME; // Purpur - Allow leashing villagers
|
||||||
// Paper start - EntityUnleashEvent
|
// Paper start - EntityUnleashEvent
|
||||||
if (!org.bukkit.craftbukkit.event.CraftEventFactory.handlePlayerUnleashEntityEvent(
|
if (!org.bukkit.craftbukkit.event.CraftEventFactory.handlePlayerUnleashEntityEvent(
|
||||||
leashable2, player, hand, !player.hasInfiniteMaterials(), true
|
leashable2, player, hand, !player.hasInfiniteMaterials(), true
|
||||||
|
|||||||
@@ -1,22 +1,21 @@
|
|||||||
--- a/net/minecraft/world/entity/animal/golem/IronGolem.java
|
--- a/net/minecraft/world/entity/animal/golem/IronGolem.java
|
||||||
+++ b/net/minecraft/world/entity/animal/golem/IronGolem.java
|
+++ b/net/minecraft/world/entity/animal/golem/IronGolem.java
|
||||||
@@ -58,13 +_,26 @@
|
@@ -58,13 +_,25 @@
|
||||||
private static final UniformInt PERSISTENT_ANGER_TIME = TimeUtil.rangeOfSeconds(20, 39);
|
private static final UniformInt PERSISTENT_ANGER_TIME = TimeUtil.rangeOfSeconds(20, 39);
|
||||||
private long persistentAngerEndTime;
|
private long persistentAngerEndTime;
|
||||||
private @Nullable EntityReference<LivingEntity> persistentAngerTarget;
|
private @Nullable EntityReference<LivingEntity> persistentAngerTarget;
|
||||||
+ @Nullable private UUID summoner; // Purpur - Summoner API
|
+ private java.util.@Nullable UUID summoner; // Purpur - Summoner API
|
||||||
|
|
||||||
public IronGolem(EntityType<? extends IronGolem> type, Level level) {
|
public IronGolem(EntityType<? extends IronGolem> type, Level level) {
|
||||||
super(type, level);
|
super(type, level);
|
||||||
}
|
}
|
||||||
|
|
||||||
+ // Purpur start - Summoner API
|
+ // Purpur start - Summoner API
|
||||||
+ @Nullable
|
+ public java.util.@Nullable UUID getSummoner() {
|
||||||
+ public UUID getSummoner() {
|
|
||||||
+ return summoner;
|
+ return summoner;
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ public void setSummoner(@Nullable UUID summoner) {
|
+ public void setSummoner(java.util.@Nullable UUID summoner) {
|
||||||
+ this.summoner = summoner;
|
+ this.summoner = summoner;
|
||||||
+ }
|
+ }
|
||||||
+ // Purpur end - Summoner API
|
+ // Purpur end - Summoner API
|
||||||
|
|||||||
@@ -1,22 +1,21 @@
|
|||||||
--- a/net/minecraft/world/entity/animal/golem/SnowGolem.java
|
--- a/net/minecraft/world/entity/animal/golem/SnowGolem.java
|
||||||
+++ b/net/minecraft/world/entity/animal/golem/SnowGolem.java
|
+++ b/net/minecraft/world/entity/animal/golem/SnowGolem.java
|
||||||
@@ -46,15 +_,27 @@
|
@@ -46,15 +_,26 @@
|
||||||
private static final EntityDataAccessor<Byte> DATA_PUMPKIN_ID = SynchedEntityData.defineId(SnowGolem.class, EntityDataSerializers.BYTE);
|
private static final EntityDataAccessor<Byte> DATA_PUMPKIN_ID = SynchedEntityData.defineId(SnowGolem.class, EntityDataSerializers.BYTE);
|
||||||
private static final byte PUMPKIN_FLAG = 16;
|
private static final byte PUMPKIN_FLAG = 16;
|
||||||
private static final boolean DEFAULT_PUMPKIN = true;
|
private static final boolean DEFAULT_PUMPKIN = true;
|
||||||
+ @Nullable private java.util.UUID summoner; // Purpur - Summoner API
|
+ private java.util.@Nullable UUID summoner; // Purpur - Summoner API
|
||||||
|
|
||||||
public SnowGolem(EntityType<? extends SnowGolem> type, Level level) {
|
public SnowGolem(EntityType<? extends SnowGolem> type, Level level) {
|
||||||
super(type, level);
|
super(type, level);
|
||||||
}
|
}
|
||||||
|
|
||||||
+ // Purpur start - Summoner API
|
+ // Purpur start - Summoner API
|
||||||
+ @Nullable
|
+ public java.util.@Nullable UUID getSummoner() {
|
||||||
+ public java.util.UUID getSummoner() {
|
|
||||||
+ return summoner;
|
+ return summoner;
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ public void setSummoner(@Nullable java.util.UUID summoner) {
|
+ public void setSummoner(java.util.@Nullable UUID summoner) {
|
||||||
+ this.summoner = summoner;
|
+ this.summoner = summoner;
|
||||||
+ }
|
+ }
|
||||||
+ // Purpur end - Summoner API
|
+ // Purpur end - Summoner API
|
||||||
|
|||||||
@@ -4,21 +4,20 @@
|
|||||||
private static final TargetingConditions.Selector LIVING_ENTITY_SELECTOR = (entity, level) -> !entity.getType().is(EntityTypeTags.WITHER_FRIENDS)
|
private static final TargetingConditions.Selector LIVING_ENTITY_SELECTOR = (entity, level) -> !entity.getType().is(EntityTypeTags.WITHER_FRIENDS)
|
||||||
&& entity.attackable();
|
&& entity.attackable();
|
||||||
private static final TargetingConditions TARGETING_CONDITIONS = TargetingConditions.forCombat().range(20.0).selector(LIVING_ENTITY_SELECTOR);
|
private static final TargetingConditions TARGETING_CONDITIONS = TargetingConditions.forCombat().range(20.0).selector(LIVING_ENTITY_SELECTOR);
|
||||||
+ @Nullable private java.util.UUID summoner; // Purpur - Summoner API
|
+ private java.util.@Nullable UUID summoner; // Purpur - Summoner API
|
||||||
|
|
||||||
public WitherBoss(EntityType<? extends WitherBoss> type, Level level) {
|
public WitherBoss(EntityType<? extends WitherBoss> type, Level level) {
|
||||||
super(type, level);
|
super(type, level);
|
||||||
@@ -88,6 +_,17 @@
|
@@ -88,6 +_,16 @@
|
||||||
this.xpReward = 50;
|
this.xpReward = 50;
|
||||||
}
|
}
|
||||||
|
|
||||||
+ // Purpur start - Summoner API
|
+ // Purpur start - Summoner API
|
||||||
+ @Nullable
|
+ public java.util.@Nullable UUID getSummoner() {
|
||||||
+ public java.util.UUID getSummoner() {
|
|
||||||
+ return summoner;
|
+ return summoner;
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ public void setSummoner(@Nullable java.util.UUID summoner) {
|
+ public void setSummoner(java.util.@Nullable UUID summoner) {
|
||||||
+ this.summoner = summoner;
|
+ this.summoner = summoner;
|
||||||
+ }
|
+ }
|
||||||
+ // Purpur end - Summoner API
|
+ // Purpur end - Summoner API
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
|
|
||||||
+ // Purpur start - Special mobs naturally spawn
|
+ // Purpur start - Special mobs naturally spawn
|
||||||
+ @Override
|
+ @Override
|
||||||
+ public net.minecraft.world.entity.SpawnGroupData finalizeSpawn(net.minecraft.world.level.ServerLevelAccessor world, net.minecraft.world.DifficultyInstance difficulty, net.minecraft.world.entity.EntitySpawnReason spawnReason, @Nullable net.minecraft.world.entity.SpawnGroupData entityData) {
|
+ public net.minecraft.world.entity.SpawnGroupData finalizeSpawn(net.minecraft.world.level.ServerLevelAccessor world, net.minecraft.world.DifficultyInstance difficulty, net.minecraft.world.entity.EntitySpawnReason spawnReason, net.minecraft.world.entity.@Nullable SpawnGroupData entityData) {
|
||||||
+ double chance = world.getLevel().purpurConfig.creeperChargedChance;
|
+ double chance = world.getLevel().purpurConfig.creeperChargedChance;
|
||||||
+ if (chance > 0D && random.nextDouble() <= chance) {
|
+ if (chance > 0D && random.nextDouble() <= chance) {
|
||||||
+ setPowered(true);
|
+ setPowered(true);
|
||||||
@@ -51,7 +51,7 @@
|
|||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
this.dead = true;
|
this.dead = true;
|
||||||
- serverLevel.explode(this, this.getX(), this.getY(), this.getZ(), event.getRadius(), event.getFire(), Level.ExplosionInteraction.MOB); // CraftBukkit // Paper - fix DamageSource API (revert to vanilla, no, just no, don't change this)
|
- serverLevel.explode(this, this.getX(), this.getY(), this.getZ(), event.getRadius(), event.getFire(), Level.ExplosionInteraction.MOB); // CraftBukkit // Paper - fix DamageSource API (revert to vanilla, no, just no, don't change this)
|
||||||
+ serverLevel.explode(this, this.getX(), this.getY(), this.getZ(), event.getRadius(), event.getFire(), serverLevel.getGameRules().getBoolean(net.minecraft.world.level.GameRules.RULE_MOBGRIEFING) && level().purpurConfig.creeperAllowGriefing ? Level.ExplosionInteraction.MOB : Level.ExplosionInteraction.NONE); // CraftBukkit // Paper - fix DamageSource API (revert to vanilla, no, just no, don't change this) // Purpur - Add enderman and creeper griefing controls
|
+ serverLevel.explode(this, this.getX(), this.getY(), this.getZ(), event.getRadius(), event.getFire(), serverLevel.getGameRules().get(net.minecraft.world.level.gamerules.GameRules.MOB_GRIEFING) && level().purpurConfig.creeperAllowGriefing ? Level.ExplosionInteraction.MOB : Level.ExplosionInteraction.NONE); // CraftBukkit // Paper - fix DamageSource API (revert to vanilla, no, just no, don't change this) // Purpur - Add enderman and creeper griefing controls
|
||||||
this.spawnLingeringCloud();
|
this.spawnLingeringCloud();
|
||||||
this.triggerOnDeathMobEffects(serverLevel, Entity.RemovalReason.KILLED);
|
this.triggerOnDeathMobEffects(serverLevel, Entity.RemovalReason.KILLED);
|
||||||
this.discard(org.bukkit.event.entity.EntityRemoveEvent.Cause.EXPLODE); // CraftBukkit - add Bukkit remove cause
|
this.discard(org.bukkit.event.entity.EntityRemoveEvent.Cause.EXPLODE); // CraftBukkit - add Bukkit remove cause
|
||||||
|
|||||||
@@ -23,14 +23,13 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
public final CompoundTag saveWithFullMetadata(HolderLookup.Provider registries) {
|
public final CompoundTag saveWithFullMetadata(HolderLookup.Provider registries) {
|
||||||
@@ -400,4 +_,17 @@
|
@@ -400,4 +_,16 @@
|
||||||
return this.blockEntity.getNameForReporting() + "@" + this.blockEntity.getBlockPos();
|
return this.blockEntity.getNameForReporting() + "@" + this.blockEntity.getBlockPos();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+
|
+
|
||||||
+ // Purpur start - Persistent BlockEntity Lore and DisplayName
|
+ // Purpur start - Persistent BlockEntity Lore and DisplayName
|
||||||
+ @Nullable
|
+ private net.minecraft.world.item.component.@Nullable ItemLore persistentLore = null;
|
||||||
+ private net.minecraft.world.item.component.ItemLore persistentLore = null;
|
|
||||||
+
|
+
|
||||||
+ public void setPersistentLore(net.minecraft.world.item.component.ItemLore lore) {
|
+ public void setPersistentLore(net.minecraft.world.item.component.ItemLore lore) {
|
||||||
+ this.persistentLore = lore;
|
+ this.persistentLore = lore;
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import net.kyori.adventure.text.minimessage.MiniMessage;
|
|||||||
import net.minecraft.core.Registry;
|
import net.minecraft.core.Registry;
|
||||||
import net.minecraft.core.registries.BuiltInRegistries;
|
import net.minecraft.core.registries.BuiltInRegistries;
|
||||||
import net.minecraft.core.registries.Registries;
|
import net.minecraft.core.registries.Registries;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
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.EntityType;
|
||||||
@@ -396,7 +396,7 @@ public class PurpurConfig {
|
|||||||
}
|
}
|
||||||
getList("settings.blocks.grindstone.ignored-enchants", defaultCurses).forEach(key -> {
|
getList("settings.blocks.grindstone.ignored-enchants", defaultCurses).forEach(key -> {
|
||||||
Registry<Enchantment> registry = MinecraftServer.getServer().registryAccess().lookupOrThrow(Registries.ENCHANTMENT);
|
Registry<Enchantment> registry = MinecraftServer.getServer().registryAccess().lookupOrThrow(Registries.ENCHANTMENT);
|
||||||
Enchantment enchantment = registry.getValue(ResourceLocation.parse(key.toString()));
|
Enchantment enchantment = registry.getValue(Identifier.parse(key.toString()));
|
||||||
if (enchantment == null) return;
|
if (enchantment == null) return;
|
||||||
grindstoneIgnoredEnchants.add(enchantment);
|
grindstoneIgnoredEnchants.add(enchantment);
|
||||||
});
|
});
|
||||||
@@ -525,7 +525,7 @@ public class PurpurConfig {
|
|||||||
|
|
||||||
private static void blastResistanceSettings() {
|
private static void blastResistanceSettings() {
|
||||||
getMap("settings.blast-resistance-overrides", Collections.emptyMap()).forEach((blockId, value) -> {
|
getMap("settings.blast-resistance-overrides", Collections.emptyMap()).forEach((blockId, value) -> {
|
||||||
Block block = BuiltInRegistries.BLOCK.getValue(ResourceLocation.parse(blockId));
|
Block block = BuiltInRegistries.BLOCK.getValue(Identifier.parse(blockId));
|
||||||
if (block == Blocks.AIR) {
|
if (block == Blocks.AIR) {
|
||||||
log(Level.SEVERE, "Invalid block for `settings.blast-resistance-overrides`: " + blockId);
|
log(Level.SEVERE, "Invalid block for `settings.blast-resistance-overrides`: " + blockId);
|
||||||
return;
|
return;
|
||||||
@@ -557,7 +557,7 @@ public class PurpurConfig {
|
|||||||
Map.entry("minecraft:purple_bed", Map.of("distance", 0.5F)),
|
Map.entry("minecraft:purple_bed", Map.of("distance", 0.5F)),
|
||||||
Map.entry("minecraft:magenta_bed", Map.of("distance", 0.5F))
|
Map.entry("minecraft:magenta_bed", Map.of("distance", 0.5F))
|
||||||
)).forEach((blockId, value) -> {
|
)).forEach((blockId, value) -> {
|
||||||
Block block = BuiltInRegistries.BLOCK.getValue(ResourceLocation.parse(blockId));
|
Block block = BuiltInRegistries.BLOCK.getValue(Identifier.parse(blockId));
|
||||||
if (block == Blocks.AIR) {
|
if (block == Blocks.AIR) {
|
||||||
log(Level.SEVERE, "Invalid block for `settings.block-fall-multipliers`: " + blockId);
|
log(Level.SEVERE, "Invalid block for `settings.block-fall-multipliers`: " + blockId);
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import java.util.Set;
|
|||||||
import java.util.function.Predicate;
|
import java.util.function.Predicate;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import net.minecraft.core.registries.BuiltInRegistries;
|
import net.minecraft.core.registries.BuiltInRegistries;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.Identifier;
|
||||||
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.monster.Shulker;
|
import net.minecraft.world.entity.monster.Shulker;
|
||||||
@@ -262,7 +262,7 @@ public class PurpurWorldConfig {
|
|||||||
public List<Item> itemImmuneToFire = new ArrayList<>();
|
public List<Item> itemImmuneToFire = new ArrayList<>();
|
||||||
public List<Item> itemImmuneToLightning = new ArrayList<>();
|
public List<Item> itemImmuneToLightning = new ArrayList<>();
|
||||||
public boolean dontRunWithScissors = false;
|
public boolean dontRunWithScissors = false;
|
||||||
public ResourceLocation dontRunWithScissorsItemModelReference = ResourceLocation.parse("purpurmc:scissors");
|
public Identifier dontRunWithScissorsItemModelReference = Identifier.parse("purpurmc:scissors");
|
||||||
public boolean ignoreScissorsInWater = false;
|
public boolean ignoreScissorsInWater = false;
|
||||||
public boolean ignoreScissorsInLava = false;
|
public boolean ignoreScissorsInLava = false;
|
||||||
public double scissorsRunningDamage = 1D;
|
public double scissorsRunningDamage = 1D;
|
||||||
@@ -283,7 +283,7 @@ public class PurpurWorldConfig {
|
|||||||
BuiltInRegistries.ITEM.stream().filter(item -> item != Items.AIR).forEach((item) -> itemImmuneToCactus.add(item));
|
BuiltInRegistries.ITEM.stream().filter(item -> item != Items.AIR).forEach((item) -> itemImmuneToCactus.add(item));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Item item = BuiltInRegistries.ITEM.getValue(ResourceLocation.parse(key.toString()));
|
Item item = BuiltInRegistries.ITEM.getValue(Identifier.parse(key.toString()));
|
||||||
if (item != Items.AIR) itemImmuneToCactus.add(item);
|
if (item != Items.AIR) itemImmuneToCactus.add(item);
|
||||||
});
|
});
|
||||||
itemImmuneToExplosion.clear();
|
itemImmuneToExplosion.clear();
|
||||||
@@ -292,7 +292,7 @@ public class PurpurWorldConfig {
|
|||||||
BuiltInRegistries.ITEM.stream().filter(item -> item != Items.AIR).forEach((item) -> itemImmuneToExplosion.add(item));
|
BuiltInRegistries.ITEM.stream().filter(item -> item != Items.AIR).forEach((item) -> itemImmuneToExplosion.add(item));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Item item = BuiltInRegistries.ITEM.getValue(ResourceLocation.parse(key.toString()));
|
Item item = BuiltInRegistries.ITEM.getValue(Identifier.parse(key.toString()));
|
||||||
if (item != Items.AIR) itemImmuneToExplosion.add(item);
|
if (item != Items.AIR) itemImmuneToExplosion.add(item);
|
||||||
});
|
});
|
||||||
itemImmuneToFire.clear();
|
itemImmuneToFire.clear();
|
||||||
@@ -301,7 +301,7 @@ public class PurpurWorldConfig {
|
|||||||
BuiltInRegistries.ITEM.stream().filter(item -> item != Items.AIR).forEach((item) -> itemImmuneToFire.add(item));
|
BuiltInRegistries.ITEM.stream().filter(item -> item != Items.AIR).forEach((item) -> itemImmuneToFire.add(item));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Item item = BuiltInRegistries.ITEM.getValue(ResourceLocation.parse(key.toString()));
|
Item item = BuiltInRegistries.ITEM.getValue(Identifier.parse(key.toString()));
|
||||||
if (item != Items.AIR) itemImmuneToFire.add(item);
|
if (item != Items.AIR) itemImmuneToFire.add(item);
|
||||||
});
|
});
|
||||||
itemImmuneToLightning.clear();
|
itemImmuneToLightning.clear();
|
||||||
@@ -310,11 +310,11 @@ public class PurpurWorldConfig {
|
|||||||
BuiltInRegistries.ITEM.stream().filter(item -> item != Items.AIR).forEach((item) -> itemImmuneToLightning.add(item));
|
BuiltInRegistries.ITEM.stream().filter(item -> item != Items.AIR).forEach((item) -> itemImmuneToLightning.add(item));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Item item = BuiltInRegistries.ITEM.getValue(ResourceLocation.parse(key.toString()));
|
Item item = BuiltInRegistries.ITEM.getValue(Identifier.parse(key.toString()));
|
||||||
if (item != Items.AIR) itemImmuneToLightning.add(item);
|
if (item != Items.AIR) itemImmuneToLightning.add(item);
|
||||||
});
|
});
|
||||||
dontRunWithScissors = getBoolean("gameplay-mechanics.item.shears.damage-if-sprinting", dontRunWithScissors);
|
dontRunWithScissors = getBoolean("gameplay-mechanics.item.shears.damage-if-sprinting", dontRunWithScissors);
|
||||||
dontRunWithScissorsItemModelReference = ResourceLocation.parse(getString("gameplay-mechanics.item.shears.damage-if-sprinting-item-model", "purpurmc:scissors"));
|
dontRunWithScissorsItemModelReference = Identifier.parse(getString("gameplay-mechanics.item.shears.damage-if-sprinting-item-model", "purpurmc:scissors"));
|
||||||
ignoreScissorsInWater = getBoolean("gameplay-mechanics.item.shears.ignore-in-water", ignoreScissorsInWater);
|
ignoreScissorsInWater = getBoolean("gameplay-mechanics.item.shears.ignore-in-water", ignoreScissorsInWater);
|
||||||
ignoreScissorsInLava = getBoolean("gameplay-mechanics.item.shears.ignore-in-lava", ignoreScissorsInLava);
|
ignoreScissorsInLava = getBoolean("gameplay-mechanics.item.shears.ignore-in-lava", ignoreScissorsInLava);
|
||||||
scissorsRunningDamage = getDouble("gameplay-mechanics.item.shears.sprinting-damage", scissorsRunningDamage);
|
scissorsRunningDamage = getDouble("gameplay-mechanics.item.shears.sprinting-damage", scissorsRunningDamage);
|
||||||
@@ -382,7 +382,7 @@ public class PurpurWorldConfig {
|
|||||||
ConfigurationSection section = getConfigurationSection("gameplay-mechanics.minecart.controllable.block-speed");
|
ConfigurationSection section = getConfigurationSection("gameplay-mechanics.minecart.controllable.block-speed");
|
||||||
if (section != null) {
|
if (section != null) {
|
||||||
for (String key : section.getKeys(false)) {
|
for (String key : section.getKeys(false)) {
|
||||||
Block block = BuiltInRegistries.BLOCK.getValue(ResourceLocation.parse(key));
|
Block block = BuiltInRegistries.BLOCK.getValue(Identifier.parse(key));
|
||||||
if (block != Blocks.AIR) {
|
if (block != Blocks.AIR) {
|
||||||
minecartControllableBlockSpeeds.put(block, section.getDouble(key, minecartControllableBaseSpeed));
|
minecartControllableBlockSpeeds.put(block, section.getDouble(key, minecartControllableBaseSpeed));
|
||||||
}
|
}
|
||||||
@@ -523,7 +523,7 @@ public class PurpurWorldConfig {
|
|||||||
"minecraft:diamond_pickaxe",
|
"minecraft:diamond_pickaxe",
|
||||||
"minecraft:netherite_pickaxe"
|
"minecraft:netherite_pickaxe"
|
||||||
)).forEach(key -> {
|
)).forEach(key -> {
|
||||||
Item item = BuiltInRegistries.ITEM.getValue(ResourceLocation.parse(key.toString()));
|
Item item = BuiltInRegistries.ITEM.getValue(Identifier.parse(key.toString()));
|
||||||
if (item != Items.AIR) silkTouchTools.add(item);
|
if (item != Items.AIR) silkTouchTools.add(item);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -714,17 +714,17 @@ public class PurpurWorldConfig {
|
|||||||
Map.entry("minecraft:bamboo_block", Map.of("into", "minecraft:stripped_bamboo_block", "drops", new HashMap<String, Double>()))
|
Map.entry("minecraft:bamboo_block", Map.of("into", "minecraft:stripped_bamboo_block", "drops", new HashMap<String, Double>()))
|
||||||
)
|
)
|
||||||
).forEach((blockId, obj) -> {
|
).forEach((blockId, obj) -> {
|
||||||
Block block = BuiltInRegistries.BLOCK.getValue(ResourceLocation.parse(blockId));
|
Block block = BuiltInRegistries.BLOCK.getValue(Identifier.parse(blockId));
|
||||||
if (block == Blocks.AIR) { PurpurConfig.log(Level.SEVERE, "Invalid block for `tools.axe.strippables`: " + blockId); return; }
|
if (block == Blocks.AIR) { PurpurConfig.log(Level.SEVERE, "Invalid block for `tools.axe.strippables`: " + blockId); return; }
|
||||||
if (!(obj instanceof Map<?, ?> map)) { PurpurConfig.log(Level.SEVERE, "Invalid yaml for `tools.axe.strippables." + blockId + "`"); return; }
|
if (!(obj instanceof Map<?, ?> map)) { PurpurConfig.log(Level.SEVERE, "Invalid yaml for `tools.axe.strippables." + blockId + "`"); return; }
|
||||||
String intoId = (String) map.get("into");
|
String intoId = (String) map.get("into");
|
||||||
Block into = BuiltInRegistries.BLOCK.getValue(ResourceLocation.parse(intoId));
|
Block into = BuiltInRegistries.BLOCK.getValue(Identifier.parse(intoId));
|
||||||
if (into == Blocks.AIR) { PurpurConfig.log(Level.SEVERE, "Invalid block for `tools.axe.strippables." + blockId + ".into`: " + intoId); return; }
|
if (into == Blocks.AIR) { PurpurConfig.log(Level.SEVERE, "Invalid block for `tools.axe.strippables." + blockId + ".into`: " + intoId); return; }
|
||||||
Object dropsObj = map.get("drops");
|
Object dropsObj = map.get("drops");
|
||||||
if (!(dropsObj instanceof Map<?, ?> dropsMap)) { PurpurConfig.log(Level.SEVERE, "Invalid yaml for `tools.axe.strippables." + blockId + ".drops`"); return; }
|
if (!(dropsObj instanceof Map<?, ?> dropsMap)) { PurpurConfig.log(Level.SEVERE, "Invalid yaml for `tools.axe.strippables." + blockId + ".drops`"); return; }
|
||||||
Map<Item, Double> drops = new HashMap<>();
|
Map<Item, Double> drops = new HashMap<>();
|
||||||
dropsMap.forEach((itemId, chance) -> {
|
dropsMap.forEach((itemId, chance) -> {
|
||||||
Item item = BuiltInRegistries.ITEM.getValue(ResourceLocation.parse(itemId.toString()));
|
Item item = BuiltInRegistries.ITEM.getValue(Identifier.parse(itemId.toString()));
|
||||||
if (item == Items.AIR) { PurpurConfig.log(Level.SEVERE, "Invalid item for `tools.axe.strippables." + blockId + ".drops`: " + itemId); return; }
|
if (item == Items.AIR) { PurpurConfig.log(Level.SEVERE, "Invalid item for `tools.axe.strippables." + blockId + ".drops`: " + itemId); return; }
|
||||||
drops.put(item, (double) chance);
|
drops.put(item, (double) chance);
|
||||||
});
|
});
|
||||||
@@ -792,17 +792,17 @@ public class PurpurWorldConfig {
|
|||||||
Map.entry("minecraft:waxed_weathered_copper_lantern", Map.of("into", "minecraft:weathered_copper_lantern", "drops", new HashMap<String, Double>())),
|
Map.entry("minecraft:waxed_weathered_copper_lantern", Map.of("into", "minecraft:weathered_copper_lantern", "drops", new HashMap<String, Double>())),
|
||||||
Map.entry("minecraft:waxed_oxidized_copper_lantern", Map.of("into", "minecraft:oxidized_copper_lantern", "drops", new HashMap<String, Double>())))
|
Map.entry("minecraft:waxed_oxidized_copper_lantern", Map.of("into", "minecraft:oxidized_copper_lantern", "drops", new HashMap<String, Double>())))
|
||||||
).forEach((blockId, obj) -> {
|
).forEach((blockId, obj) -> {
|
||||||
Block block = BuiltInRegistries.BLOCK.getValue(ResourceLocation.parse(blockId));
|
Block block = BuiltInRegistries.BLOCK.getValue(Identifier.parse(blockId));
|
||||||
if (block == Blocks.AIR) { PurpurConfig.log(Level.SEVERE, "Invalid block for `tools.axe.waxables`: " + blockId); return; }
|
if (block == Blocks.AIR) { PurpurConfig.log(Level.SEVERE, "Invalid block for `tools.axe.waxables`: " + blockId); return; }
|
||||||
if (!(obj instanceof Map<?, ?> map)) { PurpurConfig.log(Level.SEVERE, "Invalid yaml for `tools.axe.waxables." + blockId + "`"); return; }
|
if (!(obj instanceof Map<?, ?> map)) { PurpurConfig.log(Level.SEVERE, "Invalid yaml for `tools.axe.waxables." + blockId + "`"); return; }
|
||||||
String intoId = (String) map.get("into");
|
String intoId = (String) map.get("into");
|
||||||
Block into = BuiltInRegistries.BLOCK.getValue(ResourceLocation.parse(intoId));
|
Block into = BuiltInRegistries.BLOCK.getValue(Identifier.parse(intoId));
|
||||||
if (into == Blocks.AIR) { PurpurConfig.log(Level.SEVERE, "Invalid block for `tools.axe.waxables." + blockId + ".into`: " + intoId); return; }
|
if (into == Blocks.AIR) { PurpurConfig.log(Level.SEVERE, "Invalid block for `tools.axe.waxables." + blockId + ".into`: " + intoId); return; }
|
||||||
Object dropsObj = map.get("drops");
|
Object dropsObj = map.get("drops");
|
||||||
if (!(dropsObj instanceof Map<?, ?> dropsMap)) { PurpurConfig.log(Level.SEVERE, "Invalid yaml for `tools.axe.waxables." + blockId + ".drops`"); return; }
|
if (!(dropsObj instanceof Map<?, ?> dropsMap)) { PurpurConfig.log(Level.SEVERE, "Invalid yaml for `tools.axe.waxables." + blockId + ".drops`"); return; }
|
||||||
Map<Item, Double> drops = new HashMap<>();
|
Map<Item, Double> drops = new HashMap<>();
|
||||||
dropsMap.forEach((itemId, chance) -> {
|
dropsMap.forEach((itemId, chance) -> {
|
||||||
Item item = BuiltInRegistries.ITEM.getValue(ResourceLocation.parse(itemId.toString()));
|
Item item = BuiltInRegistries.ITEM.getValue(Identifier.parse(itemId.toString()));
|
||||||
if (item == Items.AIR) { PurpurConfig.log(Level.SEVERE, "Invalid item for `tools.axe.waxables." + blockId + ".drops`: " + itemId); return; }
|
if (item == Items.AIR) { PurpurConfig.log(Level.SEVERE, "Invalid item for `tools.axe.waxables." + blockId + ".drops`: " + itemId); return; }
|
||||||
drops.put(item, (double) chance);
|
drops.put(item, (double) chance);
|
||||||
});
|
});
|
||||||
@@ -855,17 +855,17 @@ public class PurpurWorldConfig {
|
|||||||
Map.entry("minecraft:weathered_copper_lantern", Map.of("into", "minecraft:exposed_copper_lantern", "drops", new HashMap<String, Double>())),
|
Map.entry("minecraft:weathered_copper_lantern", Map.of("into", "minecraft:exposed_copper_lantern", "drops", new HashMap<String, Double>())),
|
||||||
Map.entry("minecraft:oxidized_copper_lantern", Map.of("into", "minecraft:weathered_copper_lantern", "drops", new HashMap<String, Double>())))
|
Map.entry("minecraft:oxidized_copper_lantern", Map.of("into", "minecraft:weathered_copper_lantern", "drops", new HashMap<String, Double>())))
|
||||||
).forEach((blockId, obj) -> {
|
).forEach((blockId, obj) -> {
|
||||||
Block block = BuiltInRegistries.BLOCK.getValue(ResourceLocation.parse(blockId));
|
Block block = BuiltInRegistries.BLOCK.getValue(Identifier.parse(blockId));
|
||||||
if (block == Blocks.AIR) { PurpurConfig.log(Level.SEVERE, "Invalid block for `tools.axe.weatherables`: " + blockId); return; }
|
if (block == Blocks.AIR) { PurpurConfig.log(Level.SEVERE, "Invalid block for `tools.axe.weatherables`: " + blockId); return; }
|
||||||
if (!(obj instanceof Map<?, ?> map)) { PurpurConfig.log(Level.SEVERE, "Invalid yaml for `tools.axe.weatherables." + blockId + "`"); return; }
|
if (!(obj instanceof Map<?, ?> map)) { PurpurConfig.log(Level.SEVERE, "Invalid yaml for `tools.axe.weatherables." + blockId + "`"); return; }
|
||||||
String intoId = (String) map.get("into");
|
String intoId = (String) map.get("into");
|
||||||
Block into = BuiltInRegistries.BLOCK.getValue(ResourceLocation.parse(intoId));
|
Block into = BuiltInRegistries.BLOCK.getValue(Identifier.parse(intoId));
|
||||||
if (into == Blocks.AIR) { PurpurConfig.log(Level.SEVERE, "Invalid block for `tools.axe.weatherables." + blockId + ".into`: " + intoId); return; }
|
if (into == Blocks.AIR) { PurpurConfig.log(Level.SEVERE, "Invalid block for `tools.axe.weatherables." + blockId + ".into`: " + intoId); return; }
|
||||||
Object dropsObj = map.get("drops");
|
Object dropsObj = map.get("drops");
|
||||||
if (!(dropsObj instanceof Map<?, ?> dropsMap)) { PurpurConfig.log(Level.SEVERE, "Invalid yaml for `tools.axe.weatherables." + blockId + ".drops`"); return; }
|
if (!(dropsObj instanceof Map<?, ?> dropsMap)) { PurpurConfig.log(Level.SEVERE, "Invalid yaml for `tools.axe.weatherables." + blockId + ".drops`"); return; }
|
||||||
Map<Item, Double> drops = new HashMap<>();
|
Map<Item, Double> drops = new HashMap<>();
|
||||||
dropsMap.forEach((itemId, chance) -> {
|
dropsMap.forEach((itemId, chance) -> {
|
||||||
Item item = BuiltInRegistries.ITEM.getValue(ResourceLocation.parse(itemId.toString()));
|
Item item = BuiltInRegistries.ITEM.getValue(Identifier.parse(itemId.toString()));
|
||||||
if (item == Items.AIR) { PurpurConfig.log(Level.SEVERE, "Invalid item for `tools.axe.weatherables." + blockId + ".drops`: " + itemId); return; }
|
if (item == Items.AIR) { PurpurConfig.log(Level.SEVERE, "Invalid item for `tools.axe.weatherables." + blockId + ".drops`: " + itemId); return; }
|
||||||
drops.put(item, (double) chance);
|
drops.put(item, (double) chance);
|
||||||
});
|
});
|
||||||
@@ -878,20 +878,20 @@ public class PurpurWorldConfig {
|
|||||||
Map.entry("minecraft:coarse_dirt", Map.of("condition", "air_above", "into", "minecraft:dirt", "drops", new HashMap<String, Double>())),
|
Map.entry("minecraft:coarse_dirt", Map.of("condition", "air_above", "into", "minecraft:dirt", "drops", new HashMap<String, Double>())),
|
||||||
Map.entry("minecraft:rooted_dirt", Map.of("condition", "always", "into", "minecraft:dirt", "drops", Map.of("minecraft:hanging_roots", 1.0D))))
|
Map.entry("minecraft:rooted_dirt", Map.of("condition", "always", "into", "minecraft:dirt", "drops", Map.of("minecraft:hanging_roots", 1.0D))))
|
||||||
).forEach((blockId, obj) -> {
|
).forEach((blockId, obj) -> {
|
||||||
Block block = BuiltInRegistries.BLOCK.getValue(ResourceLocation.parse(blockId));
|
Block block = BuiltInRegistries.BLOCK.getValue(Identifier.parse(blockId));
|
||||||
if (block == Blocks.AIR) { PurpurConfig.log(Level.SEVERE, "Invalid block for `tools.hoe.tillables`: " + blockId); return; }
|
if (block == Blocks.AIR) { PurpurConfig.log(Level.SEVERE, "Invalid block for `tools.hoe.tillables`: " + blockId); return; }
|
||||||
if (!(obj instanceof Map<?, ?> map)) { PurpurConfig.log(Level.SEVERE, "Invalid yaml for `tools.hoe.tillables." + blockId + "`"); return; }
|
if (!(obj instanceof Map<?, ?> map)) { PurpurConfig.log(Level.SEVERE, "Invalid yaml for `tools.hoe.tillables." + blockId + "`"); return; }
|
||||||
String conditionId = (String) map.get("condition");
|
String conditionId = (String) map.get("condition");
|
||||||
Tillable.Condition condition = Tillable.Condition.get(conditionId);
|
Tillable.Condition condition = Tillable.Condition.get(conditionId);
|
||||||
if (condition == null) { PurpurConfig.log(Level.SEVERE, "Invalid condition for `tools.hoe.tillables." + blockId + ".condition`: " + conditionId); return; }
|
if (condition == null) { PurpurConfig.log(Level.SEVERE, "Invalid condition for `tools.hoe.tillables." + blockId + ".condition`: " + conditionId); return; }
|
||||||
String intoId = (String) map.get("into");
|
String intoId = (String) map.get("into");
|
||||||
Block into = BuiltInRegistries.BLOCK.getValue(ResourceLocation.parse(intoId));
|
Block into = BuiltInRegistries.BLOCK.getValue(Identifier.parse(intoId));
|
||||||
if (into == Blocks.AIR) { PurpurConfig.log(Level.SEVERE, "Invalid block for `tools.hoe.tillables." + blockId + ".into`: " + intoId); return; }
|
if (into == Blocks.AIR) { PurpurConfig.log(Level.SEVERE, "Invalid block for `tools.hoe.tillables." + blockId + ".into`: " + intoId); return; }
|
||||||
Object dropsObj = map.get("drops");
|
Object dropsObj = map.get("drops");
|
||||||
if (!(dropsObj instanceof Map<?, ?> dropsMap)) { PurpurConfig.log(Level.SEVERE, "Invalid yaml for `tools.hoe.tillables." + blockId + ".drops`"); return; }
|
if (!(dropsObj instanceof Map<?, ?> dropsMap)) { PurpurConfig.log(Level.SEVERE, "Invalid yaml for `tools.hoe.tillables." + blockId + ".drops`"); return; }
|
||||||
Map<Item, Double> drops = new HashMap<>();
|
Map<Item, Double> drops = new HashMap<>();
|
||||||
dropsMap.forEach((itemId, chance) -> {
|
dropsMap.forEach((itemId, chance) -> {
|
||||||
Item item = BuiltInRegistries.ITEM.getValue(ResourceLocation.parse(itemId.toString()));
|
Item item = BuiltInRegistries.ITEM.getValue(Identifier.parse(itemId.toString()));
|
||||||
if (item == Items.AIR) { PurpurConfig.log(Level.SEVERE, "Invalid item for `tools.hoe.tillables." + blockId + ".drops`: " + itemId); return; }
|
if (item == Items.AIR) { PurpurConfig.log(Level.SEVERE, "Invalid item for `tools.hoe.tillables." + blockId + ".drops`: " + itemId); return; }
|
||||||
drops.put(item, (double) chance);
|
drops.put(item, (double) chance);
|
||||||
});
|
});
|
||||||
@@ -905,17 +905,17 @@ public class PurpurWorldConfig {
|
|||||||
Map.entry("minecraft:mycelium", Map.of("into", "minecraft:dirt_path", "drops", new HashMap<String, Double>())),
|
Map.entry("minecraft:mycelium", Map.of("into", "minecraft:dirt_path", "drops", new HashMap<String, Double>())),
|
||||||
Map.entry("minecraft:rooted_dirt", Map.of("into", "minecraft:dirt_path", "drops", new HashMap<String, Double>())))
|
Map.entry("minecraft:rooted_dirt", Map.of("into", "minecraft:dirt_path", "drops", new HashMap<String, Double>())))
|
||||||
).forEach((blockId, obj) -> {
|
).forEach((blockId, obj) -> {
|
||||||
Block block = BuiltInRegistries.BLOCK.getValue(ResourceLocation.parse(blockId));
|
Block block = BuiltInRegistries.BLOCK.getValue(Identifier.parse(blockId));
|
||||||
if (block == Blocks.AIR) { PurpurConfig.log(Level.SEVERE, "Invalid block for `tools.shovel.flattenables`: " + blockId); return; }
|
if (block == Blocks.AIR) { PurpurConfig.log(Level.SEVERE, "Invalid block for `tools.shovel.flattenables`: " + blockId); return; }
|
||||||
if (!(obj instanceof Map<?, ?> map)) { PurpurConfig.log(Level.SEVERE, "Invalid yaml for `tools.shovel.flattenables." + blockId + "`"); return; }
|
if (!(obj instanceof Map<?, ?> map)) { PurpurConfig.log(Level.SEVERE, "Invalid yaml for `tools.shovel.flattenables." + blockId + "`"); return; }
|
||||||
String intoId = (String) map.get("into");
|
String intoId = (String) map.get("into");
|
||||||
Block into = BuiltInRegistries.BLOCK.getValue(ResourceLocation.parse(intoId));
|
Block into = BuiltInRegistries.BLOCK.getValue(Identifier.parse(intoId));
|
||||||
if (into == Blocks.AIR) { PurpurConfig.log(Level.SEVERE, "Invalid block for `tools.shovel.flattenables." + blockId + ".into`: " + intoId); return; }
|
if (into == Blocks.AIR) { PurpurConfig.log(Level.SEVERE, "Invalid block for `tools.shovel.flattenables." + blockId + ".into`: " + intoId); return; }
|
||||||
Object dropsObj = map.get("drops");
|
Object dropsObj = map.get("drops");
|
||||||
if (!(dropsObj instanceof Map<?, ?> dropsMap)) { PurpurConfig.log(Level.SEVERE, "Invalid yaml for `tools.shovel.flattenables." + blockId + ".drops`"); return; }
|
if (!(dropsObj instanceof Map<?, ?> dropsMap)) { PurpurConfig.log(Level.SEVERE, "Invalid yaml for `tools.shovel.flattenables." + blockId + ".drops`"); return; }
|
||||||
Map<Item, Double> drops = new HashMap<>();
|
Map<Item, Double> drops = new HashMap<>();
|
||||||
dropsMap.forEach((itemId, chance) -> {
|
dropsMap.forEach((itemId, chance) -> {
|
||||||
Item item = BuiltInRegistries.ITEM.getValue(ResourceLocation.parse(itemId.toString()));
|
Item item = BuiltInRegistries.ITEM.getValue(Identifier.parse(itemId.toString()));
|
||||||
if (item == Items.AIR) { PurpurConfig.log(Level.SEVERE, "Invalid item for `tools.shovel.flattenables." + blockId + ".drops`: " + itemId); return; }
|
if (item == Items.AIR) { PurpurConfig.log(Level.SEVERE, "Invalid item for `tools.shovel.flattenables." + blockId + ".drops`: " + itemId); return; }
|
||||||
drops.put(item, (double) chance);
|
drops.put(item, (double) chance);
|
||||||
});
|
});
|
||||||
@@ -1040,7 +1040,7 @@ public class PurpurWorldConfig {
|
|||||||
public List<Block> doorRequiresRedstone = new ArrayList<>();
|
public List<Block> doorRequiresRedstone = new ArrayList<>();
|
||||||
private void doorSettings() {
|
private void doorSettings() {
|
||||||
getList("blocks.door.requires-redstone", new ArrayList<String>()).forEach(key -> {
|
getList("blocks.door.requires-redstone", new ArrayList<String>()).forEach(key -> {
|
||||||
Block block = BuiltInRegistries.BLOCK.getValue(ResourceLocation.parse(key.toString()));
|
Block block = BuiltInRegistries.BLOCK.getValue(Identifier.parse(key.toString()));
|
||||||
if (!block.defaultBlockState().isAir()) {
|
if (!block.defaultBlockState().isAir()) {
|
||||||
doorRequiresRedstone.add(block);
|
doorRequiresRedstone.add(block);
|
||||||
}
|
}
|
||||||
@@ -2642,7 +2642,7 @@ public class PurpurWorldConfig {
|
|||||||
polarBearMaxHealth = getDouble("mobs.polar_bear.attributes.max_health", polarBearMaxHealth);
|
polarBearMaxHealth = getDouble("mobs.polar_bear.attributes.max_health", polarBearMaxHealth);
|
||||||
polarBearScale = Mth.clamp(getDouble("mobs.polar_bear.attributes.scale", polarBearScale), 0.0625D, 16.0D);
|
polarBearScale = Mth.clamp(getDouble("mobs.polar_bear.attributes.scale", polarBearScale), 0.0625D, 16.0D);
|
||||||
polarBearBreedableItemString = getString("mobs.polar_bear.breedable-item", polarBearBreedableItemString);
|
polarBearBreedableItemString = getString("mobs.polar_bear.breedable-item", polarBearBreedableItemString);
|
||||||
Item item = BuiltInRegistries.ITEM.getValue(ResourceLocation.parse(polarBearBreedableItemString));
|
Item item = BuiltInRegistries.ITEM.getValue(Identifier.parse(polarBearBreedableItemString));
|
||||||
if (item != Items.AIR) polarBearBreedableItem = item;
|
if (item != Items.AIR) polarBearBreedableItem = item;
|
||||||
polarBearBreedingTicks = getInt("mobs.polar_bear.breeding-delay-ticks", polarBearBreedingTicks);
|
polarBearBreedingTicks = getInt("mobs.polar_bear.breeding-delay-ticks", polarBearBreedingTicks);
|
||||||
polarBearTakeDamageFromWater = getBoolean("mobs.polar_bear.takes-damage-from-water", polarBearTakeDamageFromWater);
|
polarBearTakeDamageFromWater = getBoolean("mobs.polar_bear.takes-damage-from-water", polarBearTakeDamageFromWater);
|
||||||
@@ -2765,7 +2765,7 @@ public class PurpurWorldConfig {
|
|||||||
set("mobs.ravager.griefable-blocks", new ArrayList<>(set));
|
set("mobs.ravager.griefable-blocks", new ArrayList<>(set));
|
||||||
}
|
}
|
||||||
getList("mobs.ravager.griefable-blocks", defaultRavagerGriefableBlocks).forEach(key -> {
|
getList("mobs.ravager.griefable-blocks", defaultRavagerGriefableBlocks).forEach(key -> {
|
||||||
Block block = BuiltInRegistries.BLOCK.getValue(ResourceLocation.parse(key.toString()));
|
Block block = BuiltInRegistries.BLOCK.getValue(Identifier.parse(key.toString()));
|
||||||
if (!block.defaultBlockState().isAir()) {
|
if (!block.defaultBlockState().isAir()) {
|
||||||
ravagerGriefableBlocks.add(block);
|
ravagerGriefableBlocks.add(block);
|
||||||
}
|
}
|
||||||
@@ -3699,7 +3699,7 @@ public class PurpurWorldConfig {
|
|||||||
add("minecraft:sea_lantern");
|
add("minecraft:sea_lantern");
|
||||||
add("minecraft:dark_prismarine");
|
add("minecraft:dark_prismarine");
|
||||||
}}).forEach(key -> {
|
}}).forEach(key -> {
|
||||||
Block block = BuiltInRegistries.BLOCK.getValue(ResourceLocation.parse(key.toString()));
|
Block block = BuiltInRegistries.BLOCK.getValue(Identifier.parse(key.toString()));
|
||||||
if (!block.defaultBlockState().isAir()) {
|
if (!block.defaultBlockState().isAir()) {
|
||||||
conduitBlockList.add(block);
|
conduitBlockList.add(block);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
package org.purpurmc.purpur.entity.ai;
|
package org.purpurmc.purpur.entity.ai;
|
||||||
|
|
||||||
import net.minecraft.world.entity.animal.horse.AbstractHorse;
|
import net.minecraft.world.entity.animal.equine.AbstractHorse;
|
||||||
|
|
||||||
public class HorseHasRider extends HasRider {
|
public class HorseHasRider extends HasRider {
|
||||||
public final AbstractHorse horse;
|
public final AbstractHorse horse;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
package org.purpurmc.purpur.entity.ai;
|
package org.purpurmc.purpur.entity.ai;
|
||||||
|
|
||||||
import net.minecraft.world.entity.animal.horse.Llama;
|
import net.minecraft.world.entity.animal.equine.Llama;
|
||||||
|
|
||||||
public class LlamaHasRider extends HasRider {
|
public class LlamaHasRider extends HasRider {
|
||||||
public final Llama llama;
|
public final Llama llama;
|
||||||
|
|||||||
@@ -4,13 +4,16 @@ import net.minecraft.server.level.ServerLevel;
|
|||||||
import net.minecraft.server.level.ServerPlayer;
|
import net.minecraft.server.level.ServerPlayer;
|
||||||
import net.minecraft.world.InteractionHand;
|
import net.minecraft.world.InteractionHand;
|
||||||
import net.minecraft.world.entity.Entity;
|
import net.minecraft.world.entity.Entity;
|
||||||
|
import net.minecraft.world.entity.EntityReference;
|
||||||
|
import net.minecraft.world.entity.LivingEntity;
|
||||||
import net.minecraft.world.entity.ai.goal.Goal;
|
import net.minecraft.world.entity.ai.goal.Goal;
|
||||||
import net.minecraft.world.entity.animal.IronGolem;
|
import net.minecraft.world.entity.animal.golem.IronGolem;
|
||||||
import net.minecraft.world.item.ItemStack;
|
import net.minecraft.world.item.ItemStack;
|
||||||
import net.minecraft.world.level.block.Blocks;
|
import net.minecraft.world.level.block.Blocks;
|
||||||
|
|
||||||
import java.util.EnumSet;
|
import java.util.EnumSet;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
public class ReceiveFlower extends Goal {
|
public class ReceiveFlower extends Goal {
|
||||||
private final IronGolem irongolem;
|
private final IronGolem irongolem;
|
||||||
@@ -30,11 +33,12 @@ public class ReceiveFlower extends Goal {
|
|||||||
if (!this.irongolem.isAngry()) {
|
if (!this.irongolem.isAngry()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
UUID uuid = this.irongolem.getPersistentAngerTarget();
|
EntityReference<LivingEntity> persistentAngerTarget = this.irongolem.getPersistentAngerTarget();
|
||||||
if (uuid == null) {
|
if (persistentAngerTarget == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
Entity target = ((ServerLevel) this.irongolem.level()).getEntity(uuid);
|
|
||||||
|
LivingEntity target = EntityReference.getLivingEntity(persistentAngerTarget, this.irongolem.level());
|
||||||
if (!(target instanceof ServerPlayer player)) {
|
if (!(target instanceof ServerPlayer player)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ 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.LivingEntity;
|
import net.minecraft.world.entity.LivingEntity;
|
||||||
import net.minecraft.world.entity.animal.Dolphin;
|
import net.minecraft.world.entity.animal.dolphin.Dolphin;
|
||||||
import net.minecraft.world.entity.projectile.LlamaSpit;
|
import net.minecraft.world.entity.projectile.LlamaSpit;
|
||||||
import net.minecraft.world.entity.projectile.ProjectileUtil;
|
import net.minecraft.world.entity.projectile.ProjectileUtil;
|
||||||
import net.minecraft.world.level.Level;
|
import net.minecraft.world.level.Level;
|
||||||
|
|||||||
@@ -4,12 +4,12 @@ import net.minecraft.core.BlockPos;
|
|||||||
import net.minecraft.network.FriendlyByteBuf;
|
import net.minecraft.network.FriendlyByteBuf;
|
||||||
import net.minecraft.network.codec.StreamCodec;
|
import net.minecraft.network.codec.StreamCodec;
|
||||||
import net.minecraft.network.protocol.common.custom.CustomPacketPayload;
|
import net.minecraft.network.protocol.common.custom.CustomPacketPayload;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.Identifier;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
public record ClientboundBeehivePayload(BlockPos pos, int numOfBees) implements CustomPacketPayload {
|
public record ClientboundBeehivePayload(BlockPos pos, int numOfBees) implements CustomPacketPayload {
|
||||||
public static final StreamCodec<FriendlyByteBuf, ClientboundBeehivePayload> STREAM_CODEC = CustomPacketPayload.codec(ClientboundBeehivePayload::write, ClientboundBeehivePayload::new);
|
public static final StreamCodec<FriendlyByteBuf, ClientboundBeehivePayload> STREAM_CODEC = CustomPacketPayload.codec(ClientboundBeehivePayload::write, ClientboundBeehivePayload::new);
|
||||||
public static final Type<ClientboundBeehivePayload> TYPE = new Type<>(ResourceLocation.fromNamespaceAndPath("purpur", "beehive_s2c"));
|
public static final Type<ClientboundBeehivePayload> TYPE = new Type<>(Identifier.fromNamespaceAndPath("purpur", "beehive_s2c"));
|
||||||
|
|
||||||
public ClientboundBeehivePayload(FriendlyByteBuf friendlyByteBuf) {
|
public ClientboundBeehivePayload(FriendlyByteBuf friendlyByteBuf) {
|
||||||
this(friendlyByteBuf.readBlockPos(), friendlyByteBuf.readInt());
|
this(friendlyByteBuf.readBlockPos(), friendlyByteBuf.readInt());
|
||||||
|
|||||||
@@ -4,12 +4,12 @@ import net.minecraft.core.BlockPos;
|
|||||||
import net.minecraft.network.FriendlyByteBuf;
|
import net.minecraft.network.FriendlyByteBuf;
|
||||||
import net.minecraft.network.codec.StreamCodec;
|
import net.minecraft.network.codec.StreamCodec;
|
||||||
import net.minecraft.network.protocol.common.custom.CustomPacketPayload;
|
import net.minecraft.network.protocol.common.custom.CustomPacketPayload;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.Identifier;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
public record ServerboundBeehivePayload(BlockPos pos) implements CustomPacketPayload {
|
public record ServerboundBeehivePayload(BlockPos pos) implements CustomPacketPayload {
|
||||||
public static final StreamCodec<FriendlyByteBuf, ServerboundBeehivePayload> STREAM_CODEC = CustomPacketPayload.codec(ServerboundBeehivePayload::write, ServerboundBeehivePayload::new);
|
public static final StreamCodec<FriendlyByteBuf, ServerboundBeehivePayload> STREAM_CODEC = CustomPacketPayload.codec(ServerboundBeehivePayload::write, ServerboundBeehivePayload::new);
|
||||||
public static final Type<ServerboundBeehivePayload> TYPE = new Type<>(ResourceLocation.fromNamespaceAndPath("purpur", "beehive_c2s"));
|
public static final Type<ServerboundBeehivePayload> TYPE = new Type<>(Identifier.fromNamespaceAndPath("purpur", "beehive_c2s"));
|
||||||
|
|
||||||
public ServerboundBeehivePayload(FriendlyByteBuf friendlyByteBuf) {
|
public ServerboundBeehivePayload(FriendlyByteBuf friendlyByteBuf) {
|
||||||
this(friendlyByteBuf.readBlockPos());
|
this(friendlyByteBuf.readBlockPos());
|
||||||
|
|||||||
Reference in New Issue
Block a user