PaperSpigot-Parent/Spigot-Server-Patches/0012-Inverted-Daylight-Dete...

65 lines
2.5 KiB
Diff
Raw Normal View History

2014-08-06 01:45:22 +02:00
From 4d27753cb0ac3a0478d4ed812756ebea206810ca Mon Sep 17 00:00:00 2001
2014-07-06 09:50:09 +02:00
From: gsand <gsandowns@gmail.com>
2014-08-06 01:45:22 +02:00
Date: Tue, 5 Aug 2014 17:31:07 -0500
2014-06-22 22:44:13 +02:00
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
2014-08-06 01:45:22 +02:00
index 96e9c37..1298610 100644
2014-06-22 22:44:13 +02:00
--- a/src/main/java/net/minecraft/server/BlockDaylightDetector.java
+++ b/src/main/java/net/minecraft/server/BlockDaylightDetector.java
2014-08-06 01:45:22 +02:00
@@ -38,14 +38,27 @@ public class BlockDaylightDetector extends BlockContainer {
2014-06-22 22:44:13 +02:00
f += (6.2831855F - f) * 0.2F;
}
- i1 = Math.round((float) i1 * MathHelper.cos(f));
- if (i1 < 0) {
- i1 = 0;
- }
2014-08-06 01:45:22 +02:00
-
- if (i1 > 15) {
- i1 = 15;
+ // PaperSpigot start - Configurable "inversion" for daylight detectors
+ if (world.paperSpigotConfig.invertedDaylightDetectors) {
2014-06-22 22:44:13 +02:00
+ i1 = Math.round((float) i1 * MathHelper.cos(f) * -1 + 15);
+ if (i1 < 10) {
+ i1 = 0;
+ }
2014-08-06 01:45:22 +02:00
+
+ if (i1 > 9) {
+ i1 = 15;
+ }
+ } else {
2014-06-22 22:44:13 +02:00
+ 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
2014-08-06 01:45:22 +02:00
index 0878ea7..9cd9c6d 100644
--- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
2014-08-06 01:45:22 +02:00
@@ -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);
2014-06-22 22:44:13 +02:00
}
+
2014-08-06 01:45:22 +02:00
+ public boolean invertedDaylightDetectors;
+ private void invertedDaylightDetectors()
2014-06-22 22:44:13 +02:00
+ {
2014-08-06 01:45:22 +02:00
+ invertedDaylightDetectors = getBoolean( "inverted-daylight-detectors", false );
+ log( "Inverted Redstone Lamps: " + invertedDaylightDetectors );
2014-06-22 22:44:13 +02:00
+ }
}
2014-06-22 22:44:13 +02:00
--
1.9.1