mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-18 17:07:43 +01:00
Upstream has released updates that appears to apply and compile correctly Paper Changes: cf82dad3 Fix Non Full Status Chunk NBT Memory Leak 5a12515a Update Log4J Configuration file to stop truncating stack traces 7c001d64 More Improvements to Chunks e1c45196 Fix high memory use of non ticking chunks ee9f0d51 Fix another case of breaking blocks causing sync chunk loads 6009ba8f Drop AABB limit patch until it can be tested more 0e9c24e5 Fix log spam about Hanging entities bounding boxes 83fadad7 Fix conversion for deserializing raw nbt itemstacks - Fixes #3424 4d38ee11 Many fixes and improvements to chunk prioritization 281181c7 Use saner Entity bounding box limits edd6b6a2 Protect the visible chunk map from plugins touching it, trim Timing Errors 18c68657 Optimize performance of object pool 7e1525ea Many improvements to chunk prioritization and bug fixes c82b292a Fix pooled buffer leak resulting in dynmap black spots - Fixes #3386 63274472 Fix ./paper edit continue for Windows eb5a3058 Fix path in CONTRIBUTING.md (#3406) f6ed326d Fix a small error in CONTRIBUTING.md (#3403) 614a664b Implement Chunk Priority / Urgency System for Chunks
87 lines
4.3 KiB
Diff
87 lines
4.3 KiB
Diff
From dc561d5d0f39071ea710f243bfe8581ebb71de5d Mon Sep 17 00:00:00 2001
|
|
From: William Blake Galbreath <Blake.Galbreath@GMail.com>
|
|
Date: Sat, 8 Feb 2020 23:30:17 -0600
|
|
Subject: [PATCH] Add getPlacementBlockData to World
|
|
|
|
---
|
|
.../net/minecraft/server/BlockMobSpawner.java | 1 +
|
|
.../net/minecraft/server/ItemSpawner.java | 23 +++++++++++++++++++
|
|
src/main/java/net/minecraft/server/Items.java | 2 +-
|
|
.../org/bukkit/craftbukkit/CraftWorld.java | 5 ++++
|
|
4 files changed, 30 insertions(+), 1 deletion(-)
|
|
create mode 100644 src/main/java/net/minecraft/server/ItemSpawner.java
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/BlockMobSpawner.java b/src/main/java/net/minecraft/server/BlockMobSpawner.java
|
|
index 69d04f6cb..901d45f28 100644
|
|
--- a/src/main/java/net/minecraft/server/BlockMobSpawner.java
|
|
+++ b/src/main/java/net/minecraft/server/BlockMobSpawner.java
|
|
@@ -57,6 +57,7 @@ public class BlockMobSpawner extends BlockTileEntity {
|
|
|
|
@Override
|
|
public int getExpDrop(IBlockData iblockdata, World world, BlockPosition blockposition, ItemStack itemstack) {
|
|
+ if (isSilkTouch(itemstack)) return 0; // Purpur
|
|
int i = 15 + world.random.nextInt(15) + world.random.nextInt(15);
|
|
|
|
return i;
|
|
diff --git a/src/main/java/net/minecraft/server/ItemSpawner.java b/src/main/java/net/minecraft/server/ItemSpawner.java
|
|
new file mode 100644
|
|
index 000000000..7dc68ffe9
|
|
--- /dev/null
|
|
+++ b/src/main/java/net/minecraft/server/ItemSpawner.java
|
|
@@ -0,0 +1,23 @@
|
|
+package net.minecraft.server;
|
|
+
|
|
+public class ItemSpawner extends ItemBlock {
|
|
+ public ItemSpawner(Block block, Info info) {
|
|
+ super(block, info);
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ protected boolean a(BlockPosition blockposition, World world, EntityHuman entityhuman, ItemStack itemstack, IBlockData iblockdata) {
|
|
+ boolean handled = super.a(blockposition, world, entityhuman, itemstack, iblockdata);
|
|
+ if (entityhuman.getBukkitEntity().hasPermission("purpur.place.spawners")) {
|
|
+ TileEntity spawner = world.getTileEntity(blockposition);
|
|
+ if (spawner instanceof TileEntityMobSpawner && itemstack.hasTag()) {
|
|
+ NBTTagCompound tag = itemstack.getTag();
|
|
+ if (tag.hasKey("Purpur.mob_type")) {
|
|
+ EntityTypes.getType(tag.getString("Purpur.mob_type")).ifPresent(type ->
|
|
+ ((TileEntityMobSpawner) spawner).getSpawner().setMobName(type));
|
|
+ }
|
|
+ }
|
|
+ }
|
|
+ return handled;
|
|
+ }
|
|
+}
|
|
diff --git a/src/main/java/net/minecraft/server/Items.java b/src/main/java/net/minecraft/server/Items.java
|
|
index 9c9b93f28..74a722cce 100644
|
|
--- a/src/main/java/net/minecraft/server/Items.java
|
|
+++ b/src/main/java/net/minecraft/server/Items.java
|
|
@@ -155,7 +155,7 @@ public class Items {
|
|
public static final Item bU = a(Blocks.PURPUR_BLOCK, CreativeModeTab.b);
|
|
public static final Item bV = a(Blocks.PURPUR_PILLAR, CreativeModeTab.b);
|
|
public static final Item bW = a(Blocks.PURPUR_STAIRS, CreativeModeTab.b);
|
|
- public static final Item bX = a(Blocks.SPAWNER);
|
|
+ public static final Item bX = a(Blocks.SPAWNER, new ItemSpawner(Blocks.SPAWNER, new Item.Info().a(EnumItemRarity.EPIC))); // Purpur
|
|
public static final Item bY = a(Blocks.OAK_STAIRS, CreativeModeTab.b);
|
|
public static final Item bZ = a(Blocks.CHEST, CreativeModeTab.c);
|
|
public static final Item ca = a(Blocks.DIAMOND_ORE, CreativeModeTab.b);
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
|
index 2c2176919..1524d0ed2 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
|
@@ -2468,6 +2468,11 @@ public class CraftWorld implements World {
|
|
public net.pl3x.purpur.MoonPhase getMoonPhase() {
|
|
return net.pl3x.purpur.MoonPhase.getPhase(getFullTime() / 24000L);
|
|
}
|
|
+
|
|
+ public BlockData getPlacementBlockData(BlockData blockdata, Location location) {
|
|
+ IBlockData validData = net.minecraft.server.Block.getValidBlockForPosition(((CraftBlockData) blockdata).getState(), getHandle(), net.minecraft.server.MCUtil.toBlockPosition(location));
|
|
+ return CraftBlockData.fromData(validData == null ? Blocks.AIR.getBlockData() : validData);
|
|
+ }
|
|
// Purpur end
|
|
|
|
// Paper start
|
|
--
|
|
2.24.0
|
|
|