mirror of
https://github.com/LeavesMC/Leaves.git
synced 2025-12-19 14:59:32 +00:00
119 lines
5.4 KiB
Diff
119 lines
5.4 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: violetc <58360096+s-yh-china@users.noreply.github.com>
|
|
Date: Sat, 30 Oct 2021 21:07:43 +0800
|
|
Subject: [PATCH] Fix gravity block duper
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
|
index 734273b452caf133a7e4671c53c670c94a0c7ee1..b1a4824b23f15f944077bce56170f1a790575c48 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
|
@@ -506,38 +506,9 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
|
|
|
|
public boolean updatingSectionStatus = false;
|
|
// Paper end
|
|
+ // Leaves - fix gravity block duper
|
|
// Paper start - optimise entity tracking
|
|
final org.spigotmc.TrackingRange.TrackingRangeType trackingRangeType = org.spigotmc.TrackingRange.getTrackingRangeType(this);
|
|
- // Paper start - make end portalling safe
|
|
- public BlockPos portalBlock;
|
|
- public ServerLevel portalWorld;
|
|
- public void tickEndPortal() {
|
|
- BlockPos pos = this.portalBlock;
|
|
- ServerLevel world = this.portalWorld;
|
|
- this.portalBlock = null;
|
|
- this.portalWorld = null;
|
|
-
|
|
- if (pos == null || world == null || world != this.level) {
|
|
- return;
|
|
- }
|
|
-
|
|
- if (this.isPassenger() || this.isVehicle() || !this.canChangeDimensions() || this.isRemoved() || !this.valid || !this.isAlive()) {
|
|
- return;
|
|
- }
|
|
-
|
|
- ResourceKey<Level> resourcekey = world.getTypeKey() == LevelStem.END ? Level.OVERWORLD : Level.END; // CraftBukkit - SPIGOT-6152: send back to main overworld in custom ends
|
|
- ServerLevel worldserver = world.getServer().getLevel(resourcekey);
|
|
-
|
|
- org.bukkit.event.entity.EntityPortalEnterEvent event = new org.bukkit.event.entity.EntityPortalEnterEvent(this.getBukkitEntity(), new org.bukkit.Location(world.getWorld(), pos.getX(), pos.getY(), pos.getZ()));
|
|
- event.callEvent();
|
|
-
|
|
- if (this instanceof ServerPlayer) {
|
|
- ((ServerPlayer)this).changeDimension(worldserver, PlayerTeleportEvent.TeleportCause.END_PORTAL);
|
|
- return;
|
|
- }
|
|
- this.teleportTo(worldserver, null);
|
|
- }
|
|
- // Paper end - make end portalling safe
|
|
|
|
public boolean isLegacyTrackingEntity = false;
|
|
|
|
@@ -3182,7 +3153,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
|
|
}
|
|
|
|
this.processPortalCooldown();
|
|
- this.tickEndPortal(); // Paper - make end portalling safe
|
|
+ // Leaves - fix gravity block duper
|
|
}
|
|
}
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
|
|
index 21a4669b01e9c57100224e20500bc23f8e101434..65d60a0a27fa9e05b86b32dada49b5c36e56f39b 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
|
|
@@ -132,11 +132,7 @@ public class FallingBlockEntity extends Entity {
|
|
|
|
@Override
|
|
public void tick() {
|
|
- // Paper start - fix sand duping
|
|
- if (this.isRemoved()) {
|
|
- return;
|
|
- }
|
|
- // Paper end - fix sand duping
|
|
+ // Leaves - fix gravity block duper
|
|
if (this.blockState.isAir()) {
|
|
this.discard();
|
|
} else {
|
|
@@ -149,11 +145,7 @@ public class FallingBlockEntity extends Entity {
|
|
|
|
this.move(MoverType.SELF, this.getDeltaMovement());
|
|
|
|
- // Paper start - fix sand duping
|
|
- if (this.isRemoved()) {
|
|
- return;
|
|
- }
|
|
- // Paper end - fix sand duping
|
|
+ // Leaves - fix gravity block duper
|
|
|
|
// Paper start - Configurable EntityFallingBlock height nerf
|
|
if (this.level().paperConfig().fixes.fallingBlockHeightNerf.test(v -> this.getY() > v)) {
|
|
diff --git a/src/main/java/net/minecraft/world/level/block/EndPortalBlock.java b/src/main/java/net/minecraft/world/level/block/EndPortalBlock.java
|
|
index c82ebcac07033d887af499f81520982fbe5ed4f1..ef38de1c64f067250c12cceca24f68ef3a8feb74 100644
|
|
--- a/src/main/java/net/minecraft/world/level/block/EndPortalBlock.java
|
|
+++ b/src/main/java/net/minecraft/world/level/block/EndPortalBlock.java
|
|
@@ -61,12 +61,19 @@ public class EndPortalBlock extends BaseEntityBlock {
|
|
// return; // CraftBukkit - always fire event in case plugins wish to change it
|
|
}
|
|
|
|
- // Paper start - move all of this logic into portal tick
|
|
- entity.portalWorld = ((ServerLevel)world);
|
|
- entity.portalBlock = pos.immutable();
|
|
- // Paper end - move all of this logic into portal tick
|
|
- }
|
|
+ // Leaves start - fix gravity block duper
|
|
+ // CraftBukkit start - Entity in portal
|
|
+ EntityPortalEnterEvent event = new EntityPortalEnterEvent(entity.getBukkitEntity(), new org.bukkit.Location(world.getWorld(), pos.getX(), pos.getY(), pos.getZ()));
|
|
+ world.getCraftServer().getPluginManager().callEvent(event);
|
|
|
|
+ if (entity instanceof ServerPlayer) {
|
|
+ ((ServerPlayer) entity).changeDimension(worldserver, PlayerTeleportEvent.TeleportCause.END_PORTAL);
|
|
+ return;
|
|
+ }
|
|
+ // CraftBukkit end
|
|
+ entity.changeDimension(worldserver);
|
|
+ // Leaves end - fix gravity block duper
|
|
+ }
|
|
}
|
|
|
|
@Override
|