From 1ba8139435090176a08df79e667c28431ca6a071 Mon Sep 17 00:00:00 2001 From: Tristan Krstevski Date: Mon, 11 Sep 2023 19:08:29 +1000 Subject: [PATCH 1/2] Fix MC-868 Fixes MC-868 Adds a check if distance between minecart and detector rail is less than maximum distance of the centre of a blcok to the edge of a block (0.5) --- .../0872-Fix-a-bunch-of-vanilla-bugs.patch | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/patches/server/0872-Fix-a-bunch-of-vanilla-bugs.patch b/patches/server/0872-Fix-a-bunch-of-vanilla-bugs.patch index e4131160515a..0ec0a992fc49 100644 --- a/patches/server/0872-Fix-a-bunch-of-vanilla-bugs.patch +++ b/patches/server/0872-Fix-a-bunch-of-vanilla-bugs.patch @@ -57,6 +57,9 @@ https://bugs.mojang.com/browse/MC-84789 https://bugs.mojang.com/browse/MC-225381 Fix overfilled bundles duplicating items / being filled with air +https://bugs.mojang.com/browse/MC-868 + Fix Detector Rail switches junction before Minecart passes detector (happens only with minecarts of certain speed) + Co-authored-by: William Blake Galbreath diff --git a/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java b/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java @@ -370,6 +373,19 @@ index 023ed8441d629629828051b4098b09b06ce51a75..95b53450a807fccfa55b59852da52785 + } + // Paper end } +diff --git a/src/main/java/net/minecraft/world/level/block/DetectorRailBlock.java b/src/main/java/net/minecraft/world/level/block/DetectorRailBlock.java +index 05dfb1790a292f9f85b641377c2ca3675726c127..fe4740cd2a5092fb5c9a597c2ea3774d8ca13882 100644 +--- a/src/main/java/net/minecraft/world/level/block/DetectorRailBlock.java ++++ b/src/main/java/net/minecraft/world/level/block/DetectorRailBlock.java +@@ -75,7 +75,7 @@ public class DetectorRailBlock extends BaseRailBlock { + boolean flag = (Boolean) state.getValue(DetectorRailBlock.POWERED); + boolean flag1 = false; + List list = this.getInteractingMinecartOfType(world, pos, AbstractMinecart.class, (entity) -> { +- return true; ++ return java.awt.geom.Point2D.distance(pos.getX() + 0.5, pos.getZ() + 0.5, entity.getX(), entity.getZ()) < 0.5D; // Paper - MC-868 - Check if distance between minecart and detector rail is less than maximum distance to edge of a block + }); + + if (!list.isEmpty()) { diff --git a/src/main/java/net/minecraft/world/level/block/LayeredCauldronBlock.java b/src/main/java/net/minecraft/world/level/block/LayeredCauldronBlock.java index 2932419b7ca3f066b1db329829af36ba31e17c65..e11eced0bf15dfecaf64f5e1c28e973c38746095 100644 --- a/src/main/java/net/minecraft/world/level/block/LayeredCauldronBlock.java From e33f76179a48cb5dee01b05d3bbbe1e12b7b26a8 Mon Sep 17 00:00:00 2001 From: Tristan Krstevski Date: Mon, 11 Sep 2023 20:06:15 +1000 Subject: [PATCH 2/2] Change to distanceSq --- patches/server/0872-Fix-a-bunch-of-vanilla-bugs.patch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/patches/server/0872-Fix-a-bunch-of-vanilla-bugs.patch b/patches/server/0872-Fix-a-bunch-of-vanilla-bugs.patch index 0ec0a992fc49..4e0aeffd15b8 100644 --- a/patches/server/0872-Fix-a-bunch-of-vanilla-bugs.patch +++ b/patches/server/0872-Fix-a-bunch-of-vanilla-bugs.patch @@ -382,7 +382,7 @@ index 05dfb1790a292f9f85b641377c2ca3675726c127..fe4740cd2a5092fb5c9a597c2ea3774d boolean flag1 = false; List list = this.getInteractingMinecartOfType(world, pos, AbstractMinecart.class, (entity) -> { - return true; -+ return java.awt.geom.Point2D.distance(pos.getX() + 0.5, pos.getZ() + 0.5, entity.getX(), entity.getZ()) < 0.5D; // Paper - MC-868 - Check if distance between minecart and detector rail is less than maximum distance to edge of a block ++ return java.awt.geom.Point2D.distanceSq(pos.getX() + 0.5, pos.getZ() + 0.5, entity.getX(), entity.getZ()) < 0.25D; // Paper - MC-868 - Check if distance between minecart and detector rail is less than maximum distance to edge of a block }); if (!list.isEmpty()) {