More more work

This commit is contained in:
Nassim Jahnke 2023-06-07 20:49:17 +02:00
parent 734c1267b9
commit f4a4fec81b
30 changed files with 24 additions and 25 deletions

View File

@ -13,8 +13,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
protected void tickDespawn() { protected void tickDespawn() {
++this.life; ++this.life;
- if (this.life >= ((this instanceof ThrownTrident) ? level.spigotConfig.tridentDespawnRate : level.spigotConfig.arrowDespawnRate)) { // Spigot - if (this.life >= ((this instanceof ThrownTrident) ? this.level().spigotConfig.tridentDespawnRate : this.level().spigotConfig.arrowDespawnRate)) { // Spigot
+ if (this.life >= (pickup == Pickup.CREATIVE_ONLY ? level.paperConfig().entities.spawning.creativeArrowDespawnRate.value() : (pickup == Pickup.DISALLOWED ? level.paperConfig().entities.spawning.nonPlayerArrowDespawnRate.value() : ((this instanceof ThrownTrident) ? level.spigotConfig.tridentDespawnRate : level.spigotConfig.arrowDespawnRate)))) { // Spigot // Paper - TODO: Extract this to init? + if (this.life >= (pickup == Pickup.CREATIVE_ONLY ? this.level().paperConfig().entities.spawning.creativeArrowDespawnRate.value() : (pickup == Pickup.DISALLOWED ? this.level().paperConfig().entities.spawning.nonPlayerArrowDespawnRate.value() : ((this instanceof ThrownTrident) ? this.level().spigotConfig.tridentDespawnRate : this.level().spigotConfig.arrowDespawnRate)))) { // Spigot // Paper - TODO: Extract this to init?
this.discard(); this.discard();
} }

View File

@ -18,14 +18,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
org.bukkit.inventory.EquipmentSlot hand = org.bukkit.craftbukkit.CraftEquipmentSlot.getHand(enumhand); org.bukkit.inventory.EquipmentSlot hand = org.bukkit.craftbukkit.CraftEquipmentSlot.getHand(enumhand);
- PlayerItemConsumeEvent event = new PlayerItemConsumeEvent((Player) this.getBukkitEntity(), craftItem, hand); - PlayerItemConsumeEvent event = new PlayerItemConsumeEvent((Player) this.getBukkitEntity(), craftItem, hand);
+ event = new PlayerItemConsumeEvent((Player) this.getBukkitEntity(), craftItem, hand); // Paper + event = new PlayerItemConsumeEvent((Player) this.getBukkitEntity(), craftItem, hand); // Paper
level.getCraftServer().getPluginManager().callEvent(event); this.level().getCraftServer().getPluginManager().callEvent(event);
if (event.isCancelled()) { if (event.isCancelled()) {
@@ -0,0 +0,0 @@ public abstract class LivingEntity extends Entity implements Attackable { @@ -0,0 +0,0 @@ public abstract class LivingEntity extends Entity implements Attackable {
} else { } else {
itemstack = this.useItem.finishUsingItem(this.level, this); itemstack = this.useItem.finishUsingItem(this.level(), this);
} }
+
+ // Paper start - save the default replacement item and change it if necessary + // Paper start - save the default replacement item and change it if necessary
+ final ItemStack defaultReplacement = itemstack; + final ItemStack defaultReplacement = itemstack;
+ if (event != null && event.getReplacement() != null) { + if (event != null && event.getReplacement() != null) {

View File

@ -23,8 +23,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
return BlockPathTypes.DANGER_OTHER; return BlockPathTypes.DANGER_OTHER;
} }
@@ -0,0 +0,0 @@ public class WalkNodeEvaluator extends NodeEvaluator { @@ -0,0 +0,0 @@ public class WalkNodeEvaluator extends NodeEvaluator {
if (world.getFluidState(pos).is(FluidTags.WATER)) { if (blockState.is(Blocks.WITHER_ROSE) || blockState.is(Blocks.POINTED_DRIPSTONE)) {
return BlockPathTypes.WATER_BORDER; return BlockPathTypes.DAMAGE_CAUTIOUS;
} }
+ } // Paper + } // Paper
} }
@ -38,5 +38,5 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ BlockState blockState = world.getBlockStateIfLoaded(pos); // Paper + BlockState blockState = world.getBlockStateIfLoaded(pos); // Paper
+ if (blockState == null) return BlockPathTypes.BLOCKED; // Paper + if (blockState == null) return BlockPathTypes.BLOCKED; // Paper
Block block = blockState.getBlock(); Block block = blockState.getBlock();
Material material = blockState.getMaterial();
if (blockState.isAir()) { if (blockState.isAir()) {
return BlockPathTypes.OPEN;

View File

@ -42,12 +42,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@@ -0,0 +0,0 @@ public class GroundPathNavigation extends PathNavigation { @@ -0,0 +0,0 @@ public class GroundPathNavigation extends PathNavigation {
} }
if (!this.level.getBlockState(target).getMaterial().isSolid()) { if (!this.level.getBlockState(target).isSolid()) {
- return super.createPath(target, distance); - return super.createPath(target, distance);
+ return super.createPath(target, entity, distance); // Paper + return super.createPath(target, entity, distance); // Paper
} else { } else {
BlockPos blockPos2; BlockPos blockPos2;
for(blockPos2 = target.above(); blockPos2.getY() < this.level.getMaxBuildHeight() && this.level.getBlockState(blockPos2).getMaterial().isSolid(); blockPos2 = blockPos2.above()) { for(blockPos2 = target.above(); blockPos2.getY() < this.level.getMaxBuildHeight() && this.level.getBlockState(blockPos2).isSolid(); blockPos2 = blockPos2.above()) {
} }
- return super.createPath(blockPos2, distance); - return super.createPath(blockPos2, distance);

View File

@ -26,7 +26,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ EntityRegainHealthEvent event = new EntityRegainHealthEvent(this.getBukkitEntity(), f, regainReason, isFastRegen); // Paper + EntityRegainHealthEvent event = new EntityRegainHealthEvent(this.getBukkitEntity(), f, regainReason, isFastRegen); // Paper
// Suppress during worldgen // Suppress during worldgen
if (this.valid) { if (this.valid) {
this.level.getCraftServer().getPluginManager().callEvent(event); this.level().getCraftServer().getPluginManager().callEvent(event);
diff --git a/src/main/java/net/minecraft/world/food/FoodData.java b/src/main/java/net/minecraft/world/food/FoodData.java diff --git a/src/main/java/net/minecraft/world/food/FoodData.java b/src/main/java/net/minecraft/world/food/FoodData.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/food/FoodData.java --- a/src/main/java/net/minecraft/world/food/FoodData.java

View File

@ -129,9 +129,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java --- a/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java
+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java +++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java
@@ -0,0 +0,0 @@ public class LevelChunkSection { @@ -0,0 +0,0 @@ public class LevelChunkSection {
public static final int SECTION_HEIGHT = 16;
public static final int SECTION_SIZE = 4096; public static final int SECTION_SIZE = 4096;
public static final int BIOME_CONTAINER_BITS = 2; public static final int BIOME_CONTAINER_BITS = 2;
private final int bottomBlockY;
- private short nonEmptyBlockCount; - private short nonEmptyBlockCount;
+ short nonEmptyBlockCount; // Paper - package-private + short nonEmptyBlockCount; // Paper - package-private
private short tickingBlockCount; private short tickingBlockCount;

View File

@ -15,7 +15,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java --- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java +++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
@@ -0,0 +0,0 @@ public class RegionFileStorage implements AutoCloseable { @@ -0,0 +0,0 @@ public class RegionFileStorage implements AutoCloseable {
// Paper end if (regionfile != null) {
return regionfile; return regionfile;
} else { } else {
- if (this.regionCache.size() >= 256) { - if (this.regionCache.size() >= 256) {

View File

@ -20,7 +20,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ } + }
+ this.setAbsorptionAmount(absorptionAmount); + this.setAbsorptionAmount(absorptionAmount);
+ // Paper end + // Paper end
if (nbt.contains("Attributes", 9) && this.level != null && !this.level.isClientSide) { if (nbt.contains("Attributes", 9) && this.level() != null && !this.level().isClientSide) {
this.getAttributes().load(nbt.getList("Attributes", 10)); this.getAttributes().load(nbt.getList("Attributes", 10));
} }
@@ -0,0 +0,0 @@ public abstract class LivingEntity extends Entity implements Attackable { @@ -0,0 +0,0 @@ public abstract class LivingEntity extends Entity implements Attackable {