Paper/Spigot-Server-Patches/0012-Inverted-Daylight-Detector-Toggle.patch
2014-08-05 18:45:22 -05:00

65 lines
2.5 KiB
Diff

From 4d27753cb0ac3a0478d4ed812756ebea206810ca Mon Sep 17 00:00:00 2001
From: gsand <gsandowns@gmail.com>
Date: Tue, 5 Aug 2014 17:31:07 -0500
Subject: [PATCH] Inverted Daylight Detector Toggle
diff --git a/src/main/java/net/minecraft/server/BlockDaylightDetector.java b/src/main/java/net/minecraft/server/BlockDaylightDetector.java
index 96e9c37..1298610 100644
--- a/src/main/java/net/minecraft/server/BlockDaylightDetector.java
+++ b/src/main/java/net/minecraft/server/BlockDaylightDetector.java
@@ -38,14 +38,27 @@ public class BlockDaylightDetector extends BlockContainer {
f += (6.2831855F - f) * 0.2F;
}
- i1 = Math.round((float) i1 * MathHelper.cos(f));
- if (i1 < 0) {
- i1 = 0;
- }
-
- if (i1 > 15) {
- i1 = 15;
+ // PaperSpigot start - Configurable "inversion" for daylight detectors
+ if (world.paperSpigotConfig.invertedDaylightDetectors) {
+ i1 = Math.round((float) i1 * MathHelper.cos(f) * -1 + 15);
+ if (i1 < 10) {
+ i1 = 0;
+ }
+
+ if (i1 > 9) {
+ i1 = 15;
+ }
+ } else {
+ i1 = Math.round((float) i1 * MathHelper.cos(f));
+ if (i1 < 0) {
+ i1 = 0;
+ }
+
+ if (i1 > 15) {
+ i1 = 15;
+ }
}
+ // PaperSpigot end
if (l != i1) {
i1 = org.bukkit.craftbukkit.event.CraftEventFactory.callRedstoneChange(world, i, j, k, l, i1).getNewCurrent(); // CraftBukkit - Call BlockRedstoneEvent
diff --git a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
index 0878ea7..9cd9c6d 100644
--- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
@@ -106,4 +106,11 @@ public class PaperSpigotWorldConfig
reedMaxHeight = getInt( "max-growth-height.reeds", 3 );
log( "Max height for cactus growth " + cactusMaxHeight + ". Max height for reed growth " + reedMaxHeight);
}
+
+ public boolean invertedDaylightDetectors;
+ private void invertedDaylightDetectors()
+ {
+ invertedDaylightDetectors = getBoolean( "inverted-daylight-detectors", false );
+ log( "Inverted Redstone Lamps: " + invertedDaylightDetectors );
+ }
}
--
1.9.1