aboutsummaryrefslogtreecommitdiffhomepage
path: root/Spigot-Server-Patches/0011-Inverted-Daylight-Detector-Toggle.patch
blob: 43a78a376a76d6611f6d3dee950b55cfea83842e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
From c4877d01ec94b74594b67ec8562dd9ae171235cc Mon Sep 17 00:00:00 2001
From: gsand <gsandowns@gmail.com>
Date: Sun, 6 Jul 2014 02:46:20 -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..dc84635 100644
--- a/src/main/java/net/minecraft/server/BlockDaylightDetector.java
+++ b/src/main/java/net/minecraft/server/BlockDaylightDetector.java
@@ -1,5 +1,7 @@
 package net.minecraft.server;
 
+import org.github.paperspigot.PaperSpigotWorldConfig; // PaperSpigot
+
 import java.util.Random;
 
 public class BlockDaylightDetector extends BlockContainer {
@@ -38,14 +40,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;
-            }
+            // PaperSpigot start - Inverted Daylight Detectors
+            if (PaperSpigotWorldConfig.InvertedDaylightDetectors) {
+                i1 = Math.round((float) i1 * MathHelper.cos(f) * -1 + 15);
+                if (i1 < 10) {
+                    i1 = 0;
+                }
 
-            if (i1 > 15) {
-                i1 = 15;
+                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 29863cd..c219cab 100644
--- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
@@ -109,4 +109,11 @@ public class PaperSpigotWorldConfig
     {
         babyZombieMovementSpeed = getDouble( "baby-zombie-movement-speed", 0.5D );
     }
+
+    public static boolean InvertedDaylightDetectors;
+    private void InvertedDaylightDetectors()
+    {
+        InvertedDaylightDetectors = getBoolean( "inverted-daylight-detectors", false );
+        log( "Inverted Redstone Lamps: " + InvertedDaylightDetectors );
+    }
 }
-- 
1.9.1