CavePVP-Stuff/cSpigot-master/spigot-server-Patches/0013-Inverted-Daylight-Detector-Toggle.patch
2023-05-01 19:59:40 +01:00

65 lines
2.5 KiB
Diff

From b5c19d1870bcc620bc83dfb9b216ae795e00b2d8 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 96e9c37e3..1298610b3 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 0878ea753..9cd9c6de0 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 );
+ }
}
--
2.13.3