mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-06-23 10:47:47 +02:00
Initial 26.2 port
This commit is contained in:
@@ -1,170 +1,11 @@
|
||||
--- a/net/minecraft/world/entity/Entity.java
|
||||
+++ b/net/minecraft/world/entity/Entity.java
|
||||
@@ -168,6 +_,7 @@
|
||||
SlotProvider,
|
||||
DebugValueSource,
|
||||
TypedInstance<EntityType<?>>, ca.spottedleaf.moonrise.patches.chunk_system.entity.ChunkSystemEntity, ca.spottedleaf.moonrise.patches.entity_tracker.EntityTrackerEntity { // Paper - rewrite chunk system // Paper - optimise entity tracker
|
||||
+ public static javax.script.ScriptEngine scriptEngine = new javax.script.ScriptEngineManager().getEngineByName("rhino"); // Purpur - Configurable entity base attributes
|
||||
// CraftBukkit start
|
||||
private static final int CURRENT_LEVEL = 2;
|
||||
static boolean isLevelAtLeast(ValueInput input, int level) {
|
||||
@@ -297,8 +_,9 @@
|
||||
public double xOld;
|
||||
public double yOld;
|
||||
public double zOld;
|
||||
+ public float maxUpStep; // Purpur - Add option to set armorstand step height
|
||||
public boolean noPhysics;
|
||||
- public final RandomSource random = SHARED_RANDOM; // Paper - Share random for entities to make them more random
|
||||
+ public final RandomSource random; // Paper - Share random for entities to make them more random // Purpur - Add toggle for RNG manipulation
|
||||
public int tickCount;
|
||||
private int remainingFireTicks;
|
||||
private final EntityFluidInteraction fluidInteraction = new EntityFluidInteraction(Set.of(FluidTags.WATER, FluidTags.LAVA));
|
||||
@@ -330,8 +_,8 @@
|
||||
public @Nullable PortalProcessor portalProcess;
|
||||
public int portalCooldown;
|
||||
private boolean invulnerable;
|
||||
- protected UUID uuid = Mth.createInsecureUUID(this.random);
|
||||
- protected String stringUUID = this.uuid.toString();
|
||||
+ protected UUID uuid; // Purpur - Add toggle for RNG manipulation
|
||||
+ protected String stringUUID; // Purpur - Add toggle for RNG manipulation
|
||||
private boolean hasGlowingTag;
|
||||
@@ -381,7 +_,7 @@
|
||||
private final Set<String> tags = new io.papermc.paper.util.SizeLimitedSet<>(new it.unimi.dsi.fastutil.objects.ObjectOpenHashSet<>(), MAX_ENTITY_TAG_COUNT); // Paper - fully limit tag size - replace set impl
|
||||
private final double[] pistonDeltas = new double[]{0.0, 0.0, 0.0};
|
||||
@@ -382,6 +_,7 @@
|
||||
private final int despawnTime; // Paper - entity despawn time limit
|
||||
public int totalEntityAge; // Paper - age-like counter for all entities
|
||||
public final io.papermc.paper.entity.activation.ActivationType activationType = io.papermc.paper.entity.activation.ActivationType.activationTypeFor(this); // Paper - EAR 2/tracking ranges
|
||||
+ public @Nullable Boolean immuneToFire = null; // Purpur - Fire immune API
|
||||
// Paper start - EAR 2
|
||||
public final boolean defaultActivationState;
|
||||
public long activatedTick = Integer.MIN_VALUE;
|
||||
@@ -549,10 +_,22 @@
|
||||
}
|
||||
// Paper end - optimise entity tracker
|
||||
|
||||
+ // Purpur start - Add canSaveToDisk to Entity
|
||||
+ public boolean canSaveToDisk() {
|
||||
+ return true;
|
||||
+ }
|
||||
+ // Purpur end - Add canSaveToDisk to Entity
|
||||
+
|
||||
public Entity(final EntityType<?> type, final Level level) {
|
||||
this.type = type;
|
||||
this.level = level;
|
||||
this.dimensions = type.getDimensions();
|
||||
+ this.maxAirTicks = level == null || this.getDefaultMaxAirSupply() != Entity.TOTAL_AIR_SUPPLY ? this.getDefaultMaxAirSupply() : this.level.purpurConfig.drowningAirTicks; // Purpur - Drowning Settings
|
||||
+ // Purpur start - Add toggle for RNG manipulation
|
||||
+ this.random = level == null || level.purpurConfig.entitySharedRandom ? SHARED_RANDOM : RandomSource.create();
|
||||
+ this.uuid = Mth.createInsecureUUID(this.random);
|
||||
+ this.stringUUID = this.uuid.toString();
|
||||
+ // Purpur end - Add toggle for RNG manipulation
|
||||
this.position = Vec3.ZERO;
|
||||
this.blockPosition = BlockPos.ZERO;
|
||||
this.chunkPosition = ChunkPos.ZERO;
|
||||
@@ -950,6 +_,7 @@
|
||||
&& this.level.paperConfig().environment.netherCeilingVoidDamageHeight.test(v -> this.getY() >= v)
|
||||
&& (!(this instanceof Player player) || !player.getAbilities().invulnerable))) {
|
||||
// Paper end - Configurable nether ceiling damage
|
||||
+ if (this.level.purpurConfig.teleportOnNetherCeilingDamage && this.level.getWorld().getEnvironment() == org.bukkit.World.Environment.NETHER && this instanceof ServerPlayer player) player.teleport(org.bukkit.craftbukkit.util.CraftLocation.toBukkit(this.level.levelData.getRespawnData().pos(), this.level)); else // Purpur - Add option to teleport to spawn on nether ceiling damage
|
||||
this.onBelowWorld();
|
||||
}
|
||||
}
|
||||
@@ -2007,7 +_,7 @@
|
||||
}
|
||||
|
||||
public boolean fireImmune() {
|
||||
- return this.getType().fireImmune();
|
||||
+ return this.immuneToFire != null ? immuneToFire : this.getType().fireImmune(); // Purpur - add fire immune API
|
||||
}
|
||||
|
||||
public boolean causeFallDamage(final double fallDistance, final float damageModifier, final DamageSource damageSource) {
|
||||
@@ -2593,7 +_,7 @@
|
||||
output.putBoolean("Bukkit.invisible", this.persistentInvisibility);
|
||||
}
|
||||
// SPIGOT-6907: re-implement LivingEntity#setMaximumAir()
|
||||
- if (this.maxAirTicks != this.getDefaultMaxAirSupply()) {
|
||||
+ if (this.maxAirTicks != this.getDefaultMaxAirSupply() && this.getDefaultMaxAirSupply() != this.level().purpurConfig.drowningAirTicks) { // Purpur - Drowning Settings
|
||||
output.putInt("Bukkit.MaxAirSupply", this.getMaxAirSupply());
|
||||
}
|
||||
output.putInt("Spigot.ticksLived", this.totalEntityAge); // Paper
|
||||
@@ -2679,6 +_,11 @@
|
||||
output.putBoolean("Paper.FreezeLock", true);
|
||||
}
|
||||
// Paper end
|
||||
+ // Purpur start - Fire immune API
|
||||
+ if (immuneToFire != null) {
|
||||
+ output.putBoolean("Purpur.FireImmune", immuneToFire);
|
||||
+ }
|
||||
+ // Purpur end - Fire immune API
|
||||
} catch (Throwable t) {
|
||||
CrashReport report = CrashReport.forThrowable(t, "Saving entity NBT");
|
||||
CrashReportCategory category = report.addCategory("Entity being saved");
|
||||
@@ -2802,6 +_,9 @@
|
||||
}
|
||||
freezeLocked = input.getBooleanOr("Paper.FreezeLock", false);
|
||||
// Paper end
|
||||
+
|
||||
+ immuneToFire = input.read("Purpur.FireImmune", com.mojang.serialization.Codec.BOOL).orElse(null); // Purpur - Fire immune API
|
||||
+
|
||||
} catch (Throwable t) {
|
||||
CrashReport report = CrashReport.forThrowable(t, "Loading entity NBT");
|
||||
CrashReportCategory category = report.addCategory("Entity being loaded");
|
||||
@@ -3067,6 +_,7 @@
|
||||
if (this.isAlive() && this instanceof Leashable leashable) {
|
||||
if (leashable.getLeashHolder() == player) {
|
||||
if (!this.level().isClientSide()) {
|
||||
+ 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
|
||||
if (!org.bukkit.craftbukkit.event.CraftEventFactory.handlePlayerUnleashEntityEvent(
|
||||
leashable, player, hand, !player.hasInfiniteMaterials(), true
|
||||
@@ -3500,15 +_,18 @@
|
||||
return Vec3.directionFromRotation(this.getRotationVector());
|
||||
}
|
||||
|
||||
+ public BlockPos portalPos = BlockPos.ZERO; // Purpur - Fix stuck in portals
|
||||
public void setAsInsidePortal(final Portal portal, final BlockPos pos) {
|
||||
if (this.isOnPortalCooldown()) {
|
||||
+ if (!(level().purpurConfig.playerFixStuckPortal && this instanceof Player && !pos.equals(this.portalPos))) // Purpur - Fix stuck in portals
|
||||
this.setPortalCooldown();
|
||||
- } else {
|
||||
+ } else if (this.level.purpurConfig.entitiesCanUsePortals || this instanceof ServerPlayer) { // Purpur - Entities can use portals
|
||||
if (this.portalProcess == null || !this.portalProcess.isSamePortal(portal)) {
|
||||
this.portalProcess = new PortalProcessor(portal, pos.immutable());
|
||||
} else if (!this.portalProcess.isInsidePortalThisTick()) {
|
||||
this.portalProcess.updateEntryPosition(pos.immutable());
|
||||
this.portalProcess.setAsInsidePortalThisTick(true);
|
||||
+ this.portalPos = BlockPos.ZERO; // Purpur - Fix stuck in portals
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4238,7 +_,7 @@
|
||||
}
|
||||
|
||||
public boolean canUsePortal(final boolean ignorePassenger) {
|
||||
- return (ignorePassenger || !this.isPassenger()) && this.isAlive();
|
||||
+ return (ignorePassenger || !this.isPassenger()) && this.isAlive() && (this.level.purpurConfig.entitiesCanUsePortals || this instanceof ServerPlayer); // Purpur - Entities can use portals
|
||||
}
|
||||
|
||||
public boolean canTeleport(final Level from, final Level to) {
|
||||
@@ -4788,6 +_,12 @@
|
||||
return Mth.lerp(partial, this.yRotO, this.yRot);
|
||||
}
|
||||
|
||||
+ // Purpur start - Stop squids floating on top of water
|
||||
+ public AABB getAxisForFluidCheck() {
|
||||
+ return this.getBoundingBox().deflate(0.001D);
|
||||
+ }
|
||||
+ // Purpur end - Stop squids floating on top of water
|
||||
+
|
||||
public boolean touchingUnloadedChunk() {
|
||||
AABB box = this.getBoundingBox().inflate(1.0);
|
||||
int x0 = Mth.floor(box.minX);
|
||||
@@ -5091,7 +_,7 @@
|
||||
}
|
||||
|
||||
public float maxUpStep() {
|
||||
- return 0.0F;
|
||||
+ return maxUpStep; // Purpur - Add option to set armorstand step height
|
||||
}
|
||||
|
||||
public void onExplosionHit(final @Nullable Entity explosionCausedBy) {
|
||||
private long pistonDeltasGameTime;
|
||||
- protected EntityDimensions dimensions;
|
||||
+ private EntityDimensions dimensions;
|
||||
private float eyeHeight;
|
||||
public boolean isInPowderSnow;
|
||||
public boolean wasInPowderSnow;
|
||||
|
||||
@@ -1,44 +1,11 @@
|
||||
--- a/net/minecraft/world/entity/EntityType.java
|
||||
+++ b/net/minecraft/world/entity/EntityType.java
|
||||
@@ -1238,6 +_,16 @@
|
||||
return register(vanillaEntityId(vanillaId), builder);
|
||||
}
|
||||
|
||||
+ // Purpur start - PlayerSetSpawnerTypeWithEggEvent
|
||||
+ public static EntityType<?> getFromBukkitType(org.bukkit.entity.EntityType bukkitType) {
|
||||
+ return getFromKey(Identifier.parse(bukkitType.getKey().toString()));
|
||||
+ }
|
||||
+
|
||||
+ public static EntityType<?> getFromKey(Identifier location) {
|
||||
+ return BuiltInRegistries.ENTITY_TYPE.getValue(location);
|
||||
+ }
|
||||
+ // Purpur end - PlayerSetSpawnerTypeWithEggEvent
|
||||
+
|
||||
public static Identifier getKey(final EntityType<?> type) {
|
||||
return BuiltInRegistries.ENTITY_TYPE.getKey(type);
|
||||
}
|
||||
@@ -1495,6 +_,16 @@
|
||||
return this.category;
|
||||
}
|
||||
|
||||
+ // Purpur start - PlayerSetSpawnerTypeWithEggEvent
|
||||
+ public String getName() {
|
||||
+ return BuiltInRegistries.ENTITY_TYPE.getKey(this).getPath();
|
||||
+ }
|
||||
+
|
||||
+ public String getTranslatedName() {
|
||||
+ return getDescription().getString();
|
||||
+ }
|
||||
+ // Purpur end - PlayerSetSpawnerTypeWithEggEvent
|
||||
+
|
||||
public String getDescriptionId() {
|
||||
return this.descriptionId;
|
||||
}
|
||||
@@ -1556,6 +_,7 @@
|
||||
// Paper start - Add logging for debugging entity tags with invalid ids
|
||||
() -> {
|
||||
LOGGER.warn("Skipping Entity with id {}", input.getStringOr("id", "[invalid]"));
|
||||
+ LOGGER.warn("Location: {} {}", level.getWorld().getName(), input.read("Pos", net.minecraft.world.phys.Vec3.CODEC).orElse(net.minecraft.world.phys.Vec3.ZERO)); // Purpur - log skipped entity's position
|
||||
if ((DEBUG_ENTITIES_WITH_INVALID_IDS || level.getCraftServer().getServer().isDebugging()) && input instanceof TagValueInput tagInput) {
|
||||
LOGGER.warn("Skipped entity tag: {}", tagInput.input);
|
||||
}
|
||||
@@ -69,7 +_,7 @@
|
||||
private final String descriptionId;
|
||||
private @Nullable Component description;
|
||||
private final Optional<ResourceKey<LootTable>> lootTable;
|
||||
- public EntityDimensions dimensions;
|
||||
+ private final EntityDimensions dimensions;
|
||||
private final float spawnDimensionsScale;
|
||||
private final FeatureFlagSet requiredFeatures;
|
||||
private final boolean allowedInPeaceful;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/ExperienceOrb.java
|
||||
+++ b/net/minecraft/world/entity/ExperienceOrb.java
|
||||
@@ -352,7 +_,7 @@
|
||||
@@ -357,7 +_,7 @@
|
||||
public void playerTouch(final Player player) {
|
||||
if (player instanceof ServerPlayer serverPlayer) {
|
||||
if (player.takeXpDelay == 0 && new com.destroystokyo.paper.event.player.PlayerPickupExperienceEvent(serverPlayer.getBukkitEntity(), (org.bukkit.entity.ExperienceOrb) this.getBukkitEntity()).callEvent()) { // Paper - PlayerPickupExperienceEvent
|
||||
@@ -9,7 +9,7 @@
|
||||
player.take(this, 1);
|
||||
int remaining = this.repairPlayerItems(serverPlayer, this.getValue());
|
||||
if (remaining > 0) {
|
||||
@@ -368,7 +_,8 @@
|
||||
@@ -373,7 +_,8 @@
|
||||
}
|
||||
|
||||
private int repairPlayerItems(final ServerPlayer player, final int amount) {
|
||||
|
||||
@@ -1,177 +1,11 @@
|
||||
--- a/net/minecraft/world/entity/LivingEntity.java
|
||||
+++ b/net/minecraft/world/entity/LivingEntity.java
|
||||
@@ -441,6 +_,12 @@
|
||||
if (dist < 0.0) {
|
||||
double damagePerBlock = level.getWorldBorder().getDamagePerBlock();
|
||||
if (damagePerBlock > 0.0) {
|
||||
+ // Purpur start - Add option to teleport to spawn if outside world border
|
||||
+ if (this.level().purpurConfig.teleportIfOutsideBorder && this instanceof ServerPlayer serverPlayer) {
|
||||
+ serverPlayer.teleport(org.bukkit.craftbukkit.util.CraftLocation.toBukkit(this.level().levelData.getRespawnData().pos(), this.level()));
|
||||
+ return;
|
||||
+ }
|
||||
+ // Purpur end - Add option to teleport to spawn if outside world border
|
||||
this.hurtServer(level, this.damageSources().outOfBorder(), Math.max(1, Mth.floor(-dist * damagePerBlock)));
|
||||
}
|
||||
}
|
||||
@@ -456,7 +_,7 @@
|
||||
if (this.shouldTakeDrowningDamage()) {
|
||||
this.setAirSupply(0);
|
||||
level.broadcastEntityEvent(this, EntityEvent.DROWN_PARTICLES);
|
||||
- this.hurtServer(level, this.damageSources().drown(), 2.0F);
|
||||
+ this.hurtServer(level, this.damageSources().drown(), (float) this.level().purpurConfig.damageFromDrowning); // Purpur - Drowning Settings
|
||||
}
|
||||
} else if (this.getAirSupply() < this.getMaxAirSupply() && MobEffectUtil.shouldEffectsRefillAirsupply(this)) {
|
||||
this.setAirSupply(this.increaseAirSupply(this.getAirSupply()));
|
||||
@@ -516,7 +_,7 @@
|
||||
@@ -3914,7 +_,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
protected boolean shouldTakeDrowningDamage() {
|
||||
- return this.getAirSupply() <= -20;
|
||||
+ return this.getAirSupply() <= -this.level().purpurConfig.drowningDamageInterval; // Purpur - Drowning Settings
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1048,15 +_,33 @@
|
||||
}
|
||||
|
||||
if (targetingEntity != null) {
|
||||
- ItemStack itemStack = this.getItemBySlot(EquipmentSlot.HEAD);
|
||||
- if (targetingEntity.is(EntityType.SKELETON) && itemStack.is(Items.SKELETON_SKULL)
|
||||
- || targetingEntity.is(EntityType.ZOMBIE) && itemStack.is(Items.ZOMBIE_HEAD)
|
||||
- || targetingEntity.is(EntityType.PIGLIN) && itemStack.is(Items.PIGLIN_HEAD)
|
||||
- || targetingEntity.is(EntityType.PIGLIN_BRUTE) && itemStack.is(Items.PIGLIN_HEAD)
|
||||
- || targetingEntity.is(EntityType.CREEPER) && itemStack.is(Items.CREEPER_HEAD)) {
|
||||
- visibilityPercent *= 0.5;
|
||||
- }
|
||||
- }
|
||||
+ ItemStack itemBySlot = this.getItemBySlot(EquipmentSlot.HEAD);
|
||||
+ // Purpur start - Mob head visibility percent
|
||||
+ if (targetingEntity.is(EntityType.SKELETON) && itemBySlot.is(Items.SKELETON_SKULL)) {
|
||||
+ visibilityPercent *= targetingEntity.level().purpurConfig.skeletonHeadVisibilityPercent;
|
||||
+ }
|
||||
+ else if (targetingEntity.is(EntityType.ZOMBIE) && itemBySlot.is(Items.ZOMBIE_HEAD)) {
|
||||
+ visibilityPercent *= targetingEntity.level().purpurConfig.zombieHeadVisibilityPercent;
|
||||
+ }
|
||||
+ else if ((targetingEntity.is(EntityType.PIGLIN) || targetingEntity.is(EntityType.PIGLIN_BRUTE)) && itemBySlot.is(Items.PIGLIN_HEAD)) {
|
||||
+ visibilityPercent *= targetingEntity.level().purpurConfig.piglinHeadVisibilityPercent;
|
||||
+ }
|
||||
+ else if (targetingEntity.is(EntityType.CREEPER) && itemBySlot.is(Items.CREEPER_HEAD)) {
|
||||
+ visibilityPercent *= targetingEntity.level().purpurConfig.creeperHeadVisibilityPercent;
|
||||
+ }
|
||||
+ // Purpur end - Mob head visibility percent
|
||||
+ }
|
||||
+
|
||||
+ // Purpur start - Configurable mob blindness
|
||||
+ if (targetingEntity instanceof LivingEntity entityliving) {
|
||||
+ if (entityliving.hasEffect(MobEffects.BLINDNESS)) {
|
||||
+ int amplifier = entityliving.getEffect(MobEffects.BLINDNESS).getAmplifier();
|
||||
+ for (int i = 0; i < amplifier; i++) {
|
||||
+ amplifier *= this.level().purpurConfig.mobsBlindnessMultiplier;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ // Purpur end - Configurable mob blindness
|
||||
|
||||
return visibilityPercent;
|
||||
}
|
||||
@@ -1106,6 +_,7 @@
|
||||
Iterator<MobEffectInstance> iterator = this.activeEffects.values().iterator();
|
||||
while (iterator.hasNext()) {
|
||||
MobEffectInstance effect = iterator.next();
|
||||
+ if (cause == EntityPotionEffectEvent.Cause.MILK && !this.level().purpurConfig.milkClearsBeneficialEffects && effect.getEffect().value().isBeneficial()) continue; // Purpur - Milk Keeps Beneficial Effects
|
||||
EntityPotionEffectEvent event = CraftEventFactory.callEntityPotionEffectChangeEvent(this, effect, null, cause, EntityPotionEffectEvent.Action.CLEARED);
|
||||
if (event.isCancelled()) {
|
||||
continue;
|
||||
@@ -1438,7 +_,23 @@
|
||||
this.stopSleeping();
|
||||
}
|
||||
|
||||
- this.noActionTime = 0;
|
||||
+ // Purpur start - One Punch Man!
|
||||
+ if (source.getEntity() instanceof net.minecraft.world.entity.player.Player player && source.getEntity().level().purpurConfig.creativeOnePunch && !source.is(DamageTypeTags.IS_PROJECTILE)) {
|
||||
+ if (player.isCreative()) {
|
||||
+ org.apache.commons.lang3.mutable.MutableDouble attackDamage = new org.apache.commons.lang3.mutable.MutableDouble();
|
||||
+ player.getMainHandItem().forEachModifier(EquipmentSlot.MAINHAND, (attributeHolder, attributeModifier) -> {
|
||||
+ if (attributeModifier.operation() == AttributeModifier.Operation.ADD_VALUE) {
|
||||
+ attackDamage.addAndGet(attributeModifier.amount());
|
||||
+ }
|
||||
+ });
|
||||
+
|
||||
+ if (attackDamage.doubleValue() == 0.0D) {
|
||||
+ // One punch!
|
||||
+ damage = this.getHealth();
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ // Purpur end - One Punch Man!this.noActionTime = 0;
|
||||
if (damage < 0.0F) {
|
||||
damage = 0.0F;
|
||||
}
|
||||
@@ -1699,10 +_,10 @@
|
||||
protected @Nullable Player resolvePlayerResponsibleForDamage(final DamageSource source) {
|
||||
Entity sourceEntity = source.getEntity();
|
||||
if (sourceEntity instanceof Player playerSource) {
|
||||
- this.setLastHurtByPlayer(playerSource, 100);
|
||||
+ this.setLastHurtByPlayer(playerSource, this.level().purpurConfig.mobLastHurtByPlayerTime); // Purpur - Config for mob last hurt by player time
|
||||
} else if (sourceEntity instanceof Wolf wolf && wolf.isTame()) {
|
||||
if (wolf.getOwnerReference() != null) {
|
||||
- this.setLastHurtByPlayer(wolf.getOwnerReference().getUUID(), 100);
|
||||
+ this.setLastHurtByPlayer(wolf.getOwnerReference().getUUID(), this.level().purpurConfig.mobLastHurtByPlayerTime); // Purpur - Config for mob last hurt by player time
|
||||
} else {
|
||||
this.lastHurtByPlayer = null;
|
||||
this.lastHurtByPlayerMemoryTime = 0;
|
||||
@@ -1754,6 +_,17 @@
|
||||
}
|
||||
}
|
||||
|
||||
+ // Purpur start - Totems work in inventory
|
||||
+ if (level().purpurConfig.totemOfUndyingWorksInInventory && this instanceof ServerPlayer player && (itemStack == null || itemStack.getItem() != Items.TOTEM_OF_UNDYING) && player.getBukkitEntity().hasPermission("purpur.inventory_totem")) {
|
||||
+ for (ItemStack item : player.getInventory().getNonEquipmentItems()) {
|
||||
+ if (item.getItem() == Items.TOTEM_OF_UNDYING) {
|
||||
+ itemStack = item;
|
||||
+ protectionItem = item.copy();
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ // Purpur end - Totems work in inventory
|
||||
final org.bukkit.inventory.EquipmentSlot handSlot = (usedHand != null) ? org.bukkit.craftbukkit.CraftEquipmentSlot.getHand(usedHand) : null;
|
||||
final EntityResurrectEvent event = new EntityResurrectEvent((org.bukkit.entity.LivingEntity) this.getBukkitEntity(), handSlot);
|
||||
event.setCancelled(protectionItem == null);
|
||||
@@ -1927,6 +_,7 @@
|
||||
boolean playerKilled = this.lastHurtByPlayerMemoryTime > 0;
|
||||
this.dropEquipment(level); // CraftBukkit - from below
|
||||
if (this.shouldDropLoot(level)) {
|
||||
+ if (!(source.is(net.minecraft.world.damagesource.DamageTypes.CRAMMING) && level().purpurConfig.disableDropsOnCrammingDeath)) { // Purpur - Disable loot drops on death by cramming
|
||||
this.dropFromLootTable(level, source, playerKilled);
|
||||
// Paper start
|
||||
final boolean prev = this.clearEquipmentSlots;
|
||||
@@ -1935,6 +_,7 @@
|
||||
// Paper end
|
||||
this.dropCustomDeathLoot(level, source, playerKilled);
|
||||
this.clearEquipmentSlots = prev; // Paper
|
||||
+ } // Purpur - Disable loot drops on death by cramming
|
||||
}
|
||||
|
||||
// CraftBukkit start - Call death event // Paper start - call advancement triggers with correct entity equipment
|
||||
@@ -3264,6 +_,7 @@
|
||||
float dmg = (float)(diff * 10.0 - 3.0);
|
||||
if (dmg > 0.0F) {
|
||||
this.playSound(this.getFallDamageSound((int)dmg), 1.0F, 1.0F);
|
||||
+ if (level().purpurConfig.elytraKineticDamage) // Purpur - Toggle for kinetic damage
|
||||
this.hurt(this.damageSources().flyIntoWall(), dmg);
|
||||
}
|
||||
}
|
||||
@@ -4749,6 +_,12 @@
|
||||
? slot == EquipmentSlot.MAINHAND && this.canUseSlot(EquipmentSlot.MAINHAND)
|
||||
: slot == equippable.slot() && this.canUseSlot(equippable.slot()) && equippable.canBeEquippedBy(this.typeHolder());
|
||||
}
|
||||
+
|
||||
+ // Purpur start - Dispenser curse of binding protection
|
||||
+ public @Nullable EquipmentSlot getEquipmentSlotForDispenserItem(ItemStack itemstack) {
|
||||
+ return EnchantmentHelper.getItemEnchantmentLevel(net.minecraft.world.item.enchantment.Enchantments.BINDING_CURSE, itemstack) > 0 ? null : this.getEquipmentSlotForItem(itemstack);
|
||||
+ }
|
||||
+ // Purpur end - Dispenser curse of binding protection
|
||||
|
||||
private static SlotAccess createEquipmentSlotAccess(final LivingEntity entity, final EquipmentSlot equipmentSlot) {
|
||||
return equipmentSlot != EquipmentSlot.HEAD && equipmentSlot != EquipmentSlot.MAINHAND && equipmentSlot != EquipmentSlot.OFFHAND
|
||||
- public boolean canGlide() {
|
||||
+ protected boolean canGlide() {
|
||||
if (!this.onGround() && !this.isPassenger() && !this.hasEffect(MobEffects.LEVITATION)) {
|
||||
for (EquipmentSlot slot : EquipmentSlot.VALUES) {
|
||||
if (canGlideUsing(this.getItemBySlot(slot), slot)) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/Mob.java
|
||||
+++ b/net/minecraft/world/entity/Mob.java
|
||||
@@ -150,6 +_,7 @@
|
||||
@@ -155,6 +_,7 @@
|
||||
private int homeRadius = -1;
|
||||
public boolean aware = true; // CraftBukkit
|
||||
public net.kyori.adventure.util.TriState despawnInPeacefulOverride = net.kyori.adventure.util.TriState.NOT_SET; // Paper - allow changing despawnInPeaceful
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
protected Mob(final EntityType<? extends Mob> type, final Level level) {
|
||||
super(type, level);
|
||||
@@ -304,6 +_,7 @@
|
||||
@@ -309,6 +_,7 @@
|
||||
target = null;
|
||||
}
|
||||
}
|
||||
@@ -16,7 +16,7 @@
|
||||
this.target = target;
|
||||
return true;
|
||||
// CraftBukkit end
|
||||
@@ -347,7 +_,27 @@
|
||||
@@ -352,7 +_,27 @@
|
||||
}
|
||||
|
||||
profiler.pop();
|
||||
@@ -45,7 +45,7 @@
|
||||
|
||||
@Override
|
||||
protected void playHurtSound(final DamageSource source) {
|
||||
@@ -451,6 +_,7 @@
|
||||
@@ -456,6 +_,7 @@
|
||||
output.putString("Paper.DespawnInPeacefulOverride", this.despawnInPeacefulOverride.name());
|
||||
}
|
||||
// Paper end - allow changing despawnInPeaceful
|
||||
@@ -53,7 +53,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -478,6 +_,7 @@
|
||||
@@ -483,6 +_,7 @@
|
||||
this.lootTableSeed = input.getLongOr("DeathLootTableSeed", 0L);
|
||||
this.setNoAi(input.getBooleanOr("NoAI", false));
|
||||
this.aware = input.getBooleanOr("Bukkit.Aware", true); // CraftBukkit
|
||||
@@ -61,7 +61,7 @@
|
||||
// Paper start - allow changing despawnInPeaceful
|
||||
this.despawnInPeacefulOverride = readDespawnInPeacefulOverride(input);
|
||||
}
|
||||
@@ -1257,7 +_,7 @@
|
||||
@@ -1289,7 +_,7 @@
|
||||
);
|
||||
}
|
||||
|
||||
@@ -70,7 +70,7 @@
|
||||
return groupData;
|
||||
}
|
||||
|
||||
@@ -1614,6 +_,7 @@
|
||||
@@ -1646,6 +_,7 @@
|
||||
}
|
||||
|
||||
this.postPiercingAttack();
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
--- a/net/minecraft/world/entity/ai/behavior/AcquirePoi.java
|
||||
+++ b/net/minecraft/world/entity/ai/behavior/AcquirePoi.java
|
||||
@@ -96,7 +_,7 @@
|
||||
};
|
||||
// Paper start - optimise POI searches
|
||||
java.util.List<Pair<Holder<PoiType>, BlockPos>> poiPositionsRaw = new java.util.ArrayList<>();
|
||||
- ca.spottedleaf.moonrise.patches.poi_lookup.PoiAccess.findNearestPoiPositions(poiManager, poiType, cacheTest, body.blockPosition(), SCAN_RANGE, Double.MAX_VALUE, PoiManager.Occupancy.HAS_SPACE, ca.spottedleaf.moonrise.patches.poi_lookup.PoiAccess.LOAD_FOR_SEARCHING, 5, poiPositionsRaw);
|
||||
+ ca.spottedleaf.moonrise.patches.poi_lookup.PoiAccess.findNearestPoiPositions(poiManager, poiType, cacheTest, body.blockPosition(), level.purpurConfig.villagerAcquirePoiSearchRadius, Double.MAX_VALUE, PoiManager.Occupancy.HAS_SPACE, ca.spottedleaf.moonrise.patches.poi_lookup.PoiAccess.LOAD_FOR_SEARCHING, 5, poiPositionsRaw); // Purpur - Configurable villager search radius
|
||||
Set<Pair<Holder<PoiType>, BlockPos>> poiPositions = new java.util.HashSet<>(poiPositionsRaw.size());
|
||||
for (Pair<Holder<PoiType>, BlockPos> pair : poiPositionsRaw) {
|
||||
if (validPoi.test(level, pair.getSecond())) {
|
||||
@@ -1,73 +0,0 @@
|
||||
--- a/net/minecraft/world/entity/animal/bee/Bee.java
|
||||
+++ b/net/minecraft/world/entity/animal/bee/Bee.java
|
||||
@@ -171,7 +_,7 @@
|
||||
// Paper end - Fix MC-167279
|
||||
this.lookControl = new Bee.BeeLookControl(this);
|
||||
this.setPathfindingMalus(PathType.FIRE_IN_NEIGHBOR, -1.0F);
|
||||
- this.setPathfindingMalus(PathType.WATER, -1.0F);
|
||||
+ if (this.level().purpurConfig.beeCanInstantlyStartDrowning) this.setPathfindingMalus(PathType.WATER, -1.0F); // Purpur - bee can instantly start drowning in water option
|
||||
this.setPathfindingMalus(PathType.WATER_BORDER, 16.0F);
|
||||
this.setPathfindingMalus(PathType.COCOA, -1.0F);
|
||||
this.setPathfindingMalus(PathType.FENCE, -1.0F);
|
||||
@@ -362,13 +_,19 @@
|
||||
if (this.stayOutOfHiveCountdown <= 0 && !this.beePollinateGoal.isPollinating() && !this.hasStung() && this.getTarget() == null) {
|
||||
boolean wantsToEnterHive = this.hasNectar()
|
||||
|| this.isTiredOfLookingForNectar()
|
||||
- || this.level().environmentAttributes().getValue(EnvironmentAttributes.BEES_STAY_IN_HIVE, this.position());
|
||||
+ || this.level().environmentAttributes().getValue(EnvironmentAttributes.BEES_STAY_IN_HIVE, this.position()) || isNightOrRaining(this.level()); // Purpur - Bee can work when raining or at night
|
||||
return wantsToEnterHive && !this.isHiveNearFire();
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
+ // Purpur start - Bee can work when raining or at night
|
||||
+ public static boolean isNightOrRaining(Level level) {
|
||||
+ return level.dimensionType().hasSkyLight() && (level.isDarkOutside() && !level.purpurConfig.beeCanWorkAtNight || level.isRaining() && !level.purpurConfig.beeCanWorkInRain); // Purpur - Bee can work when raining or at night
|
||||
+ }
|
||||
+ // Purpur end - Bee can work when raining or at night
|
||||
+
|
||||
public void setStayOutOfHiveCountdown(final int ticks) {
|
||||
this.stayOutOfHiveCountdown = ticks;
|
||||
}
|
||||
@@ -389,7 +_,7 @@
|
||||
@Override
|
||||
protected void customServerAiStep(final ServerLevel level) {
|
||||
boolean hasStung = this.hasStung();
|
||||
- if (this.isInWater()) {
|
||||
+ if (this.level().purpurConfig.beeCanInstantlyStartDrowning && this.isInWater()) { // Purpur - bee can instantly start drowning in water option
|
||||
this.underWaterTicks++;
|
||||
} else {
|
||||
this.underWaterTicks = 0;
|
||||
@@ -399,6 +_,7 @@
|
||||
this.hurtServer(level, this.damageSources().drown(), 1.0F);
|
||||
}
|
||||
|
||||
+ if (hasStung && !this.level().purpurConfig.beeDiesAfterSting) setHasStung(false); else // Purpur - Stop bees from dying after stinging
|
||||
if (hasStung) {
|
||||
this.timeSinceSting++;
|
||||
if (this.timeSinceSting % 5 == 0 && this.random.nextInt(Mth.clamp(1200 - this.timeSinceSting, 1, 1200)) == 0) {
|
||||
@@ -1132,6 +_,7 @@
|
||||
Bee.this.savedFlowerPos = nearbyPos.get();
|
||||
Bee.this.navigation
|
||||
.moveTo(Bee.this.savedFlowerPos.getX() + 0.5, Bee.this.savedFlowerPos.getY() + 0.5, Bee.this.savedFlowerPos.getZ() + 0.5, 1.2F);
|
||||
+ new org.purpurmc.purpur.event.entity.BeeFoundFlowerEvent((org.bukkit.entity.Bee) Bee.this.getBukkitEntity(), org.bukkit.craftbukkit.util.CraftLocation.toBukkit(Bee.this.savedFlowerPos, Bee.this.level())).callEvent(); // Purpur - Bee API
|
||||
return true;
|
||||
} else {
|
||||
Bee.this.remainingCooldownBeforeLocatingNewFlower = Mth.nextInt(Bee.this.random, 20, 60);
|
||||
@@ -1178,6 +_,7 @@
|
||||
this.pollinating = false;
|
||||
Bee.this.navigation.stop();
|
||||
Bee.this.remainingCooldownBeforeLocatingNewFlower = 200;
|
||||
+ new org.purpurmc.purpur.event.entity.BeeStopPollinatingEvent((org.bukkit.entity.Bee) Bee.this.getBukkitEntity(), Bee.this.savedFlowerPos == null ? null : org.bukkit.craftbukkit.util.CraftLocation.toBukkit(Bee.this.savedFlowerPos, Bee.this.level()), Bee.this.hasNectar()).callEvent(); // Purpur - Bee API
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1224,6 +_,7 @@
|
||||
this.setWantedPos();
|
||||
}
|
||||
|
||||
+ if (this.successfulPollinatingTicks == 0) new org.purpurmc.purpur.event.entity.BeeStartedPollinatingEvent((org.bukkit.entity.Bee) Bee.this.getBukkitEntity(), org.bukkit.craftbukkit.util.CraftLocation.toBukkit(Bee.this.savedFlowerPos, Bee.this.level())).callEvent(); // Purpur - Bee API
|
||||
this.successfulPollinatingTicks++;
|
||||
if (Bee.this.random.nextFloat() < 0.05F && this.successfulPollinatingTicks > this.lastSoundPlayedTick + 60) {
|
||||
this.lastSoundPlayedTick = this.successfulPollinatingTicks;
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/animal/cow/AbstractCow.java
|
||||
+++ b/net/minecraft/world/entity/animal/cow/AbstractCow.java
|
||||
@@ -40,7 +_,7 @@
|
||||
@@ -41,7 +_,7 @@
|
||||
this.goalSelector.addGoal(0, new FloatGoal(this));
|
||||
this.goalSelector.addGoal(1, new PanicGoal(this, 2.0));
|
||||
this.goalSelector.addGoal(2, new BreedGoal(this, 1.0));
|
||||
@@ -9,7 +9,7 @@
|
||||
this.goalSelector.addGoal(4, new FollowParentGoal(this, 1.25));
|
||||
this.goalSelector.addGoal(5, new WaterAvoidingRandomStrollGoal(this, 1.0));
|
||||
this.goalSelector.addGoal(6, new LookAtPlayerGoal(this, Player.class, 6.0F));
|
||||
@@ -100,6 +_,10 @@
|
||||
@@ -101,6 +_,10 @@
|
||||
ItemStack bucketOrMilkBucket = ItemUtils.createFilledResult(itemStack, player, org.bukkit.craftbukkit.inventory.CraftItemStack.asNMSCopy(event.getItemStack())); // CraftBukkit
|
||||
player.setItemInHand(hand, bucketOrMilkBucket);
|
||||
return InteractionResult.SUCCESS;
|
||||
@@ -20,7 +20,7 @@
|
||||
} else {
|
||||
return super.mobInteract(player, hand);
|
||||
}
|
||||
@@ -109,4 +_,67 @@
|
||||
@@ -110,4 +_,67 @@
|
||||
public EntityDimensions getDefaultDimensions(final Pose pose) {
|
||||
return this.isBaby() ? BABY_DIMENSIONS : super.getDefaultDimensions(pose);
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
--- a/net/minecraft/world/entity/animal/cow/MushroomCow.java
|
||||
+++ b/net/minecraft/world/entity/animal/cow/MushroomCow.java
|
||||
@@ -199,6 +_,13 @@
|
||||
@@ -207,6 +_,13 @@
|
||||
level.playSound(null, this, SoundEvents.MOOSHROOM_SHEAR, soundSource, 1.0F, 1.0F);
|
||||
this.convertTo(EntityType.COW, ConversionParams.single(this, false, false), cow -> {
|
||||
this.convertTo(EntityTypes.COW, ConversionParams.single(this, false, false), cow -> {
|
||||
level.sendParticles(ParticleTypes.EXPLOSION, this.getX(), this.getY(0.5), this.getZ(), 1, 0.0, 0.0, 0.0, 0.0);
|
||||
+ // Purpur start - Fix cow rotation when shearing mooshroom
|
||||
+ cow.copyPosition(this);
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
--- a/net/minecraft/world/entity/animal/dolphin/Dolphin.java
|
||||
+++ b/net/minecraft/world/entity/animal/dolphin/Dolphin.java
|
||||
@@ -77,6 +_,7 @@
|
||||
public static final float BABY_SCALE = 0.65F;
|
||||
@@ -86,6 +_,7 @@
|
||||
.withAttachments(EntityAttachments.builder().attach(EntityAttachment.PASSENGER, 0.0F, 0.3125F, 0.0F));
|
||||
private static final boolean DEFAULT_GOT_FISH = false;
|
||||
public @Nullable BlockPos treasurePos;
|
||||
+ private boolean isNaturallyAggressiveToPlayers; // Purpur - Dolphins naturally aggressive to players chance
|
||||
|
||||
public Dolphin(final EntityType<? extends Dolphin> type, final Level level) {
|
||||
super(type, level);
|
||||
@@ -92,6 +_,7 @@
|
||||
@@ -101,6 +_,7 @@
|
||||
this.setAirSupply(this.getMaxAirSupply());
|
||||
this.setXRot(0.0F);
|
||||
SpawnGroupData spawnGroupData = Objects.requireNonNullElseGet(groupData, () -> new AgeableMob.AgeableMobGroupData(0.1F));
|
||||
@@ -16,7 +16,7 @@
|
||||
return super.finalizeSpawn(level, difficulty, spawnReason, spawnGroupData);
|
||||
}
|
||||
|
||||
@@ -157,18 +_,20 @@
|
||||
@@ -166,18 +_,20 @@
|
||||
protected void registerGoals() {
|
||||
this.goalSelector.addGoal(0, new BreathAirGoal(this));
|
||||
this.goalSelector.addGoal(0, new TryFindWaterGoal(this));
|
||||
@@ -38,7 +38,7 @@
|
||||
}
|
||||
|
||||
public static AttributeSupplier.Builder createAttributes() {
|
||||
@@ -395,6 +_,7 @@
|
||||
@@ -404,6 +_,7 @@
|
||||
|
||||
@Override
|
||||
public boolean canUse() {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/animal/equine/Llama.java
|
||||
+++ b/net/minecraft/world/entity/animal/equine/Llama.java
|
||||
@@ -75,6 +_,7 @@
|
||||
@@ -76,6 +_,7 @@
|
||||
private boolean didSpit;
|
||||
private @Nullable Llama caravanHead;
|
||||
public @Nullable Llama caravanTail; // Paper - public
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
public Llama(final EntityType<? extends Llama> type, final Level level) {
|
||||
super(type, level);
|
||||
@@ -104,6 +_,7 @@
|
||||
@@ -105,6 +_,7 @@
|
||||
super.addAdditionalSaveData(output);
|
||||
output.store("Variant", Llama.Variant.LEGACY_CODEC, this.getVariant());
|
||||
output.putInt("Strength", this.getStrength());
|
||||
@@ -16,7 +16,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -111,6 +_,7 @@
|
||||
@@ -112,6 +_,7 @@
|
||||
this.setStrength(input.getIntOr("Strength", 0));
|
||||
super.readAdditionalSaveData(input);
|
||||
this.setVariant(input.read("Variant", Llama.Variant.LEGACY_CODEC).orElse(Llama.Variant.DEFAULT));
|
||||
@@ -24,7 +24,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -387,6 +_,7 @@
|
||||
@@ -388,6 +_,7 @@
|
||||
|
||||
public void leaveCaravan() {
|
||||
if (this.caravanHead != null) {
|
||||
@@ -32,7 +32,7 @@
|
||||
this.caravanHead.caravanTail = null;
|
||||
}
|
||||
|
||||
@@ -394,6 +_,7 @@
|
||||
@@ -395,6 +_,7 @@
|
||||
}
|
||||
|
||||
public void joinCaravan(final Llama tail) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/animal/feline/Cat.java
|
||||
+++ b/net/minecraft/world/entity/animal/feline/Cat.java
|
||||
@@ -382,6 +_,14 @@
|
||||
@@ -394,6 +_,14 @@
|
||||
return this.isTame() && partner instanceof Cat cat && cat.isTame() && super.canMate(partner);
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
@Override
|
||||
public @Nullable SpawnGroupData finalizeSpawn(
|
||||
final ServerLevelAccessor level, final DifficultyInstance difficulty, final EntitySpawnReason spawnReason, @Nullable SpawnGroupData groupData
|
||||
@@ -476,7 +_,7 @@
|
||||
@@ -488,7 +_,7 @@
|
||||
}
|
||||
|
||||
private void tryToTame(final Player player) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/animal/feline/Ocelot.java
|
||||
+++ b/net/minecraft/world/entity/animal/feline/Ocelot.java
|
||||
@@ -234,7 +_,7 @@
|
||||
@@ -246,7 +_,7 @@
|
||||
public boolean checkSpawnObstruction(final LevelReader level) {
|
||||
if (level.isUnobstructed(this) && !level.containsAnyLiquid(this.getBoundingBox())) {
|
||||
BlockPos pos = this.blockPosition();
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/animal/fox/Fox.java
|
||||
+++ b/net/minecraft/world/entity/animal/fox/Fox.java
|
||||
@@ -363,6 +_,11 @@
|
||||
@@ -370,6 +_,11 @@
|
||||
}
|
||||
|
||||
private void setTargetGoals() {
|
||||
@@ -12,7 +12,7 @@
|
||||
if (this.getVariant() == Fox.Variant.RED) {
|
||||
this.targetSelector.addGoal(4, this.landTargetGoal);
|
||||
this.targetSelector.addGoal(4, this.turtleEggTargetGoal);
|
||||
@@ -390,6 +_,7 @@
|
||||
@@ -397,6 +_,7 @@
|
||||
|
||||
public void setVariant(final Fox.Variant variant) {
|
||||
this.entityData.set(DATA_TYPE_ID, variant.getId());
|
||||
@@ -20,7 +20,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -715,6 +_,29 @@
|
||||
@@ -722,6 +_,29 @@
|
||||
return slot == EquipmentSlot.MAINHAND;
|
||||
}
|
||||
// Paper end
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/animal/goat/Goat.java
|
||||
+++ b/net/minecraft/world/entity/animal/goat/Goat.java
|
||||
@@ -362,6 +_,7 @@
|
||||
@@ -369,6 +_,7 @@
|
||||
|
||||
// Paper start - Goat ram API
|
||||
public void ram(net.minecraft.world.entity.LivingEntity entity) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/animal/golem/IronGolem.java
|
||||
+++ b/net/minecraft/world/entity/animal/golem/IronGolem.java
|
||||
@@ -58,13 +_,25 @@
|
||||
@@ -59,13 +_,25 @@
|
||||
private static final UniformInt PERSISTENT_ANGER_TIME = TimeUtil.rangeOfSeconds(20, 39);
|
||||
private long persistentAngerEndTime;
|
||||
private @Nullable EntityReference<LivingEntity> persistentAngerTarget;
|
||||
@@ -26,7 +26,7 @@
|
||||
this.goalSelector.addGoal(1, new MeleeAttackGoal(this, 1.0, true));
|
||||
this.goalSelector.addGoal(2, new MoveTowardsTargetGoal(this, 0.9, 32.0F));
|
||||
this.goalSelector.addGoal(2, new MoveBackToVillageGoal(this, 0.6, false));
|
||||
@@ -142,6 +_,7 @@
|
||||
@@ -143,6 +_,7 @@
|
||||
protected void addAdditionalSaveData(final ValueOutput output) {
|
||||
super.addAdditionalSaveData(output);
|
||||
output.putBoolean("PlayerCreated", this.isPlayerCreated());
|
||||
@@ -34,7 +34,7 @@
|
||||
this.addPersistentAngerSaveData(output);
|
||||
}
|
||||
|
||||
@@ -149,6 +_,7 @@
|
||||
@@ -150,6 +_,7 @@
|
||||
protected void readAdditionalSaveData(final ValueInput input) {
|
||||
super.readAdditionalSaveData(input);
|
||||
this.setPlayerCreated(input.getBooleanOr("PlayerCreated", false));
|
||||
@@ -42,7 +42,7 @@
|
||||
this.readPersistentAngerSaveData(this.level(), input);
|
||||
}
|
||||
|
||||
@@ -269,6 +_,7 @@
|
||||
@@ -270,6 +_,7 @@
|
||||
float pitch = 1.0F + (this.random.nextFloat() - this.random.nextFloat()) * 0.2F;
|
||||
this.playSound(SoundEvents.IRON_GOLEM_REPAIR, 1.0F, pitch);
|
||||
itemStack.consume(1, player);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/animal/pig/Pig.java
|
||||
+++ b/net/minecraft/world/entity/animal/pig/Pig.java
|
||||
@@ -158,6 +_,19 @@
|
||||
@@ -166,6 +_,19 @@
|
||||
@Override
|
||||
public InteractionResult mobInteract(final Player player, final InteractionHand hand) {
|
||||
boolean hasFood = this.isFood(player.getItemInHand(hand));
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/animal/polarbear/PolarBear.java
|
||||
+++ b/net/minecraft/world/entity/animal/polarbear/PolarBear.java
|
||||
@@ -66,6 +_,29 @@
|
||||
@@ -72,6 +_,29 @@
|
||||
super(type, level);
|
||||
}
|
||||
|
||||
@@ -29,8 +29,8 @@
|
||||
+
|
||||
@Override
|
||||
public @Nullable AgeableMob getBreedOffspring(final ServerLevel level, final AgeableMob partner) {
|
||||
return EntityType.POLAR_BEAR.create(level, EntitySpawnReason.BREEDING);
|
||||
@@ -73,7 +_,7 @@
|
||||
return EntityTypes.POLAR_BEAR.create(level, EntitySpawnReason.BREEDING);
|
||||
@@ -79,7 +_,7 @@
|
||||
|
||||
@Override
|
||||
public boolean isFood(final ItemStack itemStack) {
|
||||
@@ -39,7 +39,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -82,6 +_,12 @@
|
||||
@@ -88,6 +_,12 @@
|
||||
this.goalSelector.addGoal(0, new FloatGoal(this));
|
||||
this.goalSelector.addGoal(1, new PolarBear.PolarBearMeleeAttackGoal());
|
||||
this.goalSelector.addGoal(1, new PanicGoal(this, 2.0, bear -> bear.isBaby() ? DamageTypeTags.PANIC_CAUSES : DamageTypeTags.PANIC_ENVIRONMENTAL_CAUSES));
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/animal/rabbit/Rabbit.java
|
||||
+++ b/net/minecraft/world/entity/animal/rabbit/Rabbit.java
|
||||
@@ -419,10 +_,23 @@
|
||||
@@ -420,10 +_,23 @@
|
||||
}
|
||||
|
||||
this.setVariant(variant);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/animal/squid/GlowSquid.java
|
||||
+++ b/net/minecraft/world/entity/animal/squid/GlowSquid.java
|
||||
@@ -30,6 +_,13 @@
|
||||
@@ -31,6 +_,13 @@
|
||||
super(type, level);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,50 +0,0 @@
|
||||
--- a/net/minecraft/world/entity/animal/squid/Squid.java
|
||||
+++ b/net/minecraft/world/entity/animal/squid/Squid.java
|
||||
@@ -51,10 +_,29 @@
|
||||
|
||||
public Squid(final EntityType<? extends Squid> type, final Level level) {
|
||||
super(type, level);
|
||||
- // this.random.setSeed(this.getId()); // Paper - Share random for entities to make them more random
|
||||
+ if (!level.purpurConfig.entitySharedRandom) this.random.setSeed(this.getId()); // Paper - Share random for entities to make them more random // Purpur - Add toggle for RNG manipulation
|
||||
this.tentacleSpeed = 1.0F / (this.random.nextFloat() + 1.0F) * 0.2F;
|
||||
}
|
||||
|
||||
+ // Purpur start - Stop squids floating on top of water
|
||||
+ @Override
|
||||
+ public net.minecraft.world.phys.AABB getAxisForFluidCheck() {
|
||||
+ // Stops squids from floating just over the water
|
||||
+ return super.getAxisForFluidCheck().offsetY(level().purpurConfig.squidOffsetWaterCheck);
|
||||
+ }
|
||||
+ // Purpur end - Stop squids floating on top of water
|
||||
+
|
||||
+ // Purpur start - Flying squids! Oh my!
|
||||
+ public boolean canFly() {
|
||||
+ return this.level().purpurConfig.squidsCanFly;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isInWater() {
|
||||
+ return this.wasTouchingWater || canFly();
|
||||
+ }
|
||||
+ // Purpur end - Flying squids! Oh my!
|
||||
+
|
||||
@Override
|
||||
protected void registerGoals() {
|
||||
this.goalSelector.addGoal(0, new Squid.SquidRandomMovementGoal(this));
|
||||
@@ -131,6 +_,7 @@
|
||||
}
|
||||
|
||||
if (this.isInWater()) {
|
||||
+ if (canFly()) setNoGravity(!wasTouchingWater); // Purpur - Flying squids! Oh my!
|
||||
if (this.tentacleMovement < Mth.PI) {
|
||||
float tentacleScale = this.tentacleMovement / Mth.PI;
|
||||
this.tentacleAngle = Mth.sin(tentacleScale * tentacleScale * Mth.PI) * Mth.PI * 0.25F;
|
||||
@@ -316,7 +_,7 @@
|
||||
int noActionTime = this.squid.getNoActionTime();
|
||||
if (noActionTime > 100) {
|
||||
this.squid.movementVector = Vec3.ZERO;
|
||||
- } else if (this.squid.getRandom().nextInt(reducedTickDelay(50)) == 0 || !this.squid.wasTouchingWater || !this.squid.hasMovementVector()) {
|
||||
+ } else if (this.squid.getRandom().nextInt(reducedTickDelay(50)) == 0 || !this.squid.isInWater() || !this.squid.hasMovementVector()) { // Purpur - Flying squids! Oh my!
|
||||
float angle = this.squid.getRandom().nextFloat() * (float) (Math.PI * 2);
|
||||
this.squid.movementVector = new Vec3(Mth.cos(angle) * 0.2F, -0.1F + this.squid.getRandom().nextFloat() * 0.2F, Mth.sin(angle) * 0.2F);
|
||||
}
|
||||
@@ -1,168 +0,0 @@
|
||||
--- a/net/minecraft/world/entity/animal/wolf/Wolf.java
|
||||
+++ b/net/minecraft/world/entity/animal/wolf/Wolf.java
|
||||
@@ -96,6 +_,37 @@
|
||||
public static final TargetingConditions.Selector PREY_SELECTOR = (target, level) -> target.is(EntityType.SHEEP)
|
||||
|| target.is(EntityType.RABBIT)
|
||||
|| target.is(EntityType.FOX);
|
||||
+ // Purpur start - Configurable chance for wolves to spawn rabid
|
||||
+ private boolean isRabid = false;
|
||||
+ private static final TargetingConditions.Selector RABID_PREDICATE = (entity, ignored) -> entity instanceof net.minecraft.server.level.ServerPlayer || entity instanceof net.minecraft.world.entity.Mob;
|
||||
+ private final net.minecraft.world.entity.ai.goal.Goal PATHFINDER_VANILLA = new NonTameRandomTargetGoal<>(this, Animal.class, false, PREY_SELECTOR);
|
||||
+ private final net.minecraft.world.entity.ai.goal.Goal PATHFINDER_RABID = new NonTameRandomTargetGoal<>(this, LivingEntity.class, false, RABID_PREDICATE);
|
||||
+ private static final class AvoidRabidWolfGoal extends AvoidEntityGoal<Wolf> {
|
||||
+ private final Wolf wolf;
|
||||
+
|
||||
+ public AvoidRabidWolfGoal(Wolf wolf, float distance, double minSpeed, double maxSpeed) {
|
||||
+ super(wolf, Wolf.class, distance, minSpeed, maxSpeed);
|
||||
+ this.wolf = wolf;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean canUse() {
|
||||
+ return super.canUse() && !this.wolf.isRabid() && this.toAvoid != null && this.toAvoid.isRabid(); // wolves which are not rabid run away from rabid wolves
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void start() {
|
||||
+ this.wolf.setTarget(null);
|
||||
+ super.start();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void tick() {
|
||||
+ this.wolf.setTarget(null);
|
||||
+ super.tick();
|
||||
+ }
|
||||
+ }
|
||||
+ // Purpur end - Configurable chance for wolves to spawn rabid
|
||||
private static final float START_HEALTH = 8.0F;
|
||||
private static final float TAME_HEALTH = 40.0F;
|
||||
private static final float ARMOR_REPAIR_UNIT = 0.125F;
|
||||
@@ -117,12 +_,47 @@
|
||||
this.setPathfindingMalus(PathType.ON_TOP_OF_POWDER_SNOW, -1.0F);
|
||||
}
|
||||
|
||||
+ // Purpur start - Configurable chance for wolves to spawn rabid
|
||||
+ public boolean isRabid() {
|
||||
+ return this.isRabid;
|
||||
+ }
|
||||
+
|
||||
+ public void setRabid(boolean isRabid) {
|
||||
+ this.isRabid = isRabid;
|
||||
+ updatePathfinders(true);
|
||||
+ }
|
||||
+
|
||||
+ public void updatePathfinders(boolean modifyEffects) {
|
||||
+ this.targetSelector.removeGoal(PATHFINDER_VANILLA);
|
||||
+ this.targetSelector.removeGoal(PATHFINDER_RABID);
|
||||
+ if (this.isRabid) {
|
||||
+ this.setOwnerReference(null);
|
||||
+ setTame(false, true);
|
||||
+ this.targetSelector.addGoal(5, PATHFINDER_RABID);
|
||||
+ if (modifyEffects) this.addEffect(new net.minecraft.world.effect.MobEffectInstance(net.minecraft.world.effect.MobEffects.NAUSEA, 1200));
|
||||
+ } else {
|
||||
+ this.targetSelector.addGoal(5, PATHFINDER_VANILLA);
|
||||
+ this.stopBeingAngry();
|
||||
+ if (modifyEffects) this.removeEffect(net.minecraft.world.effect.MobEffects.NAUSEA);
|
||||
+ }
|
||||
+ }
|
||||
+ // Purpur end - Configurable chance for wolves to spawn rabid
|
||||
+
|
||||
+ // Purpur start - Configurable default collar color
|
||||
+ @Override
|
||||
+ public void tame(Player player) {
|
||||
+ setCollarColor(level().purpurConfig.wolfDefaultCollarColor);
|
||||
+ super.tame(player);
|
||||
+ }
|
||||
+ // Purpur end - Configurable default collar color
|
||||
+
|
||||
@Override
|
||||
protected void registerGoals() {
|
||||
this.goalSelector.addGoal(1, new FloatGoal(this));
|
||||
this.goalSelector.addGoal(1, new TamableAnimal.TamableAnimalPanicGoal(1.5, DamageTypeTags.PANIC_ENVIRONMENTAL_CAUSES));
|
||||
this.goalSelector.addGoal(2, new SitWhenOrderedToGoal(this));
|
||||
this.goalSelector.addGoal(3, new Wolf.WolfAvoidEntityGoal<>(this, Llama.class, 24.0F, 1.5, 1.5));
|
||||
+ this.goalSelector.addGoal(3, new AvoidRabidWolfGoal(this, 24.0F, 1.5D, 1.5D)); // Purpur - Configurable chance for wolves to spawn rabid
|
||||
this.goalSelector.addGoal(4, new LeapAtTargetGoal(this, 0.4F));
|
||||
this.goalSelector.addGoal(5, new MeleeAttackGoal(this, 1.0, true));
|
||||
this.goalSelector.addGoal(6, new FollowOwnerGoal(this, 1.0, 10.0F, 2.0F));
|
||||
@@ -135,7 +_,7 @@
|
||||
this.targetSelector.addGoal(2, new OwnerHurtTargetGoal(this));
|
||||
this.targetSelector.addGoal(3, new HurtByTargetGoal(this).setAlertOthers());
|
||||
this.targetSelector.addGoal(4, new NearestAttackableTargetGoal<>(this, Player.class, 10, true, false, this::isAngryAt));
|
||||
- this.targetSelector.addGoal(5, new NonTameRandomTargetGoal<>(this, Animal.class, false, PREY_SELECTOR));
|
||||
+ //this.targetSelector.addGoal(5, new NonTameRandomTargetGoal<>(this, Animal.class, false, PREY_SELECTOR)); // Purpur - Configurable chance for wolves to spawn rabid - moved to updatePathfinders()
|
||||
this.targetSelector.addGoal(6, new NonTameRandomTargetGoal<>(this, Turtle.class, false, Turtle.BABY_ON_LAND_SELECTOR));
|
||||
this.targetSelector.addGoal(7, new NearestAttackableTargetGoal<>(this, AbstractSkeleton.class, false));
|
||||
this.targetSelector.addGoal(8, new ResetUniversalAngerTargetGoal<>(this, true));
|
||||
@@ -230,6 +_,7 @@
|
||||
protected void addAdditionalSaveData(final ValueOutput output) {
|
||||
super.addAdditionalSaveData(output);
|
||||
output.store("CollarColor", DyeColor.LEGACY_ID_CODEC, this.getCollarColor());
|
||||
+ output.putBoolean("Purpur.IsRabid", this.isRabid); // Purpur - Configurable chance for wolves to spawn rabid
|
||||
VariantUtils.writeVariant(output, this.getVariant());
|
||||
this.addPersistentAngerSaveData(output);
|
||||
this.getSoundVariant()
|
||||
@@ -244,6 +_,10 @@
|
||||
super.readAdditionalSaveData(input);
|
||||
VariantUtils.readVariant(input, Registries.WOLF_VARIANT).ifPresent(this::setVariant);
|
||||
this.setCollarColor(input.read("CollarColor", DyeColor.LEGACY_ID_CODEC).orElse(DEFAULT_COLLAR_COLOR));
|
||||
+ // Purpur start - Configurable chance for wolves to spawn rabid
|
||||
+ this.isRabid = input.getBooleanOr("Purpur.IsRabid", false);
|
||||
+ this.updatePathfinders(false);
|
||||
+ // Purpur end - Configurable chance for wolves to spawn rabid
|
||||
this.readPersistentAngerSaveData(this.level(), input);
|
||||
input.read("sound_variant", ResourceKey.codec(Registries.WOLF_SOUND_VARIANT))
|
||||
.flatMap(soundVariant -> this.registryAccess().lookupOrThrow(Registries.WOLF_SOUND_VARIANT).get((ResourceKey<WolfSoundVariant>)soundVariant))
|
||||
@@ -267,6 +_,10 @@
|
||||
}
|
||||
|
||||
this.setSoundVariant(WolfSoundVariants.pickRandomSoundVariant(this.registryAccess(), level.getRandom()));
|
||||
+ // Purpur start - Configurable chance for wolves to spawn rabid
|
||||
+ this.isRabid = level.getLevel().purpurConfig.wolfNaturalRabid > 0.0D && random.nextDouble() <= level.getLevel().purpurConfig.wolfNaturalRabid;
|
||||
+ this.updatePathfinders(false);
|
||||
+ // Purpur end - Configurable chance for wolves to spawn rabid
|
||||
return super.finalizeSpawn(level, difficulty, spawnReason, groupData);
|
||||
}
|
||||
|
||||
@@ -315,6 +_,11 @@
|
||||
public void tick() {
|
||||
super.tick();
|
||||
if (this.isAlive()) {
|
||||
+ // Purpur start - Configurable chance for wolves to spawn rabid
|
||||
+ if (this.age % 300 == 0 && this.isRabid()) {
|
||||
+ this.addEffect(new net.minecraft.world.effect.MobEffectInstance(net.minecraft.world.effect.MobEffects.NAUSEA, 400));
|
||||
+ }
|
||||
+ // Purpur end - Configurable chance for wolves to spawn rabid
|
||||
this.interestedAngleO = this.interestedAngle;
|
||||
if (this.isInterested()) {
|
||||
this.interestedAngle = this.interestedAngle + (1.0F - this.interestedAngle) * 0.4F;
|
||||
@@ -516,13 +_,27 @@
|
||||
itemStack.consume(1, player);
|
||||
this.tryToTame(player);
|
||||
return InteractionResult.SUCCESS_SERVER;
|
||||
+ // Purpur start - Configurable chance for wolves to spawn rabid
|
||||
+ } else if (this.level().purpurConfig.wolfMilkCuresRabies && itemStack.getItem() == Items.MILK_BUCKET && this.isRabid()) {
|
||||
+ if (!player.isCreative()) {
|
||||
+ player.setItemInHand(hand, new ItemStack(Items.BUCKET));
|
||||
+ }
|
||||
+ this.setRabid(false);
|
||||
+ for (int i = 0; i < 10; ++i) {
|
||||
+ ((ServerLevel) level()).sendParticlesSource(((ServerLevel) level()).players(), null, ParticleTypes.HAPPY_VILLAGER,
|
||||
+ false, true,
|
||||
+ getX() + random.nextFloat(), getY() + (random.nextFloat() * 1.5), getZ() + random.nextFloat(), 1,
|
||||
+ random.nextGaussian() * 0.05D, random.nextGaussian() * 0.05D, random.nextGaussian() * 0.05D, 0);
|
||||
+ }
|
||||
+ return InteractionResult.SUCCESS_SERVER;
|
||||
+ // Purpur end - Configurable chance for wolves to spawn rabid
|
||||
}
|
||||
|
||||
return super.mobInteract(player, hand);
|
||||
}
|
||||
|
||||
private void tryToTame(final Player player) {
|
||||
- if (this.random.nextInt(3) == 0 && !org.bukkit.craftbukkit.event.CraftEventFactory.callEntityTameEvent(this, player).isCancelled()) { // CraftBukkit - added event call
|
||||
+ if (((this.level().purpurConfig.alwaysTameInCreative && player.hasInfiniteMaterials()) || this.random.nextInt(3) == 0) && !org.bukkit.craftbukkit.event.CraftEventFactory.callEntityTameEvent(this, player).isCancelled()) { // CraftBukkit - added event call // Purpur - Config to always tame in Creative
|
||||
this.tame(player);
|
||||
this.navigation.stop();
|
||||
this.setTarget(null);
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/boss/enderdragon/EndCrystal.java
|
||||
+++ b/net/minecraft/world/entity/boss/enderdragon/EndCrystal.java
|
||||
@@ -39,6 +_,24 @@
|
||||
@@ -40,6 +_,24 @@
|
||||
this.setPos(x, y, z);
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
@Override
|
||||
protected Entity.MovementEmission getMovementEmission() {
|
||||
return Entity.MovementEmission.NONE;
|
||||
@@ -75,6 +_,8 @@
|
||||
@@ -76,6 +_,8 @@
|
||||
}
|
||||
}
|
||||
// Paper end - Fix invulnerable end crystals
|
||||
@@ -34,7 +34,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -118,15 +_,17 @@
|
||||
@@ -119,15 +_,17 @@
|
||||
}
|
||||
// CraftBukkit end
|
||||
if (!source.is(DamageTypeTags.IS_EXPLOSION)) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java
|
||||
+++ b/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java
|
||||
@@ -960,6 +_,7 @@
|
||||
@@ -964,6 +_,7 @@
|
||||
|
||||
@Override
|
||||
protected boolean canRide(final Entity vehicle) {
|
||||
@@ -8,7 +8,7 @@
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -995,7 +_,7 @@
|
||||
@@ -999,7 +_,7 @@
|
||||
boolean shouldDrop = level.getGameRules().get(GameRules.MOB_DROPS);
|
||||
int xpCount = 500;
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/decoration/ArmorStand.java
|
||||
+++ b/net/minecraft/world/entity/decoration/ArmorStand.java
|
||||
@@ -94,10 +_,13 @@
|
||||
@@ -95,10 +_,13 @@
|
||||
public boolean canTickSetByAPI = false;
|
||||
private boolean noTickEquipmentDirty = false;
|
||||
// Paper end - Allow ArmorStands not to tick
|
||||
@@ -14,7 +14,7 @@
|
||||
}
|
||||
|
||||
public ArmorStand(final Level level, final double x, final double y, final double z) {
|
||||
@@ -546,6 +_,7 @@
|
||||
@@ -547,6 +_,7 @@
|
||||
// Paper start - Allow ArmorStands not to tick
|
||||
@Override
|
||||
public void tick() {
|
||||
@@ -22,7 +22,7 @@
|
||||
if (!this.canTick) {
|
||||
if (this.noTickEquipmentDirty) {
|
||||
this.noTickEquipmentDirty = false;
|
||||
@@ -832,4 +_,19 @@
|
||||
@@ -833,4 +_,19 @@
|
||||
}
|
||||
}
|
||||
// Paper end
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/item/ItemEntity.java
|
||||
+++ b/net/minecraft/world/entity/item/ItemEntity.java
|
||||
@@ -54,6 +_,12 @@
|
||||
@@ -55,6 +_,12 @@
|
||||
public boolean canMobPickup = true; // Paper - Item#canEntityPickup
|
||||
private int despawnRate = -1; // Paper - Alternative item-despawn-rate
|
||||
public net.kyori.adventure.util.TriState frictionState = net.kyori.adventure.util.TriState.NOT_SET; // Paper - Friction API
|
||||
@@ -13,7 +13,7 @@
|
||||
|
||||
public ItemEntity(final EntityType<? extends ItemEntity> type, final Level level) {
|
||||
super(type, level);
|
||||
@@ -339,7 +_,16 @@
|
||||
@@ -341,7 +_,16 @@
|
||||
|
||||
@Override
|
||||
public final boolean hurtServer(final ServerLevel level, final DamageSource source, final float damage) {
|
||||
@@ -31,7 +31,7 @@
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -521,6 +_,12 @@
|
||||
@@ -523,6 +_,12 @@
|
||||
public void setItem(final ItemStack itemStack) {
|
||||
this.getEntityData().set(DATA_ITEM, itemStack);
|
||||
this.despawnRate = this.level().paperConfig().entities.spawning.altItemDespawnRate.enabled ? this.level().paperConfig().entities.spawning.altItemDespawnRate.items.getOrDefault(itemStack.getItem(), this.level().spigotConfig.itemDespawnRate) : this.level().spigotConfig.itemDespawnRate; // Paper - Alternative item-despawn-rate
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/item/PrimedTnt.java
|
||||
+++ b/net/minecraft/world/entity/item/PrimedTnt.java
|
||||
@@ -237,4 +_,32 @@
|
||||
@@ -244,4 +_,32 @@
|
||||
return !this.level().paperConfig().fixes.preventTntFromMovingInWater && super.isPushedByFluid();
|
||||
}
|
||||
// Paper end - Option to prevent TNT from moving in water
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/monster/Guardian.java
|
||||
+++ b/net/minecraft/world/entity/monster/Guardian.java
|
||||
@@ -310,6 +_,11 @@
|
||||
@@ -307,6 +_,11 @@
|
||||
final BlockPos pos,
|
||||
final RandomSource random
|
||||
) {
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
--- a/net/minecraft/world/entity/monster/MagmaCube.java
|
||||
+++ b/net/minecraft/world/entity/monster/MagmaCube.java
|
||||
@@ -31,6 +_,11 @@
|
||||
public static boolean checkMagmaCubeSpawnRules(
|
||||
final EntityType<MagmaCube> type, final LevelAccessor level, final EntitySpawnReason spawnReason, final BlockPos pos, final RandomSource random
|
||||
) {
|
||||
+ // Purpur start - Config to disable hostile mob spawn on ice
|
||||
+ if (net.minecraft.world.entity.monster.Monster.canSpawnInBlueAndPackedIce(level, pos)) {
|
||||
+ return false;
|
||||
+ }
|
||||
+ // Purpur end - Config to disable hostile mob spawn on ice
|
||||
return level.getDifficulty() != Difficulty.PEACEFUL;
|
||||
}
|
||||
|
||||
@@ -1,39 +0,0 @@
|
||||
--- a/net/minecraft/world/entity/monster/Monster.java
|
||||
+++ b/net/minecraft/world/entity/monster/Monster.java
|
||||
@@ -84,6 +_,11 @@
|
||||
}
|
||||
|
||||
public static boolean isDarkEnoughToSpawn(final ServerLevelAccessor level, final BlockPos pos, final RandomSource random) {
|
||||
+ // Purpur start - Config to disable hostile mob spawn on ice
|
||||
+ if (canSpawnInBlueAndPackedIce(level, pos)) {
|
||||
+ return false;
|
||||
+ }
|
||||
+ // Purpur end - Config to disable hostile mob spawn on ice
|
||||
if (level.getBrightness(LightLayer.SKY, pos) > random.nextInt(32)) {
|
||||
return false;
|
||||
}
|
||||
@@ -113,6 +_,11 @@
|
||||
public static boolean checkAnyLightMonsterSpawnRules(
|
||||
final EntityType<? extends Monster> type, final LevelAccessor level, final EntitySpawnReason spawnReason, final BlockPos pos, final RandomSource random
|
||||
) {
|
||||
+ // Purpur start - Config to disable hostile mob spawn on ice
|
||||
+ if (canSpawnInBlueAndPackedIce(level, pos)) {
|
||||
+ return false;
|
||||
+ }
|
||||
+ // Purpur end - Config to disable hostile mob spawn on ice
|
||||
return level.getDifficulty() != Difficulty.PEACEFUL && checkMobSpawnRules(type, level, spawnReason, pos, random);
|
||||
}
|
||||
|
||||
@@ -154,4 +_,12 @@
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
}
|
||||
+
|
||||
+ // Purpur start - Config to disable hostile mob spawn on ice
|
||||
+ public static boolean canSpawnInBlueAndPackedIce(LevelAccessor level, BlockPos pos) {
|
||||
+ net.minecraft.world.level.block.state.BlockState spawnBlock = level.getBlockState(pos.below());
|
||||
+
|
||||
+ return (!level.getMinecraftWorld().purpurConfig.mobsSpawnOnPackedIce && spawnBlock.is(net.minecraft.world.level.block.Blocks.PACKED_ICE)) || (!level.getMinecraftWorld().purpurConfig.mobsSpawnOnBlueIce && spawnBlock.is(net.minecraft.world.level.block.Blocks.BLUE_ICE));
|
||||
+ }
|
||||
+ // Purpur end - Config to disable hostile mob spawn on ice
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/monster/Ravager.java
|
||||
+++ b/net/minecraft/world/entity/monster/Ravager.java
|
||||
@@ -74,6 +_,7 @@
|
||||
@@ -75,6 +_,7 @@
|
||||
protected void registerGoals() {
|
||||
super.registerGoals();
|
||||
this.goalSelector.addGoal(0, new FloatGoal(this));
|
||||
@@ -8,7 +8,7 @@
|
||||
this.goalSelector.addGoal(4, new MeleeAttackGoal(this, 1.0, true));
|
||||
this.goalSelector.addGoal(5, new WaterAvoidingRandomStrollGoal(this, 0.4));
|
||||
this.goalSelector.addGoal(6, new LookAtPlayerGoal(this, Player.class, 6.0F));
|
||||
@@ -152,7 +_,7 @@
|
||||
@@ -153,7 +_,7 @@
|
||||
)) {
|
||||
BlockState state = serverLevel.getBlockState(pos);
|
||||
Block block = state.getBlock();
|
||||
|
||||
@@ -1,60 +1,11 @@
|
||||
--- a/net/minecraft/world/entity/monster/Shulker.java
|
||||
+++ b/net/minecraft/world/entity/monster/Shulker.java
|
||||
@@ -93,6 +_,22 @@
|
||||
this.lookControl = new Shulker.ShulkerLookControl(this);
|
||||
}
|
||||
|
||||
+ // Purpur start - Shulker change color with dye
|
||||
+ @Override
|
||||
+ protected net.minecraft.world.InteractionResult mobInteract(Player player, net.minecraft.world.InteractionHand hand) {
|
||||
+ net.minecraft.world.item.ItemStack itemstack = player.getItemInHand(hand);
|
||||
+ DyeColor dyeColor = itemstack.get(DataComponents.DYE);
|
||||
+ if (player.level().purpurConfig.shulkerChangeColorWithDye && dyeColor != null && dyeColor != this.getColor()) {
|
||||
+ this.setVariant(Optional.of(dyeColor));
|
||||
+ if (!player.getAbilities().instabuild) {
|
||||
+ itemstack.shrink(1);
|
||||
+ }
|
||||
+ return net.minecraft.world.InteractionResult.SUCCESS;
|
||||
+ }
|
||||
+ return super.mobInteract(player, hand);
|
||||
+ }
|
||||
+ // Purpur end - Shulker change color with dye
|
||||
+
|
||||
@Override
|
||||
protected void registerGoals() {
|
||||
this.goalSelector.addGoal(1, new LookAtPlayerGoal(this, Player.class, 8.0F, 0.02F, true));
|
||||
@@ -454,11 +_,21 @@
|
||||
private void hitByShulkerBullet() {
|
||||
Vec3 oldPosition = this.position();
|
||||
AABB oldAabb = this.getBoundingBox();
|
||||
- if (!this.isClosed() && this.teleportSomewhere()) {
|
||||
- int shulkerCount = this.level().getEntities(EntityType.SHULKER, oldAabb.inflate(8.0), Entity::isAlive).size();
|
||||
- float failureChance = (shulkerCount - 1) / 5.0F;
|
||||
- if (!(this.level().getRandom().nextFloat() < failureChance)) {
|
||||
+ // Purpur start - Shulker spawn from bullet options
|
||||
+ if ((!this.level().purpurConfig.shulkerSpawnFromBulletRequireOpenLid || !this.isClosed()) && this.teleportSomewhere()) {
|
||||
+ float failureChance = this.level().purpurConfig.shulkerSpawnFromBulletBaseChance;
|
||||
+ if (!this.level().purpurConfig.shulkerSpawnFromBulletNearbyEquation.isBlank()) {
|
||||
+ int shulkerCount = this.level().getEntities((net.minecraft.world.level.entity.EntityTypeTest) EntityType.SHULKER, oldAabb.inflate(this.level().purpurConfig.shulkerSpawnFromBulletNearbyRange), Entity::isAlive).size();
|
||||
+ try {
|
||||
+ failureChance -= ((Number) scriptEngine.eval("let nearby = " + shulkerCount + "; " + this.level().purpurConfig.shulkerSpawnFromBulletNearbyEquation)).floatValue();
|
||||
+ } catch (javax.script.ScriptException e) {
|
||||
+ e.printStackTrace();
|
||||
+ failureChance -= (shulkerCount - 1) / 5.0F;
|
||||
+ }
|
||||
+ }
|
||||
+ if (this.level().getRandom().nextFloat() <= failureChance) {
|
||||
Shulker baby = EntityType.SHULKER.create(this.level(), EntitySpawnReason.BREEDING);
|
||||
+ // Purpur end - Shulker spawn from bullet options
|
||||
if (baby != null) {
|
||||
baby.setVariant(this.getVariant());
|
||||
baby.snapTo(oldPosition);
|
||||
@@ -565,7 +_,7 @@
|
||||
}
|
||||
|
||||
public Optional<DyeColor> getVariant() {
|
||||
- return Optional.ofNullable(this.getColor());
|
||||
+ return Optional.ofNullable(this.level().purpurConfig.shulkerSpawnFromBulletRandomColor ? DyeColor.random(this.level().getRandom()) : this.getColor()); // Purpur - Shulker spawn from bullet options
|
||||
}
|
||||
|
||||
public @Nullable DyeColor getColor() {
|
||||
@@ -80,7 +_,7 @@
|
||||
private static final byte DEFAULT_PEEK = 0;
|
||||
private static final Direction DEFAULT_ATTACH_FACE = Direction.DOWN;
|
||||
private static final Vector3fc FORWARD = Direction.SOUTH.getUnitVec3f();
|
||||
- public static final float MAX_SCALE = 3.0F;
|
||||
+ private static final float MAX_SCALE = 3.0F;
|
||||
private float currentPeekAmountO;
|
||||
private float currentPeekAmount;
|
||||
private @Nullable BlockPos clientOldAttachPosition;
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
--- a/net/minecraft/world/entity/monster/Slime.java
|
||||
+++ b/net/minecraft/world/entity/monster/Slime.java
|
||||
@@ -299,6 +_,11 @@
|
||||
public static boolean checkSlimeSpawnRules(
|
||||
final EntityType<Slime> type, final LevelAccessor level, final EntitySpawnReason spawnReason, final BlockPos pos, final RandomSource random
|
||||
) {
|
||||
+ // Purpur start - Config to disable hostile mob spawn on ice
|
||||
+ if (net.minecraft.world.entity.monster.Monster.canSpawnInBlueAndPackedIce(level, pos)) {
|
||||
+ return false;
|
||||
+ }
|
||||
+ // Purpur end - Config to disable hostile mob spawn on ice
|
||||
if (level.getDifficulty() != Difficulty.PEACEFUL) {
|
||||
if (EntitySpawnReason.isSpawner(spawnReason)) {
|
||||
return checkMobSpawnRules(type, level, spawnReason, pos, random);
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/monster/Strider.java
|
||||
+++ b/net/minecraft/world/entity/monster/Strider.java
|
||||
@@ -400,6 +_,18 @@
|
||||
@@ -411,6 +_,18 @@
|
||||
@Override
|
||||
public InteractionResult mobInteract(final Player player, final InteractionHand hand) {
|
||||
boolean hasFood = this.isFood(player.getItemInHand(hand));
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/monster/hoglin/Hoglin.java
|
||||
+++ b/net/minecraft/world/entity/monster/hoglin/Hoglin.java
|
||||
@@ -173,6 +_,11 @@
|
||||
@@ -186,6 +_,11 @@
|
||||
public static boolean checkHoglinSpawnRules(
|
||||
final EntityType<Hoglin> type, final LevelAccessor level, final EntitySpawnReason spawnReason, final BlockPos pos, final RandomSource random
|
||||
) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/monster/piglin/Piglin.java
|
||||
+++ b/net/minecraft/world/entity/monster/piglin/Piglin.java
|
||||
@@ -181,6 +_,11 @@
|
||||
@@ -182,6 +_,11 @@
|
||||
public static boolean checkPiglinSpawnRules(
|
||||
final EntityType<Piglin> type, final LevelAccessor level, final EntitySpawnReason spawnReason, final BlockPos pos, final RandomSource random
|
||||
) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/monster/piglin/PiglinAi.java
|
||||
+++ b/net/minecraft/world/entity/monster/piglin/PiglinAi.java
|
||||
@@ -666,14 +_,24 @@
|
||||
@@ -664,14 +_,24 @@
|
||||
}
|
||||
|
||||
public static boolean isWearingSafeArmor(final LivingEntity livingEntity) {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
--- a/net/minecraft/world/entity/monster/skeleton/Skeleton.java
|
||||
+++ b/net/minecraft/world/entity/monster/skeleton/Skeleton.java
|
||||
@@ -130,4 +_,64 @@
|
||||
SoundEvent getStepSound() {
|
||||
@@ -131,4 +_,64 @@
|
||||
protected SoundEvent getStepSound() {
|
||||
return SoundEvents.SKELETON_STEP;
|
||||
}
|
||||
+
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/monster/zombie/Drowned.java
|
||||
+++ b/net/minecraft/world/entity/monster/zombie/Drowned.java
|
||||
@@ -93,10 +_,23 @@
|
||||
@@ -94,10 +_,23 @@
|
||||
this.goalSelector.addGoal(2, new Drowned.DrownedAttackGoal(this, 1.0, false));
|
||||
this.goalSelector.addGoal(5, new Drowned.DrownedGoToBeachGoal(this, 1.0));
|
||||
this.goalSelector.addGoal(6, new Drowned.DrownedSwimUpGoal(this, 1.0, this.level().getSeaLevel()));
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/monster/zombie/Zombie.java
|
||||
+++ b/net/minecraft/world/entity/monster/zombie/Zombie.java
|
||||
@@ -127,7 +_,19 @@
|
||||
@@ -128,7 +_,19 @@
|
||||
this.goalSelector.addGoal(7, new WaterAvoidingRandomStrollGoal(this, 1.0));
|
||||
this.targetSelector.addGoal(1, new HurtByTargetGoal(this).setAlertOthers(ZombifiedPiglin.class));
|
||||
this.targetSelector.addGoal(2, new NearestAttackableTargetGoal<>(this, Player.class, true));
|
||||
@@ -21,7 +21,7 @@
|
||||
this.targetSelector.addGoal(3, new NearestAttackableTargetGoal<>(this, IronGolem.class, true));
|
||||
this.targetSelector.addGoal(5, new NearestAttackableTargetGoal<>(this, Turtle.class, 10, true, false, Turtle.BABY_ON_LAND_SELECTOR));
|
||||
}
|
||||
@@ -540,7 +_,7 @@
|
||||
@@ -542,7 +_,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/monster/zombie/ZombieVillager.java
|
||||
+++ b/net/minecraft/world/entity/monster/zombie/ZombieVillager.java
|
||||
@@ -170,10 +_,10 @@
|
||||
@@ -166,10 +_,10 @@
|
||||
public InteractionResult mobInteract(final Player player, final InteractionHand hand) {
|
||||
ItemStack itemStack = player.getItemInHand(hand);
|
||||
if (itemStack.is(Items.GOLDEN_APPLE)) {
|
||||
|
||||
@@ -7,10 +7,10 @@
|
||||
+ private boolean isLobotomized = false; public boolean isLobotomized() { return this.isLobotomized; } // Purpur - Lobotomize stuck villagers
|
||||
+ private int notLobotomizedCount = 0; // Purpur - Lobotomize stuck villagers
|
||||
|
||||
public Villager(final EntityType<? extends Villager> type, final Level level) {
|
||||
this(type, level, VillagerType.PLAINS);
|
||||
@@ -199,6 +_,57 @@
|
||||
this.setVillagerData(this.getVillagerData().withType(type).withProfession(level.registryAccess(), VillagerProfession.NONE));
|
||||
public Villager(final EntityType<? extends Villager> entityType, final Level level) {
|
||||
super(entityType, level);
|
||||
@@ -190,6 +_,57 @@
|
||||
this.setCanPickUpLoot(true);
|
||||
}
|
||||
|
||||
+ // Purpur start - Allow leashing villagers
|
||||
@@ -66,8 +66,8 @@
|
||||
+
|
||||
@Override
|
||||
public Brain<Villager> getBrain() {
|
||||
return (Brain<Villager>) super.getBrain();
|
||||
@@ -268,11 +_,22 @@
|
||||
return (Brain<Villager>)super.getBrain();
|
||||
@@ -259,11 +_,22 @@
|
||||
// Paper start - EAR 2
|
||||
this.customServerAiStep(level, false);
|
||||
}
|
||||
@@ -92,7 +92,7 @@
|
||||
profiler.pop();
|
||||
if (this.assignProfessionWhenSpawned) {
|
||||
this.assignProfessionWhenSpawned = false;
|
||||
@@ -347,6 +_,7 @@
|
||||
@@ -338,6 +_,7 @@
|
||||
return InteractionResult.CONSUME;
|
||||
}
|
||||
|
||||
@@ -100,7 +100,7 @@
|
||||
this.startTrading(player);
|
||||
}
|
||||
|
||||
@@ -487,7 +_,7 @@
|
||||
@@ -478,7 +_,7 @@
|
||||
|
||||
public void updateDemand() {
|
||||
for (MerchantOffer offer : this.getOffers()) {
|
||||
@@ -109,7 +109,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -687,7 +_,7 @@
|
||||
@@ -688,7 +_,7 @@
|
||||
|
||||
@Override
|
||||
public boolean canBreed() {
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
--- a/net/minecraft/world/entity/npc/wanderingtrader/WanderingTraderSpawner.java
|
||||
+++ b/net/minecraft/world/entity/npc/wanderingtrader/WanderingTraderSpawner.java
|
||||
@@ -135,7 +_,17 @@
|
||||
int xPosition = referencePosition.getX() + this.random.nextInt(radius * 2) - radius;
|
||||
int zPosition = referencePosition.getZ() + this.random.nextInt(radius * 2) - radius;
|
||||
int yPosition = level.getHeight(SpawnPlacements.getHeightmapType(EntityType.WANDERING_TRADER), xPosition, zPosition);
|
||||
- BlockPos spawnPos = new BlockPos(xPosition, yPosition, zPosition);
|
||||
+ // Purpur start - Allow toggling special MobSpawners per world - allow traders to spawn below nether roof
|
||||
+ BlockPos.MutableBlockPos spawnPos = new BlockPos.MutableBlockPos(xPosition, yPosition, zPosition);
|
||||
+ if (level.dimensionType().hasCeiling()) {
|
||||
+ do {
|
||||
+ spawnPos.relative(net.minecraft.core.Direction.DOWN);
|
||||
+ } while (!level.getBlockState(spawnPos).isAir());
|
||||
+ do {
|
||||
+ spawnPos.relative(net.minecraft.core.Direction.DOWN);
|
||||
+ } while (level.getBlockState(spawnPos).isAir() && spawnPos.getY() > 0);
|
||||
+ }
|
||||
+ // Purpur end - Allow toggling special MobSpawners per world
|
||||
if (wanderingTraderSpawnType.isSpawnPositionOk(level, spawnPos, EntityType.WANDERING_TRADER)) {
|
||||
spawnPosition = spawnPos;
|
||||
break;
|
||||
@@ -1,111 +1,11 @@
|
||||
--- a/net/minecraft/world/entity/player/Player.java
|
||||
+++ b/net/minecraft/world/entity/player/Player.java
|
||||
@@ -173,11 +_,20 @@
|
||||
public float hurtDir;
|
||||
public boolean affectsSpawning = true; // Paper - Affects Spawning API
|
||||
public net.kyori.adventure.util.TriState flyingFallDamage = net.kyori.adventure.util.TriState.NOT_SET; // Paper - flying fall damage
|
||||
+ public int burpDelay = 0; // Purpur - Burp delay
|
||||
+ public boolean canPortalInstant = false; // Purpur - Add portal permission bypass
|
||||
|
||||
// CraftBukkit start
|
||||
public boolean fauxSleeping;
|
||||
public int oldLevel = -1;
|
||||
|
||||
+ // Purpur start - AFK API
|
||||
+ public abstract void setAfk(boolean afk);
|
||||
+
|
||||
+ public boolean isAfk() {
|
||||
+ return false;
|
||||
+ }
|
||||
+ // Purpur end - AFK API
|
||||
@Override
|
||||
public org.bukkit.craftbukkit.entity.CraftHumanEntity getBukkitEntity() {
|
||||
return (org.bukkit.craftbukkit.entity.CraftHumanEntity) super.getBukkitEntity();
|
||||
@@ -242,6 +_,12 @@
|
||||
|
||||
@Override
|
||||
public void tick() {
|
||||
+ // Purpur start - Burp delay
|
||||
+ if (this.burpDelay > 0 && --this.burpDelay == 0) {
|
||||
+ this.level().playSound(null, getX(), getY(), getZ(), SoundEvents.PLAYER_BURP, SoundSource.PLAYERS, 1.0F, this.level().getRandom().nextFloat() * 0.1F + 0.9F);
|
||||
+ }
|
||||
+ // Purpur end - Burp delay
|
||||
+
|
||||
this.noPhysics = this.isSpectator();
|
||||
if (this.isSpectator() || this.isPassenger()) {
|
||||
this.setOnGround(false);
|
||||
@@ -299,6 +_,17 @@
|
||||
this.turtleHelmetTick();
|
||||
}
|
||||
|
||||
+ // Purpur start - Full netherite armor grants fire resistance
|
||||
+ if (this.level().purpurConfig.playerNetheriteFireResistanceDuration > 0 && this.level().getGameTime() % 20 == 0) {
|
||||
+ if (this.getItemBySlot(EquipmentSlot.HEAD).is(Items.NETHERITE_HELMET)
|
||||
+ && this.getItemBySlot(EquipmentSlot.CHEST).is(Items.NETHERITE_CHESTPLATE)
|
||||
+ && this.getItemBySlot(EquipmentSlot.LEGS).is(Items.NETHERITE_LEGGINGS)
|
||||
+ && this.getItemBySlot(EquipmentSlot.FEET).is(Items.NETHERITE_BOOTS)) {
|
||||
+ this.addEffect(new MobEffectInstance(MobEffects.FIRE_RESISTANCE, this.level().purpurConfig.playerNetheriteFireResistanceDuration, this.level().purpurConfig.playerNetheriteFireResistanceAmplifier, this.level().purpurConfig.playerNetheriteFireResistanceAmbient, this.level().purpurConfig.playerNetheriteFireResistanceShowParticles, this.level().purpurConfig.playerNetheriteFireResistanceShowIcon), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.NETHERITE_ARMOR);
|
||||
+ }
|
||||
+ }
|
||||
+ // Purpur end - Full netherite armor grants fire resistance
|
||||
+
|
||||
this.cooldowns.tick();
|
||||
this.updatePlayerPose();
|
||||
}
|
||||
@@ -504,7 +_,7 @@
|
||||
List<Entity> orbs = Lists.newArrayList();
|
||||
|
||||
for (Entity entity : entities) {
|
||||
- if (entity.is(EntityType.EXPERIENCE_ORB)) {
|
||||
+ if (entity.is(EntityType.EXPERIENCE_ORB) && entity.level().purpurConfig.playerExpPickupDelay >= 0) { // Purpur - Configurable player pickup exp delay
|
||||
orbs.add(entity);
|
||||
} else if (!entity.isRemoved()) {
|
||||
this.touch(entity);
|
||||
@@ -1052,7 +_,7 @@
|
||||
criticalAttack = criticalAttack && !this.level().paperConfig().entities.behavior.disablePlayerCrits; // Paper - Toggleable player crits
|
||||
if (criticalAttack) {
|
||||
damageSource = damageSource.critical(); // Paper - critical damage API
|
||||
- baseDamage *= 1.5F;
|
||||
+ baseDamage *= (float) this.level().purpurConfig.playerCriticalDamageMultiplier; // Purpur - Add config change multiplier critical damage value
|
||||
}
|
||||
|
||||
float totalDamage = baseDamage + magicBoost;
|
||||
@@ -1748,7 +_,23 @@
|
||||
|
||||
@Override
|
||||
protected int getBaseExperienceReward(final ServerLevel level) {
|
||||
- return !level.getGameRules().get(GameRules.KEEP_INVENTORY) && !this.isSpectator() ? Math.min(this.experienceLevel * 7, 100) : 0;
|
||||
+ // Purpur start - Add player death exp control options
|
||||
+ if (!level.getGameRules().get(GameRules.KEEP_INVENTORY) && !this.isSpectator()) {
|
||||
+ int toDrop;
|
||||
+ try {
|
||||
+ toDrop = Math.round(((Number) scriptEngine.eval("let expLevel = " + experienceLevel + "; " +
|
||||
+ "let expTotal = " + totalExperience + "; " +
|
||||
+ "let exp = " + experienceProgress + "; " +
|
||||
+ level().purpurConfig.playerDeathExpDropEquation)).floatValue());
|
||||
+ } catch (javax.script.ScriptException e) {
|
||||
+ e.printStackTrace();
|
||||
+ toDrop = experienceLevel * 7;
|
||||
+ }
|
||||
+ return Math.min(toDrop, level().purpurConfig.playerDeathExpDropMax);
|
||||
+ } else {
|
||||
+ return 0;
|
||||
+ }
|
||||
+ // Purpur end - Add player death exp control options
|
||||
@@ -1529,7 +_,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1791,6 +_,13 @@
|
||||
public boolean addItem(final ItemStack itemStack) {
|
||||
return this.inventory.add(itemStack);
|
||||
- public boolean canGlide() {
|
||||
+ protected boolean canGlide() {
|
||||
return !this.abilities.flying && super.canGlide();
|
||||
}
|
||||
+
|
||||
+ // Purpur start - Player ridable in water option
|
||||
+ @Override
|
||||
+ public boolean dismountsUnderwater() {
|
||||
+ return !level().purpurConfig.playerRidableInWater;
|
||||
+ }
|
||||
+ // Purpur end - Player ridable in water option
|
||||
|
||||
public abstract @Nullable GameType gameMode();
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/projectile/arrow/AbstractArrow.java
|
||||
+++ b/net/minecraft/world/entity/projectile/arrow/AbstractArrow.java
|
||||
@@ -78,6 +_,7 @@
|
||||
@@ -79,6 +_,7 @@
|
||||
private @Nullable List<Entity> piercedAndKilledEntities;
|
||||
public ItemStack pickupItemStack = this.getDefaultPickupItem();
|
||||
public @Nullable ItemStack firedFromWeapon = null;
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
protected AbstractArrow(final EntityType<? extends AbstractArrow> type, final Level level) {
|
||||
super(type, level);
|
||||
@@ -605,6 +_,12 @@
|
||||
@@ -611,6 +_,12 @@
|
||||
public @Nullable ItemStack getWeaponItem() {
|
||||
return this.firedFromWeapon;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/projectile/arrow/ThrownTrident.java
|
||||
+++ b/net/minecraft/world/entity/projectile/arrow/ThrownTrident.java
|
||||
@@ -72,7 +_,7 @@
|
||||
@@ -73,7 +_,7 @@
|
||||
|
||||
Entity currentOwner = this.getOwner();
|
||||
int loyalty = this.entityData.get(ID_LOYALTY);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/projectile/hurtingprojectile/WitherSkull.java
|
||||
+++ b/net/minecraft/world/entity/projectile/hurtingprojectile/WitherSkull.java
|
||||
@@ -94,7 +_,7 @@
|
||||
@@ -95,7 +_,7 @@
|
||||
super.onHit(hitResult);
|
||||
if (!this.level().isClientSide()) {
|
||||
// CraftBukkit start
|
||||
@@ -9,7 +9,7 @@
|
||||
if (event.callEvent()) {
|
||||
this.level().explode(this, this.getX(), this.getY(), this.getZ(), event.getRadius(), event.getFire(), Level.ExplosionInteraction.MOB);
|
||||
}
|
||||
@@ -102,6 +_,13 @@
|
||||
@@ -103,6 +_,13 @@
|
||||
this.discard(org.bukkit.event.entity.EntityRemoveEvent.Cause.HIT); // CraftBukkit - add Bukkit remove cause
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/projectile/throwableitemprojectile/Snowball.java
|
||||
+++ b/net/minecraft/world/entity/projectile/throwableitemprojectile/Snowball.java
|
||||
@@ -54,9 +_,39 @@
|
||||
@@ -55,9 +_,39 @@
|
||||
protected void onHitEntity(final EntityHitResult hitResult) {
|
||||
super.onHitEntity(hitResult);
|
||||
Entity entity = hitResult.getEntity();
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
--- a/net/minecraft/world/entity/projectile/throwableitemprojectile/ThrownEnderpearl.java
|
||||
+++ b/net/minecraft/world/entity/projectile/throwableitemprojectile/ThrownEnderpearl.java
|
||||
@@ -113,9 +_,10 @@
|
||||
return;
|
||||
}
|
||||
// CraftBukkit end
|
||||
- if (this.random.nextFloat() < 0.05F && level.isSpawningMonsters()) {
|
||||
+ if (this.random.nextFloat() < level.purpurConfig.enderPearlEndermiteChance && level.isSpawningMonsters()) { // Purpur - Configurable Ender Pearl RNG
|
||||
Endermite endermite = EntityType.ENDERMITE.create(level, EntitySpawnReason.TRIGGERED);
|
||||
if (endermite != null) {
|
||||
+ endermite.setPlayerSpawned(true); // Purpur - Add back player spawned endermite API
|
||||
endermite.snapTo(preTeleportX, preTeleportY, preTeleportZ, preTeleportYRot, preTeleportXRot); // Paper - spawn endermite at pre teleport position as teleport has been moved up
|
||||
level.addFreshEntity(endermite, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.ENDER_PEARL); // Paper - add reason
|
||||
}
|
||||
@@ -135,7 +_,7 @@
|
||||
if (newOwner != null) {
|
||||
newOwner.resetFallDistance();
|
||||
newOwner.resetCurrentImpulseContext();
|
||||
- newOwner.hurtServer(player.level(), this.damageSources().enderPearl().eventEntityDamager(this), 5.0F); // CraftBukkit // Paper - fix DamageSource API
|
||||
+ newOwner.hurtServer(player.level(), this.damageSources().enderPearl().eventEntityDamager(this), this.level().purpurConfig.enderPearlDamage); // CraftBukkit // Paper - fix DamageSource API // Purpur - Configurable Ender Pearl damage
|
||||
}
|
||||
|
||||
this.playSound(level, teleportPos);
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/vehicle/minecart/NewMinecartBehavior.java
|
||||
+++ b/net/minecraft/world/entity/vehicle/minecart/NewMinecartBehavior.java
|
||||
@@ -394,7 +_,7 @@
|
||||
@@ -396,7 +_,7 @@
|
||||
private Vec3 calculateBoostTrackSpeed(final Vec3 deltaMovement, final BlockPos pos, final BlockState state) {
|
||||
if (state.is(Blocks.POWERED_RAIL) && state.getValue(PoweredRailBlock.POWERED)) {
|
||||
if (deltaMovement.length() > 0.01) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/inventory/AbstractFurnaceMenu.java
|
||||
+++ b/net/minecraft/world/inventory/AbstractFurnaceMenu.java
|
||||
@@ -121,7 +_,13 @@
|
||||
@@ -116,7 +_,13 @@
|
||||
} else if (slotIndex != 1 && slotIndex != 0) {
|
||||
if (this.canSmelt(stack)) {
|
||||
if (!this.moveItemStackTo(stack, 0, 1, false)) {
|
||||
|
||||
@@ -1,138 +0,0 @@
|
||||
--- a/net/minecraft/world/inventory/GrindstoneMenu.java
|
||||
+++ b/net/minecraft/world/inventory/GrindstoneMenu.java
|
||||
@@ -92,11 +_,13 @@
|
||||
@Override
|
||||
public void onTake(final Player player, final ItemStack carried) {
|
||||
access.execute((level, pos) -> {
|
||||
+ ItemStack itemstack = activeQuickItem == null ? carried : activeQuickItem; // Purpur - Grindstone API
|
||||
if (level instanceof ServerLevel) {
|
||||
// Paper start - Fire BlockExpEvent on grindstone use
|
||||
org.bukkit.event.block.BlockExpEvent event = new org.bukkit.event.block.BlockExpEvent(org.bukkit.craftbukkit.block.CraftBlock.at(level, pos), this.getExperienceAmount(level));
|
||||
event.callEvent();
|
||||
- ExperienceOrb.awardWithDirection((ServerLevel) level, Vec3.atCenterOf(pos), Vec3.ZERO, event.getExpToDrop(), org.bukkit.entity.ExperienceOrb.SpawnReason.GRINDSTONE, player, null);
|
||||
+ org.purpurmc.purpur.event.inventory.GrindstoneTakeResultEvent grindstoneTakeResultEvent = new org.purpurmc.purpur.event.inventory.GrindstoneTakeResultEvent(player.getBukkitEntity(), getBukkitView(), org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(itemstack), event.getExpToDrop()); grindstoneTakeResultEvent.callEvent(); // Purpur - Grindstone API
|
||||
+ ExperienceOrb.awardWithDirection((ServerLevel) level, Vec3.atCenterOf(pos), Vec3.ZERO, grindstoneTakeResultEvent.getExperienceAmount(), org.bukkit.entity.ExperienceOrb.SpawnReason.GRINDSTONE, player, null); // Purpur - Grindstone API
|
||||
// Paper end - Fire BlockExpEvent on grindstone use
|
||||
}
|
||||
|
||||
@@ -125,7 +_,7 @@
|
||||
for (Entry<Holder<Enchantment>> entry : enchantments.entrySet()) {
|
||||
Holder<Enchantment> enchant = entry.getKey();
|
||||
int lvl = entry.getIntValue();
|
||||
- if (!enchant.is(EnchantmentTags.CURSE)) {
|
||||
+ if (!org.purpurmc.purpur.PurpurConfig.grindstoneIgnoredEnchants.contains(enchant.value())) { // Purpur - Config for grindstones
|
||||
amount += enchant.value().getMinCost(lvl);
|
||||
}
|
||||
}
|
||||
@@ -205,16 +_,76 @@
|
||||
|
||||
for (Entry<Holder<Enchantment>> entry : enchantments.entrySet()) {
|
||||
Holder<Enchantment> enchant = entry.getKey();
|
||||
- if (!enchant.is(EnchantmentTags.CURSE) || newEnchantments.getLevel(enchant) == 0) {
|
||||
+ if (!org.purpurmc.purpur.PurpurConfig.grindstoneIgnoredEnchants.contains(enchant.value()) || newEnchantments.getLevel(enchant) == 0) { // Purpur - Config for grindstones
|
||||
newEnchantments.upgrade(enchant, entry.getIntValue());
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
+ // Purpur start - Config for grindstones
|
||||
+ private java.util.List<net.minecraft.core.component.DataComponentType<?>> GRINDSTONE_REMOVE_ATTRIBUTES_REMOVAL_LIST = java.util.List.of(
|
||||
+ // DataComponents.MAX_STACK_SIZE,
|
||||
+ // DataComponents.DAMAGE,
|
||||
+ // DataComponents.BLOCK_STATE,
|
||||
+ DataComponents.CUSTOM_DATA,
|
||||
+ // DataComponents.MAX_DAMAGE,
|
||||
+ // DataComponents.UNBREAKABLE,
|
||||
+ // DataComponents.CUSTOM_NAME,
|
||||
+ // DataComponents.ITEM_NAME,
|
||||
+ // DataComponents.LORE,
|
||||
+ // DataComponents.RARITY,
|
||||
+ // DataComponents.ENCHANTMENTS,
|
||||
+ // DataComponents.CAN_PLACE_ON,
|
||||
+ // DataComponents.CAN_BREAK,
|
||||
+ DataComponents.ATTRIBUTE_MODIFIERS,
|
||||
+ DataComponents.CUSTOM_MODEL_DATA,
|
||||
+ // DataComponents.HIDE_ADDITIONAL_TOOLTIP,
|
||||
+ // DataComponents.HIDE_TOOLTIP,
|
||||
+ // DataComponents.REPAIR_COST,
|
||||
+ // DataComponents.CREATIVE_SLOT_LOCK,
|
||||
+ // DataComponents.ENCHANTMENT_GLINT_OVERRIDE,
|
||||
+ // DataComponents.INTANGIBLE_PROJECTILE,
|
||||
+ // DataComponents.FOOD,
|
||||
+ // DataComponents.FIRE_RESISTANT,
|
||||
+ // DataComponents.TOOL,
|
||||
+ // DataComponents.STORED_ENCHANTMENTS,
|
||||
+ DataComponents.DYED_COLOR,
|
||||
+ // DataComponents.MAP_COLOR,
|
||||
+ // DataComponents.MAP_ID,
|
||||
+ // DataComponents.MAP_DECORATIONS,
|
||||
+ // DataComponents.MAP_POST_PROCESSING,
|
||||
+ // DataComponents.CHARGED_PROJECTILES,
|
||||
+ // DataComponents.BUNDLE_CONTENTS,
|
||||
+ // DataComponents.POTION_CONTENTS,
|
||||
+ DataComponents.SUSPICIOUS_STEW_EFFECTS
|
||||
+ // DataComponents.WRITABLE_BOOK_CONTENT,
|
||||
+ // DataComponents.WRITTEN_BOOK_CONTENT,
|
||||
+ // DataComponents.TRIM,
|
||||
+ // DataComponents.DEBUG_STICK_STATE,
|
||||
+ // DataComponents.ENTITY_DATA,
|
||||
+ // DataComponents.BUCKET_ENTITY_DATA,
|
||||
+ // DataComponents.BLOCK_ENTITY_DATA,
|
||||
+ // DataComponents.INSTRUMENT,
|
||||
+ // DataComponents.OMINOUS_BOTTLE_AMPLIFIER,
|
||||
+ // DataComponents.RECIPES,
|
||||
+ // DataComponents.LODESTONE_TRACKER,
|
||||
+ // DataComponents.FIREWORK_EXPLOSION,
|
||||
+ // DataComponents.FIREWORKS,
|
||||
+ // DataComponents.PROFILE,
|
||||
+ // DataComponents.NOTE_BLOCK_SOUND,
|
||||
+ // DataComponents.BANNER_PATTERNS,
|
||||
+ // DataComponents.BASE_COLOR,
|
||||
+ // DataComponents.POT_DECORATIONS,
|
||||
+ // DataComponents.CONTAINER,
|
||||
+ // DataComponents.BEES,
|
||||
+ // DataComponents.LOCK,
|
||||
+ // DataComponents.CONTAINER_LOOT,
|
||||
+ );
|
||||
+ // Purpur end - Config for grindstones
|
||||
private ItemStack removeNonCursesFrom(ItemStack item) {
|
||||
ItemEnchantments newEnchantments = EnchantmentHelper.updateEnchantments(
|
||||
- item, enchantments -> enchantments.removeIf(enchantment -> !enchantment.is(EnchantmentTags.CURSE))
|
||||
+ item, enchantments -> enchantments.removeIf(enchantment -> !org.purpurmc.purpur.PurpurConfig.grindstoneIgnoredEnchants.contains(enchantment.value())) // Purpur - Config for grindstones
|
||||
);
|
||||
if (item.is(Items.ENCHANTED_BOOK) && newEnchantments.isEmpty()) {
|
||||
item = item.transmuteCopy(Items.BOOK);
|
||||
@@ -227,6 +_,22 @@
|
||||
}
|
||||
|
||||
item.set(DataComponents.REPAIR_COST, repairCost);
|
||||
+
|
||||
+ // Purpur start - Config for grindstones
|
||||
+ net.minecraft.core.component.DataComponentPatch.Builder builder = net.minecraft.core.component.DataComponentPatch.builder();
|
||||
+ if (org.purpurmc.purpur.PurpurConfig.grindstoneRemoveAttributes) {
|
||||
+ item.getComponents().forEach(typedDataComponent -> {
|
||||
+ if (GRINDSTONE_REMOVE_ATTRIBUTES_REMOVAL_LIST.contains(typedDataComponent.type())) {
|
||||
+ builder.remove(typedDataComponent.type());
|
||||
+ }
|
||||
+ });
|
||||
+ }
|
||||
+ if (org.purpurmc.purpur.PurpurConfig.grindstoneRemoveDisplay) {
|
||||
+ builder.remove(DataComponents.CUSTOM_NAME);
|
||||
+ builder.remove(DataComponents.LORE);
|
||||
+ }
|
||||
+ item.applyComponents(builder.build());
|
||||
+ // Purpur end - Config for grindstones
|
||||
return item;
|
||||
}
|
||||
|
||||
@@ -283,7 +_,9 @@
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
+ this.activeQuickItem = clicked; // Purpur - Grindstone API
|
||||
slot.onTake(player, item);
|
||||
+ this.activeQuickItem = null; // Purpur - Grindstone API
|
||||
}
|
||||
|
||||
return clicked;
|
||||
@@ -20,7 +20,7 @@
|
||||
}
|
||||
// Paper end
|
||||
@@ -81,8 +_,15 @@
|
||||
CriteriaTriggers.ITEM_USED_ON_BLOCK.trigger((ServerPlayer)player, pos, itemInHand);
|
||||
CriteriaTriggers.ITEM_USED_ON_BLOCK.trigger(serverPlayer, pos, itemInHand);
|
||||
}
|
||||
|
||||
- level.setBlock(pos, newBlock.get(), Block.UPDATE_ALL_IMMEDIATE);
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
--- a/net/minecraft/world/item/BowItem.java
|
||||
+++ b/net/minecraft/world/item/BowItem.java
|
||||
@@ -28,6 +_,11 @@
|
||||
return false;
|
||||
} else {
|
||||
@@ -26,6 +_,11 @@
|
||||
public boolean releaseUsing(final ItemStack itemStack, final Level level, final LivingEntity entity, final int remainingTime) {
|
||||
if (entity instanceof Player player) {
|
||||
ItemStack projectile = player.getProjectile(itemStack);
|
||||
+ // Purpur start - Infinity bow settings
|
||||
+ if (level.purpurConfig.infinityWorksWithoutArrows && projectile.isEmpty() && net.minecraft.world.item.enchantment.EnchantmentHelper.getItemEnchantmentLevel(net.minecraft.world.item.enchantment.Enchantments.INFINITY, itemStack) > 0) {
|
||||
@@ -12,7 +12,7 @@
|
||||
if (projectile.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
@@ -40,7 +_,7 @@
|
||||
@@ -38,7 +_,7 @@
|
||||
|
||||
List<ItemStack> firedProjectiles = draw(itemStack, projectile, player);
|
||||
if (level instanceof ServerLevel serverLevel && !firedProjectiles.isEmpty()) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/item/BucketItem.java
|
||||
+++ b/net/minecraft/world/item/BucketItem.java
|
||||
@@ -152,7 +_,7 @@
|
||||
@@ -154,7 +_,7 @@
|
||||
return hitResult != null && this.emptyContents(user, level, hitResult.getBlockPos().relative(hitResult.getDirection()), null, direction, clicked, itemStack, hand); // CraftBukkit
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/item/DyeColor.java
|
||||
+++ b/net/minecraft/world/item/DyeColor.java
|
||||
@@ -154,4 +_,10 @@
|
||||
@@ -168,4 +_,10 @@
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/item/ItemStack.java
|
||||
+++ b/net/minecraft/world/item/ItemStack.java
|
||||
@@ -453,6 +_,7 @@
|
||||
@@ -452,6 +_,7 @@
|
||||
// revert back all captured blocks
|
||||
for (org.bukkit.block.BlockState blockstate : blocks) {
|
||||
((org.bukkit.craftbukkit.block.CraftBlockState) blockstate).revertPlace();
|
||||
@@ -8,7 +8,7 @@
|
||||
}
|
||||
|
||||
SignItem.openSign = null; // SPIGOT-6758 - Reset on early return
|
||||
@@ -476,6 +_,7 @@
|
||||
@@ -475,6 +_,7 @@
|
||||
if (!(block.getBlock() instanceof net.minecraft.world.level.block.BaseEntityBlock)) { // Containers get placed automatically
|
||||
block.onPlace(level, newPos, oldBlock, true, context);
|
||||
}
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
level.notifyAndUpdatePhysics(newPos, null, oldBlock, block, level.getBlockState(newPos), updateFlags, net.minecraft.world.level.block.Block.UPDATE_LIMIT); // send null chunk as chunk.k() returns false by this point
|
||||
}
|
||||
@@ -591,6 +_,26 @@
|
||||
@@ -590,6 +_,26 @@
|
||||
return this.isDamageableItem() && this.getDamageValue() > 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
--- a/net/minecraft/world/item/Items.java
|
||||
+++ b/net/minecraft/world/item/Items.java
|
||||
@@ -396,7 +_,7 @@
|
||||
public static final Item PURPUR_BLOCK = registerBlock(Blocks.PURPUR_BLOCK);
|
||||
public static final Item PURPUR_PILLAR = registerBlock(Blocks.PURPUR_PILLAR);
|
||||
public static final Item PURPUR_STAIRS = registerBlock(Blocks.PURPUR_STAIRS);
|
||||
- public static final Item SPAWNER = registerBlock(Blocks.SPAWNER);
|
||||
+ public static final Item SPAWNER = registerBlock(Blocks.SPAWNER, org.purpurmc.purpur.item.SpawnerItem::new, new Item.Properties().rarity(Rarity.EPIC)); // Purpur - Silk touch spawners
|
||||
public static final Item CREAKING_HEART = registerBlock(Blocks.CREAKING_HEART);
|
||||
public static final Item CHEST = registerBlock(Blocks.CHEST, p -> p.component(DataComponents.CONTAINER, ItemContainerContents.EMPTY));
|
||||
public static final Item CRAFTING_TABLE = registerBlock(Blocks.CRAFTING_TABLE);
|
||||
@@ -2105,7 +_,7 @@
|
||||
"sweet_berries", createBlockItemWithCustomItemName(Blocks.SWEET_BERRY_BUSH), new Item.Properties().food(Foods.SWEET_BERRIES)
|
||||
);
|
||||
public static final Item GLOW_BERRIES = registerItem(
|
||||
- "glow_berries", createBlockItemWithCustomItemName(Blocks.CAVE_VINES), new Item.Properties().food(Foods.GLOW_BERRIES)
|
||||
+ "glow_berries", settings -> new org.purpurmc.purpur.item.GlowBerryItem(Blocks.CAVE_VINES, settings.useItemDescriptionPrefix()), new Item.Properties().food(Foods.GLOW_BERRIES) // Purpur - Eating glow berries adds glow effect
|
||||
);
|
||||
public static final Item CAMPFIRE = registerBlock(Blocks.CAMPFIRE, p -> p.component(DataComponents.CONTAINER, ItemContainerContents.EMPTY));
|
||||
public static final Item SOUL_CAMPFIRE = registerBlock(Blocks.SOUL_CAMPFIRE, p -> p.component(DataComponents.CONTAINER, ItemContainerContents.EMPTY));
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/item/SpawnEggItem.java
|
||||
+++ b/net/minecraft/world/item/SpawnEggItem.java
|
||||
@@ -64,6 +_,23 @@
|
||||
@@ -61,6 +_,23 @@
|
||||
return InteractionResult.FAIL;
|
||||
} else {
|
||||
if (level.paperConfig().entities.spawning.disableMobSpawnerSpawnEggTransformation) return InteractionResult.FAIL; // Paper - Allow disabling mob spawner spawn egg transformation
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/BaseSpawner.java
|
||||
+++ b/net/minecraft/world/level/BaseSpawner.java
|
||||
@@ -60,6 +_,7 @@
|
||||
@@ -66,6 +_,7 @@
|
||||
}
|
||||
|
||||
public boolean isNearPlayer(final Level level, final BlockPos pos) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/EntityGetter.java
|
||||
+++ b/net/minecraft/world/level/EntityGetter.java
|
||||
@@ -183,7 +_,7 @@
|
||||
@@ -142,7 +_,7 @@
|
||||
|
||||
default boolean hasNearbyAlivePlayer(final double x, final double y, final double z, final double range) {
|
||||
for (Player player : this.players()) {
|
||||
|
||||
@@ -55,7 +55,7 @@
|
||||
public CraftWorld getWorld() {
|
||||
return this.world;
|
||||
}
|
||||
@@ -852,6 +_,8 @@
|
||||
@@ -220,6 +_,8 @@
|
||||
final org.bukkit.NamespacedKey worldKey = CraftNamespacedKey.fromMinecraft(dimension.identifier()); // Paper
|
||||
this.spigotConfig = new org.spigotmc.SpigotWorldConfig(bukkitName, worldKey); // Spigot
|
||||
this.paperConfig = paperWorldConfigCreator.apply(this.spigotConfig); // Paper - create paper world config
|
||||
@@ -64,8 +64,8 @@
|
||||
this.generator = generator;
|
||||
this.world = new CraftWorld((ServerLevel) this, worldKey, biomeProvider, environment);
|
||||
|
||||
@@ -2197,4 +_,14 @@
|
||||
return this.moonrise$getEntityLookup().getEntityCount(); // Paper - rewrite chunk system
|
||||
@@ -1504,4 +_,14 @@
|
||||
return ret;
|
||||
}
|
||||
// Paper end - allow patching this logic
|
||||
+
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/NaturalSpawner.java
|
||||
+++ b/net/minecraft/world/level/NaturalSpawner.java
|
||||
@@ -289,7 +_,7 @@
|
||||
@@ -213,7 +_,7 @@
|
||||
pos.set(x, yStart, z);
|
||||
double xx = x + 0.5;
|
||||
double zz = z + 0.5;
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
--- a/net/minecraft/world/level/ServerExplosion.java
|
||||
+++ b/net/minecraft/world/level/ServerExplosion.java
|
||||
@@ -623,6 +_,23 @@
|
||||
}
|
||||
|
||||
public int explode() {
|
||||
+ // Purpur start - add PreExplodeEvents
|
||||
+ if (this.source != null) {
|
||||
+ org.bukkit.Location location = new org.bukkit.Location(this.level.getWorld(), this.center.x, this.center.y, this.center.z);
|
||||
+ if(!new org.purpurmc.purpur.event.entity.PreEntityExplodeEvent(this.source.getBukkitEntity(), location, this.blockInteraction == Explosion.BlockInteraction.DESTROY_WITH_DECAY ? 1.0F / this.radius : 1.0F, org.bukkit.craftbukkit.CraftExplosionResult.toExplosionResult(getBlockInteraction())).callEvent()) {
|
||||
+ this.wasCanceled = true;
|
||||
+ return 0;
|
||||
+ }
|
||||
+ } else {
|
||||
+ org.bukkit.Location location = new org.bukkit.Location(this.level.getWorld(), this.center.x, this.center.y, this.center.z);
|
||||
+ org.bukkit.block.Block block = location.getBlock();
|
||||
+ org.bukkit.block.BlockState blockState = (this.damageSource.causingBlockSnapshot() != null) ? this.damageSource.causingBlockSnapshot() : block.getState();
|
||||
+ if(!new org.purpurmc.purpur.event.PreBlockExplodeEvent(location.getBlock(), this.blockInteraction == Explosion.BlockInteraction.DESTROY_WITH_DECAY ? 1.0F / this.radius : 1.0F, blockState, org.bukkit.craftbukkit.CraftExplosionResult.toExplosionResult(getBlockInteraction())).callEvent()) {
|
||||
+ this.wasCanceled = true;
|
||||
+ return 0;
|
||||
+ }
|
||||
+ }
|
||||
+ // Purpur end - Add PreExplodeEvents
|
||||
// Paper start - collision optimisations
|
||||
this.blockCache = new it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap<>();
|
||||
this.chunkPosCache = new long[CHUNK_CACHE_WIDTH * CHUNK_CACHE_WIDTH];
|
||||
@@ -1,29 +0,0 @@
|
||||
--- a/net/minecraft/world/level/block/BedBlock.java
|
||||
+++ b/net/minecraft/world/level/block/BedBlock.java
|
||||
@@ -101,7 +_,7 @@
|
||||
}
|
||||
|
||||
Vec3 boomPos = pos.getCenter();
|
||||
- level.explode(null, level.damageSources().badRespawnPointExplosion(boomPos), null, boomPos, 5.0F, true, Level.ExplosionInteraction.BLOCK);
|
||||
+ if (level.purpurConfig.bedExplode) level.explode(null, level.damageSources().badRespawnPointExplosion(boomPos), null, boomPos, (float) level.purpurConfig.bedExplosionPower, level.purpurConfig.bedExplosionFire, level.purpurConfig.bedExplosionEffect); // Purpur - Implement bed explosion options
|
||||
return InteractionResult.SUCCESS_SERVER;
|
||||
} else if (state.getValue(OCCUPIED)) {
|
||||
if (bedRule.explodes()) return this.explodeBed(state, level, pos); // Paper - check explode first
|
||||
@@ -153,7 +_,7 @@
|
||||
}
|
||||
|
||||
Vec3 boomPos = pos.getCenter();
|
||||
- level.explode(null, level.damageSources().badRespawnPointExplosion(boomPos).causingBlockSnapshot(blockState), null, boomPos, 5.0F, true, Level.ExplosionInteraction.BLOCK); // CraftBukkit - add state
|
||||
+ if (level.purpurConfig.bedExplode) level.explode(null, level.damageSources().badRespawnPointExplosion(boomPos).causingBlockSnapshot(blockState), null, boomPos, (float) level.purpurConfig.bedExplosionPower, level.purpurConfig.bedExplosionFire, level.purpurConfig.bedExplosionEffect); // CraftBukkit - add state // Purpur - Implement bed explosion options
|
||||
return InteractionResult.SUCCESS_SERVER;
|
||||
}
|
||||
// CraftBukkit end
|
||||
@@ -170,7 +_,7 @@
|
||||
|
||||
@Override
|
||||
public void fallOn(final Level level, final BlockState state, final BlockPos pos, final Entity entity, final double fallDistance) {
|
||||
- super.fallOn(level, state, pos, entity, fallDistance * 0.5);
|
||||
+ super.fallOn(level, state, pos, entity, fallDistance); // Purpur - Configurable block fall damage modifiers
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/block/Block.java
|
||||
+++ b/net/minecraft/world/level/block/Block.java
|
||||
@@ -114,6 +_,10 @@
|
||||
@@ -111,6 +_,10 @@
|
||||
public static final int UPDATE_LIMIT = 512;
|
||||
protected final StateDefinition<Block, BlockState> stateDefinition;
|
||||
private BlockState defaultBlockState;
|
||||
@@ -11,7 +11,7 @@
|
||||
// Paper start - Protect Bedrock and End Portal/Frames from being destroyed
|
||||
public final boolean isDestroyable() {
|
||||
return io.papermc.paper.configuration.GlobalConfiguration.get().unsupportedSettings.allowPermanentBlockBreakExploits ||
|
||||
@@ -415,7 +_,7 @@
|
||||
@@ -412,7 +_,7 @@
|
||||
event.setExpToDrop(block.getExpDrop(state, serverLevel, pos, net.minecraft.world.item.ItemStack.EMPTY, true)); // Paper - Properly handle xp dropping
|
||||
event.callEvent();
|
||||
for (org.bukkit.inventory.ItemStack drop : event.getDrops()) {
|
||||
@@ -20,7 +20,7 @@
|
||||
}
|
||||
state.spawnAfterBreak(serverLevel, pos, ItemStack.EMPTY, false); // Paper - Properly handle xp dropping
|
||||
block.popExperience(serverLevel, pos, event.getExpToDrop()); // Paper - Properly handle xp dropping
|
||||
@@ -433,7 +_,7 @@
|
||||
@@ -430,7 +_,7 @@
|
||||
|
||||
public static void dropResources(final BlockState state, final LevelAccessor level, final BlockPos pos, final @Nullable BlockEntity blockEntity) {
|
||||
if (level instanceof ServerLevel serverLevel) {
|
||||
@@ -29,7 +29,7 @@
|
||||
state.spawnAfterBreak(serverLevel, pos, ItemStack.EMPTY, true);
|
||||
}
|
||||
}
|
||||
@@ -454,11 +_,30 @@
|
||||
@@ -451,11 +_,30 @@
|
||||
, final boolean dropExperience // Paper - Properly handle xp dropping
|
||||
) {
|
||||
if (level instanceof ServerLevel serverLevel) {
|
||||
@@ -59,9 +59,9 @@
|
||||
+ // Purpur end - Persistent BlockEntity Lore and DisplayName
|
||||
+
|
||||
public static void popResource(final Level level, final BlockPos pos, final ItemStack itemStack) {
|
||||
double halfHeight = EntityType.ITEM.getHeight() / 2.0;
|
||||
double halfHeight = EntityTypes.ITEM.getHeight() / 2.0;
|
||||
RandomSource random = level.getRandom();
|
||||
@@ -548,7 +_,15 @@
|
||||
@@ -545,7 +_,15 @@
|
||||
}
|
||||
|
||||
public void setPlacedBy(final Level level, final BlockPos pos, final BlockState state, final @Nullable LivingEntity by, final ItemStack itemStack) {
|
||||
@@ -78,7 +78,7 @@
|
||||
|
||||
public boolean isPossibleToRespawnInThis(final BlockState state) {
|
||||
return !state.isSolid() && !state.liquid();
|
||||
@@ -559,7 +_,7 @@
|
||||
@@ -556,7 +_,7 @@
|
||||
}
|
||||
|
||||
public void fallOn(final Level level, final BlockState state, final BlockPos pos, final Entity entity, final double fallDistance) {
|
||||
@@ -86,4 +86,4 @@
|
||||
+ entity.causeFallDamage(fallDistance * fallDistanceMultiplier, fallDamageMultiplier, entity.damageSources().fall()); // Purpur - Configurable block fall damage modifiers
|
||||
}
|
||||
|
||||
public void updateEntityMovementAfterFallOn(final BlockGetter level, final Entity entity) {
|
||||
public float getBounceRestitution() {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/block/Blocks.java
|
||||
+++ b/net/minecraft/world/level/block/Blocks.java
|
||||
@@ -6727,6 +_,7 @@
|
||||
@@ -5519,6 +_,7 @@
|
||||
BlockBehaviour.Properties.of()
|
||||
.mapColor(MapColor.PLANT)
|
||||
.forceSolidOff()
|
||||
@@ -8,7 +8,7 @@
|
||||
.instabreak()
|
||||
.sound(SoundType.AZALEA)
|
||||
.noOcclusion()
|
||||
@@ -6738,6 +_,7 @@
|
||||
@@ -5530,6 +_,7 @@
|
||||
BlockBehaviour.Properties.of()
|
||||
.mapColor(MapColor.PLANT)
|
||||
.forceSolidOff()
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/block/CampfireBlock.java
|
||||
+++ b/net/minecraft/world/level/block/CampfireBlock.java
|
||||
@@ -136,7 +_,7 @@
|
||||
@@ -137,7 +_,7 @@
|
||||
return this.defaultBlockState()
|
||||
.setValue(WATERLOGGED, replacedWater)
|
||||
.setValue(SIGNAL_FIRE, this.isSmokeSource(level.getBlockState(pos.below())))
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
+++ b/net/minecraft/world/level/block/CarvedPumpkinBlock.java
|
||||
@@ -67,7 +_,7 @@
|
||||
if (snowGolemMatch != null) {
|
||||
SnowGolem snowGolem = EntityType.SNOW_GOLEM.create(level, EntitySpawnReason.TRIGGERED);
|
||||
SnowGolem snowGolem = EntityTypes.SNOW_GOLEM.create(level, EntitySpawnReason.TRIGGERED);
|
||||
if (snowGolem != null) {
|
||||
- spawnGolemInWorld(level, snowGolemMatch, snowGolem, snowGolemMatch.getBlock(0, 2, 0).getPos());
|
||||
+ spawnGolemInWorld(level, snowGolemMatch, snowGolem, snowGolemMatch.getBlock(0, 2, 0).getPos(), this.placer); // Purpur - Summoner API
|
||||
@@ -10,7 +10,7 @@
|
||||
}
|
||||
}
|
||||
@@ -77,7 +_,7 @@
|
||||
IronGolem ironGolem = EntityType.IRON_GOLEM.create(level, EntitySpawnReason.TRIGGERED);
|
||||
IronGolem ironGolem = EntityTypes.IRON_GOLEM.create(level, EntitySpawnReason.TRIGGERED);
|
||||
if (ironGolem != null) {
|
||||
ironGolem.setPlayerCreated(true);
|
||||
- spawnGolemInWorld(level, ironGolemMatch, ironGolem, ironGolemMatch.getBlock(1, 2, 0).getPos());
|
||||
@@ -20,7 +20,7 @@
|
||||
}
|
||||
@@ -86,7 +_,7 @@
|
||||
if (copperGolemMatch != null) {
|
||||
CopperGolem copperGolem = EntityType.COPPER_GOLEM.create(level, EntitySpawnReason.TRIGGERED);
|
||||
CopperGolem copperGolem = EntityTypes.COPPER_GOLEM.create(level, EntitySpawnReason.TRIGGERED);
|
||||
if (copperGolem != null) {
|
||||
- spawnGolemInWorld(level, copperGolemMatch, copperGolem, copperGolemMatch.getBlock(0, 0, 0).getPos());
|
||||
+ spawnGolemInWorld(level, copperGolemMatch, copperGolem, copperGolemMatch.getBlock(0, 0, 0).getPos(), this.placer); // Purpur - Summoner API
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/block/ChestBlock.java
|
||||
+++ b/net/minecraft/world/level/block/ChestBlock.java
|
||||
@@ -347,6 +_,7 @@
|
||||
@@ -348,6 +_,7 @@
|
||||
}
|
||||
|
||||
public static boolean isBlockedChestByBlock(final BlockGetter level, final BlockPos pos) {
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
--- a/net/minecraft/world/level/block/NetherPortalBlock.java
|
||||
+++ b/net/minecraft/world/level/block/NetherPortalBlock.java
|
||||
@@ -68,7 +_,7 @@
|
||||
protected void randomTick(final BlockState state, final ServerLevel level, BlockPos pos, final RandomSource random) {
|
||||
if (level.spigotConfig.enableZombiePigmenPortalSpawns && level.isSpawningMonsters() // Spigot
|
||||
@@ -70,7 +_,7 @@
|
||||
if (level.spigotConfig.enableZombiePigmenPortalSpawns && level.isSpawningMonsters() // Paper
|
||||
&& level.getLevelData().getDifficulty() != Difficulty.PEACEFUL
|
||||
&& level.environmentAttributes().getValue(EnvironmentAttributes.NETHER_PORTAL_SPAWNS_PIGLINS, pos)
|
||||
- && random.nextInt(2000) < level.getDifficulty().getId()
|
||||
+ && random.nextInt(level.purpurConfig.piglinPortalSpawnModifier) < level.getDifficulty().getId() // Purpur - Piglin portal spawn modifier
|
||||
&& level.anyPlayerCloseEnoughForSpawning(pos)) {
|
||||
while (level.getBlockState(pos).is(this)) {
|
||||
pos = pos.below();
|
||||
@@ -133,7 +_,7 @@
|
||||
@@ -135,7 +_,7 @@
|
||||
@Override
|
||||
public int getPortalTransitionTime(final ServerLevel level, final Entity entity) {
|
||||
return entity instanceof Player player
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/block/PointedDripstoneBlock.java
|
||||
+++ b/net/minecraft/world/level/block/PointedDripstoneBlock.java
|
||||
@@ -196,20 +_,20 @@
|
||||
@@ -89,20 +_,20 @@
|
||||
|
||||
@VisibleForTesting
|
||||
public static void maybeTransferFluid(final BlockState state, final ServerLevel level, final BlockPos pos, final float randomValue) {
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
--- a/net/minecraft/world/level/block/RespawnAnchorBlock.java
|
||||
+++ b/net/minecraft/world/level/block/RespawnAnchorBlock.java
|
||||
@@ -176,7 +_,7 @@
|
||||
}
|
||||
};
|
||||
Vec3 boomPos = pos.getCenter();
|
||||
- level.explode(null, level.damageSources().badRespawnPointExplosion(boomPos).causingBlockSnapshot(blockState), damageCalculator, boomPos, 5.0F, true, Level.ExplosionInteraction.BLOCK); // CraftBukkit - add state
|
||||
+ level.explode(null, level.damageSources().badRespawnPointExplosion(boomPos).causingBlockSnapshot(blockState), damageCalculator, boomPos, (float) level.purpurConfig.respawnAnchorExplosionPower, level.purpurConfig.respawnAnchorExplosionFire, level.purpurConfig.respawnAnchorExplosionEffect); // CraftBukkit - add state // Purpur - Implement respawn anchor explosion options
|
||||
}
|
||||
|
||||
public static boolean canSetSpawn(final ServerLevel level, final BlockPos pos) {
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/block/SculkShriekerBlock.java
|
||||
+++ b/net/minecraft/world/level/block/SculkShriekerBlock.java
|
||||
@@ -116,7 +_,7 @@
|
||||
@@ -117,7 +_,7 @@
|
||||
|
||||
@Override
|
||||
public @Nullable BlockState getStateForPlacement(final BlockPlaceContext context) {
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
--- a/net/minecraft/world/level/block/ShulkerBoxBlock.java
|
||||
+++ b/net/minecraft/world/level/block/ShulkerBoxBlock.java
|
||||
@@ -87,7 +_,7 @@
|
||||
return InteractionResult.SUCCESS;
|
||||
}
|
||||
|
||||
- public static boolean canOpen(final BlockState state, final Level level, final BlockPos pos, final ShulkerBoxBlockEntity blockEntity) {
|
||||
+ private static boolean canOpen(final BlockState state, final Level level, final BlockPos pos, final ShulkerBoxBlockEntity blockEntity) {
|
||||
if (blockEntity.getAnimationStatus() != ShulkerBoxBlockEntity.AnimationStatus.CLOSED) {
|
||||
return true;
|
||||
}
|
||||
@@ -1,8 +1,8 @@
|
||||
--- a/net/minecraft/world/level/block/SlabBlock.java
|
||||
+++ b/net/minecraft/world/level/block/SlabBlock.java
|
||||
@@ -143,4 +_,25 @@
|
||||
return false;
|
||||
}
|
||||
@@ -139,4 +_,25 @@
|
||||
default -> false;
|
||||
};
|
||||
}
|
||||
+
|
||||
+ // Purpur start - Break individual slabs when sneaking
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/block/SpawnerBlock.java
|
||||
+++ b/net/minecraft/world/level/block/SpawnerBlock.java
|
||||
@@ -15,6 +_,7 @@
|
||||
@@ -16,6 +_,7 @@
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
public class SpawnerBlock extends BaseEntityBlock {
|
||||
@@ -8,8 +8,8 @@
|
||||
public static final MapCodec<SpawnerBlock> CODEC = simpleCodec(SpawnerBlock::new);
|
||||
|
||||
@Override
|
||||
@@ -36,6 +_,62 @@
|
||||
return createTickerHelper(type, BlockEntityType.MOB_SPAWNER, level.isClientSide() ? SpawnerBlockEntity::clientTick : SpawnerBlockEntity::serverTick);
|
||||
@@ -37,6 +_,62 @@
|
||||
return createTickerHelper(type, BlockEntityTypes.MOB_SPAWNER, level.isClientSide() ? SpawnerBlockEntity::clientTick : SpawnerBlockEntity::serverTick);
|
||||
}
|
||||
|
||||
+ // Purpur start - Silk touch spawners
|
||||
@@ -71,7 +71,7 @@
|
||||
@Override
|
||||
protected void spawnAfterBreak(final BlockState state, final ServerLevel level, final BlockPos pos, final ItemStack tool, final boolean dropExperience) {
|
||||
super.spawnAfterBreak(state, level, pos, tool, dropExperience);
|
||||
@@ -44,6 +_,7 @@
|
||||
@@ -45,6 +_,7 @@
|
||||
|
||||
@Override
|
||||
public int getExpDrop(final BlockState state, final ServerLevel level, final BlockPos pos, final ItemStack tool, final boolean dropExperience) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/block/entity/BeaconBlockEntity.java
|
||||
+++ b/net/minecraft/world/level/block/entity/BeaconBlockEntity.java
|
||||
@@ -138,6 +_,16 @@
|
||||
@@ -140,6 +_,16 @@
|
||||
|
||||
public double getEffectRange() {
|
||||
if (this.effectRange < 0) {
|
||||
@@ -17,7 +17,7 @@
|
||||
return this.levels * 10 + 10;
|
||||
} else {
|
||||
return effectRange;
|
||||
@@ -166,6 +_,7 @@
|
||||
@@ -168,6 +_,7 @@
|
||||
int y = pos.getY();
|
||||
int z = pos.getZ();
|
||||
BlockPos checkPos;
|
||||
@@ -25,7 +25,7 @@
|
||||
if (entity.lastCheckY < y) {
|
||||
checkPos = pos;
|
||||
entity.checkingBeamSections = Lists.newArrayList();
|
||||
@@ -195,11 +_,15 @@
|
||||
@@ -197,11 +_,15 @@
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -42,7 +42,7 @@
|
||||
|
||||
lastBeamSection.increaseHeight();
|
||||
}
|
||||
@@ -210,11 +_,11 @@
|
||||
@@ -212,11 +_,11 @@
|
||||
|
||||
int previousLevels = entity.levels;
|
||||
if (level.getGameTime() % 80L == 0L) {
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
private static final int MIN_TICKS_BEFORE_REENTERING_HIVE = 400;
|
||||
private static final int MIN_OCCUPATION_TICKS_NECTAR = 2400;
|
||||
public static final int MIN_OCCUPATION_TICKS_NECTARLESS = 600;
|
||||
@@ -157,10 +_,32 @@
|
||||
@@ -157,11 +_,33 @@
|
||||
return spawned;
|
||||
}
|
||||
|
||||
@@ -33,12 +33,24 @@
|
||||
public int getOccupantCount() {
|
||||
return this.stored.size();
|
||||
}
|
||||
+
|
||||
|
||||
+ // Purpur start - Stored Bee API
|
||||
+ public List<BeeData> getStored() {
|
||||
+ return stored;
|
||||
+ }
|
||||
+ // Purpur end - Stored Bee API
|
||||
|
||||
+
|
||||
// Paper start - Add EntityBlockStorage clearEntities
|
||||
public void clearBees() {
|
||||
this.stored.clear();
|
||||
@@ -390,8 +_,8 @@
|
||||
registration.register(DebugSubscriptions.BEE_HIVES, () -> DebugHiveInfo.pack(this));
|
||||
}
|
||||
|
||||
- public static class BeeData {
|
||||
- public final BeehiveBlockEntity.Occupant occupant;
|
||||
+ private static class BeeData {
|
||||
+ private final BeehiveBlockEntity.Occupant occupant;
|
||||
private int exitTickCounter; // Paper - Fix bees aging inside hives; separate counter for checking if bee should exit to reduce exit attempts
|
||||
private int ticksInHive;
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
+ private int lapis = 0; // Purpur - Enchantment Table Persists Lapis
|
||||
|
||||
public EnchantingTableBlockEntity(final BlockPos worldPosition, final BlockState blockState) {
|
||||
super(BlockEntityType.ENCHANTING_TABLE, worldPosition, blockState);
|
||||
super(BlockEntityTypes.ENCHANTING_TABLE, worldPosition, blockState);
|
||||
@@ -39,12 +_,14 @@
|
||||
protected void saveAdditional(final ValueOutput output) {
|
||||
super.saveAdditional(output);
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
--- a/net/minecraft/world/level/block/entity/FuelValues.java
|
||||
+++ b/net/minecraft/world/level/block/entity/FuelValues.java
|
||||
@@ -17,7 +_,7 @@
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
|
||||
public class FuelValues {
|
||||
- public final Object2IntSortedMap<Item> values;
|
||||
+ private final Object2IntSortedMap<Item> values;
|
||||
|
||||
private FuelValues(final Object2IntSortedMap<Item> values) {
|
||||
this.values = values;
|
||||
@@ -0,0 +1,11 @@
|
||||
--- a/net/minecraft/world/level/block/state/BlockBehaviour.java
|
||||
+++ b/net/minecraft/world/level/block/state/BlockBehaviour.java
|
||||
@@ -88,7 +_,7 @@
|
||||
Direction.WEST, Direction.EAST, Direction.NORTH, Direction.SOUTH, Direction.DOWN, Direction.UP
|
||||
};
|
||||
public final boolean hasCollision;
|
||||
- public float explosionResistance;
|
||||
+ protected final float explosionResistance;
|
||||
protected final boolean isRandomlyTicking;
|
||||
protected final SoundType soundType;
|
||||
protected final float friction;
|
||||
@@ -1,8 +1,8 @@
|
||||
--- a/net/minecraft/world/level/chunk/storage/EntityStorage.java
|
||||
+++ b/net/minecraft/world/level/chunk/storage/EntityStorage.java
|
||||
@@ -105,6 +_,7 @@
|
||||
}
|
||||
// Paper end - Entity load/save limit per chunk
|
||||
@@ -94,6 +_,7 @@
|
||||
ListTag entities = new ListTag();
|
||||
chunk.getEntities().forEach(e -> {
|
||||
TagValueOutput output = TagValueOutput.createWithContext(reporter.forChild(e.problemPath()), e.registryAccess());
|
||||
+ if (!e.canSaveToDisk()) return; // Purpur - Add canSaveToDisk to Entity
|
||||
if (e.save(output)) {
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
--- a/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
|
||||
+++ b/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
|
||||
@@ -309,7 +_,7 @@
|
||||
|
||||
// Paper start
|
||||
private static void printOversizedLog(String msg, Path file, int x, int z) {
|
||||
- LOGGER.error("{} ({} - {},{}) Go clean it up to remove this message. /minecraft:tp {} 128 {} - DO NOT REPORT THIS TO PAPER - You may ask for help on Discord, but do not file an issue. These error messages can not be removed.", msg, file.toString().replaceAll(".+[\\\\/]", ""), x, z, x << 4, z << 4);
|
||||
+ LOGGER.error("{} ({} - {},{}) Go clean it up to remove this message. /minecraft:tp {} 128 {} - DO NOT REPORT THIS TO PURPUR - You may ask for help on Discord, but do not file an issue. These error messages can not be removed.", msg, file.toString().replaceAll(".+[\\\\/]", ""), x, z, x << 4, z << 4); // Purpur - Rebrand
|
||||
}
|
||||
|
||||
private static CompoundTag readOversizedChunk(RegionFile regionfile, ChunkPos chunkCoordinate) throws IOException {
|
||||
@@ -19,7 +19,7 @@
|
||||
int dayLength = 24000;
|
||||
@@ -56,7 +_,7 @@
|
||||
FluidState fluidState = level.getFluidState(spawnPos);
|
||||
if (NaturalSpawner.isValidEmptySpawnBlock(level, spawnPos, blockState, fluidState, EntityType.PHANTOM)) {
|
||||
if (NaturalSpawner.isValidEmptySpawnBlock(level, spawnPos, blockState, fluidState, EntityTypes.PHANTOM)) {
|
||||
SpawnGroupData groupData = null;
|
||||
- int groupSize = 1 + random.nextInt(difficulty.getDifficulty().getId() + 1);
|
||||
+ int groupSize = level.purpurConfig.phantomSpawnMinPerAttempt + random.nextInt((level.purpurConfig.phantomSpawnMaxPerAttempt < 0 ? difficulty.getDifficulty().getId() : level.purpurConfig.phantomSpawnMaxPerAttempt - level.purpurConfig.phantomSpawnMinPerAttempt) + 1); // Purpur - Add phantom spawning options
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/material/FlowingFluid.java
|
||||
+++ b/net/minecraft/world/level/material/FlowingFluid.java
|
||||
@@ -234,7 +_,7 @@
|
||||
@@ -192,7 +_,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
BlockState belowState = level.getBlockState(mutablePos.setWithOffset(pos, Direction.DOWN));
|
||||
FluidState belowFluid = belowState.getFluidState();
|
||||
if (belowState.isSolid() || this.isSourceBlockOfThisType(belowFluid)) {
|
||||
@@ -320,6 +_,12 @@
|
||||
@@ -280,6 +_,12 @@
|
||||
}
|
||||
|
||||
protected abstract boolean canConvertToSource(ServerLevel level);
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
private static final int MIN_HEIGHT = 3;
|
||||
public static final int MAX_HEIGHT = 21;
|
||||
- public static final BlockBehaviour.StatePredicate FRAME = (state, level, pos) -> state.is(Blocks.OBSIDIAN);
|
||||
+ public static final BlockBehaviour.StatePredicate FRAME = (state, level, pos) -> state.is(Blocks.OBSIDIAN) || (org.purpurmc.purpur.PurpurConfig.cryingObsidianValidForPortalFrame && state.is(Blocks.CRYING_OBSIDIAN)); // Purpur - Crying obsidian valid for portal frames
|
||||
+ private static final BlockBehaviour.StatePredicate FRAME = (state, level, pos) -> state.is(Blocks.OBSIDIAN);
|
||||
private static final float SAFE_TRAVEL_MAX_ENTITY_XY = 4.0F;
|
||||
private static final double SAFE_TRAVEL_MAX_VERTICAL_DELTA = 1.0;
|
||||
private final Direction.Axis axis;
|
||||
|
||||
Reference in New Issue
Block a user