13
0
geforkt von Mirrors/Paper
Dieser Commit ist enthalten in:
Mariell Hoversholm 2021-03-16 16:50:45 +01:00
Ursprung 908c938d0c
Commit 0750bfaf8c
92 geänderte Dateien mit 959 neuen und 135 gelöschten Zeilen

Datei anzeigen

@ -45,6 +45,24 @@ diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -0,0 +0,0 @@ import net.minecraft.server.level.WorldServer;
import net.minecraft.server.network.PlayerConnection;
import net.minecraft.server.players.WhiteListEntry;
import net.minecraft.world.entity.Entity;
+import net.minecraft.world.entity.EntityExperienceOrb;
import net.minecraft.world.entity.EntityLiving;
+import net.minecraft.world.entity.EntityTypes;
import net.minecraft.world.entity.ai.attributes.AttributeMapBase;
import net.minecraft.world.entity.ai.attributes.AttributeModifiable;
import net.minecraft.world.entity.ai.attributes.GenericAttributes;
import net.minecraft.world.entity.player.EntityHuman;
import net.minecraft.world.inventory.Container;
import net.minecraft.world.item.EnumColor;
+import net.minecraft.world.item.enchantment.EnchantmentManager;
+import net.minecraft.world.item.enchantment.Enchantments;
import net.minecraft.world.level.EnumGamemode;
import net.minecraft.world.level.block.entity.TileEntitySign;
import net.minecraft.world.level.saveddata.maps.MapIcon;
@@ -0,0 +0,0 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
return GameMode.getByValue(getHandle().playerInteractManager.getGameMode().getId());
}
@ -55,10 +73,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ public int applyMending(int amount) {
+ EntityPlayer handle = getHandle();
+ // Logic copied from EntityExperienceOrb and remapped to unobfuscated methods/properties
+ net.minecraft.server.ItemStack itemstack = net.minecraft.server.EnchantmentManager.getRandomEquippedItemWithEnchant(net.minecraft.server.Enchantments.MENDING, handle);
+ net.minecraft.world.item.ItemStack itemstack = EnchantmentManager.getRandomEquippedItemWithEnchant(Enchantments.MENDING, handle);
+ if (!itemstack.isEmpty() && itemstack.getItem().usesDurability()) {
+
+ net.minecraft.server.EntityExperienceOrb orb = net.minecraft.server.EntityTypes.EXPERIENCE_ORB.create(handle.world);
+ EntityExperienceOrb orb = EntityTypes.EXPERIENCE_ORB.create(handle.world);
+ orb.value = amount;
+ orb.spawnReason = org.bukkit.entity.ExperienceOrb.SpawnReason.CUSTOM;
+ orb.setPositionRaw(handle.locX(), handle.locY(), handle.locZ());

Datei anzeigen

@ -18,6 +18,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
import javax.annotation.Nullable;
import net.minecraft.core.BlockPosition;
import net.minecraft.core.EnumDirection;
+import net.minecraft.server.MCUtil;
import net.minecraft.sounds.SoundCategory;
import net.minecraft.sounds.SoundEffects;
import net.minecraft.stats.StatisticList;
@@ -0,0 +0,0 @@ public class BlockBell extends BlockTileEntity {
boolean flag1 = !flag || this.a(iblockdata, enumdirection, movingobjectpositionblock.getPos().y - (double) blockposition.getY());

Datei anzeigen

@ -37,13 +37,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ throw new UnsupportedOperationException(); // TODO
+ //return this.world.getHighestBlockY(HeightMap.Type.LIGHT_BLOCKING, x, z);
+ case ANY:
+ return this.world.getHighestBlockY(net.minecraft.server.HeightMap.Type.WORLD_SURFACE, x, z);
+ return this.world.getHighestBlockY(net.minecraft.world.level.levelgen.HeightMap.Type.WORLD_SURFACE, x, z);
+ case SOLID:
+ return this.world.getHighestBlockY(net.minecraft.server.HeightMap.Type.OCEAN_FLOOR, x, z);
+ return this.world.getHighestBlockY(net.minecraft.world.level.levelgen.HeightMap.Type.OCEAN_FLOOR, x, z);
+ case SOLID_OR_LIQUID:
+ return this.world.getHighestBlockY(net.minecraft.server.HeightMap.Type.MOTION_BLOCKING, x, z);
+ return this.world.getHighestBlockY(net.minecraft.world.level.levelgen.HeightMap.Type.MOTION_BLOCKING, x, z);
+ case SOLID_OR_LIQUID_NO_LEAVES:
+ return this.world.getHighestBlockY(net.minecraft.server.HeightMap.Type.MOTION_BLOCKING_NO_LEAVES, x, z);
+ return this.world.getHighestBlockY(net.minecraft.world.level.levelgen.HeightMap.Type.MOTION_BLOCKING_NO_LEAVES, x, z);
+ default:
+ throw new UnsupportedOperationException();
+ }

Datei anzeigen

@ -42,6 +42,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ public java.util.UUID getSpawningEntity() {
+ return spawningEntity;
+ }
+ public void setSpawningEntity(java.util.UUID entity) { this.spawningEntity = entity; }
+ // Paper end
+
class b extends PathfinderGoal {
@ -51,6 +52,14 @@ diff --git a/src/main/java/net/minecraft/world/level/levelgen/MobSpawnerPhantom.
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/level/levelgen/MobSpawnerPhantom.java
+++ b/src/main/java/net/minecraft/world/level/levelgen/MobSpawnerPhantom.java
@@ -0,0 +0,0 @@ import java.util.Iterator;
import java.util.Random;
import net.minecraft.core.BlockPosition;
import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.server.MCUtil;
import net.minecraft.server.level.EntityPlayer;
import net.minecraft.server.level.WorldServer;
import net.minecraft.stats.ServerStatisticManager;
@@ -0,0 +0,0 @@ public class MobSpawnerPhantom implements MobSpawner {
int k = 1 + random.nextInt(difficultydamagescaler.a().a() + 1);
@ -66,7 +75,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ // Paper end
EntityPhantom entityphantom = (EntityPhantom) EntityTypes.PHANTOM.a((World) worldserver);
-
+ entityphantom.spawningEntity = entityhuman.uniqueID; // Paper
+ entityphantom.setSpawningEntity(entityhuman.getUniqueID()); // Paper
entityphantom.setPositionRotation(blockposition1, 0.0F, 0.0F);
groupdataentity = entityphantom.prepare(worldserver, difficultydamagescaler, EnumMobSpawn.NATURAL, groupdataentity, (NBTTagCompound) null);
worldserver.addAllEntities(entityphantom, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.NATURAL); // CraftBukkit

Datei anzeigen

@ -29,6 +29,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
import java.util.Iterator;
import java.util.List;
import java.util.Random;
@@ -0,0 +0,0 @@ import net.minecraft.core.BlockPosition;
import net.minecraft.core.EnumDirection;
import net.minecraft.nbt.NBTBase;
import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.server.MCUtil;
import net.minecraft.server.level.EntityPlayer;
import net.minecraft.sounds.SoundCategory;
import net.minecraft.sounds.SoundEffects;
@@ -0,0 +0,0 @@ public class BlockBeehive extends BlockTileEntity {
if (i >= 5) {
@ -54,6 +62,14 @@ diff --git a/src/main/java/net/minecraft/world/level/block/BlockPumpkin.java b/s
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/level/block/BlockPumpkin.java
+++ b/src/main/java/net/minecraft/world/level/block/BlockPumpkin.java
@@ -0,0 +0,0 @@ package net.minecraft.world.level.block;
import net.minecraft.core.BlockPosition;
import net.minecraft.core.EnumDirection;
+import net.minecraft.server.MCUtil;
import net.minecraft.sounds.SoundCategory;
import net.minecraft.sounds.SoundEffects;
import net.minecraft.world.EnumHand;
@@ -0,0 +0,0 @@ import net.minecraft.world.level.block.state.BlockBase;
import net.minecraft.world.level.block.state.IBlockData;
import net.minecraft.world.phys.MovingObjectPositionBlock;

Datei anzeigen

@ -47,13 +47,21 @@ diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/jav
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -0,0 +0,0 @@ import net.minecraft.network.protocol.game.PacketPlayOutCustomSoundEffect;
import net.minecraft.network.protocol.game.PacketPlayOutUpdateTime;
import net.minecraft.network.protocol.game.PacketPlayOutWorldEvent;
import net.minecraft.resources.MinecraftKey;
+import net.minecraft.server.MCUtil;
import net.minecraft.server.level.ChunkMapDistance;
import net.minecraft.server.level.PlayerChunk;
import net.minecraft.server.level.PlayerChunkMap;
@@ -0,0 +0,0 @@ public class CraftWorld implements World {
@Override
public Chunk getChunkAt(int x, int z) {
- return this.world.getChunkProvider().getChunkAt(x, z, true).bukkitChunk;
+ // Paper start - add ticket to hold chunk for a little while longer if plugin accesses it
+ net.minecraft.server.Chunk chunk = world.getChunkProvider().getChunkAtIfLoadedImmediately(x, z);
+ net.minecraft.world.level.chunk.Chunk chunk = world.getChunkProvider().getChunkAtIfLoadedImmediately(x, z);
+ if (chunk == null) {
+ addTicket(x, z);
+ chunk = this.world.getChunkProvider().getChunkAt(x, z, true);

Datei anzeigen

@ -30,6 +30,14 @@ diff --git a/src/main/java/net/minecraft/world/entity/projectile/EntityFireball.
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/entity/projectile/EntityFireball.java
+++ b/src/main/java/net/minecraft/world/entity/projectile/EntityFireball.java
@@ -0,0 +0,0 @@ import net.minecraft.world.entity.EntityLiving;
import net.minecraft.world.entity.EntityTypes;
import net.minecraft.world.level.World;
import net.minecraft.world.phys.MovingObjectPosition;
+import net.minecraft.world.phys.MovingObjectPositionEntity;
import net.minecraft.world.phys.Vec3D;
import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit
@@ -0,0 +0,0 @@ public abstract class EntityFireball extends IProjectile {
MovingObjectPosition movingobjectposition = ProjectileHelper.a((Entity) this, this::a);
@ -52,6 +60,14 @@ diff --git a/src/main/java/net/minecraft/world/entity/projectile/EntityProjectil
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/entity/projectile/EntityProjectile.java
+++ b/src/main/java/net/minecraft/world/entity/projectile/EntityProjectile.java
@@ -0,0 +0,0 @@ import net.minecraft.world.level.block.entity.TileEntityEndGateway;
import net.minecraft.world.level.block.state.IBlockData;
import net.minecraft.world.phys.MovingObjectPosition;
import net.minecraft.world.phys.MovingObjectPositionBlock;
+import net.minecraft.world.phys.MovingObjectPositionEntity;
import net.minecraft.world.phys.Vec3D;
public abstract class EntityProjectile extends IProjectile {
@@ -0,0 +0,0 @@ public abstract class EntityProjectile extends IProjectile {
}

Datei anzeigen

@ -54,7 +54,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ return null;
+ }
+ }
+ net.minecraft.server.Block block;
+ net.minecraft.world.level.block.Block block;
+ if (material == Material.ANVIL) {
+ block = Blocks.ANVIL;
+ } else if (material == Material.CARTOGRAPHY_TABLE) {

Datei anzeigen

@ -188,8 +188,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- new Exception().printStackTrace();
+ // Paper start
+ ServerInternalException e = new ServerInternalException(
+ "Attempted to place a tile entity (" + tileentity + ") at " + tileentity.position.getX() + ","
+ + tileentity.position.getY() + "," + tileentity.position.getZ()
+ "Attempted to place a tile entity (" + tileentity + ") at " + tileentity.getPosition().getX() + ","
+ + tileentity.getPosition().getY() + "," + tileentity.getPosition().getZ()
+ + " (" + getType(blockposition) + ") where there was no entity tile!\n" +
+ "Chunk coordinates: " + (this.loc.x * 16) + "," + (this.loc.z * 16));
+ e.printStackTrace();

Datei anzeigen

@ -8,6 +8,14 @@ diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java b
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
@@ -0,0 +0,0 @@ import net.minecraft.world.level.block.BlockWorkbench;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.entity.TileEntity;
import net.minecraft.world.level.block.entity.TileEntityContainer;
+import net.minecraft.world.level.block.entity.TileEntitySign;
import net.minecraft.world.level.block.state.IBlockData;
import org.bukkit.GameMode;
import org.bukkit.Location;
@@ -0,0 +0,0 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
}
}
@ -17,7 +25,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ public void openSign(org.bukkit.block.Sign sign) {
+ org.apache.commons.lang.Validate.isTrue(sign.getWorld().equals(this.getWorld()), "Sign must be in the same world as player is in");
+ org.bukkit.craftbukkit.block.CraftSign craftSign = (org.bukkit.craftbukkit.block.CraftSign) sign;
+ net.minecraft.server.TileEntitySign teSign = craftSign.getTileEntity();
+ TileEntitySign teSign = craftSign.getTileEntity();
+ // Make sign editable temporarily, will be set back to false in PlayerConnection later
+ teSign.isEditable = true;
+ getHandle().openSign(teSign);

Datei anzeigen

@ -30,6 +30,13 @@ diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEvoker.java b/src/
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEvoker.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEvoker.java
@@ -0,0 +0,0 @@
package org.bukkit.craftbukkit.entity;
+import net.minecraft.world.entity.animal.EntitySheep;
import net.minecraft.world.entity.monster.EntityEvoker;
import net.minecraft.world.entity.monster.EntityIllagerWizard;
import org.bukkit.craftbukkit.CraftServer;
@@ -0,0 +0,0 @@ public class CraftEvoker extends CraftSpellcaster implements Evoker {
public void setCurrentSpell(Evoker.Spell spell) {
getHandle().setSpell(spell == null ? EntityIllagerWizard.Spell.NONE : EntityIllagerWizard.Spell.a(spell.ordinal()));
@ -38,7 +45,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ // Paper start
+ @Override
+ public org.bukkit.entity.Sheep getWololoTarget() {
+ net.minecraft.server.EntitySheep sheep = getHandle().getWololoTarget();
+ EntitySheep sheep = getHandle().getWololoTarget();
+ return sheep == null ? null : (org.bukkit.entity.Sheep) sheep.getBukkitEntity();
+ }
+

Datei anzeigen

@ -52,6 +52,14 @@ diff --git a/src/main/java/net/minecraft/world/level/block/BlockPortal.java b/sr
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/level/block/BlockPortal.java
+++ b/src/main/java/net/minecraft/world/level/block/BlockPortal.java
@@ -0,0 +0,0 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.chat.IChatBaseComponent;
import net.minecraft.server.level.WorldServer;
import net.minecraft.world.entity.Entity;
+import net.minecraft.world.entity.EntityInsentient;
import net.minecraft.world.entity.EntityTypes;
import net.minecraft.world.entity.EnumMobSpawn;
import net.minecraft.world.entity.player.EntityHuman;
@@ -0,0 +0,0 @@ public class BlockPortal extends Block {
if (entity != null) {

Datei anzeigen

@ -24,6 +24,16 @@ diff --git a/src/main/java/net/minecraft/world/entity/IEntitySelector.java b/src
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/entity/IEntitySelector.java
+++ b/src/main/java/net/minecraft/world/entity/IEntitySelector.java
@@ -0,0 +0,0 @@ package net.minecraft.world.entity;
import com.google.common.base.Predicates;
import java.util.function.Predicate;
import javax.annotation.Nullable;
+import net.minecraft.server.level.EntityPlayer;
+import net.minecraft.stats.StatisticList;
+import net.minecraft.util.MathHelper;
import net.minecraft.world.EnumDifficulty;
import net.minecraft.world.IInventory;
import net.minecraft.world.entity.player.EntityHuman;
@@ -0,0 +0,0 @@ public final class IEntitySelector {
public static final Predicate<Entity> g = (entity) -> {
return !entity.isSpectator();

Datei anzeigen

@ -16,7 +16,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
}
}
};
+ List<Entity> entitySlice = null;
+ public List<Entity> entitySlice = null;
// Paper end
public com.destroystokyo.paper.loottable.PaperLootableInventoryData lootableData; // Paper
@ -24,6 +24,15 @@ diff --git a/src/main/java/net/minecraft/world/level/chunk/Chunk.java b/src/main
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/level/chunk/Chunk.java
+++ b/src/main/java/net/minecraft/world/level/chunk/Chunk.java
@@ -0,0 +0,0 @@ import net.minecraft.ReportedException;
import net.minecraft.core.BlockPosition;
import net.minecraft.core.IRegistry;
import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.server.MinecraftServer;
+import net.minecraft.server.level.ChunkProviderServer;
import net.minecraft.server.level.PlayerChunk;
import net.minecraft.server.level.WorldServer;
import net.minecraft.util.EntitySlice;
@@ -0,0 +0,0 @@ public class Chunk implements IChunkAccess {
if (k >= this.entitySlices.length) {
k = this.entitySlices.length - 1;

Datei anzeigen

@ -113,7 +113,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ // Paper start - Add villager reputation API
+ @Override
+ public Reputation getReputation(UUID uniqueId) {
+ net.minecraft.server.Reputation.a rep = getHandle().getReputation().getReputations().get(uniqueId);
+ net.minecraft.world.entity.ai.gossip.Reputation.a rep = getHandle().getReputation().getReputations().get(uniqueId);
+ if (rep == null) {
+ return new Reputation(Maps.newHashMap());
+ }
@ -130,10 +130,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+
+ @Override
+ public void setReputation(UUID uniqueId, Reputation reputation) {
+ net.minecraft.server.Reputation.a nmsReputation =
+ net.minecraft.world.entity.ai.gossip.Reputation.a nmsReputation =
+ getHandle().getReputation().getReputations().computeIfAbsent(
+ uniqueId,
+ key -> new net.minecraft.server.Reputation.a()
+ key -> new net.minecraft.world.entity.ai.gossip.Reputation.a()
+ );
+ nmsReputation.assignFromPaperReputation(reputation);
+ }

Datei anzeigen

@ -17,7 +17,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
entity.setPositionRotation(x, y, z, yaw, pitch);
+ // Paper start
+ } else if (org.bukkit.entity.Item.class.isAssignableFrom(clazz)) {
+ entity = new EntityItem(world, x, y, z, new net.minecraft.server.ItemStack(net.minecraft.server.Item.getItemOf(net.minecraft.server.Blocks.DIRT)));
+ entity = new EntityItem(world, x, y, z, new net.minecraft.world.item.ItemStack(net.minecraft.world.item.Item.getItemOf(net.minecraft.world.level.block.Blocks.DIRT)));
+ // Paper end
} else if (FallingBlock.class.isAssignableFrom(clazz)) {
entity = new EntityFallingBlock(world, x, y, z, world.getType(new BlockPosition(x, y, z)));

Datei anzeigen

@ -1243,6 +1243,14 @@ diff --git a/src/main/java/net/minecraft/world/level/chunk/ChunkEmpty.java b/src
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/level/chunk/ChunkEmpty.java
+++ b/src/main/java/net/minecraft/world/level/chunk/ChunkEmpty.java
@@ -0,0 +0,0 @@ import net.minecraft.SystemUtils;
import net.minecraft.core.BlockPosition;
import net.minecraft.core.IRegistry;
import net.minecraft.data.worldgen.biome.BiomeRegistry;
+import net.minecraft.server.MinecraftServer;
import net.minecraft.server.level.PlayerChunk;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.level.ChunkCoordIntPair;
@@ -0,0 +0,0 @@ public class ChunkEmpty extends Chunk {
});

Datei anzeigen

@ -8,6 +8,14 @@ diff --git a/src/main/java/net/minecraft/commands/CommandDispatcher.java b/src/m
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/commands/CommandDispatcher.java
+++ b/src/main/java/net/minecraft/commands/CommandDispatcher.java
@@ -0,0 +0,0 @@ import net.minecraft.network.chat.ChatHoverable;
import net.minecraft.network.chat.ChatMessage;
import net.minecraft.network.chat.IChatMutableComponent;
import net.minecraft.network.protocol.game.PacketPlayOutCommands;
+import net.minecraft.server.MinecraftServer;
import net.minecraft.server.commands.CommandAdvancement;
import net.minecraft.server.commands.CommandAttribute;
import net.minecraft.server.commands.CommandBan;
@@ -0,0 +0,0 @@ public class CommandDispatcher {
if ( org.spigotmc.SpigotConfig.tabComplete < 0 ) return; // Spigot
// CraftBukkit start

Datei anzeigen

@ -4126,19 +4126,37 @@ diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
@@ -0,0 +0,0 @@ import net.minecraft.nbt.NBTBase;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.chat.IChatBaseComponent;
import net.minecraft.server.level.EntityPlayer;
+import net.minecraft.server.level.PlayerChunk;
+import net.minecraft.server.level.PlayerChunkMap;
+import net.minecraft.server.level.TicketType;
import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.EntityAreaEffectCloud;
@@ -0,0 +0,0 @@ import net.minecraft.world.entity.vehicle.EntityMinecartHopper;
import net.minecraft.world.entity.vehicle.EntityMinecartMobSpawner;
import net.minecraft.world.entity.vehicle.EntityMinecartRideable;
import net.minecraft.world.entity.vehicle.EntityMinecartTNT;
+import net.minecraft.world.level.ChunkCoordIntPair;
import net.minecraft.world.phys.AxisAlignedBB;
import org.bukkit.Chunk; // Paper
import org.bukkit.EntityEffect;
@@ -0,0 +0,0 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
entity.setHeadRotation(yaw);
}
+ @Override// Paper start
+ public java.util.concurrent.CompletableFuture<Boolean> teleportAsync(Location loc, @javax.annotation.Nonnull org.bukkit.event.player.PlayerTeleportEvent.TeleportCause cause) {
+ net.minecraft.server.PlayerChunkMap playerChunkMap = ((CraftWorld) loc.getWorld()).getHandle().getChunkProvider().playerChunkMap;
+ PlayerChunkMap playerChunkMap = ((CraftWorld) loc.getWorld()).getHandle().getChunkProvider().playerChunkMap;
+ java.util.concurrent.CompletableFuture<Boolean> future = new java.util.concurrent.CompletableFuture<>();
+
+ loc.getWorld().getChunkAtAsyncUrgently(loc).thenCompose(chunk -> {
+ net.minecraft.server.ChunkCoordIntPair pair = new net.minecraft.server.ChunkCoordIntPair(chunk.getX(), chunk.getZ());
+ ((CraftWorld) loc.getWorld()).getHandle().getChunkProvider().addTicketAtLevel(net.minecraft.server.TicketType.POST_TELEPORT, pair, 31, 0);
+ net.minecraft.server.PlayerChunk updatingChunk = playerChunkMap.getUpdatingChunk(pair.pair());
+ ChunkCoordIntPair pair = new ChunkCoordIntPair(chunk.getX(), chunk.getZ());
+ ((CraftWorld) loc.getWorld()).getHandle().getChunkProvider().addTicketAtLevel(TicketType.POST_TELEPORT, pair, 31, 0);
+ PlayerChunk updatingChunk = playerChunkMap.getUpdatingChunk(pair.pair());
+ if (updatingChunk != null) {
+ return updatingChunk.getEntityTickingFuture();
+ } else {

Datei anzeigen

@ -29,6 +29,20 @@ diff --git a/src/main/java/net/minecraft/world/level/chunk/Chunk.java b/src/main
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/level/chunk/Chunk.java
+++ b/src/main/java/net/minecraft/world/level/chunk/Chunk.java
@@ -0,0 +0,0 @@ import net.minecraft.server.level.PlayerChunk;
import net.minecraft.server.level.WorldServer;
import net.minecraft.util.EntitySlice;
import net.minecraft.util.MathHelper;
+import net.minecraft.world.IInventory;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.EntityTypes;
+import net.minecraft.world.entity.IEntitySelector;
import net.minecraft.world.entity.boss.EntityComplexPart;
import net.minecraft.world.entity.boss.enderdragon.EntityEnderDragon;
+import net.minecraft.world.entity.item.EntityItem;
import net.minecraft.world.level.ChunkCoordIntPair;
import net.minecraft.world.level.GeneratorAccess;
import net.minecraft.world.level.TickList;
@@ -0,0 +0,0 @@ public class Chunk implements IChunkAccess {
return removed;
}

Datei anzeigen

@ -20,6 +20,14 @@ diff --git a/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java
@@ -0,0 +0,0 @@ import net.minecraft.commands.arguments.blocks.ArgumentBlock;
import net.minecraft.core.EnumDirection;
import net.minecraft.core.IRegistry;
import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.resources.MinecraftKey;
import net.minecraft.util.INamable;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.IBlockData;
@@ -0,0 +0,0 @@ public class CraftBlockData implements BlockData {
Preconditions.checkState(MAP.put(nms, bukkit) == null, "Duplicate mapping %s->%s", nms, bukkit);
}
@ -46,7 +54,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ if (material != null) {
+ Block block = CraftMagicNumbers.getBlock(material);
+ if (block != null) {
+ net.minecraft.server.MinecraftKey key = IRegistry.BLOCK.getKey(block);
+ MinecraftKey key = IRegistry.BLOCK.getKey(block);
+ data = data == null ? key.toString() : key + data;
+ }
+ }

Datei anzeigen

@ -49,6 +49,14 @@ diff --git a/src/main/java/net/minecraft/world/level/CommandBlockListenerAbstrac
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/level/CommandBlockListenerAbstract.java
+++ b/src/main/java/net/minecraft/world/level/CommandBlockListenerAbstract.java
@@ -0,0 +0,0 @@ import net.minecraft.commands.ICommandListener;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.chat.ChatComponentText;
import net.minecraft.network.chat.IChatBaseComponent;
+import net.minecraft.server.MCUtil;
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.level.WorldServer;
import net.minecraft.util.UtilColor;
@@ -0,0 +0,0 @@ public abstract class CommandBlockListenerAbstract implements ICommandListener {
this.command = nbttagcompound.getString("Command");
this.successCount = nbttagcompound.getInt("SuccessCount");
@ -62,6 +70,14 @@ diff --git a/src/main/java/net/minecraft/world/level/block/entity/TileEntityBann
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/TileEntityBanner.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/TileEntityBanner.java
@@ -0,0 +0,0 @@ import net.minecraft.nbt.NBTTagList;
import net.minecraft.network.chat.ChatMessage;
import net.minecraft.network.chat.IChatBaseComponent;
import net.minecraft.network.protocol.game.PacketPlayOutTileEntityData;
+import net.minecraft.server.MCUtil;
import net.minecraft.world.INamableTileEntity;
import net.minecraft.world.item.EnumColor;
import net.minecraft.world.item.ItemStack;
@@ -0,0 +0,0 @@ public class TileEntityBanner extends TileEntity implements INamableTileEntity {
public void load(IBlockData iblockdata, NBTTagCompound nbttagcompound) {
super.load(iblockdata, nbttagcompound);
@ -75,6 +91,14 @@ diff --git a/src/main/java/net/minecraft/world/level/block/entity/TileEntityCont
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/TileEntityContainer.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/TileEntityContainer.java
@@ -0,0 +0,0 @@ import javax.annotation.Nullable;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.chat.ChatMessage;
import net.minecraft.network.chat.IChatBaseComponent;
+import net.minecraft.server.MCUtil;
import net.minecraft.sounds.SoundCategory;
import net.minecraft.sounds.SoundEffects;
import net.minecraft.world.ChestLock;
@@ -0,0 +0,0 @@ public abstract class TileEntityContainer extends TileEntity implements IInvento
super.load(iblockdata, nbttagcompound);
this.chestLock = ChestLock.b(nbttagcompound);

Datei anzeigen

@ -8,6 +8,14 @@ diff --git a/src/main/java/net/minecraft/core/dispenser/IDispenseBehavior.java b
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/core/dispenser/IDispenseBehavior.java
+++ b/src/main/java/net/minecraft/core/dispenser/IDispenseBehavior.java
@@ -0,0 +0,0 @@ import net.minecraft.core.BlockPosition;
import net.minecraft.core.EnumDirection;
import net.minecraft.core.IPosition;
import net.minecraft.core.ISourceBlock;
+import net.minecraft.server.MinecraftServer;
import net.minecraft.server.level.EntityPlayer;
import net.minecraft.server.level.WorldServer;
import net.minecraft.sounds.SoundCategory;
@@ -0,0 +0,0 @@ public interface IDispenseBehavior {
}
}

Datei anzeigen

@ -43,6 +43,14 @@ diff --git a/src/main/java/net/minecraft/world/entity/vehicle/EntityBoat.java b/
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/entity/vehicle/EntityBoat.java
+++ b/src/main/java/net/minecraft/world/entity/vehicle/EntityBoat.java
@@ -0,0 +0,0 @@ import net.minecraft.network.protocol.game.PacketPlayOutSpawnEntity;
import net.minecraft.network.syncher.DataWatcher;
import net.minecraft.network.syncher.DataWatcherObject;
import net.minecraft.network.syncher.DataWatcherRegistry;
+import net.minecraft.server.level.EntityPlayer;
import net.minecraft.sounds.SoundEffect;
import net.minecraft.sounds.SoundEffects;
import net.minecraft.tags.Tag;
@@ -0,0 +0,0 @@ public class EntityBoat extends Entity {
@Override
@ -55,6 +63,14 @@ diff --git a/src/main/java/net/minecraft/world/entity/vehicle/EntityMinecartAbst
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/entity/vehicle/EntityMinecartAbstract.java
+++ b/src/main/java/net/minecraft/world/entity/vehicle/EntityMinecartAbstract.java
@@ -0,0 +0,0 @@ import net.minecraft.network.protocol.game.PacketPlayOutSpawnEntity;
import net.minecraft.network.syncher.DataWatcher;
import net.minecraft.network.syncher.DataWatcherObject;
import net.minecraft.network.syncher.DataWatcherRegistry;
+import net.minecraft.server.level.EntityPlayer;
import net.minecraft.tags.Tag;
import net.minecraft.tags.TagsBlock;
import net.minecraft.util.MathHelper;
@@ -0,0 +0,0 @@ public abstract class EntityMinecartAbstract extends Entity {
public void collide(Entity entity) {
if (!this.world.isClientSide) {

Datei anzeigen

@ -23,6 +23,14 @@ diff --git a/src/main/java/net/minecraft/world/level/block/BlockDirtSnowSpreadab
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/level/block/BlockDirtSnowSpreadable.java
+++ b/src/main/java/net/minecraft/world/level/block/BlockDirtSnowSpreadable.java
@@ -0,0 +0,0 @@ package net.minecraft.world.level.block;
import java.util.Random;
import net.minecraft.core.BlockPosition;
import net.minecraft.core.EnumDirection;
+import net.minecraft.server.MinecraftServer;
import net.minecraft.server.level.WorldServer;
import net.minecraft.tags.Tag;
import net.minecraft.tags.TagsFluid;
@@ -0,0 +0,0 @@ public abstract class BlockDirtSnowSpreadable extends BlockDirtSnow {
@Override

Datei anzeigen

@ -35,6 +35,14 @@ diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -0,0 +0,0 @@ import net.minecraft.world.phys.Vec2F;
import net.minecraft.world.phys.Vec3D;
import net.minecraft.world.scores.PersistentScoreboard;
import net.minecraft.world.scores.Scoreboard;
+import net.minecraft.world.scores.ScoreboardTeam;
import org.apache.commons.lang3.Validate;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@@ -0,0 +0,0 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
this.server.getPluginManager().callEvent(new org.bukkit.event.world.WorldLoadEvent(worldserver.getWorld()));
}
@ -72,7 +80,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
// CraftBukkit start
private CraftServer cserver;
private final Map<String,EntityPlayer> playersByName = new java.util.HashMap<>();
+ @Nullable String collideRuleTeamName; // Paper - Team name used for collideRule
+ public @Nullable String collideRuleTeamName; // Paper - Team name used for collideRule
public PlayerList(MinecraftServer minecraftserver, IRegistryCustom.Dimension iregistrycustom_dimension, WorldNBTStorage worldnbtstorage, int i) {
this.cserver = minecraftserver.server = new CraftServer((DedicatedServer) minecraftserver, this);

Datei anzeigen

@ -23,6 +23,14 @@ diff --git a/src/main/java/net/minecraft/world/level/block/BlockFluids.java b/sr
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/level/block/BlockFluids.java
+++ b/src/main/java/net/minecraft/world/level/block/BlockFluids.java
@@ -0,0 +0,0 @@ import net.minecraft.world.level.material.Fluid;
import net.minecraft.world.level.material.FluidType;
import net.minecraft.world.level.material.FluidTypeFlowing;
import net.minecraft.world.level.material.FluidTypes;
+import net.minecraft.world.level.material.Material;
import net.minecraft.world.level.pathfinder.PathMode;
import net.minecraft.world.level.storage.loot.LootTableInfo;
import net.minecraft.world.phys.shapes.VoxelShape;
@@ -0,0 +0,0 @@ public class BlockFluids extends Block implements IFluidSource {
@Override
public void onPlace(IBlockData iblockdata, World world, BlockPosition blockposition, IBlockData iblockdata1, boolean flag) {

Datei anzeigen

@ -8,6 +8,14 @@ diff --git a/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutChat
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutChat.java
+++ b/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutChat.java
@@ -0,0 +0,0 @@ package net.minecraft.network.protocol.game;
import java.io.IOException;
import java.util.UUID;
+import net.minecraft.SystemUtils;
import net.minecraft.network.PacketDataSerializer;
import net.minecraft.network.chat.ChatMessageType;
import net.minecraft.network.chat.IChatBaseComponent;
@@ -0,0 +0,0 @@ public class PacketPlayOutChat implements Packet<PacketListenerPlayOut> {
public PacketPlayOutChat(IChatBaseComponent ichatbasecomponent, ChatMessageType chatmessagetype, UUID uuid) {
this.a = ichatbasecomponent;

Datei anzeigen

@ -50,7 +50,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne
}
};
List<Entity> entitySlice = null;
public List<Entity> entitySlice = null;
+ public org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason spawnReason;
// Paper end

Datei anzeigen

@ -22,6 +22,14 @@ diff --git a/src/main/java/net/minecraft/world/entity/ai/navigation/NavigationAb
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/entity/ai/navigation/NavigationAbstract.java
+++ b/src/main/java/net/minecraft/world/entity/ai/navigation/NavigationAbstract.java
@@ -0,0 +0,0 @@ import net.minecraft.core.BaseBlockPosition;
import net.minecraft.core.BlockPosition;
import net.minecraft.core.IPosition;
import net.minecraft.network.protocol.game.PacketDebug;
+import net.minecraft.server.MCUtil;
import net.minecraft.util.MathHelper;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.EntityInsentient;
@@ -0,0 +0,0 @@ import net.minecraft.world.phys.Vec3D;
public abstract class NavigationAbstract {

Datei anzeigen

@ -16,6 +16,22 @@ diff --git a/src/main/java/net/minecraft/server/level/PlayerInteractManager.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/level/PlayerInteractManager.java
+++ b/src/main/java/net/minecraft/server/level/PlayerInteractManager.java
@@ -0,0 +0,0 @@ import net.minecraft.core.BlockPosition;
import net.minecraft.core.EnumDirection;
import net.minecraft.network.protocol.game.PacketPlayInBlockDig;
import net.minecraft.network.protocol.game.PacketPlayOutBlockBreak;
+import net.minecraft.network.protocol.game.PacketPlayOutCloseWindow;
import net.minecraft.network.protocol.game.PacketPlayOutPlayerInfo;
import net.minecraft.world.EnumHand;
import net.minecraft.world.EnumInteractionResult;
@@ -0,0 +0,0 @@ import net.minecraft.world.level.EnumGamemode;
import net.minecraft.world.level.World;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.BlockCommand;
+import net.minecraft.world.level.block.BlockFlowerPot;
import net.minecraft.world.level.block.BlockJigsaw;
import net.minecraft.world.level.block.BlockStructure;
import net.minecraft.world.level.block.entity.TileEntity;
@@ -0,0 +0,0 @@ public class PlayerInteractManager {
PlayerInteractEvent event = CraftEventFactory.callPlayerInteractEvent(this.player, Action.LEFT_CLICK_BLOCK, blockposition, enumdirection, this.player.inventory.getItemInHand(), EnumHand.MAIN_HAND);
if (event.isCancelled()) {

Datei anzeigen

@ -9,6 +9,14 @@ diff --git a/src/main/java/net/minecraft/server/level/PlayerInteractManager.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/level/PlayerInteractManager.java
+++ b/src/main/java/net/minecraft/server/level/PlayerInteractManager.java
@@ -0,0 +0,0 @@ import net.minecraft.world.EnumHand;
import net.minecraft.world.EnumInteractionResult;
import net.minecraft.world.ITileInventory;
import net.minecraft.world.InteractionResultWrapper;
+import net.minecraft.world.entity.item.EntityItem;
import net.minecraft.world.entity.player.EntityHuman;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.context.ItemActionContext;
@@ -0,0 +0,0 @@ public class PlayerInteractManager {
// return true; // CraftBukkit
}

Datei anzeigen

@ -40,6 +40,14 @@ diff --git a/src/main/java/net/minecraft/server/rcon/thread/RemoteStatusListener
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/rcon/thread/RemoteStatusListener.java
+++ b/src/main/java/net/minecraft/server/rcon/thread/RemoteStatusListener.java
@@ -0,0 +0,0 @@ import java.util.Random;
import javax.annotation.Nullable;
import net.minecraft.SystemUtils;
import net.minecraft.server.IMinecraftServer;
+import net.minecraft.server.dedicated.DedicatedServer;
import net.minecraft.server.rcon.RemoteStatusReply;
import net.minecraft.server.rcon.StatusChallengeUtils;
import org.apache.logging.log4j.LogManager;
@@ -0,0 +0,0 @@ public class RemoteStatusListener extends RemoteConnectionThread {
private static final Logger LOGGER = LogManager.getLogger();
private long e;

Datei anzeigen

@ -96,6 +96,14 @@ diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftFirework.java b/sr
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftFirework.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftFirework.java
@@ -0,0 +0,0 @@
package org.bukkit.craftbukkit.entity;
import java.util.Random;
+import net.minecraft.world.entity.EntityLiving;
import net.minecraft.world.entity.projectile.EntityFireworks;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Items;
@@ -0,0 +0,0 @@ public class CraftFirework extends CraftProjectile implements Firework {
public void setShotAtAngle(boolean shotAtAngle) {
getHandle().getDataWatcher().set(EntityFireworks.SHOT_AT_ANGLE, shotAtAngle);
@ -109,7 +117,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+
+ @Override
+ public org.bukkit.entity.LivingEntity getBoostedEntity() {
+ net.minecraft.server.EntityLiving boostedEntity = getHandle().ridingEntity;
+ EntityLiving boostedEntity = getHandle().ridingEntity;
+ return boostedEntity != null ? (org.bukkit.entity.LivingEntity) boostedEntity.getBukkitEntity() : null;
+ }
+ // Paper end

Datei anzeigen

@ -86,7 +86,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
private boolean m = true;
+ // Paper start - fix advancement data player leakage
+ final Map<CriterionTriggerAbstract, Set<CriterionTrigger.a>> criterionData = Maps.newIdentityHashMap();
+ public final Map<CriterionTriggerAbstract, Set<CriterionTrigger.a>> criterionData = Maps.newIdentityHashMap();
+ // Paper end - fix advancement data player leakage
+
public AdvancementDataPlayer(DataFixer datafixer, PlayerList playerlist, AdvancementDataWorld advancementdataworld, File file, EntityPlayer entityplayer) {

Datei anzeigen

@ -169,19 +169,6 @@ diff --git a/src/main/java/net/minecraft/server/level/PlayerChunkMap.java b/src/
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/level/PlayerChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/PlayerChunkMap.java
@@ -0,0 +0,0 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
private final ChunkTaskQueueSorter p;
private final Mailbox<ChunkTaskQueueSorter.a<Runnable>> mailboxWorldGen;
final Mailbox<ChunkTaskQueueSorter.a<Runnable>> mailboxMain; // Paper - private -> package private
+ // Paper start
+ final Mailbox<ChunkTaskQueueSorter.a<Runnable>> mailboxLight;
+ public void addLightTask(PlayerChunk playerchunk, Runnable run) {
+ this.mailboxLight.a(ChunkTaskQueueSorter.a(playerchunk, run));
+ }
+ // Paper end
public final WorldLoadListener worldLoadListener;
public final PlayerChunkMap.a chunkDistanceManager;
private final AtomicInteger u;
@@ -0,0 +0,0 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
Mailbox<Runnable> mailbox = Mailbox.a("main", iasynctaskhandler::a);

Datei anzeigen

@ -19,6 +19,14 @@ diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkRegionLo
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkRegionLoader.java
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkRegionLoader.java
@@ -0,0 +0,0 @@ import net.minecraft.core.BlockPosition;
import net.minecraft.core.IRegistry;
import net.minecraft.core.RegistryBlocks;
import net.minecraft.core.SectionPosition;
+import net.minecraft.nbt.NBTBase;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.nbt.NBTTagLongArray;
@@ -0,0 +0,0 @@ public class ChunkRegionLoader {
object2 = protochunkticklist1;
}

Datei anzeigen

@ -13,6 +13,17 @@ diff --git a/src/main/java/net/minecraft/world/level/saveddata/maps/WorldMap.jav
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/level/saveddata/maps/WorldMap.java
+++ b/src/main/java/net/minecraft/world/level/saveddata/maps/WorldMap.java
@@ -0,0 +0,0 @@ import javax.annotation.Nullable;
import net.minecraft.core.BlockPosition;
import net.minecraft.nbt.DynamicOpsNBT;
import net.minecraft.nbt.NBTBase;
+import net.minecraft.nbt.NBTNumber;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
+import net.minecraft.nbt.NBTTagString;
import net.minecraft.network.chat.IChatBaseComponent;
import net.minecraft.network.protocol.Packet;
import net.minecraft.network.protocol.game.PacketPlayOutMap;
@@ -0,0 +0,0 @@ public class WorldMap extends PersistentBase {
@Override
@ -28,7 +39,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ this.uniqueId = new UUID(most, least);
+ CraftWorld world = (CraftWorld) server.getWorld(this.uniqueId);
+ if (world != null) {
+ dimension = NBTTagString.create("minecaft:" + world.getName().toLowerCase(java.util.Locale.ENGLISH));
+ dimension = NBTTagString.create("minecraft:" + world.getName().toLowerCase(java.util.Locale.ENGLISH));
+ } else {
+ dimension = NBTTagString.create("bukkit:_invalidworld_");
+ }

Datei anzeigen

@ -16,7 +16,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
public CraftPersistentDataContainer persistentDataContainer;
// CraftBukkit end
private static final Logger LOGGER = LogManager.getLogger();
+ boolean isLoadingStructure = false; // Paper
+ public boolean isLoadingStructure = false; // Paper
private final TileEntityTypes<?> tileType; public TileEntityTypes getTileEntityType() { return tileType; } // Paper - OBFHELPER
@Nullable
protected World world;

Datei anzeigen

@ -36,6 +36,14 @@ diff --git a/src/main/java/net/minecraft/server/commands/CommandDifficulty.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/commands/CommandDifficulty.java
+++ b/src/main/java/net/minecraft/server/commands/CommandDifficulty.java
@@ -0,0 +0,0 @@ import com.mojang.brigadier.exceptions.DynamicCommandExceptionType;
import net.minecraft.commands.CommandListenerWrapper;
import net.minecraft.network.chat.ChatMessage;
import net.minecraft.server.MinecraftServer;
+import net.minecraft.server.level.WorldServer;
import net.minecraft.world.EnumDifficulty;
public class CommandDifficulty {
@@ -0,0 +0,0 @@ public class CommandDifficulty {
public static int a(CommandListenerWrapper commandlistenerwrapper, EnumDifficulty enumdifficulty) throws CommandSyntaxException {
MinecraftServer minecraftserver = commandlistenerwrapper.getServer();

Datei anzeigen

@ -42,6 +42,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
// Paper end
@Nullable
@@ -0,0 +0,0 @@ public class ChunkProviderServer extends IChunkProvider {
return this.p;
}
- final class a extends IAsyncTaskHandler<Runnable> {
+ public final class a extends IAsyncTaskHandler<Runnable> { // Paper - package -> public
private a(World world) {
super("Chunk source main thread executor for " + world.getDimensionKey().a());
diff --git a/src/main/java/net/minecraft/server/level/PlayerChunk.java b/src/main/java/net/minecraft/server/level/PlayerChunk.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/level/PlayerChunk.java
@ -311,7 +320,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ chunk = world.getChunkProvider().playerChunkMap.getUnloadingChunk(x, z);
+ }
+ if (chunk != null) {
+ return chunk instanceof ProtoChunkExtension || chunk instanceof net.minecraft.server.Chunk;
+ return chunk instanceof ProtoChunkExtension || chunk instanceof net.minecraft.world.level.chunk.Chunk;
+ }
try {
- return world.getChunkProvider().getChunkAtIfCachedImmediately(x, z) != null || world.getChunkProvider().playerChunkMap.read(new ChunkCoordIntPair(x, z)) != null; // Paper (TODO check if the first part can be removed)

Datei anzeigen

@ -15,6 +15,14 @@ diff --git a/src/main/java/net/minecraft/network/PacketDataSerializer.java b/src
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/network/PacketDataSerializer.java
+++ b/src/main/java/net/minecraft/network/PacketDataSerializer.java
@@ -0,0 +0,0 @@ import net.minecraft.network.chat.IChatBaseComponent;
import net.minecraft.resources.MinecraftKey;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
+import net.minecraft.world.level.block.entity.TileEntitySkull;
import net.minecraft.world.phys.MovingObjectPositionBlock;
import net.minecraft.world.phys.Vec3D;
@@ -0,0 +0,0 @@ public class PacketDataSerializer extends ByteBuf {
if (item.usesDurability() || item.n()) {
// Spigot start - filter
@ -82,7 +90,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@Deprecated
private Item item;
- private NBTTagCompound tag;
+ NBTTagCompound tag; // Paper -> package private
+ public NBTTagCompound tag; // Paper private -> public
private boolean j;
private Entity k;
private ShapeDetectorBlock l;
@ -115,7 +123,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ return cmp;
+ }
+
+ static void sanitizeUUID(NBTTagCompound owner) {
+ public static void sanitizeUUID(NBTTagCompound owner) {
+ NBTTagCompound properties = owner.getCompound("Properties");
+ NBTTagList list = null;
+ if (!properties.isEmpty()) {

Datei anzeigen

@ -11,6 +11,14 @@ diff --git a/src/main/java/net/minecraft/world/item/ItemPotion.java b/src/main/j
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/item/ItemPotion.java
+++ b/src/main/java/net/minecraft/world/item/ItemPotion.java
@@ -0,0 +0,0 @@ import net.minecraft.world.entity.player.EntityHuman;
import net.minecraft.world.item.alchemy.PotionRegistry;
import net.minecraft.world.item.alchemy.PotionUtil;
import net.minecraft.world.item.alchemy.Potions;
+import net.minecraft.world.level.GameRules;
import net.minecraft.world.level.World;
public class ItemPotion extends Item {
@@ -0,0 +0,0 @@ public class ItemPotion extends Item {
CriterionTriggers.z.a((EntityPlayer) entityhuman, itemstack);
}

Datei anzeigen

@ -9,6 +9,14 @@ diff --git a/src/main/java/net/minecraft/world/level/block/entity/TileEntityCamp
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/TileEntityCampfire.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/TileEntityCampfire.java
@@ -0,0 +0,0 @@ import net.minecraft.world.Clearable;
import net.minecraft.world.ContainerUtil;
import net.minecraft.world.InventorySubcontainer;
import net.minecraft.world.InventoryUtils;
+import net.minecraft.world.entity.item.EntityItem;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.crafting.RecipeCampfire;
import net.minecraft.world.item.crafting.Recipes;
@@ -0,0 +0,0 @@ public class TileEntityCampfire extends TileEntity implements Clearable, ITickab
result = blockCookEvent.getResult();
itemstack1 = CraftItemStack.asNMSCopy(result);

Datei anzeigen

@ -38,6 +38,14 @@ diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/IChunkLoader.
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/level/chunk/storage/IChunkLoader.java
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/IChunkLoader.java
@@ -0,0 +0,0 @@ import net.minecraft.SharedConstants;
import net.minecraft.nbt.GameProfileSerializer;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.resources.ResourceKey;
+import net.minecraft.server.level.PlayerChunkMap;
import net.minecraft.util.datafix.DataFixTypes;
import net.minecraft.world.level.ChunkCoordIntPair;
import net.minecraft.world.level.World;
@@ -0,0 +0,0 @@ public class IChunkLoader implements AutoCloseable {
public void a(ChunkCoordIntPair chunkcoordintpair, NBTTagCompound nbttagcompound) throws IOException { write(chunkcoordintpair, nbttagcompound); } // Paper OBFHELPER

Datei anzeigen

@ -635,6 +635,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
import it.unimi.dsi.fastutil.shorts.ShortArraySet;
import it.unimi.dsi.fastutil.shorts.ShortSet;
import java.util.List;
@@ -0,0 +0,0 @@ import net.minecraft.network.protocol.game.PacketPlayOutBlockChange;
import net.minecraft.network.protocol.game.PacketPlayOutLightUpdate;
import net.minecraft.network.protocol.game.PacketPlayOutMultiBlockChange;
import net.minecraft.network.protocol.game.PacketPlayOutTileEntityData;
+import net.minecraft.server.MCUtil;
import net.minecraft.util.MathHelper;
import net.minecraft.world.level.ChunkCoordIntPair;
import net.minecraft.world.level.EnumSkyBlock;
@@ -0,0 +0,0 @@ public class PlayerChunk {
private CompletableFuture<IChunkAccess> chunkSave;
public int oldTicketLevel;
@ -1201,7 +1209,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@@ -0,0 +0,0 @@ public abstract class PlayerList {
final ChunkCoordIntPair pos = new ChunkCoordIntPair(chunkX, chunkZ);
PlayerChunkMap playerChunkMap = worldserver1.getChunkProvider().playerChunkMap;
playerChunkMap.chunkDistanceManager.addTicketAtLevel(TicketType.LOGIN, pos, 31, pos.pair());
playerChunkMap.getChunkDistanceManager().addTicketAtLevel(TicketType.LOGIN, pos, 31, pos.pair());
- worldserver1.getChunkProvider().tickDistanceManager();
- worldserver1.getChunkProvider().getChunkAtAsynchronously(chunkX, chunkZ, true, true).thenApply(chunk -> {
+ worldserver1.getChunkProvider().markAreaHighPriority(pos, 28, 3);
@ -1256,6 +1264,22 @@ diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -0,0 +0,0 @@ import net.minecraft.server.level.PlayerChunkMap;
import net.minecraft.server.level.WorldServer;
import net.minecraft.server.network.PlayerConnection;
import net.minecraft.server.players.WhiteListEntry;
+import net.minecraft.util.MathHelper;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.EntityExperienceOrb;
import net.minecraft.world.entity.EntityLiving;
@@ -0,0 +0,0 @@ import net.minecraft.world.inventory.Container;
import net.minecraft.world.item.EnumColor;
import net.minecraft.world.item.enchantment.EnchantmentManager;
import net.minecraft.world.item.enchantment.Enchantments;
+import net.minecraft.world.level.ChunkCoordIntPair;
import net.minecraft.world.level.EnumGamemode;
import net.minecraft.world.level.biome.BiomeManager;
import net.minecraft.world.level.block.entity.TileEntitySign;
@@ -0,0 +0,0 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
throw new UnsupportedOperationException("Cannot set rotation of players. Consider teleporting instead.");
}
@ -1263,7 +1287,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ // Paper start
+ @Override
+ public java.util.concurrent.CompletableFuture<Boolean> teleportAsync(Location loc, @javax.annotation.Nonnull PlayerTeleportEvent.TeleportCause cause) {
+ ((CraftWorld)loc.getWorld()).getHandle().getChunkProvider().markAreaHighPriority(new net.minecraft.server.ChunkCoordIntPair(net.minecraft.server.MathHelper.floor(loc.getX()) >> 4, net.minecraft.server.MathHelper.floor(loc.getZ()) >> 4), 28, 3); // Paper - load area high priority
+ ((CraftWorld)loc.getWorld()).getHandle().getChunkProvider().markAreaHighPriority(new ChunkCoordIntPair(MathHelper.floor(loc.getX()) >> 4, MathHelper.floor(loc.getZ()) >> 4), 28, 3); // Paper - load area high priority
+ return super.teleportAsync(loc, cause);
+ }
+ // Paper end

Datei anzeigen

@ -23,6 +23,14 @@ diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftArmorStand.java b/
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftArmorStand.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftArmorStand.java
@@ -0,0 +0,0 @@
package org.bukkit.craftbukkit.entity;
import net.minecraft.core.Vector3f;
+import net.minecraft.world.entity.EnumItemSlot;
import net.minecraft.world.entity.decoration.EntityArmorStand;
import org.bukkit.craftbukkit.CraftEquipmentSlot;
import org.bukkit.craftbukkit.CraftServer;
@@ -0,0 +0,0 @@ public class CraftArmorStand extends CraftLivingEntity implements ArmorStand {
public void setCanMove(boolean move) {
getHandle().canMove = move;
@ -76,7 +84,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ int disabled = 0;
+ for (org.bukkit.inventory.EquipmentSlot slot : slots) {
+ if (slot == org.bukkit.inventory.EquipmentSlot.OFF_HAND) continue;
+ net.minecraft.server.EnumItemSlot nmsSlot = org.bukkit.craftbukkit.CraftEquipmentSlot.getNMS(slot);
+ EnumItemSlot nmsSlot = org.bukkit.craftbukkit.CraftEquipmentSlot.getNMS(slot);
+ disabled += (1 << nmsSlot.getSlotFlag()) + (1 << (nmsSlot.getSlotFlag() + 8)) + (1 << (nmsSlot.getSlotFlag() + 16));
+ }
+ getHandle().disabledSlots = disabled;

Datei anzeigen

@ -1066,9 +1066,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@@ -0,0 +0,0 @@
+package com.destroystokyo.paper.entity.ai;
+
+import net.minecraft.server.EntityInsentient;
+import net.minecraft.server.PathfinderGoal;
+
+import net.minecraft.world.entity.EntityInsentient;
+import net.minecraft.world.entity.ai.goal.PathfinderGoal;
+import org.junit.Assert;
+import org.junit.Test;
+

Datei anzeigen

@ -16,7 +16,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ @Override
+ public Entity getEntity(UUID uuid) {
+ Validate.notNull(uuid, "UUID cannot be null");
+ net.minecraft.server.Entity entity = world.getEntity(uuid);
+ net.minecraft.world.entity.Entity entity = world.getEntity(uuid);
+ return entity == null ? null : entity.getBukkitEntity();
+ }
+ // Paper end

Datei anzeigen

@ -35,6 +35,21 @@ diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
@@ -0,0 +0,0 @@ import java.util.logging.Level;
import java.util.logging.Logger;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
+import net.minecraft.commands.arguments.blocks.ArgumentBlock;
import net.minecraft.nbt.NBTBase;
import net.minecraft.nbt.NBTCompressedStreamTools;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.nbt.NBTTagString;
import net.minecraft.network.chat.ChatComponentText;
+import net.minecraft.resources.MinecraftKey;
import net.minecraft.world.entity.EnumItemSlot;
import net.minecraft.world.item.ItemBlock;
import org.apache.commons.codec.binary.Base64;
@@ -0,0 +0,0 @@ import org.bukkit.persistence.PersistentDataContainer;
import static org.spigotmc.ValidateUtils.*;
// Spigot end
@ -377,7 +392,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+
+ private @Nullable Namespaced deserializeNamespaced(String raw) {
+ boolean isTag = raw.length() > 0 && raw.codePointAt(0) == '#';
+ net.minecraft.server.ArgumentBlock blockParser = new net.minecraft.server.ArgumentBlock(new com.mojang.brigadier.StringReader(raw), true);
+ ArgumentBlock blockParser = new ArgumentBlock(new com.mojang.brigadier.StringReader(raw), true);
+ try {
+ blockParser = blockParser.parse(false);
+ } catch (com.mojang.brigadier.exceptions.CommandSyntaxException e) {
@ -385,7 +400,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ return null;
+ }
+
+ net.minecraft.server.MinecraftKey key;
+ MinecraftKey key;
+ if (isTag) {
+ key = blockParser.getTagKey();
+ } else {

Datei anzeigen

@ -8,6 +8,14 @@ diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java
@@ -0,0 +0,0 @@ import net.minecraft.world.inventory.InventoryCrafting;
import net.minecraft.world.inventory.InventoryEnderChest;
import net.minecraft.world.inventory.InventoryMerchant;
import net.minecraft.world.level.block.entity.IHopper;
+import net.minecraft.world.level.block.entity.TileEntity;
import net.minecraft.world.level.block.entity.TileEntityBarrel;
import net.minecraft.world.level.block.entity.TileEntityBlastFurnace;
import net.minecraft.world.level.block.entity.TileEntityBrewingStand;
@@ -0,0 +0,0 @@ public class CraftInventory implements Inventory {
return inventory.getOwner();
}
@ -15,7 +23,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ // Paper start - getHolder without snapshot
+ @Override
+ public InventoryHolder getHolder(boolean useSnapshot) {
+ return inventory instanceof net.minecraft.server.TileEntity ? ((net.minecraft.server.TileEntity) inventory).getOwner(useSnapshot) : getHolder();
+ return inventory instanceof TileEntity ? ((TileEntity) inventory).getOwner(useSnapshot) : getHolder();
+ }
+ // Paper end
+

Datei anzeigen

@ -37,6 +37,19 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
public Integer clientViewDistance;
// CraftBukkit end
public PlayerNaturallySpawnCreaturesEvent playerNaturallySpawnedEvent; // Paper
diff --git a/src/main/java/net/minecraft/server/level/PlayerChunkMap.java b/src/main/java/net/minecraft/server/level/PlayerChunkMap.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/level/PlayerChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/PlayerChunkMap.java
@@ -0,0 +0,0 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
private final Mailbox<ChunkTaskQueueSorter.a<Runnable>> mailboxWorldGen;
private final Mailbox<ChunkTaskQueueSorter.a<Runnable>> mailboxMain;
public final WorldLoadListener worldLoadListener;
- public final PlayerChunkMap.a chunkDistanceManager;
+ public final PlayerChunkMap.a chunkDistanceManager; public final ChunkMapDistance getChunkDistanceManager() { return this.chunkDistanceManager; } // Paper - OBFHELPER
private final AtomicInteger u;
public final DefinedStructureManager definedStructureManager; // Paper - private -> public
private final File w;
diff --git a/src/main/java/net/minecraft/server/level/TicketType.java b/src/main/java/net/minecraft/server/level/TicketType.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/level/TicketType.java
@ -174,7 +187,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ int chunkZ = loc.getBlockZ() >> 4;
+ final ChunkCoordIntPair pos = new ChunkCoordIntPair(chunkX, chunkZ);
+ PlayerChunkMap playerChunkMap = worldserver1.getChunkProvider().playerChunkMap;
+ playerChunkMap.chunkDistanceManager.addTicketAtLevel(TicketType.LOGIN, pos, 31, pos.pair());
+ playerChunkMap.getChunkDistanceManager().addTicketAtLevel(TicketType.LOGIN, pos, 31, pos.pair());
+ worldserver1.getChunkProvider().tickDistanceManager();
+ worldserver1.getChunkProvider().getChunkAtAsynchronously(chunkX, chunkZ, true, true).thenApply(chunk -> {
+ PlayerChunk updatingChunk = playerChunkMap.getUpdatingChunk(pos.pair());

Datei anzeigen

@ -34,6 +34,15 @@ diff --git a/src/main/java/net/minecraft/world/entity/ai/targeting/PathfinderTar
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/entity/ai/targeting/PathfinderTargetCondition.java
+++ b/src/main/java/net/minecraft/world/entity/ai/targeting/PathfinderTargetCondition.java
@@ -0,0 +0,0 @@ import java.util.function.Predicate;
import javax.annotation.Nullable;
import net.minecraft.world.entity.EntityInsentient;
import net.minecraft.world.entity.EntityLiving;
+import net.minecraft.world.entity.ai.attributes.AttributeModifiable;
+import net.minecraft.world.entity.ai.attributes.GenericAttributes;
public class PathfinderTargetCondition {
@@ -0,0 +0,0 @@ public class PathfinderTargetCondition {
if (this.b > 0.0D) {

Datei anzeigen

@ -185,7 +185,38 @@ diff --git a/src/main/java/net/minecraft/network/EnumProtocol.java b/src/main/ja
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/network/EnumProtocol.java
+++ b/src/main/java/net/minecraft/network/EnumProtocol.java
@@ -0,0 +0,0 @@ import org.apache.logging.log4j.LogManager;
@@ -0,0 +0,0 @@ import javax.annotation.Nullable;
import net.minecraft.SystemUtils;
import net.minecraft.network.protocol.EnumProtocolDirection;
import net.minecraft.network.protocol.Packet;
+import net.minecraft.network.protocol.game.PacketListenerPlayIn;
+import net.minecraft.network.protocol.game.PacketListenerPlayOut;
import net.minecraft.network.protocol.game.PacketPlayInAbilities;
import net.minecraft.network.protocol.game.PacketPlayInAdvancements;
import net.minecraft.network.protocol.game.PacketPlayInArmAnimation;
@@ -0,0 +0,0 @@ import net.minecraft.network.protocol.game.PacketPlayOutWindowItems;
import net.minecraft.network.protocol.game.PacketPlayOutWorldBorder;
import net.minecraft.network.protocol.game.PacketPlayOutWorldEvent;
import net.minecraft.network.protocol.game.PacketPlayOutWorldParticles;
+import net.minecraft.network.protocol.handshake.PacketHandshakingInListener;
import net.minecraft.network.protocol.handshake.PacketHandshakingInSetProtocol;
import net.minecraft.network.protocol.login.PacketLoginInCustomPayload;
import net.minecraft.network.protocol.login.PacketLoginInEncryptionBegin;
+import net.minecraft.network.protocol.login.PacketLoginInListener;
import net.minecraft.network.protocol.login.PacketLoginInStart;
import net.minecraft.network.protocol.login.PacketLoginOutCustomPayload;
import net.minecraft.network.protocol.login.PacketLoginOutDisconnect;
import net.minecraft.network.protocol.login.PacketLoginOutEncryptionBegin;
+import net.minecraft.network.protocol.login.PacketLoginOutListener;
import net.minecraft.network.protocol.login.PacketLoginOutSetCompression;
import net.minecraft.network.protocol.login.PacketLoginOutSuccess;
+import net.minecraft.network.protocol.status.PacketStatusInListener;
import net.minecraft.network.protocol.status.PacketStatusInPing;
import net.minecraft.network.protocol.status.PacketStatusInStart;
+import net.minecraft.network.protocol.status.PacketStatusOutListener;
import net.minecraft.network.protocol.status.PacketStatusOutPong;
import net.minecraft.network.protocol.status.PacketStatusOutServerInfo;
import org.apache.logging.log4j.LogManager;
public enum EnumProtocol {
@ -216,7 +247,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ return stream.<ResourcePackLoader>map(resourcepackrepository::a).filter(Objects::nonNull).map(ResourcePackLoader::d).collect(ImmutableList.toImmutableList()); // CraftBukkit - decompile error // Paper - decompile error
}, this).thenCompose((immutablelist) -> {
- return DataPackResources.a(immutablelist, this.j() ? CommandDispatcher.ServerType.DEDICATED : CommandDispatcher.ServerType.INTEGRATED, this.h(), this.executorService, this);
+ return DataPackResources.a((List<IResourcePack>) immutablelist, this.j() ? CommandDispatcher.ServerType.DEDICATED : CommandDispatcher.ServerType.INTEGRATED, this.h(), this.executorService, this); // Paper - decompile error
+ return DataPackResources.a(immutablelist, this.j() ? CommandDispatcher.ServerType.DEDICATED : CommandDispatcher.ServerType.INTEGRATED, this.h(), this.executorService, this); // Paper - decompile error
}).thenAcceptAsync((datapackresources) -> {
this.dataPackResources.close();
this.dataPackResources = datapackresources;

Datei anzeigen

@ -3057,7 +3057,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ return x & 3 | ((z & 3) << 2);
+ }
+
+ void addLoadedChunk(Chunk chunk) {
+ public void addLoadedChunk(Chunk chunk) {
+ this.loadedChunkMapSeqLock.acquireWrite();
+ try {
+ this.loadedChunkMap.put(chunk.coordinateKey, chunk);
@ -3072,7 +3072,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ this.lastLoadedChunks[cacheKey] = chunk;
+ }
+
+ void removeLoadedChunk(Chunk chunk) {
+ public void removeLoadedChunk(Chunk chunk) {
+ this.loadedChunkMapSeqLock.acquireWrite();
+ try {
+ this.loadedChunkMap.remove(chunk.coordinateKey);
@ -3893,6 +3893,14 @@ diff --git a/src/main/java/net/minecraft/world/level/ChunkCache.java b/src/main/
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/level/ChunkCache.java
+++ b/src/main/java/net/minecraft/world/level/ChunkCache.java
@@ -0,0 +0,0 @@ import java.util.function.Predicate;
import java.util.stream.Stream;
import javax.annotation.Nullable;
import net.minecraft.core.BlockPosition;
+import net.minecraft.server.level.WorldServer;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.entity.TileEntity;
@@ -0,0 +0,0 @@ public class ChunkCache implements IBlockAccess, ICollisionAccess {
protected final int b;
protected final IChunkAccess[][] c;

Datei anzeigen

@ -199,9 +199,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
private final ChunkTaskQueueSorter p;
private final Mailbox<ChunkTaskQueueSorter.a<Runnable>> mailboxWorldGen;
- private final Mailbox<ChunkTaskQueueSorter.a<Runnable>> mailboxMain;
+ final Mailbox<ChunkTaskQueueSorter.a<Runnable>> mailboxMain; // Paper - private -> package private
+ public final Mailbox<ChunkTaskQueueSorter.a<Runnable>> mailboxMain; // Paper - private -> public
+ // Paper start
+ final Mailbox<ChunkTaskQueueSorter.a<Runnable>> mailboxLight;
+ public void addLightTask(PlayerChunk playerchunk, Runnable run) {
+ this.mailboxLight.a(ChunkTaskQueueSorter.a(playerchunk, run));
+ }
+ // Paper end
public final WorldLoadListener worldLoadListener;
public final PlayerChunkMap.a chunkDistanceManager;
public final PlayerChunkMap.a chunkDistanceManager; public final ChunkMapDistance getChunkDistanceManager() { return this.chunkDistanceManager; } // Paper - OBFHELPER
private final AtomicInteger u;
@@ -0,0 +0,0 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
public final com.destroystokyo.paper.util.misc.PlayerAreaMap playerMobSpawnMap; // this map is absent from updateMaps since it's controlled at the start of the chunkproviderserver tick
@ -510,7 +516,48 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
}
- private final void sendChunk(EntityPlayer entityplayer, Packet<?>[] apacket, Chunk chunk) { this.a(entityplayer, apacket, chunk); } // Paper - OBFHELPER
+ final void sendChunk(EntityPlayer entityplayer, Packet<?>[] apacket, Chunk chunk) { this.a(entityplayer, apacket, chunk); } // Paper - OBFHELPER
+ // Paper start
+ private static int getLightMask(final Chunk chunk) {
+ final ChunkSection[] chunkSections = chunk.getSections();
+ int mask = 0;
+
+ for (int i = 0; i < chunkSections.length; ++i) {
+ /*
+
+
+Lightmasks have 18 bits, from the -1 (void) section until the 17th (air) section.
+Sections go from 0..16. Now whenever a section is not empty, it can potentially change lighting for the section itself, the section below and the section above, hence the bitmask 111b, which is 7d.
+
+ */
+ mask |= (ChunkSection.isEmpty(chunkSections[i]) ? 0 : 7) << i;
+ }
+
+ return mask;
+ }
+
+ private static int getCeilingLightMask(final Chunk chunk) {
+ int mask = getLightMask(chunk);
+
+ /*
+ It is similar to get highest bit, it would turn an 001010 into an 001111 so basically the highest bit and all below.
+ We then invert this, so we'd have 110000 and compare that to the "main" chunk.
+ This is because the bug only appears when the current chunks lightmaps are higher than those of the neighbors, thus we can omit sending neighbors which are lower than the current chunks lights.
+
+ so TLDR is that getCeilingLightMask returns a light mask with all bits set below the highest affected section. We could also count the number of leading zeros and invert them, somehow.
+ @TODO: Implement Leafs suggestion
+ either use Integer#numberOfLeadingZeros or document what this bithack is supposed to be doing then
+ */
+ mask |= mask >> 1;
+ mask |= mask >> 2;
+ mask |= mask >> 4;
+ mask |= mask >> 8;
+ mask |= mask >> 16;
+
+ return mask;
+ }
+ // Paper end
+
+ public final void sendChunk(EntityPlayer entityplayer, Packet<?>[] apacket, Chunk chunk) { this.a(entityplayer, apacket, chunk); } // Paper - OBFHELPER
private void a(EntityPlayer entityplayer, Packet<?>[] apacket, Chunk chunk) {
if (apacket[0] == null) {
apacket[0] = new PacketPlayOutMapChunk(chunk, 65535, chunk.world.chunkPacketBlockController.shouldModify(entityplayer, chunk, 65535)); // Paper - Anti-Xray - Bypass
@ -577,6 +624,19 @@ diff --git a/src/main/java/net/minecraft/world/level/chunk/Chunk.java b/src/main
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/level/chunk/Chunk.java
+++ b/src/main/java/net/minecraft/world/level/chunk/Chunk.java
@@ -0,0 +0,0 @@ import net.minecraft.core.IRegistry;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.level.ChunkProviderServer;
+import net.minecraft.network.protocol.Packet;
+import net.minecraft.server.level.ChunkTaskQueueSorter;
+import net.minecraft.server.level.EntityPlayer;
import net.minecraft.server.level.PlayerChunk;
+import net.minecraft.server.level.PlayerChunkMap;
+import net.minecraft.server.level.TicketType;
import net.minecraft.server.level.WorldServer;
import net.minecraft.util.EntitySlice;
import net.minecraft.util.MathHelper;
@@ -0,0 +0,0 @@ public class Chunk implements IChunkAccess {
}
@ -642,6 +702,14 @@ diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/jav
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -0,0 +0,0 @@ import net.minecraft.network.protocol.game.PacketPlayOutWorldEvent;
import net.minecraft.resources.MinecraftKey;
import net.minecraft.server.level.ChunkMapDistance;
import net.minecraft.server.level.PlayerChunk;
+import net.minecraft.server.level.PlayerChunkMap;
import net.minecraft.server.level.Ticket;
import net.minecraft.server.level.TicketType;
import net.minecraft.server.level.WorldServer;
@@ -0,0 +0,0 @@ public class CraftWorld implements World {
// Spigot start
@Override
@ -657,7 +725,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ if (viewDistance < 2 || viewDistance > 32) {
+ throw new IllegalArgumentException("View distance " + viewDistance + " is out of range of [2, 32]");
+ }
+ net.minecraft.server.PlayerChunkMap chunkMap = getHandle().getChunkProvider().playerChunkMap;
+ PlayerChunkMap chunkMap = getHandle().getChunkProvider().playerChunkMap;
+ if (viewDistance != chunkMap.getEffectiveViewDistance()) {
+ chunkMap.setViewDistance(viewDistance);
+ }
@ -673,7 +741,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ if ((viewDistance < 2 || viewDistance > 32) && viewDistance != -1) {
+ throw new IllegalArgumentException("View distance " + viewDistance + " is out of range of [2, 32]");
+ }
+ net.minecraft.server.PlayerChunkMap chunkMap = getHandle().getChunkProvider().playerChunkMap;
+ PlayerChunkMap chunkMap = getHandle().getChunkProvider().playerChunkMap;
+ if (viewDistance != chunkMap.getRawNoTickViewDistance()) {
+ chunkMap.setNoTickViewDistance(viewDistance);
+ }
@ -687,12 +755,20 @@ diff --git a/src/main/java/org/spigotmc/ActivationRange.java b/src/main/java/org
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/spigotmc/ActivationRange.java
+++ b/src/main/java/org/spigotmc/ActivationRange.java
@@ -0,0 +0,0 @@ package org.spigotmc;
import java.util.Collection;
import net.minecraft.server.MinecraftServer;
+import net.minecraft.server.level.WorldServer;
import net.minecraft.util.MathHelper;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.EntityCreature;
@@ -0,0 +0,0 @@ public class ActivationRange
maxRange = Math.max( maxRange, waterActivationRange );
maxRange = Math.max( maxRange, villagerActivationRange );
// Paper end
- maxRange = Math.min( ( world.spigotConfig.viewDistance << 4 ) - 8, maxRange );
+ maxRange = Math.min( ( ((net.minecraft.server.WorldServer)world).getChunkProvider().playerChunkMap.getEffectiveViewDistance() << 4 ) - 8, maxRange ); // Paper - no-tick view distance
+ maxRange = Math.min( ( ((WorldServer)world).getChunkProvider().playerChunkMap.getEffectiveViewDistance() << 4 ) - 8, maxRange ); // Paper - no-tick view distance
for ( EntityHuman player : world.getPlayers() )
{

Datei anzeigen

@ -55,6 +55,14 @@ diff --git a/src/main/java/net/minecraft/world/level/block/BlockPlant.java b/src
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/level/block/BlockPlant.java
+++ b/src/main/java/net/minecraft/world/level/block/BlockPlant.java
@@ -0,0 +0,0 @@ package net.minecraft.world.level.block;
import net.minecraft.core.BlockPosition;
import net.minecraft.core.EnumDirection;
+import net.minecraft.server.level.WorldServer;
import net.minecraft.world.level.GeneratorAccess;
import net.minecraft.world.level.IBlockAccess;
import net.minecraft.world.level.IWorldReader;
@@ -0,0 +0,0 @@ public class BlockPlant extends Block {
public IBlockData updateState(IBlockData iblockdata, EnumDirection enumdirection, IBlockData iblockdata1, GeneratorAccess generatoraccess, BlockPosition blockposition, BlockPosition blockposition1) {
// CraftBukkit start
@ -68,6 +76,14 @@ diff --git a/src/main/java/net/minecraft/world/level/block/BlockTallPlant.java b
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/level/block/BlockTallPlant.java
+++ b/src/main/java/net/minecraft/world/level/block/BlockTallPlant.java
@@ -0,0 +0,0 @@ package net.minecraft.world.level.block;
import javax.annotation.Nullable;
import net.minecraft.core.BlockPosition;
import net.minecraft.core.EnumDirection;
+import net.minecraft.server.level.WorldServer;
import net.minecraft.world.entity.EntityLiving;
import net.minecraft.world.entity.player.EntityHuman;
import net.minecraft.world.item.ItemStack;
@@ -0,0 +0,0 @@ public class BlockTallPlant extends BlockPlant {
protected static void b(World world, BlockPosition blockposition, IBlockData iblockdata, EntityHuman entityhuman) {

Datei anzeigen

@ -1075,6 +1075,14 @@ diff --git a/src/main/java/net/minecraft/world/level/TickListChunk.java b/src/ma
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/level/TickListChunk.java
+++ b/src/main/java/net/minecraft/world/level/TickListChunk.java
@@ -0,0 +0,0 @@ import net.minecraft.core.BlockPosition;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.resources.MinecraftKey;
+import net.minecraft.server.MinecraftServer;
public class TickListChunk<T> implements TickList<T> {
@@ -0,0 +0,0 @@ public class TickListChunk<T> implements TickList<T> {
return nbttaglist;
}

Datei anzeigen

@ -251,7 +251,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ }
+
+ @FunctionalInterface
+ static interface DataBitConsumer {
+ public static interface DataBitConsumer {
+
+ void accept(int location, int data);
+

Datei anzeigen

@ -71,6 +71,16 @@ diff --git a/src/main/java/net/minecraft/world/level/VoxelShapeSpliterator.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/level/VoxelShapeSpliterator.java
+++ b/src/main/java/net/minecraft/world/level/VoxelShapeSpliterator.java
@@ -0,0 +0,0 @@ import java.util.function.Consumer;
import javax.annotation.Nullable;
import net.minecraft.core.BlockPosition;
import net.minecraft.core.CursorPosition;
+import net.minecraft.server.MCUtil;
+import net.minecraft.server.level.EntityPlayer;
+import net.minecraft.server.level.RegionLimitedWorldAccess;
import net.minecraft.util.MathHelper;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.level.block.Blocks;
@@ -0,0 +0,0 @@ import net.minecraft.world.phys.shapes.VoxelShapes;
public class VoxelShapeSpliterator extends AbstractSpliterator<VoxelShape> {

Datei anzeigen

@ -34,6 +34,14 @@ diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -0,0 +0,0 @@ import net.minecraft.world.level.WorldSettings;
import net.minecraft.world.level.biome.BiomeManager;
import net.minecraft.world.level.biome.WorldChunkManager;
import net.minecraft.world.level.block.Block;
+import net.minecraft.world.level.block.entity.TileEntityHopper;
import net.minecraft.world.level.border.IWorldBorderListener;
import net.minecraft.world.level.border.WorldBorder;
import net.minecraft.world.level.chunk.ChunkGenerator;
@@ -0,0 +0,0 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
while (iterator.hasNext()) {
WorldServer worldserver = (WorldServer) iterator.next();
@ -138,7 +146,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ // Paper start - Optimize Hoppers
+ private static boolean skipPullModeEventFire = false;
+ private static boolean skipPushModeEventFire = false;
+ static boolean skipHopperEvents = false;
+ public static boolean skipHopperEvents = false;
+
+ private boolean hopperPush(IInventory iinventory, EnumDirection enumdirection) {
+ skipPushModeEventFire = skipHopperEvents;

Datei anzeigen

@ -94,6 +94,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
import it.unimi.dsi.fastutil.objects.ObjectList;
import it.unimi.dsi.fastutil.objects.ObjectListIterator;
@@ -0,0 +0,0 @@ import net.minecraft.util.thread.ThreadedMailbox;
import net.minecraft.world.level.ChunkCoordIntPair;
import net.minecraft.world.level.EnumSkyBlock;
import net.minecraft.world.level.chunk.ChunkSection;
+import net.minecraft.world.level.chunk.ChunkStatus;
import net.minecraft.world.level.chunk.IChunkAccess;
import net.minecraft.world.level.chunk.ILightAccess;
import net.minecraft.world.level.chunk.NibbleArray;
@@ -0,0 +0,0 @@ public class LightEngineThreaded extends LightEngine implements AutoCloseable {
private static final Logger LOGGER = LogManager.getLogger();
@ -461,17 +469,17 @@ diff --git a/src/main/java/net/minecraft/world/level/chunk/NibbleArray.java b/sr
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/level/chunk/NibbleArray.java
+++ b/src/main/java/net/minecraft/world/level/chunk/NibbleArray.java
@@ -0,0 +0,0 @@ import net.minecraft.SystemUtils;
@@ -0,0 +0,0 @@ import net.minecraft.server.MCUtil;
public class NibbleArray {
// Paper start
+ static final NibbleArray EMPTY_NIBBLE_ARRAY = new NibbleArray() {
+ public static final NibbleArray EMPTY_NIBBLE_ARRAY = new NibbleArray() {
+ @Override
+ public byte[] asBytes() {
+ throw new IllegalStateException();
+ }
+ };
+ long lightCacheKey = Long.MIN_VALUE;
+ public long lightCacheKey = Long.MIN_VALUE;
public static byte[] EMPTY_NIBBLE = new byte[2048];
private static final int nibbleBucketSizeMultiplier = Integer.getInteger("Paper.nibbleBucketSize", 3072);
private static final int maxPoolSize = Integer.getInteger("Paper.maxNibblePoolSize", (int) Math.min(6, Math.max(1, Runtime.getRuntime().maxMemory() / 1024 / 1024 / 1024)) * (nibbleBucketSizeMultiplier * 8));
@ -759,6 +767,14 @@ diff --git a/src/main/java/net/minecraft/world/level/lighting/LightEngineSky.jav
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/level/lighting/LightEngineSky.java
+++ b/src/main/java/net/minecraft/world/level/lighting/LightEngineSky.java
@@ -0,0 +0,0 @@ import net.minecraft.core.BlockPosition;
import net.minecraft.core.EnumDirection;
import net.minecraft.core.SectionPosition;
import net.minecraft.world.level.EnumSkyBlock;
+import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.state.IBlockData;
import net.minecraft.world.level.chunk.ILightAccess;
import net.minecraft.world.level.chunk.NibbleArray;
@@ -0,0 +0,0 @@ public final class LightEngineSky extends LightEngineLayer<LightEngineStorageSky
return k;
} else {

Datei anzeigen

@ -52,9 +52,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
public java.net.InetSocketAddress virtualHost;
private static boolean enableExplicitFlush = Boolean.getBoolean("paper.explicit-flush");
+ // Optimize network
+ boolean isPending = true;
+ boolean queueImmunity = false;
+ EnumProtocol protocol;
+ public boolean isPending = true;
+ public boolean queueImmunity = false;
+ public EnumProtocol protocol;
// Paper end
public NetworkManager(EnumProtocolDirection enumprotocoldirection) {
@ -71,7 +71,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
this.packetListener = packetlistener;
}
+ // Paper start
+ EntityPlayer getPlayer() {
+ public EntityPlayer getPlayer() {
+ if (packetListener instanceof PlayerConnection) {
+ return ((PlayerConnection) packetListener).player;
+ } else {

Datei anzeigen

@ -62,6 +62,16 @@ diff --git a/src/main/java/net/minecraft/network/protocol/PlayerConnectionUtils.
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/network/protocol/PlayerConnectionUtils.java
+++ b/src/main/java/net/minecraft/network/protocol/PlayerConnectionUtils.java
@@ -0,0 +0,0 @@
package net.minecraft.network.protocol;
+import net.minecraft.network.NetworkManager;
import net.minecraft.network.PacketListener;
+import net.minecraft.network.chat.ChatComponentText;
+import net.minecraft.network.protocol.game.PacketPlayOutKickDisconnect;
import net.minecraft.server.CancelledPacketHandleException;
import net.minecraft.server.level.WorldServer;
import net.minecraft.util.thread.IAsyncTaskHandler;
@@ -0,0 +0,0 @@ public class PlayerConnectionUtils {
try (Timing ignored = timing.startTiming()) { // Paper - timings
packet.a(t0);

Datei anzeigen

@ -134,6 +134,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import net.minecraft.SystemUtils;
+import net.minecraft.server.MCUtil;
public class NibbleArray {
@ -303,6 +304,14 @@ diff --git a/src/main/java/net/minecraft/world/level/lighting/LightEngineStorage
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/level/lighting/LightEngineStorageArray.java
+++ b/src/main/java/net/minecraft/world/level/lighting/LightEngineStorageArray.java
@@ -0,0 +0,0 @@ package net.minecraft.world.level.lighting;
import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap;
import javax.annotation.Nullable;
+import net.minecraft.server.MCUtil;
import net.minecraft.world.level.chunk.NibbleArray;
public abstract class LightEngineStorageArray<M extends LightEngineStorageArray<M>> {
@@ -0,0 +0,0 @@ public abstract class LightEngineStorageArray<M extends LightEngineStorageArray<
public void a(long i) {

Datei anzeigen

@ -10,6 +10,14 @@ diff --git a/src/main/java/net/minecraft/world/entity/ai/navigation/NavigationAb
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/entity/ai/navigation/NavigationAbstract.java
+++ b/src/main/java/net/minecraft/world/entity/ai/navigation/NavigationAbstract.java
@@ -0,0 +0,0 @@ import net.minecraft.core.BlockPosition;
import net.minecraft.core.IPosition;
import net.minecraft.network.protocol.game.PacketDebug;
import net.minecraft.server.MCUtil;
+import net.minecraft.server.MinecraftServer;
import net.minecraft.util.MathHelper;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.EntityInsentient;
@@ -0,0 +0,0 @@ public abstract class NavigationAbstract {
protected final EntityInsentient a; public Entity getEntity() { return a; } // Paper - OBFHELPER
protected final World b;

Datei anzeigen

@ -285,7 +285,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ if (Thread.currentThread() != world.getMinecraftWorld().serverThread) {
+ synchronized (world.getChunkProvider().playerChunkMap.visibleChunks) {
+ Long2ObjectLinkedOpenHashMap<PlayerChunk> chunks = world.getChunkProvider().playerChunkMap.visibleChunks;
+ return chunks.values().stream().map(PlayerChunk::getFullChunk).filter(Objects::nonNull).map(net.minecraft.server.Chunk::getBukkitChunk).toArray(Chunk[]::new);
+ return chunks.values().stream().map(PlayerChunk::getFullChunk).filter(Objects::nonNull).map(net.minecraft.world.level.chunk.Chunk::getBukkitChunk).toArray(Chunk[]::new);
+ }
+ }
+ // Paper end

Datei anzeigen

@ -47,6 +47,14 @@ diff --git a/src/main/java/net/minecraft/world/level/block/entity/TileEntityChes
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/TileEntityChest.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/TileEntityChest.java
@@ -0,0 +0,0 @@ import net.minecraft.core.NonNullList;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.chat.ChatMessage;
import net.minecraft.network.chat.IChatBaseComponent;
+import net.minecraft.server.MCUtil;
import net.minecraft.sounds.SoundCategory;
import net.minecraft.sounds.SoundEffect;
import net.minecraft.sounds.SoundEffects;
@@ -0,0 +0,0 @@ import org.bukkit.craftbukkit.entity.CraftHumanEntity;
import org.bukkit.entity.HumanEntity;
// CraftBukkit end
@ -133,7 +141,12 @@ diff --git a/src/main/java/net/minecraft/world/level/block/entity/TileEntityEnde
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/TileEntityEnderChest.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/TileEntityEnderChest.java
@@ -0,0 +0,0 @@ import net.minecraft.sounds.SoundEffects;
@@ -0,0 +0,0 @@
package net.minecraft.world.level.block.entity;
+import net.minecraft.server.MCUtil;
import net.minecraft.sounds.SoundCategory;
import net.minecraft.sounds.SoundEffects;
import net.minecraft.world.entity.player.EntityHuman;
import net.minecraft.world.level.block.Blocks;

Datei anzeigen

@ -39,6 +39,14 @@ diff --git a/src/main/java/net/minecraft/server/players/UserCache.java b/src/mai
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/players/UserCache.java
+++ b/src/main/java/net/minecraft/server/players/UserCache.java
@@ -0,0 +0,0 @@ import java.util.concurrent.atomic.AtomicLong;
import java.util.concurrent.atomic.AtomicReference;
import java.util.stream.Stream;
import javax.annotation.Nullable;
+import net.minecraft.server.MCUtil;
import net.minecraft.world.entity.player.EntityHuman;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@@ -0,0 +0,0 @@ public class UserCache {
return UserCache.b;
}

Datei anzeigen

@ -64,6 +64,21 @@ diff --git a/src/main/java/net/minecraft/world/entity/item/EntityTNTPrimed.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/entity/item/EntityTNTPrimed.java
+++ b/src/main/java/net/minecraft/world/entity/item/EntityTNTPrimed.java
@@ -0,0 +0,0 @@ import javax.annotation.Nullable;
import net.minecraft.core.particles.Particles;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.protocol.Packet;
+import net.minecraft.network.protocol.game.PacketPlayOutEntityTeleport;
+import net.minecraft.network.protocol.game.PacketPlayOutEntityVelocity;
import net.minecraft.network.protocol.game.PacketPlayOutSpawnEntity;
import net.minecraft.network.syncher.DataWatcher;
import net.minecraft.network.syncher.DataWatcherObject;
import net.minecraft.network.syncher.DataWatcherRegistry;
+import net.minecraft.server.level.PlayerChunkMap;
+import net.minecraft.server.level.WorldServer;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.EntityLiving;
import net.minecraft.world.entity.EntityPose;
@@ -0,0 +0,0 @@ public class EntityTNTPrimed extends Entity {
this.world.addParticle(Particles.SMOKE, this.locX(), this.locY() + 0.5D, this.locZ(), 0.0D, 0.0D, 0.0D);
}

Datei anzeigen

@ -63,6 +63,16 @@ diff --git a/src/main/java/net/minecraft/world/level/levelgen/MobSpawnerPatrol.j
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/level/levelgen/MobSpawnerPatrol.java
+++ b/src/main/java/net/minecraft/world/level/levelgen/MobSpawnerPatrol.java
@@ -0,0 +0,0 @@ package net.minecraft.world.level.levelgen;
import java.util.Random;
import net.minecraft.core.BlockPosition;
import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.server.level.EntityPlayer;
import net.minecraft.server.level.WorldServer;
+import net.minecraft.stats.StatisticList;
import net.minecraft.world.entity.EntityTypes;
import net.minecraft.world.entity.EnumMobSpawn;
import net.minecraft.world.entity.GroupDataEntity;
@@ -0,0 +0,0 @@ import net.minecraft.world.level.block.state.IBlockData;
public class MobSpawnerPatrol implements MobSpawner {

Datei anzeigen

@ -8,6 +8,21 @@ diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -0,0 +0,0 @@ import net.minecraft.world.entity.ai.attributes.AttributeMapBase;
import net.minecraft.world.entity.ai.attributes.AttributeModifiable;
import net.minecraft.world.entity.ai.attributes.GenericAttributes;
import net.minecraft.world.entity.player.EntityHuman;
+import net.minecraft.world.entity.projectile.EntityFireworks;
import net.minecraft.world.inventory.Container;
import net.minecraft.world.item.EnumColor;
import net.minecraft.world.item.enchantment.EnchantmentManager;
import net.minecraft.world.item.enchantment.Enchantments;
import net.minecraft.world.level.ChunkCoordIntPair;
import net.minecraft.world.level.EnumGamemode;
+import net.minecraft.world.level.World;
import net.minecraft.world.level.biome.BiomeManager;
import net.minecraft.world.level.block.entity.TileEntitySign;
import net.minecraft.world.level.saveddata.maps.MapIcon;
@@ -0,0 +0,0 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
}
throw new RuntimeException("Unknown settings type");
@ -19,9 +34,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ Validate.isTrue(firework != null, "firework == null");
+ Validate.isTrue(firework.getType() == Material.FIREWORK_ROCKET, "Firework must be Material.FIREWORK_ROCKET");
+
+ net.minecraft.server.ItemStack item = org.bukkit.craftbukkit.inventory.CraftItemStack.asNMSCopy(firework);
+ net.minecraft.server.World world = ((CraftWorld) getWorld()).getHandle();
+ net.minecraft.server.EntityFireworks entity = new net.minecraft.server.EntityFireworks(world, item, getHandle());
+ net.minecraft.world.item.ItemStack item = org.bukkit.craftbukkit.inventory.CraftItemStack.asNMSCopy(firework);
+ World world = ((CraftWorld) getWorld()).getHandle();
+ EntityFireworks entity = new EntityFireworks(world, item, getHandle());
+ return world.addEntity(entity)
+ ? (org.bukkit.entity.Firework) entity.getBukkitEntity()
+ : null;

Datei anzeigen

@ -51,6 +51,14 @@ diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -0,0 +0,0 @@ import net.minecraft.world.item.EnumColor;
import net.minecraft.world.item.enchantment.EnchantmentManager;
import net.minecraft.world.item.enchantment.Enchantments;
import net.minecraft.world.level.EnumGamemode;
+import net.minecraft.world.level.biome.BiomeManager;
import net.minecraft.world.level.block.entity.TileEntitySign;
import net.minecraft.world.level.saveddata.maps.MapIcon;
import net.minecraft.world.phys.Vec3D;
@@ -0,0 +0,0 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
hiddenPlayers.put(player.getUniqueId(), hidingPlugins);
@ -118,7 +126,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+
+ //Respawn the player then update their position and selected slot
+ WorldServer worldserver = handle.getWorldServer();
+ connection.sendPacket(new net.minecraft.network.protocol.game.PacketPlayOutRespawn(worldserver.getDimensionManager(), worldserver.getDimensionKey(), net.minecraft.server.BiomeManager.a(worldserver.getSeed()), handle.playerInteractManager.getGameMode(), handle.playerInteractManager.c(), worldserver.isDebugWorld(), worldserver.isFlatWorld(), true));
+ connection.sendPacket(new net.minecraft.network.protocol.game.PacketPlayOutRespawn(worldserver.getDimensionManager(), worldserver.getDimensionKey(), BiomeManager.a(worldserver.getSeed()), handle.playerInteractManager.getGameMode(), handle.playerInteractManager.c(), worldserver.isDebugWorld(), worldserver.isFlatWorld(), true));
+ handle.updateAbilities();
+ connection.sendPacket(new net.minecraft.network.protocol.game.PacketPlayOutPosition(loc.getX(), loc.getY(), loc.getZ(), loc.getYaw(), loc.getPitch(), new HashSet<>(), 0));
+ net.minecraft.server.MinecraftServer.getServer().getPlayerList().updateClient(handle);

Datei anzeigen

@ -116,6 +116,20 @@ diff --git a/src/main/java/net/minecraft/world/item/ItemExpBottle.java b/src/mai
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/item/ItemExpBottle.java
+++ b/src/main/java/net/minecraft/world/item/ItemExpBottle.java
@@ -0,0 +0,0 @@
package net.minecraft.world.item;
+import net.minecraft.server.level.EntityPlayer;
import net.minecraft.sounds.SoundCategory;
import net.minecraft.sounds.SoundEffects;
import net.minecraft.stats.StatisticList;
import net.minecraft.world.EnumHand;
+import net.minecraft.world.EnumInteractionResult;
import net.minecraft.world.InteractionResultWrapper;
+import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.player.EntityHuman;
import net.minecraft.world.entity.projectile.EntityThrownExpBottle;
import net.minecraft.world.level.World;
@@ -0,0 +0,0 @@ public class ItemExpBottle extends Item {
public InteractionResultWrapper<ItemStack> a(World world, EntityHuman entityhuman, EnumHand enumhand) {
ItemStack itemstack = entityhuman.b(enumhand);
@ -161,6 +175,14 @@ diff --git a/src/main/java/net/minecraft/world/item/ItemFireworks.java b/src/mai
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/item/ItemFireworks.java
+++ b/src/main/java/net/minecraft/world/item/ItemFireworks.java
@@ -0,0 +0,0 @@ package net.minecraft.world.item;
import java.util.Arrays;
import java.util.Comparator;
import net.minecraft.core.EnumDirection;
+import net.minecraft.server.level.EntityPlayer;
import net.minecraft.world.EnumHand;
import net.minecraft.world.EnumInteractionResult;
import net.minecraft.world.InteractionResultWrapper;
@@ -0,0 +0,0 @@ public class ItemFireworks extends Item {
EntityFireworks entityfireworks = new EntityFireworks(world, itemactioncontext.getEntity(), vec3d.x + (double) enumdirection.getAdjacentX() * 0.15D, vec3d.y + (double) enumdirection.getAdjacentY() * 0.15D, vec3d.z + (double) enumdirection.getAdjacentZ() * 0.15D, itemstack);
entityfireworks.spawningEntity = itemactioncontext.getEntity().getUniqueID(); // Paper
@ -180,6 +202,14 @@ diff --git a/src/main/java/net/minecraft/world/item/ItemLingeringPotion.java b/s
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/item/ItemLingeringPotion.java
+++ b/src/main/java/net/minecraft/world/item/ItemLingeringPotion.java
@@ -0,0 +0,0 @@ package net.minecraft.world.item;
import net.minecraft.sounds.SoundCategory;
import net.minecraft.sounds.SoundEffects;
import net.minecraft.world.EnumHand;
+import net.minecraft.world.EnumInteractionResult;
import net.minecraft.world.InteractionResultWrapper;
import net.minecraft.world.entity.player.EntityHuman;
import net.minecraft.world.level.World;
@@ -0,0 +0,0 @@ public class ItemLingeringPotion extends ItemPotionThrowable {
@Override
@ -199,6 +229,16 @@ diff --git a/src/main/java/net/minecraft/world/item/ItemPotionThrowable.java b/s
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/item/ItemPotionThrowable.java
+++ b/src/main/java/net/minecraft/world/item/ItemPotionThrowable.java
@@ -0,0 +0,0 @@
package net.minecraft.world.item;
+import net.minecraft.server.level.EntityPlayer;
import net.minecraft.stats.StatisticList;
import net.minecraft.world.EnumHand;
+import net.minecraft.world.EnumInteractionResult;
import net.minecraft.world.InteractionResultWrapper;
import net.minecraft.world.entity.player.EntityHuman;
import net.minecraft.world.entity.projectile.EntityPotion;
@@ -0,0 +0,0 @@ public class ItemPotionThrowable extends ItemPotion {
entitypotion.setItem(itemstack);
@ -265,6 +305,14 @@ diff --git a/src/main/java/net/minecraft/world/item/ItemSplashPotion.java b/src/
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/item/ItemSplashPotion.java
+++ b/src/main/java/net/minecraft/world/item/ItemSplashPotion.java
@@ -0,0 +0,0 @@ package net.minecraft.world.item;
import net.minecraft.sounds.SoundCategory;
import net.minecraft.sounds.SoundEffects;
import net.minecraft.world.EnumHand;
+import net.minecraft.world.EnumInteractionResult;
import net.minecraft.world.InteractionResultWrapper;
import net.minecraft.world.entity.player.EntityHuman;
import net.minecraft.world.level.World;
@@ -0,0 +0,0 @@ public class ItemSplashPotion extends ItemPotionThrowable {
@Override

Datei anzeigen

@ -9,6 +9,14 @@ diff --git a/src/main/java/net/minecraft/world/entity/EntityExperienceOrb.java b
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/entity/EntityExperienceOrb.java
+++ b/src/main/java/net/minecraft/world/entity/EntityExperienceOrb.java
@@ -0,0 +0,0 @@ import net.minecraft.core.BlockPosition;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.protocol.Packet;
import net.minecraft.network.protocol.game.PacketPlayOutSpawnEntityExperienceOrb;
+import net.minecraft.server.level.EntityPlayer;
import net.minecraft.sounds.SoundEffects;
import net.minecraft.tags.Tag;
import net.minecraft.tags.TagsFluid;
@@ -0,0 +0,0 @@ public class EntityExperienceOrb extends Entity {
@Override
public void pickup(EntityHuman entityhuman) {

Datei anzeigen

@ -9,6 +9,14 @@ diff --git a/src/main/java/net/minecraft/world/level/block/entity/TileEntityEndG
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/TileEntityEndGateway.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/TileEntityEndGateway.java
@@ -0,0 +0,0 @@ import net.minecraft.data.worldgen.BiomeDecoratorGroups;
import net.minecraft.nbt.GameProfileSerializer;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.protocol.game.PacketPlayOutTileEntityData;
+import net.minecraft.server.MCUtil;
import net.minecraft.server.level.EntityPlayer;
import net.minecraft.server.level.WorldServer;
import net.minecraft.util.MathHelper;
@@ -0,0 +0,0 @@ public class TileEntityEndGateway extends TileEntityEnderPortal implements ITick
location.setPitch(player.getLocation().getPitch());
location.setYaw(player.getLocation().getYaw());

Datei anzeigen

@ -11,6 +11,14 @@ diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java b
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
@@ -0,0 +0,0 @@ import net.minecraft.network.chat.IChatBaseComponent;
import net.minecraft.network.protocol.game.PacketPlayInCloseWindow;
import net.minecraft.network.protocol.game.PacketPlayOutOpenWindow;
import net.minecraft.server.level.EntityPlayer;
+import net.minecraft.server.level.WorldServer;
import net.minecraft.world.ITileInventory;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.EntityTypes;
@@ -0,0 +0,0 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
return getHandle().sleepTicks;
}
@ -24,7 +32,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ return null;
+ }
+
+ net.minecraft.server.WorldServer worldServer = handle.server.getWorldServer(handle.getSpawnDimension());
+ WorldServer worldServer = handle.server.getWorldServer(handle.getSpawnDimension());
+ if (worldServer == null) {
+ return null;
+ }

Datei anzeigen

@ -72,6 +72,14 @@ diff --git a/src/main/java/net/minecraft/world/entity/npc/EntityVillager.java b/
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/entity/npc/EntityVillager.java
+++ b/src/main/java/net/minecraft/world/entity/npc/EntityVillager.java
@@ -0,0 +0,0 @@ import net.minecraft.network.protocol.game.PacketDebug;
import net.minecraft.network.syncher.DataWatcher;
import net.minecraft.network.syncher.DataWatcherObject;
import net.minecraft.network.syncher.DataWatcherRegistry;
+import net.minecraft.server.MCUtil;
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.level.WorldServer;
import net.minecraft.sounds.SoundEffect;
@@ -0,0 +0,0 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation
BlockPosition blockposition1 = this.a(blockposition, d0, d1);
@ -98,6 +106,14 @@ diff --git a/src/main/java/net/minecraft/world/level/MobSpawnerAbstract.java b/s
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/level/MobSpawnerAbstract.java
+++ b/src/main/java/net/minecraft/world/level/MobSpawnerAbstract.java
@@ -0,0 +0,0 @@ import net.minecraft.core.particles.Particles;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.resources.MinecraftKey;
+import net.minecraft.server.MCUtil;
import net.minecraft.server.level.WorldServer;
import net.minecraft.util.UtilColor;
import net.minecraft.util.WeightedRandom;
@@ -0,0 +0,0 @@ public abstract class MobSpawnerAbstract {
WorldServer worldserver = (WorldServer) world;
@ -130,6 +146,14 @@ diff --git a/src/main/java/net/minecraft/world/level/SpawnerCreature.java b/src/
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/level/SpawnerCreature.java
+++ b/src/main/java/net/minecraft/world/level/SpawnerCreature.java
@@ -0,0 +0,0 @@ import net.minecraft.core.EnumDirection;
import net.minecraft.core.IPosition;
import net.minecraft.core.IRegistry;
import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.server.MCUtil;
import net.minecraft.server.level.WorldServer;
import net.minecraft.tags.Tag;
import net.minecraft.tags.TagsBlock;
@@ -0,0 +0,0 @@ public final class SpawnerCreature {
j1 = biomesettingsmobs_c.d + worldserver.random.nextInt(1 + biomesettingsmobs_c.e - biomesettingsmobs_c.d);
}

Datei anzeigen

@ -55,6 +55,14 @@ diff --git a/src/main/java/net/minecraft/world/entity/ai/util/RandomPositionGene
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/entity/ai/util/RandomPositionGenerator.java
+++ b/src/main/java/net/minecraft/world/entity/ai/util/RandomPositionGenerator.java
@@ -0,0 +0,0 @@ import net.minecraft.util.MathHelper;
import net.minecraft.world.entity.EntityCreature;
import net.minecraft.world.entity.ai.navigation.NavigationAbstract;
import net.minecraft.world.level.IBlockAccess;
+import net.minecraft.world.level.material.Fluid;
import net.minecraft.world.level.pathfinder.PathType;
import net.minecraft.world.level.pathfinder.PathfinderNormal;
import net.minecraft.world.phys.Vec3D;
@@ -0,0 +0,0 @@ public class RandomPositionGenerator {
}

Datei anzeigen

@ -59,6 +59,14 @@ diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkRegionLo
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkRegionLoader.java
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkRegionLoader.java
@@ -0,0 +0,0 @@ import net.minecraft.nbt.NBTTagList;
import net.minecraft.nbt.NBTTagLongArray;
import net.minecraft.nbt.NBTTagShort;
import net.minecraft.server.level.ChunkProviderServer;
+import net.minecraft.server.level.EntityPlayer;
import net.minecraft.server.level.LightEngineThreaded;
import net.minecraft.server.level.WorldServer;
import net.minecraft.world.entity.Entity;
@@ -0,0 +0,0 @@ public class ChunkRegionLoader {
nbttagcompound1.set("TileEntities", nbttaglist1);
NBTTagList nbttaglist2 = new NBTTagList();

Datei anzeigen

@ -17,7 +17,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ // Paper start - Provide fast information methods
+ public int getEntityCount() {
+ int ret = 0;
+ for (net.minecraft.server.Entity entity : world.entitiesById.values()) {
+ for (net.minecraft.world.entity.Entity entity : world.entitiesById.values()) {
+ if (entity.isChunkLoaded()) {
+ ++ret;
+ }
@ -28,8 +28,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ // We don't use the full world tile entity list, so we must iterate chunks
+ Long2ObjectLinkedOpenHashMap<PlayerChunk> chunks = world.getChunkProvider().playerChunkMap.visibleChunks;
+ int size = 0;
+ for (net.minecraft.server.PlayerChunk playerchunk : chunks.values()) {
+ net.minecraft.server.Chunk chunk = playerchunk.getChunk();
+ for (PlayerChunk playerchunk : chunks.values()) {
+ net.minecraft.world.level.chunk.Chunk chunk = playerchunk.getChunk();
+ if (chunk == null) {
+ continue;
+ }

Datei anzeigen

@ -42,7 +42,7 @@ diff --git a/src/main/java/net/minecraft/server/level/PlayerChunkMap.java b/src/
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/level/PlayerChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/PlayerChunkMap.java
@@ -0,0 +0,0 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
@@ -0,0 +0,0 @@ Sections go from 0..16. Now whenever a section is not empty, it can potentially
public void updatePlayer(EntityPlayer entityplayer) {
org.spigotmc.AsyncCatcher.catchOp("player tracker update"); // Spigot
if (entityplayer != this.tracker) {

Datei anzeigen

@ -8,6 +8,18 @@ diff --git a/src/main/java/net/minecraft/world/level/chunk/Chunk.java b/src/main
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/level/chunk/Chunk.java
+++ b/src/main/java/net/minecraft/world/level/chunk/Chunk.java
@@ -0,0 +0,0 @@ import net.minecraft.world.level.TickListChunk;
import net.minecraft.world.level.TickListEmpty;
import net.minecraft.world.level.World;
import net.minecraft.world.level.block.Block;
+import net.minecraft.world.level.block.BlockMobSpawner;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.ITileEntity;
import net.minecraft.world.level.block.entity.TileEntity;
+import net.minecraft.world.level.block.entity.TileEntityMobSpawner;
import net.minecraft.world.level.block.state.IBlockData;
import net.minecraft.world.level.levelgen.ChunkProviderDebug;
import net.minecraft.world.level.levelgen.HeightMap;
@@ -0,0 +0,0 @@ public class Chunk implements IChunkAccess {
}

Datei anzeigen

@ -112,6 +112,14 @@ diff --git a/src/main/java/net/minecraft/world/level/levelgen/ChunkGeneratorAbst
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/level/levelgen/ChunkGeneratorAbstract.java
+++ b/src/main/java/net/minecraft/world/level/levelgen/ChunkGeneratorAbstract.java
@@ -0,0 +0,0 @@ import net.minecraft.world.level.levelgen.feature.structures.WorldGenFeatureDefi
import net.minecraft.world.level.levelgen.feature.structures.WorldGenFeatureDefinedStructurePoolTemplate;
import net.minecraft.world.level.levelgen.structure.StructureBoundingBox;
import net.minecraft.world.level.levelgen.structure.StructurePiece;
+import net.minecraft.world.level.levelgen.structure.StructureStart;
import net.minecraft.world.level.levelgen.structure.WorldGenFeaturePillagerOutpostPoolPiece;
import net.minecraft.world.level.levelgen.synth.NoiseGenerator;
import net.minecraft.world.level.levelgen.synth.NoiseGenerator3;
@@ -0,0 +0,0 @@ public final class ChunkGeneratorAbstract extends ChunkGenerator {
while (iterator.hasNext()) {
StructureGenerator<?> structuregenerator = (StructureGenerator) iterator.next();

Datei anzeigen

@ -23,6 +23,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
import java.util.List;
import net.minecraft.core.IRegistry;
import net.minecraft.resources.RegistryLookupCodec;
import net.minecraft.util.MathHelper;
+import net.minecraft.world.level.ChunkCoordIntPair;
import net.minecraft.world.level.levelgen.SeededRandom;
import net.minecraft.world.level.levelgen.synth.NoiseGenerator3Handler;
@@ -0,0 +0,0 @@ public class WorldChunkManagerTheEnd extends WorldChunkManager {
private final BiomeBase k;
private final BiomeBase l;

Datei anzeigen

@ -24,7 +24,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
}
// Paper start
+ java.lang.ref.WeakReference<net.minecraft.world.level.chunk.Chunk> currentChunk = null;
+ public java.lang.ref.WeakReference<net.minecraft.world.level.chunk.Chunk> currentChunk = null;
+
+ public void setCurrentChunk(net.minecraft.world.level.chunk.Chunk chunk) {
+ this.currentChunk = chunk != null ? new java.lang.ref.WeakReference<>(chunk) : null;

Datei anzeigen

@ -21,6 +21,14 @@ diff --git a/src/main/java/net/minecraft/world/entity/animal/EntityTurtle.java b
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/entity/animal/EntityTurtle.java
+++ b/src/main/java/net/minecraft/world/entity/animal/EntityTurtle.java
@@ -0,0 +0,0 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.syncher.DataWatcher;
import net.minecraft.network.syncher.DataWatcherObject;
import net.minecraft.network.syncher.DataWatcherRegistry;
+import net.minecraft.server.MCUtil;
import net.minecraft.server.level.EntityPlayer;
import net.minecraft.server.level.WorldServer;
import net.minecraft.sounds.SoundCategory;
@@ -0,0 +0,0 @@ public class EntityTurtle extends EntityAnimal {
this.datawatcher.set(EntityTurtle.bp, blockposition);
}

Datei anzeigen

@ -21,6 +21,14 @@ diff --git a/src/main/java/net/minecraft/world/entity/projectile/IProjectile.jav
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/entity/projectile/IProjectile.java
+++ b/src/main/java/net/minecraft/world/entity/projectile/IProjectile.java
@@ -0,0 +0,0 @@ import java.util.Iterator;
import java.util.UUID;
import javax.annotation.Nullable;
import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.server.level.EntityPlayer;
import net.minecraft.server.level.WorldServer;
import net.minecraft.util.MathHelper;
import net.minecraft.world.entity.Entity;
@@ -0,0 +0,0 @@ public abstract class IProjectile extends Entity {
protected boolean a(Entity entity) {
if (!entity.isSpectator() && entity.isAlive() && entity.isInteractable()) {

Datei anzeigen

@ -23,52 +23,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
import net.minecraft.world.level.chunk.ChunkStatus;
import net.minecraft.world.level.chunk.IChunkAccess;
import net.minecraft.world.level.chunk.ILightAccess;
@@ -0,0 +0,0 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
}
+ // Paper start
+ private static int getLightMask(final Chunk chunk) {
+ final ChunkSection[] chunkSections = chunk.getSections();
+ int mask = 0;
+
+ for (int i = 0; i < chunkSections.length; ++i) {
+ /*
+
+
+Lightmasks have 18 bits, from the -1 (void) section until the 17th (air) section.
+Sections go from 0..16. Now whenever a section is not empty, it can potentially change lighting for the section itself, the section below and the section above, hence the bitmask 111b, which is 7d.
+
+ */
+ mask |= (ChunkSection.isEmpty(chunkSections[i]) ? 0 : 7) << i;
+ }
+
+ return mask;
+ }
+
+ private static int getCeilingLightMask(final Chunk chunk) {
+ int mask = getLightMask(chunk);
+
+ /*
+ It is similar to get highest bit, it would turn an 001010 into an 001111 so basically the highest bit and all below.
+ We then invert this, so we'd have 110000 and compare that to the "main" chunk.
+ This is because the bug only appears when the current chunks lightmaps are higher than those of the neighbors, thus we can omit sending neighbors which are lower than the current chunks lights.
+
+ so TLDR is that getCeilingLightMask returns a light mask with all bits set below the highest affected section. We could also count the number of leading zeros and invert them, somehow.
+ @TODO: Implement Leafs suggestion
+ either use Integer#numberOfLeadingZeros or document what this bithack is supposed to be doing then
+ */
+ mask |= mask >> 1;
+ mask |= mask >> 2;
+ mask |= mask >> 4;
+ mask |= mask >> 8;
+ mask |= mask >> 16;
+
+ return mask;
+ }
+ // Paper end
+
final void sendChunk(EntityPlayer entityplayer, Packet<?>[] apacket, Chunk chunk) { this.a(entityplayer, apacket, chunk); } // Paper - OBFHELPER
@@ -0,0 +0,0 @@ Sections go from 0..16. Now whenever a section is not empty, it can potentially
public final void sendChunk(EntityPlayer entityplayer, Packet<?>[] apacket, Chunk chunk) { this.a(entityplayer, apacket, chunk); } // Paper - OBFHELPER
private void a(EntityPlayer entityplayer, Packet<?>[] apacket, Chunk chunk) {
if (apacket[0] == null) {
+ // Paper start - add 8 for light fix workaround

Datei anzeigen

@ -8,7 +8,13 @@ diff --git a/src/main/java/net/minecraft/world/item/ItemNameTag.java b/src/main/
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/item/ItemNameTag.java
+++ b/src/main/java/net/minecraft/world/item/ItemNameTag.java
@@ -0,0 +0,0 @@ import net.minecraft.world.entity.EntityInsentient;
@@ -0,0 +0,0 @@
package net.minecraft.world.item;
+import net.minecraft.server.level.EntityPlayer;
import net.minecraft.world.EnumHand;
import net.minecraft.world.EnumInteractionResult;
import net.minecraft.world.entity.EntityInsentient;
import net.minecraft.world.entity.EntityLiving;
import net.minecraft.world.entity.player.EntityHuman;

Datei anzeigen

@ -674,6 +674,14 @@ diff --git a/src/main/java/net/minecraft/world/level/SpawnerCreature.java b/src/
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/level/SpawnerCreature.java
+++ b/src/main/java/net/minecraft/world/level/SpawnerCreature.java
@@ -0,0 +0,0 @@ import net.minecraft.core.IPosition;
import net.minecraft.core.IRegistry;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.server.MCUtil;
+import net.minecraft.server.level.EntityPlayer;
import net.minecraft.server.level.WorldServer;
import net.minecraft.tags.Tag;
import net.minecraft.tags.TagsBlock;
@@ -0,0 +0,0 @@ public final class SpawnerCreature {
});

Datei anzeigen

@ -62,7 +62,7 @@ function importLibrary {
files=$(cat "$basedir/Spigot-Server-Patches/"* | grep "+++ b/src/main/java/net/minecraft/" | sort | uniq | sed 's/\+\+\+ b\/src\/main\/java\/net\/minecraft\///g')
nonnms=$(grep -R "new file mode" -B 1 "$basedir/Spigot-Server-Patches/" | grep -v "new file mode" | grep -oE "net\/minecraft\/**\/.*.java" | grep -oE "[A-Za-z]+?.java$" --color=none | sed 's/.java//g')
nonnms=$(grep -R "new file mode" -B 1 "$basedir/Spigot-Server-Patches/" | grep -v "new file mode" | grep -oE "net\/minecraft\/**\/.*.java" | sed -E 's/.*\/net\/minecraft\/(.*)/\1/g')
function containsElement {
local e
for e in "${@:2}"; do
@ -78,12 +78,16 @@ for f in $files; do
f="$(echo "$f" | sed 's/.java//g')"
if [ ! -f "$decompiledir/$nms/$f.java" ]; then
echo "$(color 1 31) ERROR!!! Missing NMS$(color 1 34) $f $(colorend)";
error=true
else
import $f
fi
fi
fi
done
if [ -n "$error" ]; then
exit 1
fi
########################################################
########################################################