fix light level check on monsters

This commit is contained in:
Aikar 2016-03-19 10:45:28 -04:00
parent e8649166ae
commit afd40e5d12

View file

@ -1,4 +1,4 @@
From d2745c17b2cd8c0c9edf0d6cc7adeee17cdd4432 Mon Sep 17 00:00:00 2001
From d18a0f9f4674037220125a5074a84138353227ee Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Fri, 18 Mar 2016 21:22:56 -0400
Subject: [PATCH] Optimized Light Level Comparisons
@ -91,7 +91,7 @@ index 097d11e..d0fa4ae 100644
if (random.nextInt((int) ((100 / (this == Blocks.PUMPKIN_STEM ? world.spigotConfig.pumpkinModifier : world.spigotConfig.melonModifier)) * (25.0F / f)) + 1) == 0) { // Spigot
diff --git a/src/main/java/net/minecraft/server/EntityMonster.java b/src/main/java/net/minecraft/server/EntityMonster.java
index 64f4754..6dc21fb 100644
index 64f4754..7aea23a 100644
--- a/src/main/java/net/minecraft/server/EntityMonster.java
+++ b/src/main/java/net/minecraft/server/EntityMonster.java
@@ -118,17 +118,17 @@ public abstract class EntityMonster extends EntityCreature implements IMonster {
@ -107,10 +107,10 @@ index 64f4754..6dc21fb 100644
this.world.c(10);
- i = this.world.getLightLevel(blockposition);
+ passes = world.isLightLevel(blockposition, this.random.nextInt(8)); // Paper
+ passes = !world.isLightLevel(blockposition, this.random.nextInt(8)); // Paper
this.world.c(j);
- }
+ } else { passes = world.isLightLevel(blockposition, this.random.nextInt(8)); } // Paper
+ } else { passes = !world.isLightLevel(blockposition, this.random.nextInt(8)); } // Paper
- return i <= this.random.nextInt(8);
+ return passes; // Paper