mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-22 10:57:43 +01:00
Include all Airplane patches
This commit is contained in:
@@ -1,77 +0,0 @@
|
||||
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 30ba21ac1bced18a9d0946b7c3ed55971ada48bb..23796bd657f071a337fdf76d777e33c207baf7a7 100644
|
||||
--- a/src/main/java/net/minecraft/server/EnumDirection.java
|
||||
+++ b/src/main/java/net/minecraft/server/EnumDirection.java
|
||||
@@ -112,6 +112,7 @@ public enum EnumDirection implements INamable {
|
||||
return fromType1(this.h);
|
||||
}
|
||||
|
||||
+ public EnumDirection rotateCW() { return g(); } // Purpur - OBFHELPER
|
||||
public EnumDirection g() {
|
||||
switch (this) {
|
||||
case NORTH:
|
||||
@@ -127,6 +128,7 @@ public enum EnumDirection implements INamable {
|
||||
}
|
||||
}
|
||||
|
||||
+ public EnumDirection rotateCCW() { return h(); } // Purpur - OBFHELPER
|
||||
public EnumDirection h() {
|
||||
switch (this) {
|
||||
case NORTH:
|
||||
@@ -158,6 +160,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 1277a9c8f06936c53f02dc6cfd2eb5184a7b37a2..5675544e018ce6d4fa608680989980edb0ea625a 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 87c68707aaab2d0e49d4e9c17de94b28a4324799..ade194e572b37365cc2becc69081bac8ca34ca46 100644
|
||||
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
@@ -251,8 +251,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;
|
||||
Reference in New Issue
Block a user