mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-23 09:27:45 +01:00
Drop extended BlockStateListPopulator and fix SpongeAbsorbEvent handling
This patch, while would have been nice, would just take too much in order to re-implement it to retain and handle all of the state changes possible, and complicates retaining state properly Fix SpongeAbsortEvent handling Only process drops when the block is actually going to be removed
This commit is contained in:
parent
cf772531f4
commit
8b8e15fb63
@ -1,4 +1,4 @@
|
|||||||
From 83b8bb51552c5b1ffd6509c9f9d6b46a747f6a2c Mon Sep 17 00:00:00 2001
|
From e97afba9cc1e570e5e20d21303566e319cb6b325 Mon Sep 17 00:00:00 2001
|
||||||
From: Aikar <aikar@aikar.co>
|
From: Aikar <aikar@aikar.co>
|
||||||
Date: Wed, 21 Mar 2018 20:52:07 -0400
|
Date: Wed, 21 Mar 2018 20:52:07 -0400
|
||||||
Subject: [PATCH] Fix Dragon Server Crashes
|
Subject: [PATCH] Fix Dragon Server Crashes
|
||||||
@ -20,5 +20,5 @@ index da89a69ed6..45f96078c5 100644
|
|||||||
blockposition$mutableblockposition.c(MathHelper.floor(d0), MathHelper.floor(d2), MathHelper.floor(d1));
|
blockposition$mutableblockposition.c(MathHelper.floor(d0), MathHelper.floor(d2), MathHelper.floor(d1));
|
||||||
}
|
}
|
||||||
--
|
--
|
||||||
2.19.0
|
2.19.1
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
From 30bd8cf126f419185caa6520eca498e877c4b0ce Mon Sep 17 00:00:00 2001
|
From 365c7b5ab1d21da717a5a16e5b596dbd3ef2fcb0 Mon Sep 17 00:00:00 2001
|
||||||
From: Aikar <aikar@aikar.co>
|
From: Aikar <aikar@aikar.co>
|
||||||
Date: Thu, 22 Mar 2018 01:40:24 -0400
|
Date: Thu, 22 Mar 2018 01:40:24 -0400
|
||||||
Subject: [PATCH] getPlayerUniqueId API
|
Subject: [PATCH] getPlayerUniqueId API
|
||||||
@ -9,7 +9,7 @@ In Offline Mode, will return an Offline UUID
|
|||||||
This is a more performant way to obtain a UUID for a name than loading an OfflinePlayer
|
This is a more performant way to obtain a UUID for a name than loading an OfflinePlayer
|
||||||
|
|
||||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||||
index 0e582e4e5c..04a76802b8 100644
|
index 9d4cc5a483..e4f53cba65 100644
|
||||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||||
@@ -1412,6 +1412,26 @@ public final class CraftServer implements Server {
|
@@ -1412,6 +1412,26 @@ public final class CraftServer implements Server {
|
||||||
@ -40,5 +40,5 @@ index 0e582e4e5c..04a76802b8 100644
|
|||||||
@Deprecated
|
@Deprecated
|
||||||
public OfflinePlayer getOfflinePlayer(String name) {
|
public OfflinePlayer getOfflinePlayer(String name) {
|
||||||
--
|
--
|
||||||
2.19.0
|
2.19.1
|
||||||
|
|
||||||
|
@ -1,134 +0,0 @@
|
|||||||
From 3c048e89df0608e4a5187df2ddc1c36956b11df5 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Shane Freeder <theboyetronic@gmail.com>
|
|
||||||
Date: Thu, 8 Nov 2018 04:53:00 +0000
|
|
||||||
Subject: [PATCH] Extend BlockStateListPopulator
|
|
||||||
|
|
||||||
extends BlockStateListPopulator to suppport checking block types in the
|
|
||||||
physical world it's representing, allowing for blocks making modifications
|
|
||||||
to the world to maintain proper state.
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/server/BlockSponge.java b/src/main/java/net/minecraft/server/BlockSponge.java
|
|
||||||
index 987af9c3de..6e52d46952 100644
|
|
||||||
--- a/src/main/java/net/minecraft/server/BlockSponge.java
|
|
||||||
+++ b/src/main/java/net/minecraft/server/BlockSponge.java
|
|
||||||
@@ -68,7 +68,7 @@ public class BlockSponge extends Block {
|
|
||||||
linkedlist.add(new Tuple(blockposition2, Integer.valueOf(j + 1)));
|
|
||||||
}
|
|
||||||
} else if (material == Material.WATER_PLANT || material == Material.REPLACEABLE_WATER_PLANT) {
|
|
||||||
- // iblockdata.a(world, blockposition2, 0);
|
|
||||||
+ iblockdata.a(blockList, blockposition2, 0); // Paper
|
|
||||||
blockList.setTypeAndData(blockposition2, Blocks.AIR.getBlockData(), 3); // CraftBukkit
|
|
||||||
++i;
|
|
||||||
if (j < 6) {
|
|
||||||
@@ -96,12 +96,14 @@ public class BlockSponge extends Block {
|
|
||||||
|
|
||||||
for (CraftBlockState block : blocks) {
|
|
||||||
BlockPosition blockposition2 = new BlockPosition(block.getX(), block.getY(), block.getZ());
|
|
||||||
+ /* // Paper start
|
|
||||||
IBlockData iblockdata = world.getType(blockposition2);
|
|
||||||
Material material = iblockdata.getMaterial();
|
|
||||||
|
|
||||||
if (material == Material.WATER_PLANT || material == Material.REPLACEABLE_WATER_PLANT) {
|
|
||||||
iblockdata.a(world, blockposition2, 0);
|
|
||||||
}
|
|
||||||
+ */ // Paper end
|
|
||||||
|
|
||||||
world.setTypeAndData(blockposition2, block.getHandle(), block.getFlag());
|
|
||||||
}
|
|
||||||
diff --git a/src/main/java/org/bukkit/craftbukkit/util/BlockStateListPopulator.java b/src/main/java/org/bukkit/craftbukkit/util/BlockStateListPopulator.java
|
|
||||||
index 165843ddfe..8482abd054 100644
|
|
||||||
--- a/src/main/java/org/bukkit/craftbukkit/util/BlockStateListPopulator.java
|
|
||||||
+++ b/src/main/java/org/bukkit/craftbukkit/util/BlockStateListPopulator.java
|
|
||||||
@@ -4,8 +4,12 @@ import java.util.ArrayList;
|
|
||||||
import java.util.LinkedHashMap;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
+import net.minecraft.server.Block;
|
|
||||||
import net.minecraft.server.BlockPosition;
|
|
||||||
+import net.minecraft.server.FluidType;
|
|
||||||
import net.minecraft.server.IBlockData;
|
|
||||||
+import net.minecraft.server.TickList;
|
|
||||||
+import net.minecraft.server.TickListPriority;
|
|
||||||
import net.minecraft.server.World;
|
|
||||||
|
|
||||||
import org.bukkit.block.BlockState;
|
|
||||||
@@ -14,6 +18,41 @@ import org.bukkit.craftbukkit.block.CraftBlockState;
|
|
||||||
public class BlockStateListPopulator extends DummyGeneratorAccess {
|
|
||||||
private final World world;
|
|
||||||
private final LinkedHashMap<BlockPosition, CraftBlockState> list;
|
|
||||||
+ // Paper start
|
|
||||||
+ private final TickList<FluidType> fluidTickList = new TickList<FluidType>() {
|
|
||||||
+ @Override
|
|
||||||
+ public boolean a(BlockPosition var1, FluidType var2) {
|
|
||||||
+ return BlockStateListPopulator.super.I().a(var1, var2);
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ @Override
|
|
||||||
+ public void a(BlockPosition var1, FluidType var2, int var3, TickListPriority var4) {
|
|
||||||
+
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ @Override
|
|
||||||
+ public boolean b(BlockPosition var1, FluidType var2) {
|
|
||||||
+ return false;
|
|
||||||
+ }
|
|
||||||
+ };
|
|
||||||
+
|
|
||||||
+ private TickList<Block> blockTickList = new TickList<Block>() {
|
|
||||||
+ @Override
|
|
||||||
+ public boolean a(BlockPosition var1, Block var2) {
|
|
||||||
+ return BlockStateListPopulator.super.J().a(var1, var2);
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ @Override
|
|
||||||
+ public void a(BlockPosition var1, Block var2, int var3, TickListPriority var4) {
|
|
||||||
+
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ @Override
|
|
||||||
+ public boolean b(BlockPosition var1, Block var2) {
|
|
||||||
+ return false;
|
|
||||||
+ }
|
|
||||||
+ };
|
|
||||||
+ // Paper end
|
|
||||||
|
|
||||||
public BlockStateListPopulator(World world) {
|
|
||||||
this(world, new LinkedHashMap<>());
|
|
||||||
@@ -45,4 +84,34 @@ public class BlockStateListPopulator extends DummyGeneratorAccess {
|
|
||||||
public World getWorld() {
|
|
||||||
return world;
|
|
||||||
}
|
|
||||||
+
|
|
||||||
+ // Paper start
|
|
||||||
+ @Override
|
|
||||||
+ public IBlockData getType(BlockPosition bp) {
|
|
||||||
+ CraftBlockState craftState = list.get(bp);
|
|
||||||
+ if (craftState != null) {
|
|
||||||
+ return craftState.getHandle();
|
|
||||||
+ } else {
|
|
||||||
+ return world.getType(bp);
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ // Do nothing, this will be ran when the block is actually placed into the world
|
|
||||||
+ @Override
|
|
||||||
+ public void update(BlockPosition bp, Block block) {}
|
|
||||||
+
|
|
||||||
+ // Dumb tick lists, we rely upon block placement into the world updating this info
|
|
||||||
+ // no obfhelpers intentional, design of these classes do not favor them, and easier
|
|
||||||
+ // to just rework on upgrade...
|
|
||||||
+ @Override
|
|
||||||
+ public TickList<FluidType> I() {
|
|
||||||
+ return fluidTickList;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ @Override
|
|
||||||
+ public TickList<Block> J() {
|
|
||||||
+ return blockTickList;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ // paper end
|
|
||||||
}
|
|
||||||
--
|
|
||||||
2.19.1
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
From ba4a67a8ef2297d66890683df14305f14353a107 Mon Sep 17 00:00:00 2001
|
From 916ce7c5d118a993548b4ee9048507b3c79b268b Mon Sep 17 00:00:00 2001
|
||||||
From: Aikar <aikar@aikar.co>
|
From: Aikar <aikar@aikar.co>
|
||||||
Date: Thu, 8 Nov 2018 21:33:09 -0500
|
Date: Thu, 8 Nov 2018 21:33:09 -0500
|
||||||
Subject: [PATCH] Use Vanilla Minecart Speeds
|
Subject: [PATCH] Use Vanilla Minecart Speeds
|
@ -0,0 +1,39 @@
|
|||||||
|
From 3122cace4a90a3f599b9de4ac6438a7b584dcf18 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Shane Freeder <theboyetronic@gmail.com>
|
||||||
|
Date: Sat, 10 Nov 2018 05:15:21 +0000
|
||||||
|
Subject: [PATCH] Fix SpongeAbsortEvent handling
|
||||||
|
|
||||||
|
Only process drops when the block is actually going to be removed
|
||||||
|
|
||||||
|
diff --git a/src/main/java/net/minecraft/server/BlockSponge.java b/src/main/java/net/minecraft/server/BlockSponge.java
|
||||||
|
index 987af9c3de..adb863eb55 100644
|
||||||
|
--- a/src/main/java/net/minecraft/server/BlockSponge.java
|
||||||
|
+++ b/src/main/java/net/minecraft/server/BlockSponge.java
|
||||||
|
@@ -100,7 +100,11 @@ public class BlockSponge extends Block {
|
||||||
|
Material material = iblockdata.getMaterial();
|
||||||
|
|
||||||
|
if (material == Material.WATER_PLANT || material == Material.REPLACEABLE_WATER_PLANT) {
|
||||||
|
- iblockdata.a(world, blockposition2, 0);
|
||||||
|
+ // Paper start
|
||||||
|
+ if (block.getHandle().getMaterial() == Material.AIR) {
|
||||||
|
+ iblockdata.dropNaturally(world, blockposition2, 0);
|
||||||
|
+ }
|
||||||
|
+ // Paper end
|
||||||
|
}
|
||||||
|
|
||||||
|
world.setTypeAndData(blockposition2, block.getHandle(), block.getFlag());
|
||||||
|
diff --git a/src/main/java/net/minecraft/server/IBlockData.java b/src/main/java/net/minecraft/server/IBlockData.java
|
||||||
|
index 2d855aae69..bc345a2c39 100644
|
||||||
|
--- a/src/main/java/net/minecraft/server/IBlockData.java
|
||||||
|
+++ b/src/main/java/net/minecraft/server/IBlockData.java
|
||||||
|
@@ -223,6 +223,7 @@ public interface IBlockData extends IBlockDataHolder<IBlockData> {
|
||||||
|
this.getBlock().a(this, world, blockposition, entity);
|
||||||
|
}
|
||||||
|
|
||||||
|
+ default void dropNaturally(World world, BlockPosition blockPosition, int i) { a(world, blockPosition, i);} // Paper - OBFHELPER
|
||||||
|
default void a(World world, BlockPosition blockposition, int i) {
|
||||||
|
this.dropNaturally(world, blockposition, 1.0F, i);
|
||||||
|
}
|
||||||
|
--
|
||||||
|
2.19.1
|
||||||
|
|
Loading…
Reference in New Issue
Block a user