mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-17 08:27:43 +01:00
Upstream has released updates that appear to apply and compile correctly Paper Changes: fb36f15d6 Let some more packets be send immediately, closes #4140 (#4896) ede41fe16 Emancipate more features to PlayerHandshakeEvent 3fdeba1f5 [CI-SKIP] [Auto] Rebuild Patches 5fc07bd63 Maded Title-Objects directy sendable to targets e7b9a478e Player Chunk Load/Unload Events 1d0cfc0cc MC-4 Fix item position desync 458db6206 Limit auto recipe packets
78 lines
3.7 KiB
Diff
78 lines
3.7 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: William Blake Galbreath <Blake.Galbreath@GMail.com>
|
|
Date: Tue, 4 Aug 2020 21:11:03 -0500
|
|
Subject: [PATCH] Dispensers place anvils option
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/EnumDirection.java b/src/main/java/net/minecraft/server/EnumDirection.java
|
|
index c9963c19892c3e408964b72983bc6e26f8b63b67..e3ba447eb7f3023406b71aab97e3d30523540588 100644
|
|
--- a/src/main/java/net/minecraft/server/EnumDirection.java
|
|
+++ b/src/main/java/net/minecraft/server/EnumDirection.java
|
|
@@ -102,6 +102,7 @@ public enum EnumDirection implements INamable {
|
|
return fromType1(this.h);
|
|
}
|
|
|
|
+ public EnumDirection rotateCW() { return g(); } // Purpur - OBFHELPER
|
|
public EnumDirection g() {
|
|
switch (this) {
|
|
case NORTH:
|
|
@@ -117,6 +118,7 @@ public enum EnumDirection implements INamable {
|
|
}
|
|
}
|
|
|
|
+ public EnumDirection rotateCCW() { return h(); } // Purpur - OBFHELPER
|
|
public EnumDirection h() {
|
|
switch (this) {
|
|
case NORTH:
|
|
@@ -148,6 +150,7 @@ public enum EnumDirection implements INamable {
|
|
return this.j;
|
|
}
|
|
|
|
+ public EnumDirection.EnumAxis getAxis() { return n(); } // Purpur - OBFHELPER
|
|
public EnumDirection.EnumAxis n() {
|
|
return this.k;
|
|
}
|
|
diff --git a/src/main/java/net/minecraft/server/IDispenseBehavior.java b/src/main/java/net/minecraft/server/IDispenseBehavior.java
|
|
index 7b8a470d97ccf0fdcdb8eef9368195486e09913b..d1f9d2884d055efbe72b01f86b0bdaf13ed122a5 100644
|
|
--- a/src/main/java/net/minecraft/server/IDispenseBehavior.java
|
|
+++ b/src/main/java/net/minecraft/server/IDispenseBehavior.java
|
|
@@ -915,6 +915,23 @@ public interface IDispenseBehavior {
|
|
}
|
|
}));
|
|
BlockDispenser.a((IMaterial) Items.SHEARS.getItem(), (IDispenseBehavior) (new DispenseBehaviorShears()));
|
|
+ // Purpur start
|
|
+ BlockDispenser.a(Blocks.ANVIL, new DispenseBehaviorMaybe() {
|
|
+ @Override
|
|
+ protected ItemStack a(ISourceBlock dispenser, ItemStack itemstack) {
|
|
+ World world = dispenser.getWorld();
|
|
+ if (!world.purpurConfig.dispenserPlaceAnvils) return super.a(dispenser, itemstack);
|
|
+ EnumDirection facing = dispenser.getBlockData().get(BlockDispenser.FACING);
|
|
+ BlockPosition blockposition = dispenser.getBlockPosition().shift(facing);
|
|
+ IBlockData iblockdata = world.getType(blockposition);
|
|
+ if (iblockdata.isAir()) {
|
|
+ world.setTypeUpdate(blockposition, Blocks.ANVIL.getBlockData().set(BlockAnvil.FACING, facing.getAxis() == EnumDirection.EnumAxis.Y ? EnumDirection.NORTH : facing.rotateCW()));
|
|
+ itemstack.subtract(1);
|
|
+ }
|
|
+ return itemstack;
|
|
+ }
|
|
+ });
|
|
+ // Purpur end
|
|
}
|
|
|
|
static void a(ISourceBlock isourceblock, Entity entity, EnumDirection enumdirection) {
|
|
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
|
index a26529e932d442c9c9f4ca6a7eff5e3c5f842190..73969ac4480594b5c78cdb2c30fa4d49370a6a6d 100644
|
|
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
|
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
|
@@ -240,8 +240,10 @@ public class PurpurWorldConfig {
|
|
}
|
|
|
|
public boolean dispenserApplyCursedArmor = true;
|
|
+ public boolean dispenserPlaceAnvils = false;
|
|
private void dispenserSettings() {
|
|
dispenserApplyCursedArmor = getBoolean("blocks.dispenser.apply-cursed-to-armor-slots", dispenserApplyCursedArmor);
|
|
+ dispenserPlaceAnvils = getBoolean("blocks.dispenser.place-anvils", dispenserPlaceAnvils);
|
|
}
|
|
|
|
public boolean farmlandGetsMoistFromBelow = false;
|