More more more more work

This commit is contained in:
Nassim Jahnke 2021-11-23 14:22:49 +01:00
parent 979f2cdf25
commit 91fcee0c04
85 changed files with 69 additions and 58 deletions

View file

@ -8,5 +8,3 @@
# To import classes from the vanilla Minecraft jar use `minecraft` as the artifactId: # To import classes from the vanilla Minecraft jar use `minecraft` as the artifactId:
# minecraft net.minecraft.world.level.entity.LevelEntityGetterAdapter # minecraft net.minecraft.world.level.entity.LevelEntityGetterAdapter
# minecraft net/minecraft/world/level/entity/LevelEntityGetter.java # minecraft net/minecraft/world/level/entity/LevelEntityGetter.java
minecraft net.minecraft.network.protocol.game.ClientboundLoginPacket

View file

@ -14,7 +14,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
if (world.getDifficulty() != Difficulty.PEACEFUL) { if (world.getDifficulty() != Difficulty.PEACEFUL) {
- Villager.LOGGER.info("Villager {} was struck by lightning {}.", this, lightning); - Villager.LOGGER.info("Villager {} was struck by lightning {}.", this, lightning);
+ // Paper - move log down, event can cancel + // Paper - move log down, event can cancel
Witch entitywitch = (Witch) EntityType.WITCH.create((Level) world); Witch entitywitch = (Witch) EntityType.WITCH.create(world);
+ // Paper start + // Paper start
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityZapEvent(this, lightning, entitywitch).isCancelled()) { + if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityZapEvent(this, lightning, entitywitch).isCancelled()) {

View file

@ -40,7 +40,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit
@@ -0,0 +0,0 @@ public abstract class AbstractHurtingProjectile extends Projectile { @@ -0,0 +0,0 @@ public abstract class AbstractHurtingProjectile extends Projectile {
HitResult movingobjectposition = ProjectileUtil.getHitResult((Entity) this, this::canHitEntity); HitResult movingobjectposition = ProjectileUtil.getHitResult(this, this::canHitEntity);
- if (movingobjectposition.getType() != HitResult.Type.MISS) { - if (movingobjectposition.getType() != HitResult.Type.MISS) {
+ // Paper start - Call ProjectileCollideEvent + // Paper start - Call ProjectileCollideEvent

View file

@ -39,14 +39,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
mutableBlockPos.setWithOffset(pos, direction); mutableBlockPos.setWithOffset(pos, direction);
BlockState blockState = world.getBlockState(mutableBlockPos); BlockState blockState = world.getBlockState(mutableBlockPos);
if (blockState.is(this) && !this.slightlyMelt(blockState, world, mutableBlockPos)) { if (blockState.is(this) && !this.slightlyMelt(blockState, world, mutableBlockPos)) {
- world.getBlockTicks().scheduleTick(mutableBlockPos, this, Mth.nextInt(random, 20, 40)); - world.scheduleTick(mutableBlockPos, this, Mth.nextInt(random, 20, 40));
+ 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
} }
} }
} else { } else {
- world.getBlockTicks().scheduleTick(pos, this, Mth.nextInt(random, 20, 40)); - world.scheduleTick(pos, this, Mth.nextInt(random, 20, 40));
+ world.getBlockTicks().scheduleTick(pos, this, Mth.nextInt(random, world.paperConfig.frostedIceDelayMin, world.paperConfig.frostedIceDelayMax)); // Paper - use configurable min/max delay + world.scheduleTick(pos, this, Mth.nextInt(random, world.paperConfig.frostedIceDelayMin, world.paperConfig.frostedIceDelayMax)); // Paper - use configurable min/max delay
} }
} }

View file

@ -37,11 +37,11 @@ diff --git a/src/main/java/net/minecraft/world/level/levelgen/feature/StructureF
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/level/levelgen/feature/StructureFeature.java --- a/src/main/java/net/minecraft/world/level/levelgen/feature/StructureFeature.java
+++ b/src/main/java/net/minecraft/world/level/levelgen/feature/StructureFeature.java +++ b/src/main/java/net/minecraft/world/level/levelgen/feature/StructureFeature.java
@@ -0,0 +0,0 @@ public abstract class StructureFeature<C extends FeatureConfiguration> { @@ -0,0 +0,0 @@ public class StructureFeature<C extends FeatureConfiguration> {
int o = j + i * m; int o = j + i * m;
int p = k + i * n; int p = k + i * n;
ChunkPos chunkPos = this.getPotentialFeatureChunk(config, worldSeed, worldgenRandom, o, p); ChunkPos chunkPos = this.getPotentialFeatureChunk(config, worldSeed, o, p);
+ if (!world.getWorldBorder().isChunkInBounds(chunkPos.x, chunkPos.z)) { continue; } // Paper + if (!levelReader.getWorldBorder().isChunkInBounds(chunkPos.x, chunkPos.z)) { continue; } // Paper
boolean bl3 = world.getBiomeManager().getPrimaryBiomeAtChunk(chunkPos).getGenerationSettings().isValidStart(this); StructureCheckResult structureCheckResult = structureAccessor.checkStructurePresence(chunkPos, this, skipExistingChunks);
if (bl3) { if (structureCheckResult != StructureCheckResult.START_NOT_PRESENT) {
ChunkAccess chunkAccess = world.getChunk(chunkPos.x, chunkPos.z, ChunkStatus.STRUCTURE_STARTS); if (!skipExistingChunks && structureCheckResult == StructureCheckResult.START_PRESENT) {

View file

@ -30,7 +30,7 @@ diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/jav
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java --- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/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 final org.spigotmc.ActivationRange.ActivationType activationType = org.spigotmc.ActivationRange.initializeEntityActivationType(this); public final org.spigotmc.ActivationRange.ActivationType activationType = org.spigotmc.ActivationRange.initializeEntityActivationType(this);
public final boolean defaultActivationState; public final boolean defaultActivationState;
public long activatedTick = Integer.MIN_VALUE; public long activatedTick = Integer.MIN_VALUE;

View file

@ -35,7 +35,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@Override @Override
public void randomTick(BlockState state, ServerLevel world, BlockPos pos, Random random) { public void randomTick(BlockState state, ServerLevel world, BlockPos pos, Random random) {
- if (!SpreadingSnowyDirtBlock.canBeGrass(state, world, pos)) {
+ if (this instanceof GrassBlock && world.paperConfig.grassUpdateRate != 1 && (world.paperConfig.grassUpdateRate < 1 || (MinecraftServer.currentTick + pos.hashCode()) % world.paperConfig.grassUpdateRate != 0)) { return; } // Paper + if (this instanceof GrassBlock && world.paperConfig.grassUpdateRate != 1 && (world.paperConfig.grassUpdateRate < 1 || (MinecraftServer.currentTick + pos.hashCode()) % world.paperConfig.grassUpdateRate != 0)) { return; } // Paper
if (!SpreadingSnowyDirtBlock.canBeGrass(state, (LevelReader) world, pos)) { + if (!SpreadingSnowyDirtBlock.canBeGrass(state, (LevelReader) world, pos)) {
// CraftBukkit start // CraftBukkit start
if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockFadeEvent(world, pos, Blocks.DIRT.defaultBlockState()).isCancelled()) { if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockFadeEvent(world, pos, Blocks.DIRT.defaultBlockState()).isCancelled()) {
return;

View file

@ -8,7 +8,7 @@ diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/jav
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java --- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/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
} }
protected boolean addPassenger(Entity entity) { // CraftBukkit protected boolean addPassenger(Entity entity) { // CraftBukkit

View file

@ -37,6 +37,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- player.heal(f / 6.0F, org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason.SATIATED); // CraftBukkit - added RegainReason - player.heal(f / 6.0F, org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason.SATIATED); // CraftBukkit - added RegainReason
+ player.heal(f / 6.0F, org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason.SATIATED, true); // CraftBukkit - added RegainReason // Paper - This is fast regen + player.heal(f / 6.0F, org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason.SATIATED, true); // CraftBukkit - added RegainReason // Paper - This is fast regen
// this.a(f); CraftBukkit - EntityExhaustionEvent // this.addExhaustion(f); CraftBukkit - EntityExhaustionEvent
player.applyExhaustion(f, org.bukkit.event.entity.EntityExhaustionEvent.ExhaustionReason.REGEN); // CraftBukkit - EntityExhaustionEvent player.causeFoodExhaustion(f, org.bukkit.event.entity.EntityExhaustionEvent.ExhaustionReason.REGEN); // CraftBukkit - EntityExhaustionEvent
this.tickTimer = 0; this.tickTimer = 0;

View file

@ -263,8 +263,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
public void onTake(net.minecraft.world.entity.player.Player player, ItemStack stack) { public void onTake(net.minecraft.world.entity.player.Player player, ItemStack stack) {
context.execute((world, blockposition) -> { context.execute((world, blockposition) -> {
if (world instanceof ServerLevel) { if (world instanceof ServerLevel) {
- ExperienceOrb.award((ServerLevel) world, Vec3.atCenterOf((Vec3i) blockposition), this.getExperienceAmount(world)); - ExperienceOrb.award((ServerLevel) world, Vec3.atCenterOf(blockposition), this.getExperienceAmount(world));
+ ExperienceOrb.award((ServerLevel) world, Vec3.atCenterOf((Vec3i) blockposition), this.getExperienceAmount(world), org.bukkit.entity.ExperienceOrb.SpawnReason.GRINDSTONE, player); // Paper + ExperienceOrb.award((ServerLevel) world, Vec3.atCenterOf(blockposition), this.getExperienceAmount(world), org.bukkit.entity.ExperienceOrb.SpawnReason.GRINDSTONE, player); // Paper
} }
world.levelEvent(1042, blockposition, 0); world.levelEvent(1042, blockposition, 0);
@ -282,8 +282,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ public void popExperience(ServerLevel world, BlockPos pos, int size, net.minecraft.server.level.ServerPlayer player) { + public void popExperience(ServerLevel world, BlockPos pos, int size, net.minecraft.server.level.ServerPlayer player) {
+ // Paper end - add player parameter + // Paper end - add player parameter
if (world.getGameRules().getBoolean(GameRules.RULE_DOBLOCKDROPS)) { if (world.getGameRules().getBoolean(GameRules.RULE_DOBLOCKDROPS)) {
- ExperienceOrb.award(world, Vec3.atCenterOf((Vec3i) pos), size); - ExperienceOrb.award(world, Vec3.atCenterOf(pos), size);
+ ExperienceOrb.award(world, Vec3.atCenterOf((Vec3i) pos), size, org.bukkit.entity.ExperienceOrb.SpawnReason.BLOCK_BREAK, player); // Paper + ExperienceOrb.award(world, Vec3.atCenterOf(pos), size, org.bukkit.entity.ExperienceOrb.SpawnReason.BLOCK_BREAK, player); // Paper
} }
} }

View file

@ -33,7 +33,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@@ -0,0 +0,0 @@ public class RedstoneTorchBlock extends TorchBlock { @@ -0,0 +0,0 @@ public class RedstoneTorchBlock extends TorchBlock {
@Override @Override
public void tick(BlockState state, ServerLevel world, BlockPos pos, Random random) { public void tick(BlockState state, ServerLevel world, BlockPos pos, Random random) {
boolean flag = this.hasNeighborSignal((Level) world, pos, state); boolean flag = this.hasNeighborSignal(world, pos, state);
- List list = (List) RedstoneTorchBlock.RECENT_TOGGLES.get(world); - List list = (List) RedstoneTorchBlock.RECENT_TOGGLES.get(world);
- -
- while (list != null && !list.isEmpty() && world.getGameTime() - ((RedstoneTorchBlock.Toggle) list.get(0)).when > 60L) { - while (list != null && !list.isEmpty() && world.getGameTime() - ((RedstoneTorchBlock.Toggle) list.get(0)).when > 60L) {

View file

@ -12,7 +12,7 @@ diff --git a/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.ja
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java --- a/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java
@@ -0,0 +0,0 @@ public abstract class BlockEntity implements net.minecraft.server.KeyedObject { @@ -0,0 +0,0 @@ public abstract class BlockEntity implements io.papermc.paper.util.KeyedObject {
public CraftPersistentDataContainer persistentDataContainer; public CraftPersistentDataContainer persistentDataContainer;
// CraftBukkit end // CraftBukkit end
private static final Logger LOGGER = LogManager.getLogger(); private static final Logger LOGGER = LogManager.getLogger();

View file

@ -518,7 +518,7 @@ diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/jav
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java --- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/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
}; };
// Paper end // Paper end

View file

@ -28,11 +28,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@@ -0,0 +0,0 @@ public class WitherBoss extends Monster implements PowerableMob, RangedAttackMob @@ -0,0 +0,0 @@ public class WitherBoss extends Monster implements PowerableMob, RangedAttackMob
if (!this.isSilent()) { if (!this.isSilent()) {
// CraftBukkit start - Use relative location for far away sounds // CraftBukkit start - Use relative location for far away sounds
// this.world.b(1023, new BlockPosition(this), 0); // this.world.globalLevelEvent(1023, new BlockPosition(this), 0);
- int viewDistance = ((ServerLevel) this.level).getCraftServer().getViewDistance() * 16; - int viewDistance = ((ServerLevel) this.level).getCraftServer().getViewDistance() * 16;
- for (ServerPlayer player : (List<ServerPlayer>) MinecraftServer.getServer().getPlayerList().players) { + //int viewDistance = ((ServerLevel) this.level).getCraftServer().getViewDistance() * 16; // Paper - updated to use worlds actual view distance incase we have to uncomment this due to removal of player view distance API
+ //int viewDistance = ((WorldServer) this.world).getServer().getViewDistance() * 16; // Paper - updated to use worlds actual view distance incase we have to uncomment this due to removal of player view distance API for (ServerPlayer player : (List<ServerPlayer>) MinecraftServer.getServer().getPlayerList().players) {
+ for (ServerPlayer player : (List<ServerPlayer>)this.level.players()) {
+ final int viewDistance = player.getViewDistance(); // TODO apply view distance api patch + final int viewDistance = player.getViewDistance(); // TODO apply view distance api patch
double deltaX = this.getX() - player.getX(); double deltaX = this.getX() - player.getX();
double deltaZ = this.getZ() - player.getZ(); double deltaZ = this.getZ() - player.getZ();

View file

@ -55,18 +55,19 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/world/level/block/state/properties/Property.java --- a/src/main/java/net/minecraft/world/level/block/state/properties/Property.java
+++ b/src/main/java/net/minecraft/world/level/block/state/properties/Property.java +++ b/src/main/java/net/minecraft/world/level/block/state/properties/Property.java
@@ -0,0 +0,0 @@ public abstract class Property<T extends Comparable<T>> { @@ -0,0 +0,0 @@ public abstract class Property<T extends Comparable<T>> {
}
@Override
public boolean equals(Object object) { public boolean equals(Object object) {
- if (this == object) { - if (this == object) {
- return true; - return true;
- } else if (!(object instanceof Property)) { - } else if (!(object instanceof Property)) {
- return false; - return false;
- } else { - } else {
- Property<?> property = (Property)object; - Property<?> iblockstate = (Property) object;
- return this.clazz.equals(property.clazz) && this.name.equals(property.name); -
- return this.clazz.equals(iblockstate.clazz) && this.name.equals(iblockstate.name);
- } - }
+ return this == object; + return this == object; // Paper
} }
@Override public final int hashCode() {

View file

@ -10,11 +10,11 @@ After: http://i.imgur.com/nJ46crB.png
Optimize redundant converting of static fields into an unsigned long each call by precomputing it in ctor Optimize redundant converting of static fields into an unsigned long each call by precomputing it in ctor
diff --git a/src/main/java/net/minecraft/util/BitStorage.java b/src/main/java/net/minecraft/util/BitStorage.java diff --git a/src/main/java/net/minecraft/util/SimpleBitStorage.java b/src/main/java/net/minecraft/util/SimpleBitStorage.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/util/BitStorage.java --- a/src/main/java/net/minecraft/util/SimpleBitStorage.java
+++ b/src/main/java/net/minecraft/util/BitStorage.java +++ b/src/main/java/net/minecraft/util/SimpleBitStorage.java
@@ -0,0 +0,0 @@ public class BitStorage { @@ -0,0 +0,0 @@ public class SimpleBitStorage implements BitStorage {
private final long mask; private final long mask;
private final int size; private final int size;
private final int valuesPerLong; private final int valuesPerLong;
@ -24,19 +24,19 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ private final int divideAdd; private final long divideAddUnsigned; // Paper + private final int divideAdd; private final long divideAddUnsigned; // Paper
private final int divideShift; private final int divideShift;
public BitStorage(int elementBits, int size) { public SimpleBitStorage(int elementBits, int size, int[] is) {
@@ -0,0 +0,0 @@ public class BitStorage { @@ -0,0 +0,0 @@ public class SimpleBitStorage implements BitStorage {
this.mask = (1L << elementBits) - 1L; this.mask = (1L << elementBits) - 1L;
this.valuesPerLong = (char)(64 / elementBits); this.valuesPerLong = (char)(64 / elementBits);
int i = 3 * (this.valuesPerLong - 1); int i = 3 * (this.valuesPerLong - 1);
- this.divideMul = MAGIC[i + 0]; - this.divideMul = MAGIC[i + 0];
- this.divideAdd = MAGIC[i + 1]; - this.divideAdd = MAGIC[i + 1];
+ this.divideMul = BitStorage.MAGIC[i + 0]; this.divideMulUnsigned = Integer.toUnsignedLong(this.divideMul); // Paper + this.divideMul = MAGIC[i + 0]; this.divideMulUnsigned = Integer.toUnsignedLong(this.divideMul); // Paper
+ this.divideAdd = BitStorage.MAGIC[i + 1]; this.divideAddUnsigned = Integer.toUnsignedLong(this.divideAdd); // Paper + this.divideAdd = MAGIC[i + 1]; this.divideAddUnsigned = Integer.toUnsignedLong(this.divideAdd); // Paper
this.divideShift = MAGIC[i + 2]; this.divideShift = MAGIC[i + 2];
int j = (size + this.valuesPerLong - 1) / this.valuesPerLong; int j = (size + this.valuesPerLong - 1) / this.valuesPerLong;
if (storage != null) { if (data != null) {
@@ -0,0 +0,0 @@ public class BitStorage { @@ -0,0 +0,0 @@ public class SimpleBitStorage implements BitStorage {
} }
private int cellIndex(int index) { private int cellIndex(int index) {
@ -48,6 +48,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ return (int) ((long) index * this.divideMulUnsigned + this.divideAddUnsigned >> 32 >> this.divideShift); // Paper + return (int) ((long) index * this.divideMulUnsigned + this.divideAddUnsigned >> 32 >> this.divideShift); // Paper
} }
@Override
- public int getAndSet(int index, int value) { - public int getAndSet(int index, int value) {
- Validate.inclusiveBetween(0L, (long)(this.size - 1), (long)index); - Validate.inclusiveBetween(0L, (long)(this.size - 1), (long)index);
- Validate.inclusiveBetween(0L, this.mask, (long)value); - Validate.inclusiveBetween(0L, this.mask, (long)value);
@ -57,10 +58,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
int i = this.cellIndex(index); int i = this.cellIndex(index);
long l = this.data[i]; long l = this.data[i];
int j = (index - i * this.valuesPerLong) * this.bits; int j = (index - i * this.valuesPerLong) * this.bits;
@@ -0,0 +0,0 @@ public class BitStorage { @@ -0,0 +0,0 @@ public class SimpleBitStorage implements BitStorage {
return k;
} }
@Override
- public void set(int index, int value) { - public void set(int index, int value) {
- Validate.inclusiveBetween(0L, (long)(this.size - 1), (long)index); - Validate.inclusiveBetween(0L, (long)(this.size - 1), (long)index);
- Validate.inclusiveBetween(0L, this.mask, (long)value); - Validate.inclusiveBetween(0L, this.mask, (long)value);
@ -70,9 +71,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
int i = this.cellIndex(index); int i = this.cellIndex(index);
long l = this.data[i]; long l = this.data[i];
int j = (index - i * this.valuesPerLong) * this.bits; int j = (index - i * this.valuesPerLong) * this.bits;
this.data[i] = l & ~(this.mask << j) | ((long)value & this.mask) << j; @@ -0,0 +0,0 @@ public class SimpleBitStorage implements BitStorage {
} }
@Override
- public int get(int index) { - public int get(int index) {
- Validate.inclusiveBetween(0L, (long)(this.size - 1), (long)index); - Validate.inclusiveBetween(0L, (long)(this.size - 1), (long)index);
+ public final int get(int index) { // Paper - make final for inline + public final int get(int index) { // Paper - make final for inline

View file

@ -22,14 +22,23 @@ diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java --- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java +++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
@@ -0,0 +0,0 @@ public class LevelChunk implements ChunkAccess { @@ -0,0 +0,0 @@ public class LevelChunk extends ChunkAccess {
}
this.setLightCorrect(protoChunk.isLightCorrect());
- this.unsaved = true;
+ this.setUnsaved(true);
this.needsDecoration = true; // CraftBukkit
}
@@ -0,0 +0,0 @@ public class LevelChunk extends ChunkAccess {
"Chunk coordinates: " + (this.chunkPos.x * 16) + "," + (this.chunkPos.z * 16)); "Chunk coordinates: " + (this.chunkPos.x * 16) + "," + (this.chunkPos.z * 16));
e.printStackTrace(); e.printStackTrace();
ServerInternalException.reportInternalException(e); ServerInternalException.reportInternalException(e);
+ +
+ if (this.level.paperConfig.removeCorruptTEs) { + if (this.level.paperConfig.removeCorruptTEs) {
+ this.removeBlockEntity(blockEntity.getBlockPos()); + this.removeBlockEntity(blockEntity.getBlockPos());
+ this.markUnsaved(); + this.setUnsaved(true);
+ org.bukkit.Bukkit.getLogger().info("Removing corrupt tile entity"); + org.bukkit.Bukkit.getLogger().info("Removing corrupt tile entity");
+ } + }
// Paper end // Paper end

View file

@ -9,7 +9,7 @@ diff --git a/src/main/java/net/minecraft/world/level/block/entity/TheEndGatewayB
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/TheEndGatewayBlockEntity.java --- a/src/main/java/net/minecraft/world/level/block/entity/TheEndGatewayBlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/TheEndGatewayBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/TheEndGatewayBlockEntity.java
@@ -0,0 +0,0 @@ import net.minecraft.data.worldgen.Features; @@ -0,0 +0,0 @@ import net.minecraft.data.worldgen.features.EndFeatures;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.NbtUtils; import net.minecraft.nbt.NbtUtils;
import net.minecraft.network.protocol.game.ClientboundBlockEntityDataPacket; import net.minecraft.network.protocol.game.ClientboundBlockEntityDataPacket;

View file

@ -39,8 +39,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ runtimeOnly("org.apache.logging.log4j:log4j-core:2.14.1") + runtimeOnly("org.apache.logging.log4j:log4j-core:2.14.1")
+ // Paper end + // Paper end
implementation("org.apache.logging.log4j:log4j-iostreams:2.14.1") // Paper implementation("org.apache.logging.log4j:log4j-iostreams:2.14.1") // Paper
implementation("org.apache.logging.log4j:log4j-api:2.14.1") // Paper
implementation("org.ow2.asm:asm:9.2") implementation("org.ow2.asm:asm:9.2")
implementation("org.ow2.asm:asm-commons:9.2") // Paper - ASM event executor generation
diff --git a/src/main/java/com/destroystokyo/paper/console/PaperConsole.java b/src/main/java/com/destroystokyo/paper/console/PaperConsole.java diff --git a/src/main/java/com/destroystokyo/paper/console/PaperConsole.java b/src/main/java/com/destroystokyo/paper/console/PaperConsole.java
new file mode 100644 new file mode 100644
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
@ -121,12 +121,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
import com.mojang.datafixers.DataFixer; import com.mojang.datafixers.DataFixer;
+import io.papermc.paper.adventure.PaperAdventure; // Paper +import io.papermc.paper.adventure.PaperAdventure; // Paper
import it.unimi.dsi.fastutil.longs.LongIterator; import it.unimi.dsi.fastutil.longs.LongIterator;
import java.awt.GraphicsEnvironment;
import java.awt.image.BufferedImage; import java.awt.image.BufferedImage;
import java.io.BufferedWriter;
@@ -0,0 +0,0 @@ import org.apache.logging.log4j.Logger; @@ -0,0 +0,0 @@ import org.apache.logging.log4j.Logger;
// CraftBukkit start
import com.mojang.serialization.DynamicOps; import com.mojang.serialization.DynamicOps;
import com.mojang.serialization.Lifecycle; import com.mojang.serialization.Lifecycle;
import com.google.common.collect.ImmutableSet;
-import jline.console.ConsoleReader; -import jline.console.ConsoleReader;
+// import jline.console.ConsoleReader; // Paper +// import jline.console.ConsoleReader; // Paper
import joptsimple.OptionSet; import joptsimple.OptionSet;
@ -247,9 +247,9 @@ diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/ja
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -0,0 +0,0 @@ import java.util.function.Consumer; @@ -0,0 +0,0 @@ import java.util.logging.Level;
import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
import java.util.stream.Collectors;
import javax.imageio.ImageIO; import javax.imageio.ImageIO;
-import jline.console.ConsoleReader; -import jline.console.ConsoleReader;
import net.minecraft.advancements.Advancement; import net.minecraft.advancements.Advancement;

View file

@ -11,12 +11,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -0,0 +0,0 @@ import org.spigotmc.SlackActivityAccountant; // Spigot @@ -0,0 +0,0 @@ import org.spigotmc.SlackActivityAccountant; // Spigot
public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTask> implements SnooperPopulator, CommandSource, AutoCloseable { public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTask> implements CommandSource, AutoCloseable {
+ private static MinecraftServer SERVER; // Paper + private static MinecraftServer SERVER; // Paper
public static final Logger LOGGER = LogManager.getLogger(); public static final Logger LOGGER = LogManager.getLogger();
public static final String VANILLA_BRAND = "vanilla";
private static final float AVERAGE_TICK_TIME_SMOOTHING = 0.8F; private static final float AVERAGE_TICK_TIME_SMOOTHING = 0.8F;
private static final int TICK_STATS_SPAN = 100;
@@ -0,0 +0,0 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -0,0 +0,0 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
public MinecraftServer(OptionSet options, DataPackConfig datapackconfiguration, Thread thread, RegistryAccess.RegistryHolder iregistrycustom_dimension, LevelStorageSource.LevelStorageAccess convertable_conversionsession, WorldData savedata, PackRepository resourcepackrepository, Proxy proxy, DataFixer datafixer, ServerResources datapackresources, @Nullable MinecraftSessionService minecraftsessionservice, @Nullable GameProfileRepository gameprofilerepository, @Nullable GameProfileCache usercache, ChunkProgressListenerFactory worldloadlistenerfactory) { public MinecraftServer(OptionSet options, DataPackConfig datapackconfiguration, Thread thread, RegistryAccess.RegistryHolder iregistrycustom_dimension, LevelStorageSource.LevelStorageAccess convertable_conversionsession, WorldData savedata, PackRepository resourcepackrepository, Proxy proxy, DataFixer datafixer, ServerResources datapackresources, @Nullable MinecraftSessionService minecraftsessionservice, @Nullable GameProfileRepository gameprofilerepository, @Nullable GameProfileCache usercache, ChunkProgressListenerFactory worldloadlistenerfactory) {