mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-18 08:57:44 +01:00
Upstream has released updates that appears to apply and compile correctly Paper Changes: c8028d1c Fix data version check for ItemStack serialization (#3394) 9254a80a Fix race condition reintroduced in Prioritize class loader patch 6f196fe7 Add Raw Byte ItemStack Serialization df43f828 Allow server startup for those poor people running <1G Xmx 3c9b65ef Fix cases where no-tick < tick view distance 72f89a07 Workaround for Client Lag Spikes (MC-162253) 3f941c0c Add option for console having all permissions d2ae4658 Add permission for command blocks 9f8ae5cb Prioritise own classes where possible 74466412 Check portal restrictions when entering end gateways fc9cf84d Fix NPE when temp ip bans expire (#3373) 16bd420d Add missing mob goals for API (#3367) b5c4e2f6 Ensure no-tick view is not smaller than ticking VD 52564b1f Expand Pathfinding API with more options dde65481 Fix usage of vanilla goals 7797aebe Drop Leads from nether portals - Fixes #3226 511b6bc2 Reduce MutableInt and Vec3d allocations, use ArrayDeque 84673141 Optimize NibbleArray to use pooled buffers 897dd2c8 Foundational work for Future Memory usage improvements bb4002d8 Handle CraftPlayer#setSpectatorTarget better 4ae08959 Fix collision checks on spawning hanging entities and null on async chunk loads c2f8d1ef Protect Bedrock and End Portal/Frames from being destroyed 827cc632 Updated Upstream (Bukkit/CraftBukkit/Spigot) 92f680ed Fix Pathfinding and obscure glitchy buggy 0 tick farms 7a7c4292 Optimize Pathfinder - Remove Streams / Optimized collections fc917d16 Optimize Hoppers - Major performance improvement 14ad77c6 Fix PotionEffect API Ignoring Icon bug eb3ce8a2 Fix EntityRaider picking up items when they shouldn't be able 1ea9ada0 Add a TELEPORT ticket when changing dimensions 8e9459ea Fix missing flag pass for isUrgent 7befec44 Potential bed api (#3339) 27945a6b Optimize WorldBorder collision checks and air 55e17a85 Wait for Async Tasks during shutdown b5905256 Ensure Entity AABB's are never invalid a054aa6f Properly remove Entities from current chunk c894ddfd Fix teleporting onto a chunk line 57d6cc01 Send LOGIN protocol packets immediately - Fix disconnect during async prelogin cd93e54d Don't use our modified chunk checks for collision in world gen b4003ef1 Allow loading entities current chunk if needed to fix collision checks e5f64896 Add Urgent API for Async Chunks API and use it for Async Teleport ad8e59dc Ensure chunks loaded on respawn for suffocation check
159 lines
8.5 KiB
Diff
159 lines
8.5 KiB
Diff
From 6b15e6d5c97e3bee4ce7d47a08679a5b73437a7e Mon Sep 17 00:00:00 2001
|
|
From: William Blake Galbreath <Blake.Galbreath@GMail.com>
|
|
Date: Sat, 11 Jan 2020 23:12:52 -0600
|
|
Subject: [PATCH] Add EntityPortalReadyEvent
|
|
|
|
---
|
|
.../java/net/minecraft/server/BlockPortal.java | 16 +++++++++-------
|
|
src/main/java/net/minecraft/server/Entity.java | 7 ++++---
|
|
.../net/minecraft/server/PortalTravelAgent.java | 5 +++--
|
|
.../java/net/minecraft/server/WorldServer.java | 2 +-
|
|
4 files changed, 17 insertions(+), 13 deletions(-)
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/BlockPortal.java b/src/main/java/net/minecraft/server/BlockPortal.java
|
|
index 09c7c1318..6880cdd7f 100644
|
|
--- a/src/main/java/net/minecraft/server/BlockPortal.java
|
|
+++ b/src/main/java/net/minecraft/server/BlockPortal.java
|
|
@@ -54,6 +54,7 @@ public class BlockPortal extends Block {
|
|
|
|
}
|
|
|
|
+ public boolean createPortal(GeneratorAccess generatoraccess, BlockPosition blockposition) { return a(generatoraccess, blockposition); } // Purpur - OBFHELPER
|
|
public boolean a(GeneratorAccess generatoraccess, BlockPosition blockposition) {
|
|
BlockPortal.Shape blockportal_shape = this.b(generatoraccess, blockposition);
|
|
|
|
@@ -67,8 +68,8 @@ public class BlockPortal extends Block {
|
|
}
|
|
}
|
|
|
|
- @Nullable
|
|
- public BlockPortal.Shape b(GeneratorAccess generatoraccess, BlockPosition blockposition) {
|
|
+ public BlockPortal.Shape createShape(GeneratorAccess generatoraccess, BlockPosition blockposition) { return b(generatoraccess, blockposition); } // Purpur - OBFHELPER
|
|
+ @Nullable public BlockPortal.Shape b(GeneratorAccess generatoraccess, BlockPosition blockposition) {
|
|
BlockPortal.Shape blockportal_shape = new BlockPortal.Shape(generatoraccess, blockposition, EnumDirection.EnumAxis.X);
|
|
|
|
if (blockportal_shape.d() && blockportal_shape.e == 0) {
|
|
@@ -189,6 +190,7 @@ public class BlockPortal extends Block {
|
|
private int height;
|
|
private int width;
|
|
java.util.List<org.bukkit.block.BlockState> blocks = new java.util.ArrayList<org.bukkit.block.BlockState>(); // CraftBukkit - add field
|
|
+ public static Block FRAME_BLOCK = Blocks.OBSIDIAN; // Purpur
|
|
|
|
public Shape(GeneratorAccess generatoraccess, BlockPosition blockposition, EnumDirection.EnumAxis enumdirection_enumaxis) {
|
|
this.a = generatoraccess;
|
|
@@ -228,14 +230,14 @@ public class BlockPortal extends Block {
|
|
for (i = 0; i < 22; ++i) {
|
|
BlockPosition blockposition1 = blockposition.shift(enumdirection, i);
|
|
|
|
- if (!this.a(this.a.getType(blockposition1)) || this.a.getType(blockposition1.down()).getBlock() != Blocks.OBSIDIAN) {
|
|
+ if (!this.a(this.a.getType(blockposition1)) || this.a.getType(blockposition1.down()).getBlock() != FRAME_BLOCK) { // Purpur
|
|
break;
|
|
}
|
|
}
|
|
|
|
Block block = this.a.getType(blockposition.shift(enumdirection, i)).getBlock();
|
|
|
|
- return block == Blocks.OBSIDIAN ? i : 0;
|
|
+ return block == FRAME_BLOCK ? i : 0; // Purpur
|
|
}
|
|
|
|
public int a() {
|
|
@@ -270,7 +272,7 @@ public class BlockPortal extends Block {
|
|
|
|
if (i == 0) {
|
|
block = this.a.getType(blockposition.shift(this.d)).getBlock();
|
|
- if (block != Blocks.OBSIDIAN) {
|
|
+ if (block != FRAME_BLOCK) { // Purpur
|
|
break label56;
|
|
// CraftBukkit start - add the block to our list
|
|
} else {
|
|
@@ -280,7 +282,7 @@ public class BlockPortal extends Block {
|
|
}
|
|
} else if (i == this.width - 1) {
|
|
block = this.a.getType(blockposition.shift(this.c)).getBlock();
|
|
- if (block != Blocks.OBSIDIAN) {
|
|
+ if (block != FRAME_BLOCK) { // Purpur
|
|
break label56;
|
|
// CraftBukkit start - add the block to our list
|
|
} else {
|
|
@@ -293,7 +295,7 @@ public class BlockPortal extends Block {
|
|
}
|
|
|
|
for (i = 0; i < this.width; ++i) {
|
|
- if (this.a.getType(this.position.shift(this.c, i).up(this.height)).getBlock() != Blocks.OBSIDIAN) {
|
|
+ if (this.a.getType(this.position.shift(this.c, i).up(this.height)).getBlock() != FRAME_BLOCK) { // Purpur
|
|
this.height = 0;
|
|
break;
|
|
// CraftBukkit start - add the block to our list
|
|
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
|
|
index 46bc91524..39bd34ab3 100644
|
|
--- a/src/main/java/net/minecraft/server/Entity.java
|
|
+++ b/src/main/java/net/minecraft/server/Entity.java
|
|
@@ -170,9 +170,9 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
|
|
protected boolean af; public final boolean inPortal() { return this.af; } // Paper - OBFHELPER
|
|
protected int ag;
|
|
public DimensionManager dimension;
|
|
- protected BlockPosition ai;
|
|
- protected Vec3D aj;
|
|
- protected EnumDirection ak;
|
|
+ public BlockPosition ai; // Purpur - protected -> public
|
|
+ public Vec3D aj; // Purpur - protected -> public
|
|
+ public EnumDirection ak; // Purpur - protected -> public
|
|
private boolean invulnerable;
|
|
protected UUID uniqueID;
|
|
protected String am;
|
|
@@ -2287,6 +2287,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
|
|
this.world.getMethodProfiler().enter("portal");
|
|
this.ag = i;
|
|
this.portalCooldown = this.ba();
|
|
+ if (new net.pl3x.purpur.event.entity.EntityPortalReadyEvent(getBukkitEntity()).callEvent()) // Purpur
|
|
// CraftBukkit start
|
|
if (this instanceof EntityPlayer) {
|
|
((EntityPlayer) this).a(this.world.worldProvider.getDimensionManager().getType() == DimensionManager.NETHER ? DimensionManager.OVERWORLD : DimensionManager.NETHER, PlayerTeleportEvent.TeleportCause.NETHER_PORTAL);
|
|
diff --git a/src/main/java/net/minecraft/server/PortalTravelAgent.java b/src/main/java/net/minecraft/server/PortalTravelAgent.java
|
|
index f84dd6d9b..f50e9670b 100644
|
|
--- a/src/main/java/net/minecraft/server/PortalTravelAgent.java
|
|
+++ b/src/main/java/net/minecraft/server/PortalTravelAgent.java
|
|
@@ -11,6 +11,7 @@ public class PortalTravelAgent {
|
|
|
|
private final WorldServer world;
|
|
private final Random b;
|
|
+ public Block FRAME_BLOCK = Blocks.OBSIDIAN; // Purpur
|
|
|
|
public PortalTravelAgent(WorldServer worldserver) {
|
|
this.world = worldserver;
|
|
@@ -233,7 +234,7 @@ public class PortalTravelAgent {
|
|
boolean flag1 = l2 < 0;
|
|
|
|
blockposition_mutableblockposition.d(j3, l3, i4);
|
|
- blockList.setTypeAndData(blockposition_mutableblockposition, flag1 ? Blocks.OBSIDIAN.getBlockData() : Blocks.AIR.getBlockData(), 3); // CraftBukkit
|
|
+ blockList.setTypeAndData(blockposition_mutableblockposition, flag1 ? FRAME_BLOCK.getBlockData() : Blocks.AIR.getBlockData(), 3); // CraftBukkit // Purpur
|
|
}
|
|
}
|
|
}
|
|
@@ -243,7 +244,7 @@ public class PortalTravelAgent {
|
|
for (i3 = -1; i3 < 4; ++i3) {
|
|
if (k2 == -1 || k2 == 2 || i3 == -1 || i3 == 3) {
|
|
blockposition_mutableblockposition.d(i5 + k2 * k5, j5 + i3, j2 + k2 * l5);
|
|
- blockList.setTypeAndData(blockposition_mutableblockposition, Blocks.OBSIDIAN.getBlockData(), 3); // CraftBukkit
|
|
+ blockList.setTypeAndData(blockposition_mutableblockposition, FRAME_BLOCK.getBlockData(), 3); // CraftBukkit // Purpur
|
|
}
|
|
}
|
|
}
|
|
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
|
|
index afb6ad44a..75424bfbc 100644
|
|
--- a/src/main/java/net/minecraft/server/WorldServer.java
|
|
+++ b/src/main/java/net/minecraft/server/WorldServer.java
|
|
@@ -75,7 +75,7 @@ public class WorldServer extends World {
|
|
public boolean savingDisabled;
|
|
private boolean everyoneSleeping;
|
|
private int emptyTime;
|
|
- private final PortalTravelAgent portalTravelAgent;
|
|
+ public PortalTravelAgent portalTravelAgent; // Purpur - private final -> public non-final
|
|
private final TickListServer<Block> nextTickListBlock;
|
|
private final TickListServer<FluidType> nextTickListFluid;
|
|
private final Set<NavigationAbstract> navigators;
|
|
--
|
|
2.24.0
|
|
|