Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ae51c16
commit 930555c
Showing
2 changed files
with
78 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
1.16.1--6874b340330971b9934941a70410d110383d7e76 | ||
1.16.1--57ffa5163aff13683299c03bda1dc3e019c523f4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
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 5a04654657..0ec5ea0659 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 660f44975a..2cf10277ef 100644 | ||
--- a/src/main/java/net/minecraft/server/IDispenseBehavior.java | ||
+++ b/src/main/java/net/minecraft/server/IDispenseBehavior.java | ||
@@ -914,6 +914,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 f42af3d9f9..278b100de9 100644 | ||
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java | ||
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java | ||
@@ -230,8 +230,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; |