More more more more more more work

This commit is contained in:
Nassim Jahnke 2021-11-23 16:04:41 +01:00
parent d8709b6bf1
commit 82f6e6bb0e
110 changed files with 69 additions and 63 deletions

View file

@ -9,3 +9,4 @@
# minecraft net.minecraft.world.level.entity.LevelEntityGetterAdapter
# minecraft net/minecraft/world/level/entity/LevelEntityGetter.java

View file

@ -8,9 +8,9 @@ diff --git a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java b/src/main/jav
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java
@@ -0,0 +0,0 @@ package org.bukkit.craftbukkit;
import com.google.common.base.Preconditions;
@@ -0,0 +0,0 @@ import com.google.common.base.Preconditions;
import com.google.common.base.Predicates;
import com.mojang.serialization.Codec;
import java.lang.ref.WeakReference;
+import java.util.ArrayList;
import java.util.Arrays;

View file

@ -44,7 +44,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
return this.chunkSource.getChunk(x, z, false);
@@ -0,0 +0,0 @@ public class ServerLevel extends Level implements WorldGenLevel {
// CraftBukkit start
private boolean addEntity0(Entity entity, CreatureSpawnEvent.SpawnReason spawnReason) {
private boolean addEntity(Entity entity, CreatureSpawnEvent.SpawnReason spawnReason) {
org.spigotmc.AsyncCatcher.catchOp("entity add"); // Spigot
+ // Paper start
+ if (entity.valid) {
@ -68,14 +68,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ getAddToWorldStackTrace(entity).printStackTrace();
+ }
+ // Paper end
// WorldServer.LOGGER.warn("Tried to add entity {} but it was marked as removed already", EntityTypes.getName(entity.getEntityType())); // CraftBukkit
// WorldServer.LOGGER.warn("Tried to add entity {} but it was marked as removed already", EntityTypes.getKey(entity.getType())); // CraftBukkit
return false;
} else {
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -0,0 +0,0 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
@@ -0,0 +0,0 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i
public com.destroystokyo.paper.loottable.PaperLootableInventoryData lootableData; // Paper
private CraftEntity bukkitEntity;

View file

@ -97,7 +97,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ if(!new com.destroystokyo.paper.event.block.TNTPrimeEvent(tntBlock, com.destroystokyo.paper.event.block.TNTPrimeEvent.PrimeReason.ITEM, player.getBukkitEntity()).callEvent())
+ return InteractionResult.FAIL;
+ // Paper end
TntBlock.explode(world, pos, (LivingEntity) player);
TntBlock.explode(world, pos, player);
world.setBlock(pos, Blocks.AIR.defaultBlockState(), 11);
Item item = itemstack.getItem();
@@ -0,0 +0,0 @@ public class TntBlock extends Block {

View file

@ -47,7 +47,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
iblockdata = world.getBlockState(blockposition);
BlockPos blockposition2 = iblockdata.getBlock() instanceof LiquidBlockContainer && this.content == Fluids.WATER ? blockposition : blockposition1;
- if (this.a(user, world, blockposition2, movingobjectpositionblock, movingobjectpositionblock.getDirection(), blockposition, itemstack)) { // CraftBukkit
- if (this.emptyContents(user, world, blockposition2, movingobjectpositionblock, movingobjectpositionblock.getDirection(), blockposition, itemstack)) { // CraftBukkit
+ if (this.emptyContents(user, world, blockposition2, movingobjectpositionblock, movingobjectpositionblock.getDirection(), blockposition, itemstack, hand)) { // CraftBukkit // Paper - add enumhand
this.checkExtraContent(user, world, itemstack, blockposition2);
if (user instanceof ServerPlayer) {
@ -56,12 +56,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@Override
public boolean emptyContents(@Nullable Player player, Level world, BlockPos pos, @Nullable BlockHitResult hitResult) {
- return this.a(player, world, pos, hitResult, null, null, null);
- return this.emptyContents(player, world, pos, hitResult, null, null, null);
+ // Paper start - add enumHand
+ return emptyContents(player, world, pos, hitResult, null, null, null, null);
}
- public boolean a(Player entityhuman, Level world, BlockPos blockposition, @Nullable BlockHitResult movingobjectpositionblock, Direction enumdirection, BlockPos clicked, ItemStack itemstack) {
- public boolean emptyContents(Player entityhuman, Level world, BlockPos blockposition, @Nullable BlockHitResult movingobjectpositionblock, Direction enumdirection, BlockPos clicked, ItemStack itemstack) {
+ public boolean emptyContents(Player entityhuman, Level world, BlockPos blockposition, @Nullable BlockHitResult movingobjectpositionblock, Direction enumdirection, BlockPos clicked, ItemStack itemstack, InteractionHand enumhand) {
+ // Paper end
// CraftBukkit end
@ -80,9 +80,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
}
// CraftBukkit end
if (!flag1) {
- return movingobjectpositionblock != null && this.a(entityhuman, world, movingobjectpositionblock.getBlockPos().relative(movingobjectpositionblock.getDirection()), (BlockHitResult) null, enumdirection, clicked, itemstack); // CraftBukkit
+ return movingobjectpositionblock != null && this.emptyContents(entityhuman, world, movingobjectpositionblock.getBlockPos().relative(movingobjectpositionblock.getDirection()), (BlockHitResult) null, enumdirection, clicked, itemstack, enumhand); // CraftBukkit // Paper - add enumhand
} else if (world.dimensionType().ultraWarm() && this.content.is((Tag) FluidTags.WATER)) {
- return movingobjectpositionblock != null && this.emptyContents(entityhuman, world, movingobjectpositionblock.getBlockPos().relative(movingobjectpositionblock.getDirection()), (BlockHitResult) null, enumdirection, clicked, itemstack); // CraftBukkit
+ return movingobjectpositionblock != null && this.emptyContents(entityhuman, world, movingobjectpositionblock.getBlockPos().relative(movingobjectpositionblock.getDirection()), (BlockHitResult) null, enumdirection, clicked, itemstack, enumhand); // CraftBukkit // Paper
} else if (world.dimensionType().ultraWarm() && this.content.is(FluidTags.WATER)) {
int i = blockposition.getX();
int j = blockposition.getY();
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java

View file

@ -51,7 +51,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
private long keepAliveChallenge;
// CraftBukkit start - multithreaded fields
private AtomicInteger chatSpamTickCount = new AtomicInteger();
private final AtomicInteger chatSpamTickCount = new AtomicInteger();
+ private final java.util.concurrent.atomic.AtomicInteger tabSpamLimiter = new java.util.concurrent.atomic.AtomicInteger(); // Paper - configurable tab spam limits
// CraftBukkit end
private int dropSpamTickCount;

View file

@ -10,10 +10,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -0,0 +0,0 @@ public class PaperWorldConfig {
private void squidMaxSpawnHeight() {
squidMaxSpawnHeight = getDouble("squid-spawn-height.maximum", 0.0D);
disableCreeperLingeringEffect = getBoolean("disable-creeper-lingering-effect", false);
log("Creeper lingering effect: " + disableCreeperLingeringEffect);
}
+
+ public double squidMaxSpawnHeight;
+ private void squidMaxSpawnHeight() {
+ squidMaxSpawnHeight = getDouble("squid-spawn-height.maximum", 0.0D);
+ }
+
+ public boolean disableSprintInterruptionOnAttack;
+ private void disableSprintInterruptionOnAttack() {
+ disableSprintInterruptionOnAttack = getBoolean("game-mechanics.disable-sprint-interruption-on-attack", false);

View file

@ -12,7 +12,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/world/entity/monster/EnderMan.java
+++ b/src/main/java/net/minecraft/world/entity/monster/EnderMan.java
@@ -0,0 +0,0 @@ public class EnderMan extends Monster implements NeutralMob {
this.setGoalTarget(target, org.bukkit.event.entity.EntityTargetEvent.TargetReason.UNKNOWN, true);
this.setTarget(target, org.bukkit.event.entity.EntityTargetEvent.TargetReason.UNKNOWN, true);
}
+ // Paper start
@ -22,8 +22,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ // Paper end
+
@Override
public boolean setGoalTarget(LivingEntity entityliving, org.bukkit.event.entity.EntityTargetEvent.TargetReason reason, boolean fireEvent) {
if (!super.setGoalTarget(entityliving, reason, fireEvent)) {
public boolean setTarget(LivingEntity entityliving, org.bukkit.event.entity.EntityTargetEvent.TargetReason reason, boolean fireEvent) {
if (!super.setTarget(entityliving, reason, fireEvent)) {
@@ -0,0 +0,0 @@ public class EnderMan extends Monster implements NeutralMob {
if (this.level.isDay() && this.tickCount >= this.targetChangeTime + 600) {
float f = this.getBrightness();
@ -34,9 +34,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
this.teleport();
}
@@ -0,0 +0,0 @@ public class EnderMan extends Monster implements NeutralMob {
if (this.isInvulnerableTo(source)) {
return false;
} else if (source instanceof IndirectEntityDamageSource) {
flag = false;
}
+ if (this.tryEscape(com.destroystokyo.paper.event.entity.EndermanEscapeEvent.Reason.INDIRECT)) { // Paper start
for (int i = 0; i < 64; ++i) {
if (this.teleport()) {
@ -45,9 +45,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
}
+ } // Paper end
return false;
return flag;
} else {
boolean flag = super.hurt(source, amount);
boolean flag1 = super.hurt(source, amount);
- if (!this.level.isClientSide() && !(source.getEntity() instanceof LivingEntity) && this.random.nextInt(10) != 0) {
+ if (!this.level.isClientSide() && !(source.getEntity() instanceof LivingEntity) && this.random.nextInt(10) != 0 && this.tryEscape(source == DamageSource.DROWN ? com.destroystokyo.paper.event.entity.EndermanEscapeEvent.Reason.DROWN : com.destroystokyo.paper.event.entity.EndermanEscapeEvent.Reason.INDIRECT)) { // Paper - use to be critical hits as else, but mojang removed critical hits in 1.16.2 due to MC-185684

View file

@ -53,18 +53,18 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
}
// CraftBukkit end
return itemstack;
diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacket.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacket.java
diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacketData.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacketData.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacket.java
+++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacket.java
@@ -0,0 +0,0 @@ public class ClientboundLevelChunkPacket implements Packet<ClientGamePacketListe
for(Entry<BlockPos, BlockEntity> entry2 : chunk.getBlockEntities().entrySet()) {
BlockEntity blockEntity = entry2.getValue();
--- a/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacketData.java
+++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacketData.java
@@ -0,0 +0,0 @@ public class ClientboundLevelChunkPacketData {
static ClientboundLevelChunkPacketData.BlockEntityInfo create(BlockEntity blockEntity) {
CompoundTag compoundTag = blockEntity.getUpdateTag();
BlockPos blockPos = blockEntity.getBlockPos();
+ if (blockEntity instanceof net.minecraft.world.level.block.entity.SkullBlockEntity) { net.minecraft.world.level.block.entity.SkullBlockEntity.sanitizeTileEntityUUID(compoundTag); } // Paper
this.blockEntitiesTags.add(compoundTag);
int i = SectionPos.sectionRelative(blockPos.getX()) << 4 | SectionPos.sectionRelative(blockPos.getZ());
return new ClientboundLevelChunkPacketData.BlockEntityInfo(i, blockPos.getY(), blockEntity.getType(), compoundTag.isEmpty() ? null : compoundTag);
}
diff --git a/src/main/java/net/minecraft/world/level/block/entity/SkullBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/SkullBlockEntity.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/SkullBlockEntity.java
@ -78,11 +78,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
import net.minecraft.network.protocol.game.ClientboundBlockEntityDataPacket;
import net.minecraft.server.players.GameProfileCache;
@@ -0,0 +0,0 @@ public class SkullBlockEntity extends BlockEntity {
@Nullable
@Override
public ClientboundBlockEntityDataPacket getUpdatePacket() {
- return new ClientboundBlockEntityDataPacket(this.worldPosition, 4, this.getUpdateTag());
+ return new ClientboundBlockEntityDataPacket(this.worldPosition, 4, sanitizeTileEntityUUID(this.getUpdateTag())); // Paper
- return ClientboundBlockEntityDataPacket.create(this);
+ return ClientboundBlockEntityDataPacket.create(this, e -> sanitizeTileEntityUUID(e.getUpdateTag())); // Paper
}
+ // Paper start
@ -115,4 +115,4 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+
@Override
public CompoundTag getUpdateTag() {
return this.save(new CompoundTag());
return this.saveWithoutMetadata();

View file

@ -95,7 +95,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
target.push((double) (-Mth.sin(this.getYRot() * 0.017453292F) * (float) i * 0.5F), 0.1D, (double) (Mth.cos(this.getYRot() * 0.017453292F) * (float) i * 0.5F));
}
@@ -0,0 +0,0 @@ public abstract class Player extends LivingEntity {
if (entityliving != this && entityliving != target && !this.isAlliedTo(entityliving) && (!(entityliving instanceof ArmorStand) || !((ArmorStand) entityliving).isMarker()) && this.distanceToSqr((Entity) entityliving) < 9.0D) {
if (entityliving != this && entityliving != target && !this.isAlliedTo((Entity) entityliving) && (!(entityliving instanceof ArmorStand) || !((ArmorStand) entityliving).isMarker()) && this.distanceToSqr((Entity) entityliving) < 9.0D) {
// CraftBukkit start - Only apply knockback if the damage hits
if (entityliving.hurt(DamageSource.playerAttack(this).sweep(), f4)) {
- entityliving.knockback(0.4000000059604645D, (double) Mth.sin(this.getYRot() * 0.017453292F), (double) (-Mth.cos(this.getYRot() * 0.017453292F)));

View file

@ -17,15 +17,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
private int size;
+ private java.util.BitSet usedIds; // Paper
public CrudeIncrementalIntIdentityHashBiMap(int size) {
size = (int)((float)size / 0.8F);
private CrudeIncrementalIntIdentityHashBiMap(int size) {
this.keys = (K[])(new Object[size]);
this.values = new int[size];
this.byId = (K[])(new Object[size]);
+ this.usedIds = new java.util.BitSet(); // Paper
}
@Override
public static <A> CrudeIncrementalIntIdentityHashBiMap<A> create(int expectedSize) {
@@ -0,0 +0,0 @@ public class CrudeIncrementalIntIdentityHashBiMap<K> implements IdMap<K> {
}
@ -41,13 +40,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
return this.nextId;
}
@@ -0,0 +0,0 @@ public class CrudeIncrementalIntIdentityHashBiMap<K> implements IdMap<K> {
this.byId = (K[])(new Object[newSize]);
this.nextId = 0;
this.size = 0;
this.byId = crudeIncrementalIntIdentityHashBiMap.byId;
this.nextId = crudeIncrementalIntIdentityHashBiMap.nextId;
this.size = crudeIncrementalIntIdentityHashBiMap.size;
+ this.usedIds.clear(); // Paper
}
for(int i = 0; i < objects.length; ++i) {
if (objects[i] != null) {
public void addMapping(K value, int id) {
@@ -0,0 +0,0 @@ public class CrudeIncrementalIntIdentityHashBiMap<K> implements IdMap<K> {
this.keys[k] = value;
this.values[k] = id;
@ -63,4 +62,4 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ this.usedIds.clear(); // Paper
}
public int size() {
@Override

View file

@ -27,7 +27,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@Override
protected void pushEntities() {
+ if (!level.paperConfig.armorStandEntityLookups) return; // Paper
List<Entity> list = this.level.getEntities(this, this.getBoundingBox(), ArmorStand.RIDABLE_MINECARTS);
List<Entity> list = this.level.getEntities((Entity) this, this.getBoundingBox(), ArmorStand.RIDABLE_MINECARTS);
for (int i = 0; i < list.size(); ++i) {
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
@ -46,5 +46,5 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ }
+ // Paper end
public Explosion explode(@Nullable Entity entity, double x, double y, double z, float power, Explosion.BlockInteraction destructionType) {
return this.explode(entity, (DamageSource) null, (ExplosionDamageCalculator) null, x, y, z, power, false, destructionType);
public boolean shouldTickDeath(Entity entity) {
return true;

View file

@ -212,7 +212,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
// CraftBukkit start - moved up
/*
@@ -0,0 +0,0 @@ public class SnowballItem extends Item {
itemstack.subtract(1);
itemstack.shrink(1);
}
*/
+ // Paper end

View file

@ -17,7 +17,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ BlockState blockState = world.getTypeIfLoaded(mutableBlockPos); // Paper
+ if (blockState == null) { continue; } // Paper
if (blockState.is(this) && !this.slightlyMelt(blockState, world, mutableBlockPos)) {
world.getBlockTicks().scheduleTick(mutableBlockPos, this, Mth.nextInt(random, world.paperConfig.frostedIceDelayMin, world.paperConfig.frostedIceDelayMax)); // Paper - use configurable min/max delay
world.scheduleTick(mutableBlockPos, this, Mth.nextInt(random, world.paperConfig.frostedIceDelayMin, world.paperConfig.frostedIceDelayMax)); // Paper - use configurable min/max delay
}
@@ -0,0 +0,0 @@ public class FrostedIceBlock extends IceBlock {

View file

@ -8,7 +8,7 @@ diff --git a/src/main/java/net/minecraft/world/entity/animal/horse/SkeletonTrapG
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/entity/animal/horse/SkeletonTrapGoal.java
+++ b/src/main/java/net/minecraft/world/entity/animal/horse/SkeletonTrapGoal.java
@@ -0,0 +0,0 @@ import net.minecraft.world.level.Level;
@@ -0,0 +0,0 @@ import net.minecraft.world.item.enchantment.EnchantmentHelper;
public class SkeletonTrapGoal extends Goal {
private final SkeletonHorse horse;

Some files were not shown because too many files have changed in this diff Show more