mirror of
https://github.com/PaperMC/Paper.git
synced 2025-08-01 20:52:12 -07:00
More work?
This commit is contained in:
@@ -29,7 +29,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
--- a/src/main/java/net/minecraft/commands/Commands.java
|
--- a/src/main/java/net/minecraft/commands/Commands.java
|
||||||
+++ b/src/main/java/net/minecraft/commands/Commands.java
|
+++ b/src/main/java/net/minecraft/commands/Commands.java
|
||||||
@@ -0,0 +0,0 @@ public class Commands {
|
@@ -0,0 +0,0 @@ public class Commands {
|
||||||
commandlistenerwrapper.getServer().getProfiler().push(() -> {
|
Profiler.get().push(() -> {
|
||||||
return "/" + s;
|
return "/" + s;
|
||||||
});
|
});
|
||||||
- ContextChain<CommandSourceStack> contextchain = Commands.finishParsing(parseresults, s, commandlistenerwrapper, label); // CraftBukkit
|
- ContextChain<CommandSourceStack> contextchain = Commands.finishParsing(parseresults, s, commandlistenerwrapper, label); // CraftBukkit
|
@@ -14,9 +14,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
--- a/src/main/java/net/minecraft/Util.java
|
--- a/src/main/java/net/minecraft/Util.java
|
||||||
+++ b/src/main/java/net/minecraft/Util.java
|
+++ b/src/main/java/net/minecraft/Util.java
|
||||||
@@ -0,0 +0,0 @@ public class Util {
|
@@ -0,0 +0,0 @@ public class Util {
|
||||||
private static final ExecutorService BACKGROUND_EXECUTOR = makeExecutor("Main");
|
private static final TracingExecutor BACKGROUND_EXECUTOR = makeExecutor("Main");
|
||||||
private static final ExecutorService IO_POOL = makeIoExecutor("IO-Worker-", false);
|
private static final TracingExecutor IO_POOL = makeIoExecutor("IO-Worker-", false);
|
||||||
private static final ExecutorService DOWNLOAD_POOL = makeIoExecutor("Download-", true);
|
private static final TracingExecutor DOWNLOAD_POOL = makeIoExecutor("Download-", true);
|
||||||
+ // Paper start - don't submit BLOCKING PROFILE LOOKUPS to the world gen thread
|
+ // Paper start - don't submit BLOCKING PROFILE LOOKUPS to the world gen thread
|
||||||
+ public static final ExecutorService PROFILE_EXECUTOR = Executors.newFixedThreadPool(2, new java.util.concurrent.ThreadFactory() {
|
+ public static final ExecutorService PROFILE_EXECUTOR = Executors.newFixedThreadPool(2, new java.util.concurrent.ThreadFactory() {
|
||||||
+
|
+
|
||||||
@@ -44,7 +44,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
} else {
|
} else {
|
||||||
CompletableFuture<Optional<GameProfile>> completablefuture1 = CompletableFuture.supplyAsync(() -> {
|
CompletableFuture<Optional<GameProfile>> completablefuture1 = CompletableFuture.supplyAsync(() -> {
|
||||||
return this.get(username);
|
return this.get(username);
|
||||||
- }, Util.backgroundExecutor()).whenCompleteAsync((optional, throwable) -> {
|
- }, Util.backgroundExecutor().forName("getProfile")).whenCompleteAsync((optional, throwable) -> {
|
||||||
+ }, Util.PROFILE_EXECUTOR).whenCompleteAsync((optional, throwable) -> { // Paper - don't submit BLOCKING PROFILE LOOKUPS to the world gen thread
|
+ }, Util.PROFILE_EXECUTOR).whenCompleteAsync((optional, throwable) -> { // Paper - don't submit BLOCKING PROFILE LOOKUPS to the world gen thread
|
||||||
this.requests.remove(username);
|
this.requests.remove(username);
|
||||||
}, this.executor);
|
}, this.executor);
|
||||||
@@ -57,7 +57,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
ProfileResult profileResult = apiServices.sessionService().fetchProfile(uuid, true);
|
ProfileResult profileResult = apiServices.sessionService().fetchProfile(uuid, true);
|
||||||
return Optional.ofNullable(profileResult).map(ProfileResult::profile);
|
return Optional.ofNullable(profileResult).map(ProfileResult::profile);
|
||||||
}
|
}
|
||||||
- }, Util.backgroundExecutor());
|
- }, Util.backgroundExecutor().forName("fetchProfile"));
|
||||||
+ }, Util.PROFILE_EXECUTOR); // Paper - don't submit BLOCKING PROFILE LOOKUPS to the world gen thread
|
+ }, Util.PROFILE_EXECUTOR); // Paper - don't submit BLOCKING PROFILE LOOKUPS to the world gen thread
|
||||||
}
|
}
|
||||||
|
|
@@ -131,11 +131,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||||
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||||
@@ -0,0 +0,0 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
@@ -0,0 +0,0 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||||
protected void dropExperience(@Nullable Entity attacker) {
|
protected void dropExperience(ServerLevel world, @Nullable Entity attacker) {
|
||||||
// CraftBukkit start - Update getExpReward() above if the removed if() changes!
|
// CraftBukkit start - Update getExpReward() above if the removed if() changes!
|
||||||
if (!(this instanceof net.minecraft.world.entity.boss.enderdragon.EnderDragon)) { // CraftBukkit - SPIGOT-2420: Special case ender dragon will drop the xp over time
|
if (!(this instanceof net.minecraft.world.entity.boss.enderdragon.EnderDragon)) { // CraftBukkit - SPIGOT-2420: Special case ender dragon will drop the xp over time
|
||||||
- ExperienceOrb.award((ServerLevel) this.level(), this.position(), this.expToDrop);
|
- ExperienceOrb.award(world, this.position(), this.expToDrop);
|
||||||
+ ExperienceOrb.award((ServerLevel) this.level(), this.position(), this.expToDrop, this instanceof ServerPlayer ? org.bukkit.entity.ExperienceOrb.SpawnReason.PLAYER_DEATH : org.bukkit.entity.ExperienceOrb.SpawnReason.ENTITY_DEATH, attacker, this); // Paper
|
+ ExperienceOrb.award(world, this.position(), this.expToDrop, this instanceof ServerPlayer ? org.bukkit.entity.ExperienceOrb.SpawnReason.PLAYER_DEATH : org.bukkit.entity.ExperienceOrb.SpawnReason.ENTITY_DEATH, attacker, this); // Paper
|
||||||
this.expToDrop = 0;
|
this.expToDrop = 0;
|
||||||
}
|
}
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
@@ -175,8 +175,8 @@ diff --git a/src/main/java/net/minecraft/world/entity/animal/Fox.java b/src/main
|
|||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/net/minecraft/world/entity/animal/Fox.java
|
--- a/src/main/java/net/minecraft/world/entity/animal/Fox.java
|
||||||
+++ b/src/main/java/net/minecraft/world/entity/animal/Fox.java
|
+++ b/src/main/java/net/minecraft/world/entity/animal/Fox.java
|
||||||
@@ -0,0 +0,0 @@ public class Fox extends Animal implements VariantHolder<Fox.Type> {
|
@@ -0,0 +0,0 @@ public class Fox extends Animal implements VariantHolder<Fox.Variant> {
|
||||||
if (this.level.getGameRules().getBoolean(GameRules.RULE_DOMOBLOOT)) {
|
if (worldserver.getGameRules().getBoolean(GameRules.RULE_DOMOBLOOT)) {
|
||||||
// CraftBukkit start - use event experience
|
// CraftBukkit start - use event experience
|
||||||
if (experience > 0) {
|
if (experience > 0) {
|
||||||
- this.level.addFreshEntity(new ExperienceOrb(this.level, this.animal.getX(), this.animal.getY(), this.animal.getZ(), experience));
|
- this.level.addFreshEntity(new ExperienceOrb(this.level, this.animal.getX(), this.animal.getY(), this.animal.getZ(), experience));
|
||||||
@@ -191,7 +191,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
@@ -0,0 +0,0 @@ public class Turtle extends Animal {
|
@@ -0,0 +0,0 @@ public class Turtle extends Animal {
|
||||||
RandomSource randomsource = this.animal.getRandom();
|
RandomSource randomsource = this.animal.getRandom();
|
||||||
|
|
||||||
if (this.level.getGameRules().getBoolean(GameRules.RULE_DOMOBLOOT)) {
|
if (getServerLevel((Level) this.level).getGameRules().getBoolean(GameRules.RULE_DOMOBLOOT)) {
|
||||||
- this.level.addFreshEntity(new ExperienceOrb(this.level, this.animal.getX(), this.animal.getY(), this.animal.getZ(), randomsource.nextInt(7) + 1));
|
- this.level.addFreshEntity(new ExperienceOrb(this.level, this.animal.getX(), this.animal.getY(), this.animal.getZ(), randomsource.nextInt(7) + 1));
|
||||||
+ this.level.addFreshEntity(new ExperienceOrb(this.level, this.animal.getX(), this.animal.getY(), this.animal.getZ(), randomsource.nextInt(7) + 1, org.bukkit.entity.ExperienceOrb.SpawnReason.BREED, entityplayer)); // Paper;
|
+ this.level.addFreshEntity(new ExperienceOrb(this.level, this.animal.getX(), this.animal.getY(), this.animal.getZ(), randomsource.nextInt(7) + 1, org.bukkit.entity.ExperienceOrb.SpawnReason.BREED, entityplayer)); // Paper;
|
||||||
}
|
}
|
||||||
@@ -203,19 +203,19 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+++ b/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java
|
+++ b/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java
|
||||||
@@ -0,0 +0,0 @@ public class EnderDragon extends Mob implements Enemy {
|
@@ -0,0 +0,0 @@ public class EnderDragon extends Mob implements Enemy {
|
||||||
|
|
||||||
if (this.level() instanceof ServerLevel) {
|
if (world instanceof ServerLevel worldserver) {
|
||||||
if (this.dragonDeathTime > 150 && this.dragonDeathTime % 5 == 0 && true) { // CraftBukkit - SPIGOT-2420: Already checked for the game rule when calculating the xp
|
if (this.dragonDeathTime > 150 && this.dragonDeathTime % 5 == 0 && true) { // CraftBukkit - SPIGOT-2420: Already checked for the game rule when calculating the xp
|
||||||
- ExperienceOrb.award((ServerLevel) this.level(), this.position(), Mth.floor((float) short0 * 0.08F));
|
- ExperienceOrb.award(worldserver, this.position(), Mth.floor((float) short0 * 0.08F));
|
||||||
+ ExperienceOrb.award((ServerLevel) this.level(), this.position(), Mth.floor((float) short0 * 0.08F), org.bukkit.entity.ExperienceOrb.SpawnReason.ENTITY_DEATH, this.lastHurtByPlayer, this); // Paper
|
+ ExperienceOrb.award(worldserver, this.position(), Mth.floor((float) short0 * 0.08F), org.bukkit.entity.ExperienceOrb.SpawnReason.ENTITY_DEATH, this.lastHurtByPlayer, this); // Paper
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.dragonDeathTime == 1 && !this.isSilent()) {
|
if (this.dragonDeathTime == 1 && !this.isSilent()) {
|
||||||
@@ -0,0 +0,0 @@ public class EnderDragon extends Mob implements Enemy {
|
@@ -0,0 +0,0 @@ public class EnderDragon extends Mob implements Enemy {
|
||||||
this.move(MoverType.SELF, new Vec3(0.0D, 0.10000000149011612D, 0.0D));
|
if (world instanceof ServerLevel) {
|
||||||
if (this.dragonDeathTime == 200 && this.level() instanceof ServerLevel) {
|
ServerLevel worldserver = (ServerLevel) world; // CraftBukkit - decompile error
|
||||||
if (true) { // CraftBukkit - SPIGOT-2420: Already checked for the game rule when calculating the xp
|
if (true) { // CraftBukkit - SPIGOT-2420: Already checked for the game rule when calculating the xp
|
||||||
- ExperienceOrb.award((ServerLevel) this.level(), this.position(), Mth.floor((float) short0 * 0.2F));
|
- ExperienceOrb.award(worldserver, this.position(), Mth.floor((float) short0 * 0.2F));
|
||||||
+ ExperienceOrb.award((ServerLevel) this.level(), this.position(), Mth.floor((float) short0 * 0.2F), org.bukkit.entity.ExperienceOrb.SpawnReason.ENTITY_DEATH, this.lastHurtByPlayer, this); // Paper
|
+ ExperienceOrb.award(worldserver, this.position(), Mth.floor((float) short0 * 0.2F), org.bukkit.entity.ExperienceOrb.SpawnReason.ENTITY_DEATH, this.lastHurtByPlayer, this); // Paper
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.dragonFight != null) {
|
if (this.dragonFight != null) {
|
||||||
@@ -328,7 +328,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ spawnData -> new net.minecraft.world.entity.ExperienceOrb(spawnData.minecraftWorld(), spawnData.x(), spawnData.y(), spawnData.z(), 0, org.bukkit.entity.ExperienceOrb.SpawnReason.CUSTOM, null, null) // Paper
|
+ spawnData -> new net.minecraft.world.entity.ExperienceOrb(spawnData.minecraftWorld(), spawnData.x(), spawnData.y(), spawnData.z(), 0, org.bukkit.entity.ExperienceOrb.SpawnReason.CUSTOM, null, null) // Paper
|
||||||
));
|
));
|
||||||
register(new EntityTypeData<>(EntityType.AREA_EFFECT_CLOUD, AreaEffectCloud.class, CraftAreaEffectCloud::new, spawnData -> new net.minecraft.world.entity.AreaEffectCloud(spawnData.minecraftWorld(), spawnData.x(), spawnData.y(), spawnData.z())));
|
register(new EntityTypeData<>(EntityType.AREA_EFFECT_CLOUD, AreaEffectCloud.class, CraftAreaEffectCloud::new, spawnData -> new net.minecraft.world.entity.AreaEffectCloud(spawnData.minecraftWorld(), spawnData.x(), spawnData.y(), spawnData.z())));
|
||||||
register(new EntityTypeData<>(EntityType.EGG, Egg.class, CraftEgg::new, spawnData -> new ThrownEgg(spawnData.minecraftWorld(), spawnData.x(), spawnData.y(), spawnData.z())));
|
register(new EntityTypeData<>(EntityType.EGG, Egg.class, CraftEgg::new, spawnData -> new ThrownEgg(spawnData.minecraftWorld(), spawnData.x(), spawnData.y(), spawnData.z(), new net.minecraft.world.item.ItemStack(Items.EGG))));
|
||||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftExperienceOrb.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftExperienceOrb.java
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftExperienceOrb.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftExperienceOrb.java
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftExperienceOrb.java
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftExperienceOrb.java
|
@@ -11,13 +11,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
@@ -0,0 +0,0 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab
|
@@ -0,0 +0,0 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab
|
||||||
ItemEntity entityitem = (ItemEntity) iterator.next();
|
ItemEntity entityitem = (ItemEntity) iterator.next();
|
||||||
|
|
||||||
if (!entityitem.isRemoved() && !entityitem.getItem().isEmpty() && !entityitem.hasPickUpDelay() && this.wantsToPickUp(entityitem.getItem())) {
|
if (!entityitem.isRemoved() && !entityitem.getItem().isEmpty() && !entityitem.hasPickUpDelay() && this.wantsToPickUp(worldserver, entityitem.getItem())) {
|
||||||
+ // Paper start - Item#canEntityPickup
|
+ // Paper start - Item#canEntityPickup
|
||||||
+ if (!entityitem.canMobPickup) {
|
+ if (!entityitem.canMobPickup) {
|
||||||
+ continue;
|
+ continue;
|
||||||
+ }
|
+ }
|
||||||
+ // Paper end - Item#canEntityPickup
|
+ // Paper end - Item#canEntityPickup
|
||||||
this.pickUpItem(entityitem);
|
this.pickUpItem(worldserver, entityitem);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
diff --git a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
|
diff --git a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
|
24
patches/server/PlayerTeleportEndGatewayEvent.patch
Normal file
24
patches/server/PlayerTeleportEndGatewayEvent.patch
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Aikar <aikar@aikar.co>
|
||||||
|
Date: Sat, 31 Dec 2016 21:44:50 -0500
|
||||||
|
Subject: [PATCH] PlayerTeleportEndGatewayEvent
|
||||||
|
|
||||||
|
Allows you to access the Gateway being used in a teleport event
|
||||||
|
Fix the offset used for player teleportation
|
||||||
|
|
||||||
|
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||||
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
|
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||||
|
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||||
|
@@ -0,0 +0,0 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player {
|
||||||
|
PositionMoveRotation absolutePosition = PositionMoveRotation.calculateAbsolute(PositionMoveRotation.of(this), PositionMoveRotation.of(teleportTarget), teleportTarget.relatives());
|
||||||
|
Location exit = (worldserver == null) ? null : CraftLocation.toBukkit(absolutePosition.position(), worldserver.getWorld(), absolutePosition.yRot(), absolutePosition.xRot());
|
||||||
|
PlayerTeleportEvent tpEvent = new PlayerTeleportEvent(this.getBukkitEntity(), enter, exit, teleportTarget.cause());
|
||||||
|
+ // Paper start - gateway-specific teleport event
|
||||||
|
+ if (this.portalProcess != null && this.portalProcess.isSamePortal(((net.minecraft.world.level.block.EndGatewayBlock) net.minecraft.world.level.block.Blocks.END_GATEWAY)) && this.serverLevel().getBlockEntity(this.portalProcess.getEntryPosition()) instanceof net.minecraft.world.level.block.entity.TheEndGatewayBlockEntity theEndGatewayBlockEntity) {
|
||||||
|
+ tpEvent = new com.destroystokyo.paper.event.player.PlayerTeleportEndGatewayEvent(this.getBukkitEntity(), enter, exit, new org.bukkit.craftbukkit.block.CraftEndGateway(this.serverLevel().getWorld(), theEndGatewayBlockEntity));
|
||||||
|
+ }
|
||||||
|
+ // Paper end - gateway-specific teleport event
|
||||||
|
Bukkit.getServer().getPluginManager().callEvent(tpEvent);
|
||||||
|
Location newExit = tpEvent.getTo();
|
||||||
|
if (tpEvent.isCancelled() || newExit == null) {
|
@@ -16,8 +16,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
}
|
}
|
||||||
this.parsePending();
|
this.parsePending();
|
||||||
} else {
|
} else {
|
||||||
- this.debugTail = this.debugTail.setNext(new CraftAsyncDebugger(currentTick + CraftScheduler.RECENT_TICKS, task.getOwner(), task.getTaskClass()));
|
- this.debugTail = this.debugTail.setNext(new CraftAsyncDebugger(this.currentTick + CraftScheduler.RECENT_TICKS, task.getOwner(), task.getTaskClass()));
|
||||||
+ // this.debugTail = this.debugTail.setNext(new CraftAsyncDebugger(currentTick + CraftScheduler.RECENT_TICKS, task.getOwner(), task.getTaskClass())); // Paper
|
+ // this.debugTail = this.debugTail.setNext(new CraftAsyncDebugger(this.currentTick + CraftScheduler.RECENT_TICKS, task.getOwner(), task.getTaskClass())); // Paper
|
||||||
this.executor.execute(new com.destroystokyo.paper.ServerSchedulerReportingWrapper(task)); // Paper
|
this.executor.execute(new com.destroystokyo.paper.ServerSchedulerReportingWrapper(task)); // Paper
|
||||||
// We don't need to parse pending
|
// We don't need to parse pending
|
||||||
// (async tasks must live with race-conditions if they attempt to cancel between these few lines of code)
|
// (async tasks must live with race-conditions if they attempt to cancel between these few lines of code)
|
||||||
@@ -25,8 +25,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
this.pending.addAll(temp);
|
this.pending.addAll(temp);
|
||||||
temp.clear();
|
temp.clear();
|
||||||
MinecraftTimings.bukkitSchedulerFinishTimer.stopTiming(); // Paper
|
MinecraftTimings.bukkitSchedulerFinishTimer.stopTiming(); // Paper
|
||||||
- this.debugHead = this.debugHead.getNextHead(currentTick);
|
- this.debugHead = this.debugHead.getNextHead(this.currentTick);
|
||||||
+ //this.debugHead = this.debugHead.getNextHead(currentTick); // Paper
|
+ //this.debugHead = this.debugHead.getNextHead(this.currentTick); // Paper
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addTask(final CraftTask task) {
|
private void addTask(final CraftTask task) {
|
@@ -12,7 +12,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
+ // Paper start
|
+ // Paper start - release entity api
|
||||||
+ public Entity releaseLeftShoulderEntity() {
|
+ public Entity releaseLeftShoulderEntity() {
|
||||||
+ Entity entity = this.respawnEntityOnShoulder0(this.getShoulderEntityLeft());
|
+ Entity entity = this.respawnEntityOnShoulder0(this.getShoulderEntityLeft());
|
||||||
+ if (entity != null) {
|
+ if (entity != null) {
|
||||||
@@ -28,42 +28,39 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ }
|
+ }
|
||||||
+ return entity;
|
+ return entity;
|
||||||
+ }
|
+ }
|
||||||
+ // Paper - maintain old signature
|
+ // Paper end - release entity api
|
||||||
+
|
+
|
||||||
private boolean respawnEntityOnShoulder(CompoundTag nbttagcompound) { // CraftBukkit void->boolean
|
private boolean respawnEntityOnShoulder(CompoundTag nbttagcompound) { // CraftBukkit void->boolean
|
||||||
- if (!this.level().isClientSide && !nbttagcompound.isEmpty()) {
|
+ // Paper start - release entity api - return entity - overload
|
||||||
+ return this.respawnEntityOnShoulder0(nbttagcompound) != null;
|
+ return this.respawnEntityOnShoulder0(nbttagcompound) != null;
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ // Paper - return entity
|
|
||||||
+ private Entity respawnEntityOnShoulder0(CompoundTag nbttagcompound) { // CraftBukkit void->boolean
|
+ private Entity respawnEntityOnShoulder0(CompoundTag nbttagcompound) { // CraftBukkit void->boolean
|
||||||
+ if (!this.level().isClientSide && nbttagcompound != null && !nbttagcompound.isEmpty()) {
|
+ // Paper end - release entity api - return entity - overload
|
||||||
return EntityType.create(nbttagcompound, this.level()).map((entity) -> { // CraftBukkit
|
if (!this.level().isClientSide && !nbttagcompound.isEmpty()) {
|
||||||
|
return EntityType.create(nbttagcompound, this.level(), EntitySpawnReason.LOAD).map((entity) -> { // CraftBukkit
|
||||||
if (entity instanceof TamableAnimal) {
|
if (entity instanceof TamableAnimal) {
|
||||||
((TamableAnimal) entity).setOwnerUUID(this.uuid);
|
@@ -0,0 +0,0 @@ public abstract class Player extends LivingEntity {
|
||||||
}
|
}
|
||||||
|
|
||||||
entity.setPos(this.getX(), this.getY() + 0.699999988079071D, this.getZ());
|
entity.setPos(this.getX(), this.getY() + 0.699999988079071D, this.getZ());
|
||||||
- return ((ServerLevel) this.level()).addWithUUID(entity, CreatureSpawnEvent.SpawnReason.SHOULDER_ENTITY); // CraftBukkit
|
- return ((ServerLevel) this.level()).addWithUUID(entity, CreatureSpawnEvent.SpawnReason.SHOULDER_ENTITY); // CraftBukkit
|
||||||
- }).orElse(true); // CraftBukkit
|
- }).orElse(true); // CraftBukkit
|
||||||
+ boolean addedToWorld = ((ServerLevel) this.level()).addWithUUID(entity, CreatureSpawnEvent.SpawnReason.SHOULDER_ENTITY); // CraftBukkit
|
+ return ((ServerLevel) this.level()).addWithUUID(entity, CreatureSpawnEvent.SpawnReason.SHOULDER_ENTITY) ? entity : null; // CraftBukkit // Paper start - release entity api - return entity
|
||||||
+ return addedToWorld ? entity : null;
|
+ }).orElse(null); // CraftBukkit // Paper end - release entity api - return entity
|
||||||
+ }).orElse(null); // CraftBukkit // Paper - true -> null
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- return true; // CraftBukkit
|
- return true; // CraftBukkit
|
||||||
+ return null; // Paper - return null
|
+ return null; // Paper - return null
|
||||||
}
|
}
|
||||||
+ // Paper end
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public abstract boolean isSpectator();
|
|
||||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
|
||||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
|
||||||
@@ -0,0 +0,0 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
|
@@ -0,0 +0,0 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
|
||||||
this.getHandle().getCooldowns().addCooldown(CraftItemType.bukkitToMinecraft(material), ticks);
|
this.getHandle().getCooldowns().addCooldown(CraftItemStack.asNMSCopy(item), ticks);
|
||||||
}
|
}
|
||||||
|
|
||||||
+ // Paper start
|
+ // Paper start
|
@@ -9,7 +9,7 @@ diff --git a/src/main/java/net/minecraft/world/entity/monster/Creeper.java b/src
|
|||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/net/minecraft/world/entity/monster/Creeper.java
|
--- a/src/main/java/net/minecraft/world/entity/monster/Creeper.java
|
||||||
+++ b/src/main/java/net/minecraft/world/entity/monster/Creeper.java
|
+++ b/src/main/java/net/minecraft/world/entity/monster/Creeper.java
|
||||||
@@ -0,0 +0,0 @@ public class Creeper extends Monster implements PowerableMob {
|
@@ -0,0 +0,0 @@ public class Creeper extends Monster {
|
||||||
private void spawnLingeringCloud() {
|
private void spawnLingeringCloud() {
|
||||||
Collection<MobEffectInstance> collection = this.getActiveEffects();
|
Collection<MobEffectInstance> collection = this.getActiveEffects();
|
||||||
|
|
@@ -1,35 +0,0 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Aikar <aikar@aikar.co>
|
|
||||||
Date: Sat, 31 Dec 2016 21:44:50 -0500
|
|
||||||
Subject: [PATCH] PlayerTeleportEndGatewayEvent
|
|
||||||
|
|
||||||
Allows you to access the Gateway being used in a teleport event
|
|
||||||
Fix the offset used for player teleportation
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
|
||||||
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
|
||||||
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
|
||||||
@@ -0,0 +0,0 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player {
|
|
||||||
ResourceKey<LevelStem> resourcekey = worldserver1.getTypeKey();
|
|
||||||
|
|
||||||
if (worldserver != null && worldserver.dimension() == worldserver1.dimension()) { // CraftBukkit
|
|
||||||
+ // Paper start - gateway-specific teleport event
|
|
||||||
+ if (this.portalProcess != null && this.portalProcess.isSamePortal(((net.minecraft.world.level.block.EndGatewayBlock) net.minecraft.world.level.block.Blocks.END_GATEWAY)) && this.serverLevel().getBlockEntity(this.portalProcess.getEntryPosition()) instanceof net.minecraft.world.level.block.entity.TheEndGatewayBlockEntity theEndGatewayBlockEntity) {
|
|
||||||
+ Location to = CraftLocation.toBukkit(teleportTarget.pos(), this.serverLevel().getWorld(), teleportTarget.yRot(), teleportTarget.xRot());
|
|
||||||
+ final com.destroystokyo.paper.event.player.PlayerTeleportEndGatewayEvent event = new com.destroystokyo.paper.event.player.PlayerTeleportEndGatewayEvent(this.getBukkitEntity(), this.getBukkitEntity().getLocation(), to, new org.bukkit.craftbukkit.block.CraftEndGateway(to.getWorld(), theEndGatewayBlockEntity));
|
|
||||||
+ if (!event.callEvent() || event.getTo() == null) {
|
|
||||||
+ return null;
|
|
||||||
+ }
|
|
||||||
+ this.connection.teleport(event.getTo());
|
|
||||||
+ } else {
|
|
||||||
+ // Paper end - gateway-specific teleport event
|
|
||||||
boolean result = this.connection.teleport(teleportTarget.pos().x, teleportTarget.pos().y, teleportTarget.pos().z, teleportTarget.yRot(), teleportTarget.xRot(), teleportTarget.cause());
|
|
||||||
if (!result) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
// CraftBukkit end
|
|
||||||
+ } // Paper
|
|
||||||
this.connection.resetPosition();
|
|
||||||
teleportTarget.postDimensionTransition().onTransition(this);
|
|
||||||
return this;
|
|
Reference in New Issue
Block a user