More work
This commit is contained in:
		
					parent
					
						
							
								c46b20492e
							
						
					
				
			
			
				commit
				
					
						e70c4bc478
					
				
			
		
					 17 changed files with 28 additions and 39 deletions
				
			
		| 
						 | 
				
			
			@ -0,0 +1,87 @@
 | 
			
		|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
 | 
			
		||||
From: Suddenly <suddenly@suddenly.coffee>
 | 
			
		||||
Date: Tue, 1 Mar 2016 13:51:54 -0600
 | 
			
		||||
Subject: [PATCH] Add configurable despawn distances for living entities
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
 | 
			
		||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
 | 
			
		||||
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
 | 
			
		||||
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
 | 
			
		||||
@@ -0,0 +0,0 @@ package com.destroystokyo.paper;
 | 
			
		||||
 
 | 
			
		||||
 import java.util.List;
 | 
			
		||||
 
 | 
			
		||||
+import it.unimi.dsi.fastutil.objects.Reference2IntMap;
 | 
			
		||||
+import it.unimi.dsi.fastutil.objects.Reference2IntOpenHashMap;
 | 
			
		||||
+import net.minecraft.world.entity.MobCategory;
 | 
			
		||||
 import org.bukkit.Bukkit;
 | 
			
		||||
 import org.bukkit.configuration.file.YamlConfiguration;
 | 
			
		||||
 import org.spigotmc.SpigotWorldConfig;
 | 
			
		||||
@@ -0,0 +0,0 @@ public class PaperWorldConfig {
 | 
			
		||||
     public void removeOldValues() {
 | 
			
		||||
         boolean needsSave = false;
 | 
			
		||||
 
 | 
			
		||||
+        if (PaperConfig.version < 24) {
 | 
			
		||||
+            needsSave = true;
 | 
			
		||||
+
 | 
			
		||||
+            set("despawn-ranges.soft", null);
 | 
			
		||||
+            set("despawn-ranges.hard", null);
 | 
			
		||||
+        }
 | 
			
		||||
+
 | 
			
		||||
         if (needsSave) {
 | 
			
		||||
             saveConfig();
 | 
			
		||||
         }
 | 
			
		||||
@@ -0,0 +0,0 @@ public class PaperWorldConfig {
 | 
			
		||||
     private void nerfedMobsShouldJump() {
 | 
			
		||||
         nerfedMobsShouldJump = getBoolean("spawner-nerfed-mobs-should-jump", false);
 | 
			
		||||
     }
 | 
			
		||||
+
 | 
			
		||||
+    public final Reference2IntMap<MobCategory> softDespawnDistances = new Reference2IntOpenHashMap<>(MobCategory.values().length);
 | 
			
		||||
+    public final Reference2IntMap<MobCategory> hardDespawnDistances = new Reference2IntOpenHashMap<>(MobCategory.values().length);
 | 
			
		||||
+    private void despawnDistances() {
 | 
			
		||||
+        if (PaperConfig.version < 24) {
 | 
			
		||||
+            int softDistance = getInt("despawn-ranges.soft", 32, false); // 32^2 = 1024, Minecraft Default
 | 
			
		||||
+            int hardDistance = getInt("despawn-ranges.hard", 128, false); // 128^2 = 16384, Minecraft Default
 | 
			
		||||
+            for (MobCategory value : MobCategory.values()) {
 | 
			
		||||
+                if (softDistance != 32) {
 | 
			
		||||
+                    softDespawnDistances.put(value, softDistance);
 | 
			
		||||
+                }
 | 
			
		||||
+                if (hardDistance != 128) {
 | 
			
		||||
+                    hardDespawnDistances.put(value, hardDistance);
 | 
			
		||||
+                }
 | 
			
		||||
+            }
 | 
			
		||||
+        }
 | 
			
		||||
+        for (MobCategory category : MobCategory.values()) {
 | 
			
		||||
+            int softDistance = getInt("despawn-ranges." + category.getName() + ".soft", softDespawnDistances.getOrDefault(category, category.getNoDespawnDistance()));
 | 
			
		||||
+            int hardDistance = getInt("despawn-ranges." + category.getName() + ".hard", hardDespawnDistances.getOrDefault(category, category.getDespawnDistance()));
 | 
			
		||||
+            if (softDistance > hardDistance) {
 | 
			
		||||
+                softDistance = hardDistance;
 | 
			
		||||
+            }
 | 
			
		||||
+            log("Mobs in " + category.getName() + " Despawn Ranges: Soft" + softDistance + " Hard: " + hardDistance);
 | 
			
		||||
+            softDespawnDistances.put(category, softDistance);
 | 
			
		||||
+            hardDespawnDistances.put(category, hardDistance);
 | 
			
		||||
+        }
 | 
			
		||||
+    }
 | 
			
		||||
 }
 | 
			
		||||
diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java
 | 
			
		||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
 | 
			
		||||
--- a/src/main/java/net/minecraft/world/entity/Mob.java
 | 
			
		||||
+++ b/src/main/java/net/minecraft/world/entity/Mob.java
 | 
			
		||||
@@ -0,0 +0,0 @@ public abstract class Mob extends LivingEntity {
 | 
			
		||||
 
 | 
			
		||||
             if (entityhuman != null) {
 | 
			
		||||
                 double d0 = entityhuman.distanceToSqr((Entity) this);
 | 
			
		||||
-                int i = this.getType().getCategory().getDespawnDistance();
 | 
			
		||||
+                int i = this.level.paperConfig.hardDespawnDistances.getInt(this.getType().getCategory()); // Paper - custom despawn distances
 | 
			
		||||
                 int j = i * i;
 | 
			
		||||
 
 | 
			
		||||
                 if (d0 > (double) j) { // CraftBukkit - remove isTypeNotPersistent() check
 | 
			
		||||
                     this.discard();
 | 
			
		||||
                 }
 | 
			
		||||
 
 | 
			
		||||
-                int k = this.getType().getCategory().getNoDespawnDistance();
 | 
			
		||||
+                int k = this.level.paperConfig.softDespawnDistances.getInt(this.getType().getCategory()); // Paper - custom despawn distances
 | 
			
		||||
                 int l = k * k;
 | 
			
		||||
 
 | 
			
		||||
                 if (this.noActionTime > 600 && this.random.nextInt(800) == 0 && d0 > (double) l) { // CraftBukkit - remove isTypeNotPersistent() check
 | 
			
		||||
							
								
								
									
										214
									
								
								patches/server/Add-version-history-to-version-command.patch
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										214
									
								
								patches/server/Add-version-history-to-version-command.patch
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,214 @@
 | 
			
		|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
 | 
			
		||||
From: Kyle Wood <kyle@denwav.dev>
 | 
			
		||||
Date: Thu, 1 Mar 2018 19:37:52 -0600
 | 
			
		||||
Subject: [PATCH] Add version history to version command
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java b/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java
 | 
			
		||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
 | 
			
		||||
--- a/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java
 | 
			
		||||
+++ b/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java
 | 
			
		||||
@@ -0,0 +0,0 @@ import com.google.gson.*;
 | 
			
		||||
 import net.kyori.adventure.text.Component;
 | 
			
		||||
 import net.kyori.adventure.text.event.ClickEvent;
 | 
			
		||||
 import net.kyori.adventure.text.format.NamedTextColor;
 | 
			
		||||
+import net.kyori.adventure.text.format.TextDecoration;
 | 
			
		||||
+import net.kyori.adventure.text.TextComponent;
 | 
			
		||||
 
 | 
			
		||||
 import javax.annotation.Nonnull;
 | 
			
		||||
 import javax.annotation.Nullable;
 | 
			
		||||
@@ -0,0 +0,0 @@ public class PaperVersionFetcher implements VersionFetcher {
 | 
			
		||||
     @Override
 | 
			
		||||
     public Component getVersionMessage(@Nonnull String serverVersion) {
 | 
			
		||||
         String[] parts = serverVersion.substring("git-Paper-".length()).split("[-\\s]");
 | 
			
		||||
-        return getUpdateStatusMessage("PaperMC/Paper", GITHUB_BRANCH_NAME, parts[0]);
 | 
			
		||||
+        final Component updateMessage = getUpdateStatusMessage("PaperMC/Paper", GITHUB_BRANCH_NAME, parts[0]);
 | 
			
		||||
+        final Component history = getHistory();
 | 
			
		||||
+
 | 
			
		||||
+        return history != null ? TextComponent.ofChildren(updateMessage, Component.newline(), history) : updateMessage;
 | 
			
		||||
     }
 | 
			
		||||
 
 | 
			
		||||
     private static @Nullable String getMinecraftVersion() {
 | 
			
		||||
@@ -0,0 +0,0 @@ public class PaperVersionFetcher implements VersionFetcher {
 | 
			
		||||
             return -1;
 | 
			
		||||
         }
 | 
			
		||||
     }
 | 
			
		||||
+
 | 
			
		||||
+    @Nullable
 | 
			
		||||
+    private Component getHistory() {
 | 
			
		||||
+        final VersionHistoryManager.VersionData data = VersionHistoryManager.INSTANCE.getVersionData();
 | 
			
		||||
+        if (data == null) {
 | 
			
		||||
+            return null;
 | 
			
		||||
+        }
 | 
			
		||||
+
 | 
			
		||||
+        final String oldVersion = data.getOldVersion();
 | 
			
		||||
+        if (oldVersion == null) {
 | 
			
		||||
+            return null;
 | 
			
		||||
+        }
 | 
			
		||||
+
 | 
			
		||||
+        return Component.text("Previous version: " + oldVersion, NamedTextColor.GRAY, TextDecoration.ITALIC);
 | 
			
		||||
+    }
 | 
			
		||||
 }
 | 
			
		||||
diff --git a/src/main/java/com/destroystokyo/paper/VersionHistoryManager.java b/src/main/java/com/destroystokyo/paper/VersionHistoryManager.java
 | 
			
		||||
new file mode 100644
 | 
			
		||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
 | 
			
		||||
--- /dev/null
 | 
			
		||||
+++ b/src/main/java/com/destroystokyo/paper/VersionHistoryManager.java
 | 
			
		||||
@@ -0,0 +0,0 @@
 | 
			
		||||
+package com.destroystokyo.paper;
 | 
			
		||||
+
 | 
			
		||||
+import com.google.common.base.MoreObjects;
 | 
			
		||||
+import com.google.gson.Gson;
 | 
			
		||||
+import com.google.gson.JsonSyntaxException;
 | 
			
		||||
+import java.io.BufferedReader;
 | 
			
		||||
+import java.io.BufferedWriter;
 | 
			
		||||
+import java.io.IOException;
 | 
			
		||||
+import java.nio.charset.StandardCharsets;
 | 
			
		||||
+import java.nio.file.Files;
 | 
			
		||||
+import java.nio.file.Path;
 | 
			
		||||
+import java.nio.file.Paths;
 | 
			
		||||
+import java.nio.file.StandardOpenOption;
 | 
			
		||||
+import java.util.Objects;
 | 
			
		||||
+import java.util.logging.Level;
 | 
			
		||||
+import java.util.logging.Logger;
 | 
			
		||||
+import org.bukkit.Bukkit;
 | 
			
		||||
+
 | 
			
		||||
+import javax.annotation.Nonnull;
 | 
			
		||||
+import javax.annotation.Nullable;
 | 
			
		||||
+
 | 
			
		||||
+public enum VersionHistoryManager {
 | 
			
		||||
+    INSTANCE;
 | 
			
		||||
+
 | 
			
		||||
+    private final Gson gson = new Gson();
 | 
			
		||||
+
 | 
			
		||||
+    private final Logger logger = Bukkit.getLogger();
 | 
			
		||||
+
 | 
			
		||||
+    private VersionData currentData = null;
 | 
			
		||||
+
 | 
			
		||||
+    VersionHistoryManager() {
 | 
			
		||||
+        final Path path = Paths.get("version_history.json");
 | 
			
		||||
+
 | 
			
		||||
+        if (Files.exists(path)) {
 | 
			
		||||
+            // Basic file santiy checks
 | 
			
		||||
+            if (!Files.isRegularFile(path)) {
 | 
			
		||||
+                if (Files.isDirectory(path)) {
 | 
			
		||||
+                    logger.severe(path + " is a directory, cannot be used for version history");
 | 
			
		||||
+                } else {
 | 
			
		||||
+                    logger.severe(path + " is not a regular file, cannot be used for version history");
 | 
			
		||||
+                }
 | 
			
		||||
+                // We can't continue
 | 
			
		||||
+                return;
 | 
			
		||||
+            }
 | 
			
		||||
+
 | 
			
		||||
+            try (final BufferedReader reader = Files.newBufferedReader(path, StandardCharsets.UTF_8)) {
 | 
			
		||||
+                currentData = gson.fromJson(reader, VersionData.class);
 | 
			
		||||
+            } catch (final IOException e) {
 | 
			
		||||
+                logger.log(Level.SEVERE, "Failed to read version history file '" + path + "'", e);
 | 
			
		||||
+                return;
 | 
			
		||||
+            } catch (final JsonSyntaxException e) {
 | 
			
		||||
+                logger.log(Level.SEVERE, "Invalid json syntax for file '" + path + "'", e);
 | 
			
		||||
+                return;
 | 
			
		||||
+            }
 | 
			
		||||
+
 | 
			
		||||
+            final String version = Bukkit.getVersion();
 | 
			
		||||
+            if (version == null) {
 | 
			
		||||
+                logger.severe("Failed to retrieve current version");
 | 
			
		||||
+                return;
 | 
			
		||||
+            }
 | 
			
		||||
+
 | 
			
		||||
+            if (!version.equals(currentData.getCurrentVersion())) {
 | 
			
		||||
+                // The version appears to have changed
 | 
			
		||||
+                currentData.setOldVersion(currentData.getCurrentVersion());
 | 
			
		||||
+                currentData.setCurrentVersion(version);
 | 
			
		||||
+                writeFile(path);
 | 
			
		||||
+            }
 | 
			
		||||
+        } else {
 | 
			
		||||
+            // File doesn't exist, start fresh
 | 
			
		||||
+            currentData = new VersionData();
 | 
			
		||||
+            // oldVersion is null
 | 
			
		||||
+            currentData.setCurrentVersion(Bukkit.getVersion());
 | 
			
		||||
+            writeFile(path);
 | 
			
		||||
+        }
 | 
			
		||||
+    }
 | 
			
		||||
+
 | 
			
		||||
+    private void writeFile(@Nonnull final Path path) {
 | 
			
		||||
+        try (final BufferedWriter writer = Files.newBufferedWriter(
 | 
			
		||||
+            path,
 | 
			
		||||
+            StandardCharsets.UTF_8,
 | 
			
		||||
+            StandardOpenOption.WRITE,
 | 
			
		||||
+            StandardOpenOption.CREATE,
 | 
			
		||||
+            StandardOpenOption.TRUNCATE_EXISTING
 | 
			
		||||
+        )) {
 | 
			
		||||
+            gson.toJson(currentData, writer);
 | 
			
		||||
+        } catch (final IOException e) {
 | 
			
		||||
+            logger.log(Level.SEVERE, "Failed to write to version history file", e);
 | 
			
		||||
+        }
 | 
			
		||||
+    }
 | 
			
		||||
+
 | 
			
		||||
+    @Nullable
 | 
			
		||||
+    public VersionData getVersionData() {
 | 
			
		||||
+        return currentData;
 | 
			
		||||
+    }
 | 
			
		||||
+
 | 
			
		||||
+    public static class VersionData {
 | 
			
		||||
+        private String oldVersion;
 | 
			
		||||
+
 | 
			
		||||
+        private String currentVersion;
 | 
			
		||||
+
 | 
			
		||||
+        @Nullable
 | 
			
		||||
+        public String getOldVersion() {
 | 
			
		||||
+            return oldVersion;
 | 
			
		||||
+        }
 | 
			
		||||
+
 | 
			
		||||
+        public void setOldVersion(@Nullable String oldVersion) {
 | 
			
		||||
+            this.oldVersion = oldVersion;
 | 
			
		||||
+        }
 | 
			
		||||
+
 | 
			
		||||
+        @Nullable
 | 
			
		||||
+        public String getCurrentVersion() {
 | 
			
		||||
+            return currentVersion;
 | 
			
		||||
+        }
 | 
			
		||||
+
 | 
			
		||||
+        public void setCurrentVersion(@Nullable String currentVersion) {
 | 
			
		||||
+            this.currentVersion = currentVersion;
 | 
			
		||||
+        }
 | 
			
		||||
+
 | 
			
		||||
+        @Override
 | 
			
		||||
+        public String toString() {
 | 
			
		||||
+            return MoreObjects.toStringHelper(this)
 | 
			
		||||
+                .add("oldVersion", oldVersion)
 | 
			
		||||
+                .add("currentVersion", currentVersion)
 | 
			
		||||
+                .toString();
 | 
			
		||||
+        }
 | 
			
		||||
+
 | 
			
		||||
+        @Override
 | 
			
		||||
+        public boolean equals(@Nullable Object o) {
 | 
			
		||||
+            if (this == o) {
 | 
			
		||||
+                return true;
 | 
			
		||||
+            }
 | 
			
		||||
+            if (o == null || getClass() != o.getClass()) {
 | 
			
		||||
+                return false;
 | 
			
		||||
+            }
 | 
			
		||||
+            final VersionData versionData = (VersionData) o;
 | 
			
		||||
+            return Objects.equals(oldVersion, versionData.oldVersion) &&
 | 
			
		||||
+                Objects.equals(currentVersion, versionData.currentVersion);
 | 
			
		||||
+        }
 | 
			
		||||
+
 | 
			
		||||
+        @Override
 | 
			
		||||
+        public int hashCode() {
 | 
			
		||||
+            return Objects.hash(oldVersion, currentVersion);
 | 
			
		||||
+        }
 | 
			
		||||
+    }
 | 
			
		||||
+}
 | 
			
		||||
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
 | 
			
		||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
 | 
			
		||||
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
 | 
			
		||||
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
 | 
			
		||||
@@ -0,0 +0,0 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
 | 
			
		||||
             return false;
 | 
			
		||||
         }
 | 
			
		||||
         com.destroystokyo.paper.PaperConfig.registerCommands();
 | 
			
		||||
+        com.destroystokyo.paper.VersionHistoryManager.INSTANCE.getClass(); // load version history now
 | 
			
		||||
         // Paper end
 | 
			
		||||
 
 | 
			
		||||
         this.setPvpAllowed(dedicatedserverproperties.pvp);
 | 
			
		||||
							
								
								
									
										3575
									
								
								patches/server/Adventure.patch
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										3575
									
								
								patches/server/Adventure.patch
									
										
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load diff
											
										
									
								
							
							
								
								
									
										33
									
								
								patches/server/Allow-for-toggling-of-spawn-chunks.patch
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										33
									
								
								patches/server/Allow-for-toggling-of-spawn-chunks.patch
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,33 @@
 | 
			
		|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
 | 
			
		||||
From: Zach Brown <1254957+zachbr@users.noreply.github.com>
 | 
			
		||||
Date: Thu, 3 Mar 2016 03:53:43 -0600
 | 
			
		||||
Subject: [PATCH] Allow for toggling of spawn chunks
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
 | 
			
		||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
 | 
			
		||||
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
 | 
			
		||||
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
 | 
			
		||||
@@ -0,0 +0,0 @@ public class PaperWorldConfig {
 | 
			
		||||
             hardDespawnDistances.put(category, hardDistance);
 | 
			
		||||
         }
 | 
			
		||||
     }
 | 
			
		||||
+
 | 
			
		||||
+    public boolean keepSpawnInMemory;
 | 
			
		||||
+    private void keepSpawnInMemory() {
 | 
			
		||||
+        keepSpawnInMemory = getBoolean("keep-spawn-loaded", true);
 | 
			
		||||
+        log("Keep spawn chunk loaded: " + keepSpawnInMemory);
 | 
			
		||||
+    }
 | 
			
		||||
 }
 | 
			
		||||
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
 | 
			
		||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
 | 
			
		||||
--- a/src/main/java/net/minecraft/world/level/Level.java
 | 
			
		||||
+++ b/src/main/java/net/minecraft/world/level/Level.java
 | 
			
		||||
@@ -0,0 +0,0 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
 | 
			
		||||
         });
 | 
			
		||||
         // CraftBukkit end
 | 
			
		||||
         timings = new co.aikar.timings.WorldTimingsHandler(this); // Paper - code below can generate new world and access timings
 | 
			
		||||
+        this.keepSpawnInMemory = this.paperConfig.keepSpawnInMemory; // Paper
 | 
			
		||||
         this.entityLimiter = new org.spigotmc.TickLimiter(spigotConfig.entityMaxTickTime);
 | 
			
		||||
         this.tileLimiter = new org.spigotmc.TickLimiter(spigotConfig.tileMaxTickTime);
 | 
			
		||||
     }
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,75 @@
 | 
			
		|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
 | 
			
		||||
From: Zach Brown <1254957+zachbr@users.noreply.github.com>
 | 
			
		||||
Date: Tue, 1 Mar 2016 13:24:16 -0600
 | 
			
		||||
Subject: [PATCH] Allow nerfed mobs to jump and take water damage
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
 | 
			
		||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
 | 
			
		||||
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
 | 
			
		||||
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
 | 
			
		||||
@@ -0,0 +0,0 @@ public class PaperWorldConfig {
 | 
			
		||||
         fishingMaxTicks = getInt("fishing-time-range.MaximumTicks", 600);
 | 
			
		||||
         log("Fishing time ranges are between " + fishingMinTicks +" and " + fishingMaxTicks + " ticks");
 | 
			
		||||
     }
 | 
			
		||||
+
 | 
			
		||||
+    public boolean nerfedMobsShouldJump;
 | 
			
		||||
+    private void nerfedMobsShouldJump() {
 | 
			
		||||
+        nerfedMobsShouldJump = getBoolean("spawner-nerfed-mobs-should-jump", false);
 | 
			
		||||
+    }
 | 
			
		||||
 }
 | 
			
		||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
 | 
			
		||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
 | 
			
		||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
 | 
			
		||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
 | 
			
		||||
@@ -0,0 +0,0 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i
 | 
			
		||||
         return this.isInWater() || this.isInRain();
 | 
			
		||||
     }
 | 
			
		||||
 
 | 
			
		||||
+    @Deprecated public final boolean isInWaterOrRainOrBubble() { return isInWaterRainOrBubble(); } // Paper - OBFHELPER
 | 
			
		||||
     public boolean isInWaterRainOrBubble() {
 | 
			
		||||
         return this.isInWater() || this.isInRain() || this.isInBubbleColumn();
 | 
			
		||||
     }
 | 
			
		||||
diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java
 | 
			
		||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
 | 
			
		||||
--- a/src/main/java/net/minecraft/world/entity/Mob.java
 | 
			
		||||
+++ b/src/main/java/net/minecraft/world/entity/Mob.java
 | 
			
		||||
@@ -0,0 +0,0 @@ public abstract class Mob extends LivingEntity {
 | 
			
		||||
     private final BodyRotationControl bodyRotationControl;
 | 
			
		||||
     protected PathNavigation navigation;
 | 
			
		||||
     public GoalSelector goalSelector;
 | 
			
		||||
+    @Nullable public net.minecraft.world.entity.ai.goal.FloatGoal goalFloat; // Paper
 | 
			
		||||
     public GoalSelector targetSelector;
 | 
			
		||||
     @Nullable
 | 
			
		||||
     private LivingEntity target;
 | 
			
		||||
@@ -0,0 +0,0 @@ public abstract class Mob extends LivingEntity {
 | 
			
		||||
     @Override
 | 
			
		||||
     protected final void serverAiStep() {
 | 
			
		||||
         ++this.noActionTime;
 | 
			
		||||
-        if (!this.aware) return; // CraftBukkit
 | 
			
		||||
+        if (!this.aware) { // Paper start - Allow nerfed mobs to jump, float and take water damage
 | 
			
		||||
+            if (goalFloat != null) {
 | 
			
		||||
+                if (goalFloat.canUse()) goalFloat.tick();
 | 
			
		||||
+                this.getJumpControl().tick();
 | 
			
		||||
+            }
 | 
			
		||||
+            if ((this instanceof net.minecraft.world.entity.monster.Blaze || this instanceof net.minecraft.world.entity.monster.EnderMan) && isInWaterRainOrBubble()) {
 | 
			
		||||
+                hurt(DamageSource.DROWN, 1.0F);
 | 
			
		||||
+            }
 | 
			
		||||
+            return;
 | 
			
		||||
+        }
 | 
			
		||||
+        // Paper end
 | 
			
		||||
         this.level.getProfiler().push("sensing");
 | 
			
		||||
         this.sensing.tick();
 | 
			
		||||
         this.level.getProfiler().pop();
 | 
			
		||||
diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/FloatGoal.java b/src/main/java/net/minecraft/world/entity/ai/goal/FloatGoal.java
 | 
			
		||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
 | 
			
		||||
--- a/src/main/java/net/minecraft/world/entity/ai/goal/FloatGoal.java
 | 
			
		||||
+++ b/src/main/java/net/minecraft/world/entity/ai/goal/FloatGoal.java
 | 
			
		||||
@@ -0,0 +0,0 @@ public class FloatGoal extends Goal {
 | 
			
		||||
 
 | 
			
		||||
     public FloatGoal(Mob mob) {
 | 
			
		||||
         this.mob = mob;
 | 
			
		||||
+        if (mob.getCommandSenderWorld().paperConfig.nerfedMobsShouldJump) mob.goalFloat = this; // Paper
 | 
			
		||||
         this.setFlags(EnumSet.of(Goal.Flag.JUMP));
 | 
			
		||||
         mob.getNavigation().setCanFloat(true);
 | 
			
		||||
     }
 | 
			
		||||
							
								
								
									
										51
									
								
								patches/server/Configurable-baby-zombie-movement-speed.patch
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										51
									
								
								patches/server/Configurable-baby-zombie-movement-speed.patch
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,51 @@
 | 
			
		|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
 | 
			
		||||
From: Zach Brown <1254957+zachbr@users.noreply.github.com>
 | 
			
		||||
Date: Tue, 1 Mar 2016 13:09:16 -0600
 | 
			
		||||
Subject: [PATCH] Configurable baby zombie movement speed
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
 | 
			
		||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
 | 
			
		||||
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
 | 
			
		||||
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
 | 
			
		||||
@@ -0,0 +0,0 @@ public class PaperWorldConfig {
 | 
			
		||||
         log("Max height for cactus growth " + cactusMaxHeight + ". Max height for reed growth " + reedMaxHeight + ". Max height for bamboo growth " + bambooMaxHeight + ". Min height for fully-grown bamboo " + bambooMinHeight + ".");
 | 
			
		||||
 
 | 
			
		||||
     }
 | 
			
		||||
+
 | 
			
		||||
+    public double babyZombieMovementModifier;
 | 
			
		||||
+    private void babyZombieMovementModifier() {
 | 
			
		||||
+        babyZombieMovementModifier = getDouble("baby-zombie-movement-modifier", 0.5D);
 | 
			
		||||
+        if (PaperConfig.version < 20) {
 | 
			
		||||
+            babyZombieMovementModifier = getDouble("baby-zombie-movement-speed", 0.5D);
 | 
			
		||||
+            set("baby-zombie-movement-modifier", babyZombieMovementModifier);
 | 
			
		||||
+        }
 | 
			
		||||
+
 | 
			
		||||
+        log("Baby zombies will move at the speed of " + babyZombieMovementModifier);
 | 
			
		||||
+    }
 | 
			
		||||
 }
 | 
			
		||||
diff --git a/src/main/java/net/minecraft/world/entity/monster/Zombie.java b/src/main/java/net/minecraft/world/entity/monster/Zombie.java
 | 
			
		||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
 | 
			
		||||
--- a/src/main/java/net/minecraft/world/entity/monster/Zombie.java
 | 
			
		||||
+++ b/src/main/java/net/minecraft/world/entity/monster/Zombie.java
 | 
			
		||||
@@ -0,0 +0,0 @@ import org.bukkit.event.entity.EntityTransformEvent;
 | 
			
		||||
 public class Zombie extends Monster {
 | 
			
		||||
 
 | 
			
		||||
     private static final UUID SPEED_MODIFIER_BABY_UUID = UUID.fromString("B9766B59-9566-4402-BC1F-2EE2A276D836");
 | 
			
		||||
-    private static final AttributeModifier SPEED_MODIFIER_BABY = new AttributeModifier(Zombie.SPEED_MODIFIER_BABY_UUID, "Baby speed boost", 0.5D, AttributeModifier.Operation.MULTIPLY_BASE);
 | 
			
		||||
+    private final AttributeModifier SPEED_MODIFIER_BABY = new AttributeModifier(Zombie.SPEED_MODIFIER_BABY_UUID, "Baby speed boost", 0.5D, AttributeModifier.Operation.MULTIPLY_BASE); private final AttributeModifier babyModifier = this.SPEED_MODIFIER_BABY; // Paper - remove static - Make baby speed configurable
 | 
			
		||||
     private static final EntityDataAccessor<Boolean> DATA_BABY_ID = SynchedEntityData.defineId(Zombie.class, EntityDataSerializers.BOOLEAN);
 | 
			
		||||
     private static final EntityDataAccessor<Integer> DATA_SPECIAL_TYPE_ID = SynchedEntityData.defineId(Zombie.class, EntityDataSerializers.INT);
 | 
			
		||||
     public static final EntityDataAccessor<Boolean> DATA_DROWNED_CONVERSION_ID = SynchedEntityData.defineId(Zombie.class, EntityDataSerializers.BOOLEAN);
 | 
			
		||||
@@ -0,0 +0,0 @@ public class Zombie extends Monster {
 | 
			
		||||
         if (this.level != null && !this.level.isClientSide) {
 | 
			
		||||
             AttributeInstance attributemodifiable = this.getAttribute(Attributes.MOVEMENT_SPEED);
 | 
			
		||||
 
 | 
			
		||||
-            attributemodifiable.removeModifier(Zombie.SPEED_MODIFIER_BABY);
 | 
			
		||||
+            attributemodifiable.removeModifier(this.babyModifier); // Paper
 | 
			
		||||
             if (baby) {
 | 
			
		||||
-                attributemodifiable.addTransientModifier(Zombie.SPEED_MODIFIER_BABY);
 | 
			
		||||
+                attributemodifiable.addTransientModifier(this.babyModifier); // Paper
 | 
			
		||||
             }
 | 
			
		||||
         }
 | 
			
		||||
 
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,114 @@
 | 
			
		|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
 | 
			
		||||
From: Zach Brown <1254957+zachbr@users.noreply.github.com>
 | 
			
		||||
Date: Tue, 1 Mar 2016 13:02:51 -0600
 | 
			
		||||
Subject: [PATCH] Configurable cactus bamboo and reed growth heights
 | 
			
		||||
 | 
			
		||||
Bamboo - Both the minimum fully-grown heights and the maximum are configurable
 | 
			
		||||
- Machine_Maker
 | 
			
		||||
 | 
			
		||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
 | 
			
		||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
 | 
			
		||||
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
 | 
			
		||||
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
 | 
			
		||||
@@ -0,0 +0,0 @@ public class PaperWorldConfig {
 | 
			
		||||
         config.addDefault("world-settings.default." + path, def);
 | 
			
		||||
         return config.getString("world-settings." + worldName + "." + path, config.getString("world-settings.default." + path));
 | 
			
		||||
     }
 | 
			
		||||
+
 | 
			
		||||
+    public int cactusMaxHeight;
 | 
			
		||||
+    public int reedMaxHeight;
 | 
			
		||||
+    public int bambooMaxHeight;
 | 
			
		||||
+    public int bambooMinHeight;
 | 
			
		||||
+    private void blockGrowthHeight() {
 | 
			
		||||
+        cactusMaxHeight = getInt("max-growth-height.cactus", 3);
 | 
			
		||||
+        reedMaxHeight = getInt("max-growth-height.reeds", 3);
 | 
			
		||||
+        bambooMaxHeight = getInt("max-growth-height.bamboo.max", 16);
 | 
			
		||||
+        bambooMinHeight = getInt("max-growth-height.bamboo.min", 11);
 | 
			
		||||
+        log("Max height for cactus growth " + cactusMaxHeight + ". Max height for reed growth " + reedMaxHeight + ". Max height for bamboo growth " + bambooMaxHeight + ". Min height for fully-grown bamboo " + bambooMinHeight + ".");
 | 
			
		||||
+
 | 
			
		||||
+    }
 | 
			
		||||
 }
 | 
			
		||||
diff --git a/src/main/java/net/minecraft/world/level/block/BambooBlock.java b/src/main/java/net/minecraft/world/level/block/BambooBlock.java
 | 
			
		||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
 | 
			
		||||
--- a/src/main/java/net/minecraft/world/level/block/BambooBlock.java
 | 
			
		||||
+++ b/src/main/java/net/minecraft/world/level/block/BambooBlock.java
 | 
			
		||||
@@ -0,0 +0,0 @@ public class BambooBlock extends Block implements BonemealableBlock {
 | 
			
		||||
             if (random.nextInt(Math.max(1, (int) (100.0F / world.spigotConfig.bambooModifier) * 3)) == 0 && world.isEmptyBlock(pos.above()) && world.getRawBrightness(pos.above(), 0) >= 9) { // Spigot
 | 
			
		||||
                 int i = this.getHeightBelowUpToMax(world, pos) + 1;
 | 
			
		||||
 
 | 
			
		||||
-                if (i < 16) {
 | 
			
		||||
+                if (i < world.paperConfig.bambooMaxHeight) { // Paper
 | 
			
		||||
                     this.growBamboo(state, world, pos, random, i);
 | 
			
		||||
                 }
 | 
			
		||||
             }
 | 
			
		||||
@@ -0,0 +0,0 @@ public class BambooBlock extends Block implements BonemealableBlock {
 | 
			
		||||
         int i = this.getHeightAboveUpToMax(world, pos);
 | 
			
		||||
         int j = this.getHeightBelowUpToMax(world, pos);
 | 
			
		||||
 
 | 
			
		||||
-        return i + j + 1 < 16 && (Integer) world.getBlockState(pos.above(i)).getValue(BambooBlock.STAGE) != 1;
 | 
			
		||||
+        return i + j + 1 < ((Level) world).paperConfig.bambooMaxHeight && (Integer) world.getBlockState(pos.above(i)).getValue(BambooBlock.STAGE) != 1; // Paper
 | 
			
		||||
     }
 | 
			
		||||
 
 | 
			
		||||
     @Override
 | 
			
		||||
@@ -0,0 +0,0 @@ public class BambooBlock extends Block implements BonemealableBlock {
 | 
			
		||||
             BlockPos blockposition1 = pos.above(i);
 | 
			
		||||
             BlockState iblockdata1 = world.getBlockState(blockposition1);
 | 
			
		||||
 
 | 
			
		||||
-            if (k >= 16 || !iblockdata1.is(Blocks.BAMBOO) || (Integer) iblockdata1.getValue(BambooBlock.STAGE) == 1 || !world.isEmptyBlock(blockposition1.above())) { // CraftBukkit - If the BlockSpreadEvent was cancelled, we have no bamboo here
 | 
			
		||||
+            if (k >= world.paperConfig.bambooMaxHeight || !iblockdata1.is(Blocks.BAMBOO) || (Integer) iblockdata1.getValue(BambooBlock.STAGE) == 1 || !world.isEmptyBlock(blockposition1.above())) { // CraftBukkit - If the BlockSpreadEvent was cancelled, we have no bamboo here // Paper - Configurable cactus bamboo and reed growth heights
 | 
			
		||||
                 return;
 | 
			
		||||
             }
 | 
			
		||||
 
 | 
			
		||||
@@ -0,0 +0,0 @@ public class BambooBlock extends Block implements BonemealableBlock {
 | 
			
		||||
         }
 | 
			
		||||
 
 | 
			
		||||
         int j = (Integer) state.getValue(BambooBlock.AGE) != 1 && !iblockdata2.is(Blocks.BAMBOO) ? 0 : 1;
 | 
			
		||||
-        int k = (height < 11 || random.nextFloat() >= 0.25F) && height != 15 ? 0 : 1;
 | 
			
		||||
+        int k = (height < world.paperConfig.bambooMinHeight || random.nextFloat() >= 0.25F) && height != (world.paperConfig.bambooMaxHeight - 1) ? 0 : 1; // Paper
 | 
			
		||||
 
 | 
			
		||||
         // CraftBukkit start
 | 
			
		||||
         if (org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockSpreadEvent(world, pos, pos.above(), (BlockState) ((BlockState) ((BlockState) this.defaultBlockState().setValue(BambooBlock.AGE, j)).setValue(BambooBlock.LEAVES, blockpropertybamboosize)).setValue(BambooBlock.STAGE, k), 3)) {
 | 
			
		||||
@@ -0,0 +0,0 @@ public class BambooBlock extends Block implements BonemealableBlock {
 | 
			
		||||
     protected int getHeightAboveUpToMax(BlockGetter world, BlockPos pos) {
 | 
			
		||||
         int i;
 | 
			
		||||
 
 | 
			
		||||
-        for (i = 0; i < 16 && world.getBlockState(pos.above(i + 1)).is(Blocks.BAMBOO); ++i) {
 | 
			
		||||
+        for (i = 0; i < ((Level) world).paperConfig.bambooMaxHeight && world.getBlockState(pos.above(i + 1)).is(Blocks.BAMBOO); ++i) { // Paper
 | 
			
		||||
             ;
 | 
			
		||||
         }
 | 
			
		||||
 
 | 
			
		||||
@@ -0,0 +0,0 @@ public class BambooBlock extends Block implements BonemealableBlock {
 | 
			
		||||
     protected int getHeightBelowUpToMax(BlockGetter world, BlockPos pos) {
 | 
			
		||||
         int i;
 | 
			
		||||
 
 | 
			
		||||
-        for (i = 0; i < 16 && world.getBlockState(pos.below(i + 1)).is(Blocks.BAMBOO); ++i) {
 | 
			
		||||
+        for (i = 0; i < ((Level) world).paperConfig.bambooMaxHeight && world.getBlockState(pos.below(i + 1)).is(Blocks.BAMBOO); ++i) { // Paper
 | 
			
		||||
             ;
 | 
			
		||||
         }
 | 
			
		||||
 
 | 
			
		||||
diff --git a/src/main/java/net/minecraft/world/level/block/CactusBlock.java b/src/main/java/net/minecraft/world/level/block/CactusBlock.java
 | 
			
		||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
 | 
			
		||||
--- a/src/main/java/net/minecraft/world/level/block/CactusBlock.java
 | 
			
		||||
+++ b/src/main/java/net/minecraft/world/level/block/CactusBlock.java
 | 
			
		||||
@@ -0,0 +0,0 @@ public class CactusBlock extends Block {
 | 
			
		||||
                 ;
 | 
			
		||||
             }
 | 
			
		||||
 
 | 
			
		||||
-            if (i < 3) {
 | 
			
		||||
+            if (i < world.paperConfig.cactusMaxHeight) { // Paper - Configurable growth height
 | 
			
		||||
                 int j = (Integer) state.getValue(CactusBlock.AGE);
 | 
			
		||||
 
 | 
			
		||||
                 if (j >= (byte) range(3, ((100.0F / world.spigotConfig.cactusModifier) * 15) + 0.5F, 15)) { // Spigot
 | 
			
		||||
diff --git a/src/main/java/net/minecraft/world/level/block/SugarCaneBlock.java b/src/main/java/net/minecraft/world/level/block/SugarCaneBlock.java
 | 
			
		||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
 | 
			
		||||
--- a/src/main/java/net/minecraft/world/level/block/SugarCaneBlock.java
 | 
			
		||||
+++ b/src/main/java/net/minecraft/world/level/block/SugarCaneBlock.java
 | 
			
		||||
@@ -0,0 +0,0 @@ public class SugarCaneBlock extends Block {
 | 
			
		||||
                 ;
 | 
			
		||||
             }
 | 
			
		||||
 
 | 
			
		||||
-            if (i < 3) {
 | 
			
		||||
+                if (i < world.paperConfig.reedMaxHeight) { // Paper - Configurable growth height
 | 
			
		||||
                 int j = (Integer) state.getValue(SugarCaneBlock.AGE);
 | 
			
		||||
 
 | 
			
		||||
                 if (j >= (byte) range(3, ((100.0F / world.spigotConfig.caneModifier) * 15) + 0.5F, 15)) { // Spigot
 | 
			
		||||
							
								
								
									
										38
									
								
								patches/server/Configurable-fishing-time-ranges.patch
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										38
									
								
								patches/server/Configurable-fishing-time-ranges.patch
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,38 @@
 | 
			
		|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
 | 
			
		||||
From: Zach Brown <1254957+zachbr@users.noreply.github.com>
 | 
			
		||||
Date: Tue, 1 Mar 2016 13:14:11 -0600
 | 
			
		||||
Subject: [PATCH] Configurable fishing time ranges
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
 | 
			
		||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
 | 
			
		||||
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
 | 
			
		||||
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
 | 
			
		||||
@@ -0,0 +0,0 @@ public class PaperWorldConfig {
 | 
			
		||||
 
 | 
			
		||||
         log("Baby zombies will move at the speed of " + babyZombieMovementModifier);
 | 
			
		||||
     }
 | 
			
		||||
+
 | 
			
		||||
+    public int fishingMinTicks;
 | 
			
		||||
+    public int fishingMaxTicks;
 | 
			
		||||
+    private void fishingTickRange() {
 | 
			
		||||
+        fishingMinTicks = getInt("fishing-time-range.MinimumTicks", 100);
 | 
			
		||||
+        fishingMaxTicks = getInt("fishing-time-range.MaximumTicks", 600);
 | 
			
		||||
+        log("Fishing time ranges are between " + fishingMinTicks +" and " + fishingMaxTicks + " ticks");
 | 
			
		||||
+    }
 | 
			
		||||
 }
 | 
			
		||||
diff --git a/src/main/java/net/minecraft/world/entity/projectile/FishingHook.java b/src/main/java/net/minecraft/world/entity/projectile/FishingHook.java
 | 
			
		||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
 | 
			
		||||
--- a/src/main/java/net/minecraft/world/entity/projectile/FishingHook.java
 | 
			
		||||
+++ b/src/main/java/net/minecraft/world/entity/projectile/FishingHook.java
 | 
			
		||||
@@ -0,0 +0,0 @@ public class FishingHook extends Projectile {
 | 
			
		||||
         this.noCulling = true;
 | 
			
		||||
         this.luck = Math.max(0, lureLevel);
 | 
			
		||||
         this.lureSpeed = Math.max(0, luckOfTheSeaLevel);
 | 
			
		||||
+        // Paper start
 | 
			
		||||
+        minWaitTime = world.paperConfig.fishingMinTicks;
 | 
			
		||||
+        maxWaitTime = world.paperConfig.fishingMaxTicks;
 | 
			
		||||
+        // Paper end
 | 
			
		||||
     }
 | 
			
		||||
 
 | 
			
		||||
     public FishingHook(EntityType<? extends FishingHook> type, Level world) {
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,82 @@
 | 
			
		|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
 | 
			
		||||
From: Byteflux <byte@byteflux.net>
 | 
			
		||||
Date: Tue, 1 Mar 2016 14:14:15 -0600
 | 
			
		||||
Subject: [PATCH] Drop falling block and tnt entities at the specified height
 | 
			
		||||
 | 
			
		||||
* Dec 2, 2020 Added tnt nerf for tnt minecarts - Machine_Maker
 | 
			
		||||
 | 
			
		||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
 | 
			
		||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
 | 
			
		||||
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
 | 
			
		||||
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
 | 
			
		||||
@@ -0,0 +0,0 @@ public class PaperWorldConfig {
 | 
			
		||||
         keepSpawnInMemory = getBoolean("keep-spawn-loaded", true);
 | 
			
		||||
         log("Keep spawn chunk loaded: " + keepSpawnInMemory);
 | 
			
		||||
     }
 | 
			
		||||
+
 | 
			
		||||
+    public int fallingBlockHeightNerf;
 | 
			
		||||
+    public int entityTNTHeightNerf;
 | 
			
		||||
+    private void heightNerfs() {
 | 
			
		||||
+        fallingBlockHeightNerf = getInt("falling-block-height-nerf", 0);
 | 
			
		||||
+        entityTNTHeightNerf = getInt("tnt-entity-height-nerf", 0);
 | 
			
		||||
+
 | 
			
		||||
+        if (fallingBlockHeightNerf != 0) log("Falling Block Height Limit set to Y: " + fallingBlockHeightNerf);
 | 
			
		||||
+        if (entityTNTHeightNerf != 0) log("TNT Entity Height Limit set to Y: " + entityTNTHeightNerf);
 | 
			
		||||
+    }
 | 
			
		||||
 }
 | 
			
		||||
diff --git a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
 | 
			
		||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
 | 
			
		||||
--- a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
 | 
			
		||||
+++ b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
 | 
			
		||||
@@ -0,0 +0,0 @@ public class FallingBlockEntity extends Entity {
 | 
			
		||||
             }
 | 
			
		||||
 
 | 
			
		||||
             this.move(MoverType.SELF, this.getDeltaMovement());
 | 
			
		||||
+
 | 
			
		||||
+            // Paper start - Configurable EntityFallingBlock height nerf
 | 
			
		||||
+            if (this.level.paperConfig.fallingBlockHeightNerf != 0 && this.getY() > this.level.paperConfig.fallingBlockHeightNerf) {
 | 
			
		||||
+                if (this.dropItem && this.level.getGameRules().getBoolean(GameRules.RULE_DOENTITYDROPS)) {
 | 
			
		||||
+                    this.spawnAtLocation(block);
 | 
			
		||||
+                }
 | 
			
		||||
+
 | 
			
		||||
+                this.discard();
 | 
			
		||||
+                return;
 | 
			
		||||
+            }
 | 
			
		||||
+            // Paper end
 | 
			
		||||
             if (!this.level.isClientSide) {
 | 
			
		||||
                 blockposition = this.blockPosition();
 | 
			
		||||
                 boolean flag = this.blockState.getBlock() instanceof ConcretePowderBlock;
 | 
			
		||||
diff --git a/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java b/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
 | 
			
		||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
 | 
			
		||||
--- a/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
 | 
			
		||||
+++ b/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
 | 
			
		||||
@@ -0,0 +0,0 @@ public class PrimedTnt extends Entity {
 | 
			
		||||
         }
 | 
			
		||||
 
 | 
			
		||||
         this.move(MoverType.SELF, this.getDeltaMovement());
 | 
			
		||||
+        // Paper start - Configurable TNT entity height nerf
 | 
			
		||||
+        if (this.level.paperConfig.entityTNTHeightNerf != 0 && this.getY() > this.level.paperConfig.entityTNTHeightNerf) {
 | 
			
		||||
+            this.discard();
 | 
			
		||||
+            return;
 | 
			
		||||
+        }
 | 
			
		||||
+        // Paper end
 | 
			
		||||
         this.setDeltaMovement(this.getDeltaMovement().scale(0.98D));
 | 
			
		||||
         if (this.onGround) {
 | 
			
		||||
             this.setDeltaMovement(this.getDeltaMovement().multiply(0.7D, -0.5D, 0.7D));
 | 
			
		||||
diff --git a/src/main/java/net/minecraft/world/entity/vehicle/MinecartTNT.java b/src/main/java/net/minecraft/world/entity/vehicle/MinecartTNT.java
 | 
			
		||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
 | 
			
		||||
--- a/src/main/java/net/minecraft/world/entity/vehicle/MinecartTNT.java
 | 
			
		||||
+++ b/src/main/java/net/minecraft/world/entity/vehicle/MinecartTNT.java
 | 
			
		||||
@@ -0,0 +0,0 @@ public class MinecartTNT extends AbstractMinecart {
 | 
			
		||||
     public void tick() {
 | 
			
		||||
         super.tick();
 | 
			
		||||
         if (this.fuse > 0) {
 | 
			
		||||
+            // Paper start - Configurable TNT entity height nerf
 | 
			
		||||
+            if (this.level.paperConfig.entityTNTHeightNerf != 0 && this.getY() > this.level.paperConfig.entityTNTHeightNerf) {
 | 
			
		||||
+                this.discard();
 | 
			
		||||
+                return;
 | 
			
		||||
+            }
 | 
			
		||||
+            // Paper end
 | 
			
		||||
             --this.fuse;
 | 
			
		||||
             this.level.addParticle(ParticleTypes.SMOKE, this.getX(), this.getY() + 0.5D, this.getZ(), 0.0D, 0.0D, 0.0D);
 | 
			
		||||
         } else if (this.fuse == 0) {
 | 
			
		||||
							
								
								
									
										157
									
								
								patches/server/Implement-Paper-VersionChecker.patch
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										157
									
								
								patches/server/Implement-Paper-VersionChecker.patch
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,157 @@
 | 
			
		|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
 | 
			
		||||
From: Zach Brown <1254957+zachbr@users.noreply.github.com>
 | 
			
		||||
Date: Mon, 27 May 2019 03:40:05 -0500
 | 
			
		||||
Subject: [PATCH] Implement Paper VersionChecker
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java b/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java
 | 
			
		||||
new file mode 100644
 | 
			
		||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
 | 
			
		||||
--- /dev/null
 | 
			
		||||
+++ b/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java
 | 
			
		||||
@@ -0,0 +0,0 @@
 | 
			
		||||
+package com.destroystokyo.paper;
 | 
			
		||||
+
 | 
			
		||||
+import com.destroystokyo.paper.util.VersionFetcher;
 | 
			
		||||
+import com.google.common.base.Charsets;
 | 
			
		||||
+import com.google.common.io.Resources;
 | 
			
		||||
+import com.google.gson.*;
 | 
			
		||||
+import net.kyori.adventure.text.Component;
 | 
			
		||||
+import net.kyori.adventure.text.event.ClickEvent;
 | 
			
		||||
+import net.kyori.adventure.text.format.NamedTextColor;
 | 
			
		||||
+
 | 
			
		||||
+import javax.annotation.Nonnull;
 | 
			
		||||
+import javax.annotation.Nullable;
 | 
			
		||||
+import java.io.*;
 | 
			
		||||
+import java.net.HttpURLConnection;
 | 
			
		||||
+import java.net.URL;
 | 
			
		||||
+import java.util.stream.StreamSupport;
 | 
			
		||||
+
 | 
			
		||||
+public class PaperVersionFetcher implements VersionFetcher {
 | 
			
		||||
+    private static final java.util.regex.Pattern VER_PATTERN = java.util.regex.Pattern.compile("^([0-9\\.]*)\\-.*R"); // R is an anchor, will always give '-R' at end
 | 
			
		||||
+    private static final String GITHUB_BRANCH_NAME = "master";
 | 
			
		||||
+    private static final String DOWNLOAD_PAGE = "https://papermc.io/downloads";
 | 
			
		||||
+    private static @Nullable String mcVer;
 | 
			
		||||
+
 | 
			
		||||
+    @Override
 | 
			
		||||
+    public long getCacheTime() {
 | 
			
		||||
+        return 720000;
 | 
			
		||||
+    }
 | 
			
		||||
+
 | 
			
		||||
+    @Nonnull
 | 
			
		||||
+    @Override
 | 
			
		||||
+    public Component getVersionMessage(@Nonnull String serverVersion) {
 | 
			
		||||
+        String[] parts = serverVersion.substring("git-Paper-".length()).split("[-\\s]");
 | 
			
		||||
+        return getUpdateStatusMessage("PaperMC/Paper", GITHUB_BRANCH_NAME, parts[0]);
 | 
			
		||||
+    }
 | 
			
		||||
+
 | 
			
		||||
+    private static @Nullable String getMinecraftVersion() {
 | 
			
		||||
+        if (mcVer == null) {
 | 
			
		||||
+            java.util.regex.Matcher matcher = VER_PATTERN.matcher(org.bukkit.Bukkit.getBukkitVersion());
 | 
			
		||||
+            if (matcher.find()) {
 | 
			
		||||
+                String result = matcher.group();
 | 
			
		||||
+                mcVer = result.substring(0, result.length() - 2); // strip 'R' anchor and trailing '-'
 | 
			
		||||
+            } else {
 | 
			
		||||
+                org.bukkit.Bukkit.getLogger().warning("Unable to match version to pattern! Report to PaperMC!");
 | 
			
		||||
+                org.bukkit.Bukkit.getLogger().warning("Pattern: " + VER_PATTERN.toString());
 | 
			
		||||
+                org.bukkit.Bukkit.getLogger().warning("Version: " + org.bukkit.Bukkit.getBukkitVersion());
 | 
			
		||||
+            }
 | 
			
		||||
+        }
 | 
			
		||||
+
 | 
			
		||||
+        return mcVer;
 | 
			
		||||
+    }
 | 
			
		||||
+
 | 
			
		||||
+    private static Component getUpdateStatusMessage(@Nonnull String repo, @Nonnull String branch, @Nonnull String versionInfo) {
 | 
			
		||||
+        int distance;
 | 
			
		||||
+        try {
 | 
			
		||||
+            int jenkinsBuild = Integer.parseInt(versionInfo);
 | 
			
		||||
+            distance = fetchDistanceFromSiteApi(jenkinsBuild, getMinecraftVersion());
 | 
			
		||||
+        } catch (NumberFormatException ignored) {
 | 
			
		||||
+            versionInfo = versionInfo.replace("\"", "");
 | 
			
		||||
+            distance = fetchDistanceFromGitHub(repo, branch, versionInfo);
 | 
			
		||||
+        }
 | 
			
		||||
+
 | 
			
		||||
+        switch (distance) {
 | 
			
		||||
+            case -1:
 | 
			
		||||
+                return Component.text("Error obtaining version information", NamedTextColor.YELLOW);
 | 
			
		||||
+            case 0:
 | 
			
		||||
+                return Component.text("You are running the latest version", NamedTextColor.GREEN);
 | 
			
		||||
+            case -2:
 | 
			
		||||
+                return Component.text("Unknown version", NamedTextColor.YELLOW);
 | 
			
		||||
+            default:
 | 
			
		||||
+                return Component.text("You are " + distance + " version(s) behind", NamedTextColor.YELLOW)
 | 
			
		||||
+                        .append(Component.newline())
 | 
			
		||||
+                        .append(Component.text("Download the new version at: ")
 | 
			
		||||
+                                .append(Component.text(DOWNLOAD_PAGE, NamedTextColor.GOLD)
 | 
			
		||||
+                                        .hoverEvent(Component.text("Click to open", NamedTextColor.WHITE))
 | 
			
		||||
+                                        .clickEvent(ClickEvent.openUrl(DOWNLOAD_PAGE))));
 | 
			
		||||
+        }
 | 
			
		||||
+    }
 | 
			
		||||
+
 | 
			
		||||
+    private static int fetchDistanceFromSiteApi(int jenkinsBuild, @Nullable String siteApiVersion) {
 | 
			
		||||
+        if (siteApiVersion == null) { return -1; }
 | 
			
		||||
+        try {
 | 
			
		||||
+            try (BufferedReader reader = Resources.asCharSource(
 | 
			
		||||
+                new URL("https://papermc.io/api/v2/projects/paper/versions/" + siteApiVersion),
 | 
			
		||||
+                Charsets.UTF_8
 | 
			
		||||
+            ).openBufferedStream()) {
 | 
			
		||||
+                JsonObject json = new Gson().fromJson(reader, JsonObject.class);
 | 
			
		||||
+                JsonArray builds = json.getAsJsonArray("builds");
 | 
			
		||||
+                int latest = StreamSupport.stream(builds.spliterator(), false)
 | 
			
		||||
+                    .mapToInt(e -> e.getAsInt())
 | 
			
		||||
+                    .max()
 | 
			
		||||
+                    .getAsInt();
 | 
			
		||||
+                return latest - jenkinsBuild;
 | 
			
		||||
+            } catch (JsonSyntaxException ex) {
 | 
			
		||||
+                ex.printStackTrace();
 | 
			
		||||
+                return -1;
 | 
			
		||||
+            }
 | 
			
		||||
+        } catch (IOException e) {
 | 
			
		||||
+            e.printStackTrace();
 | 
			
		||||
+            return -1;
 | 
			
		||||
+        }
 | 
			
		||||
+    }
 | 
			
		||||
+
 | 
			
		||||
+    // Contributed by Techcable <Techcable@outlook.com> in GH-65
 | 
			
		||||
+    private static int fetchDistanceFromGitHub(@Nonnull String repo, @Nonnull String branch, @Nonnull String hash) {
 | 
			
		||||
+        try {
 | 
			
		||||
+            HttpURLConnection connection = (HttpURLConnection) new URL("https://api.github.com/repos/" + repo + "/compare/" + branch + "..." + hash).openConnection();
 | 
			
		||||
+            connection.connect();
 | 
			
		||||
+            if (connection.getResponseCode() == HttpURLConnection.HTTP_NOT_FOUND) return -2; // Unknown commit
 | 
			
		||||
+            try (BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream(), Charsets.UTF_8))) {
 | 
			
		||||
+                JsonObject obj = new Gson().fromJson(reader, JsonObject.class);
 | 
			
		||||
+                String status = obj.get("status").getAsString();
 | 
			
		||||
+                switch (status) {
 | 
			
		||||
+                    case "identical":
 | 
			
		||||
+                        return 0;
 | 
			
		||||
+                    case "behind":
 | 
			
		||||
+                        return obj.get("behind_by").getAsInt();
 | 
			
		||||
+                    default:
 | 
			
		||||
+                        return -1;
 | 
			
		||||
+                }
 | 
			
		||||
+            } catch (JsonSyntaxException | NumberFormatException e) {
 | 
			
		||||
+                e.printStackTrace();
 | 
			
		||||
+                return -1;
 | 
			
		||||
+            }
 | 
			
		||||
+        } catch (IOException e) {
 | 
			
		||||
+            e.printStackTrace();
 | 
			
		||||
+            return -1;
 | 
			
		||||
+        }
 | 
			
		||||
+    }
 | 
			
		||||
+}
 | 
			
		||||
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
 | 
			
		||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
 | 
			
		||||
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
 | 
			
		||||
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
 | 
			
		||||
@@ -0,0 +0,0 @@ public final class CraftMagicNumbers implements UnsafeValues {
 | 
			
		||||
     public String getTimingsServerName() {
 | 
			
		||||
         return com.destroystokyo.paper.PaperConfig.timingsServerName;
 | 
			
		||||
     }
 | 
			
		||||
+
 | 
			
		||||
+    @Override
 | 
			
		||||
+    public com.destroystokyo.paper.util.VersionFetcher getVersionFetcher() {
 | 
			
		||||
+        return new com.destroystokyo.paper.PaperVersionFetcher();
 | 
			
		||||
+    }
 | 
			
		||||
     // Paper end
 | 
			
		||||
 
 | 
			
		||||
     /**
 | 
			
		||||
| 
						 | 
				
			
			@ -733,16 +733,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
 | 
			
		|||
+import it.unimi.dsi.fastutil.longs.LongIterator;
 | 
			
		||||
+import it.unimi.dsi.fastutil.shorts.Short2LongOpenHashMap;
 | 
			
		||||
+import java.util.Arrays;
 | 
			
		||||
+import net.minecraft.world.level.block.Block;
 | 
			
		||||
+import net.minecraft.world.level.block.state.BlockState;
 | 
			
		||||
+import net.minecraft.world.level.chunk.GlobalPalette;
 | 
			
		||||
+import net.minecraft.world.level.chunk.LevelChunkSection;
 | 
			
		||||
+
 | 
			
		||||
+/**
 | 
			
		||||
+ * @author Spottedleaf
 | 
			
		||||
+ */
 | 
			
		||||
+public final class IBlockDataList {
 | 
			
		||||
+
 | 
			
		||||
+    static final GlobalPalette<BlockState> GLOBAL_PALETTE = (GlobalPalette) LevelChunkSection.GLOBAL_BLOCKSTATE_PALETTE;
 | 
			
		||||
+    static final GlobalPalette<BlockState> GLOBAL_PALETTE = new GlobalPalette<>(Block.BLOCK_STATE_REGISTRY);
 | 
			
		||||
+
 | 
			
		||||
+    // map of location -> (index | (location << 16) | (palette id << 32))
 | 
			
		||||
+    private final Short2LongOpenHashMap map = new Short2LongOpenHashMap(2, 0.8f);
 | 
			
		||||
| 
						 | 
				
			
			@ -5382,6 +5382,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
 | 
			
		|||
 import net.minecraft.world.level.storage.LevelData;
 | 
			
		||||
 import net.minecraft.world.level.storage.LevelStorageSource;
 | 
			
		||||
+import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap; // Paper
 | 
			
		||||
+import java.util.function.Function; // Paper
 | 
			
		||||
 
 | 
			
		||||
 public class ServerChunkCache extends ChunkSource {
 | 
			
		||||
+    public static final org.apache.logging.log4j.Logger LOGGER = org.apache.logging.log4j.LogManager.getLogger(); // Paper
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										143
									
								
								patches/server/Player-affects-spawning-API.patch
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										143
									
								
								patches/server/Player-affects-spawning-API.patch
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,143 @@
 | 
			
		|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
 | 
			
		||||
From: Jedediah Smith <jedediah@silencegreys.com>
 | 
			
		||||
Date: Tue, 1 Mar 2016 14:47:52 -0600
 | 
			
		||||
Subject: [PATCH] Player affects spawning API
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
diff --git a/src/main/java/net/minecraft/world/entity/EntitySelector.java b/src/main/java/net/minecraft/world/entity/EntitySelector.java
 | 
			
		||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
 | 
			
		||||
--- a/src/main/java/net/minecraft/world/entity/EntitySelector.java
 | 
			
		||||
+++ b/src/main/java/net/minecraft/world/entity/EntitySelector.java
 | 
			
		||||
@@ -0,0 +0,0 @@ public final class EntitySelector {
 | 
			
		||||
     public static final Predicate<Entity> CAN_BE_COLLIDED_WITH = EntitySelector.NO_SPECTATORS.and(Entity::canBeCollidedWith);
 | 
			
		||||
 
 | 
			
		||||
     private EntitySelector() {}
 | 
			
		||||
+    // Paper start
 | 
			
		||||
+    public static final Predicate<Entity> affectsSpawning = (entity) -> {
 | 
			
		||||
+        return !entity.isSpectator() && entity.isAlive() && (entity instanceof net.minecraft.server.level.ServerPlayer) && ((net.minecraft.server.level.ServerPlayer) entity).affectsSpawning;
 | 
			
		||||
+    };
 | 
			
		||||
+    // Paper end
 | 
			
		||||
 
 | 
			
		||||
     public static Predicate<Entity> withinDistance(double x, double y, double z, double max) {
 | 
			
		||||
         double d4 = max * max;
 | 
			
		||||
diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java
 | 
			
		||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
 | 
			
		||||
--- a/src/main/java/net/minecraft/world/entity/Mob.java
 | 
			
		||||
+++ b/src/main/java/net/minecraft/world/entity/Mob.java
 | 
			
		||||
@@ -0,0 +0,0 @@ public abstract class Mob extends LivingEntity {
 | 
			
		||||
         if (this.level.getDifficulty() == Difficulty.PEACEFUL && this.shouldDespawnInPeaceful()) {
 | 
			
		||||
             this.discard();
 | 
			
		||||
         } else if (!this.isPersistenceRequired() && !this.requiresCustomPersistence()) {
 | 
			
		||||
-            Player entityhuman = this.level.getNearestPlayer(this, -1.0D);
 | 
			
		||||
+            Player entityhuman = this.level.findNearbyPlayer(this, -1.0D, EntitySelector.affectsSpawning); // Paper
 | 
			
		||||
 
 | 
			
		||||
             if (entityhuman != null) {
 | 
			
		||||
                 double d0 = entityhuman.distanceToSqr((Entity) this);
 | 
			
		||||
diff --git a/src/main/java/net/minecraft/world/entity/monster/Silverfish.java b/src/main/java/net/minecraft/world/entity/monster/Silverfish.java
 | 
			
		||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
 | 
			
		||||
--- a/src/main/java/net/minecraft/world/entity/monster/Silverfish.java
 | 
			
		||||
+++ b/src/main/java/net/minecraft/world/entity/monster/Silverfish.java
 | 
			
		||||
@@ -0,0 +0,0 @@ public class Silverfish extends Monster {
 | 
			
		||||
         if (checkAnyLightMonsterSpawnRules(type, world, spawnReason, pos, random)) {
 | 
			
		||||
             Player entityhuman = world.getNearestPlayer((double) pos.getX() + 0.5D, (double) pos.getY() + 0.5D, (double) pos.getZ() + 0.5D, 5.0D, true);
 | 
			
		||||
 
 | 
			
		||||
-            return entityhuman == null;
 | 
			
		||||
+            return !(entityhuman != null && !entityhuman.affectsSpawning) && entityhuman == null; // Paper - Affects Spawning API
 | 
			
		||||
         } else {
 | 
			
		||||
             return false;
 | 
			
		||||
         }
 | 
			
		||||
diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java
 | 
			
		||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
 | 
			
		||||
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
 | 
			
		||||
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
 | 
			
		||||
@@ -0,0 +0,0 @@ public abstract class Player extends LivingEntity {
 | 
			
		||||
     private final ItemCooldowns cooldowns;
 | 
			
		||||
     @Nullable
 | 
			
		||||
     public FishingHook fishing;
 | 
			
		||||
+    // Paper start
 | 
			
		||||
+    public boolean affectsSpawning = true;
 | 
			
		||||
+    // Paper end
 | 
			
		||||
 
 | 
			
		||||
     // CraftBukkit start
 | 
			
		||||
     public boolean fauxSleeping;
 | 
			
		||||
diff --git a/src/main/java/net/minecraft/world/level/BaseSpawner.java b/src/main/java/net/minecraft/world/level/BaseSpawner.java
 | 
			
		||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
 | 
			
		||||
--- a/src/main/java/net/minecraft/world/level/BaseSpawner.java
 | 
			
		||||
+++ b/src/main/java/net/minecraft/world/level/BaseSpawner.java
 | 
			
		||||
@@ -0,0 +0,0 @@ public abstract class BaseSpawner {
 | 
			
		||||
     }
 | 
			
		||||
 
 | 
			
		||||
     private boolean isNearPlayer(Level world, BlockPos pos) {
 | 
			
		||||
-        return world.hasNearbyAlivePlayer((double) pos.getX() + 0.5D, (double) pos.getY() + 0.5D, (double) pos.getZ() + 0.5D, (double) this.requiredPlayerRange);
 | 
			
		||||
+        return world.isAffectsSpawningPlayerNearby((double) pos.getX() + 0.5D, (double) pos.getY() + 0.5D, (double) pos.getZ() + 0.5D, (double) this.requiredPlayerRange); // Paper
 | 
			
		||||
     }
 | 
			
		||||
 
 | 
			
		||||
     public void clientTick(Level world, BlockPos pos) {
 | 
			
		||||
diff --git a/src/main/java/net/minecraft/world/level/EntityGetter.java b/src/main/java/net/minecraft/world/level/EntityGetter.java
 | 
			
		||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
 | 
			
		||||
--- a/src/main/java/net/minecraft/world/level/EntityGetter.java
 | 
			
		||||
+++ b/src/main/java/net/minecraft/world/level/EntityGetter.java
 | 
			
		||||
@@ -0,0 +0,0 @@ public interface EntityGetter {
 | 
			
		||||
         }
 | 
			
		||||
     }
 | 
			
		||||
 
 | 
			
		||||
-    @Nullable
 | 
			
		||||
-    default Player getNearestPlayer(double x, double y, double z, double maxDistance, @Nullable Predicate<Entity> targetPredicate) {
 | 
			
		||||
+    default Player findNearbyPlayer(Entity entity, double d0, @Nullable Predicate<Entity> predicate) { return this.getNearestPlayer(entity.getX(), entity.getY(), entity.getZ(), d0, predicate); } // Paper
 | 
			
		||||
+    @Nullable default Player getNearestPlayer(double x, double y, double z, double maxDistance, @Nullable Predicate<Entity> targetPredicate) { // Paper
 | 
			
		||||
         double d = -1.0D;
 | 
			
		||||
         Player player = null;
 | 
			
		||||
 
 | 
			
		||||
@@ -0,0 +0,0 @@ public interface EntityGetter {
 | 
			
		||||
         return this.getNearestPlayer(x, y, z, maxDistance, predicate);
 | 
			
		||||
     }
 | 
			
		||||
 
 | 
			
		||||
+    // Paper end
 | 
			
		||||
+    default boolean isAffectsSpawningPlayerNearby(double d0, double d1, double d2, double d3) {
 | 
			
		||||
+        java.util.Iterator iterator = this.players().iterator();
 | 
			
		||||
+        double d4;
 | 
			
		||||
+        do {
 | 
			
		||||
+            Player entityhuman;
 | 
			
		||||
+            do {
 | 
			
		||||
+                if (!iterator.hasNext()) {
 | 
			
		||||
+                    return false;
 | 
			
		||||
+                }
 | 
			
		||||
+
 | 
			
		||||
+                entityhuman = (Player) iterator.next();
 | 
			
		||||
+            } while (!EntitySelector.affectsSpawning.test(entityhuman));
 | 
			
		||||
+
 | 
			
		||||
+            d4 = entityhuman.distanceToSqr(d0, d1, d2);
 | 
			
		||||
+        } while (d3 >= 0.0D && d4 >= d3 * d3);
 | 
			
		||||
+
 | 
			
		||||
+        return true;
 | 
			
		||||
+    }
 | 
			
		||||
+    // Paper end
 | 
			
		||||
+
 | 
			
		||||
     default boolean hasNearbyAlivePlayer(double x, double y, double z, double range) {
 | 
			
		||||
         for(Player player : this.players()) {
 | 
			
		||||
             if (EntitySelector.NO_SPECTATORS.test(player) && EntitySelector.LIVING_ENTITY_STILL_ALIVE.test(player)) {
 | 
			
		||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
 | 
			
		||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
 | 
			
		||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
 | 
			
		||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
 | 
			
		||||
@@ -0,0 +0,0 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
 | 
			
		||||
     @Override
 | 
			
		||||
     public String getLocale() {
 | 
			
		||||
         return this.getHandle().locale;
 | 
			
		||||
+
 | 
			
		||||
+    }
 | 
			
		||||
+
 | 
			
		||||
+    // Paper start
 | 
			
		||||
+    public void setAffectsSpawning(boolean affects) {
 | 
			
		||||
+        this.getHandle().affectsSpawning = affects;
 | 
			
		||||
     }
 | 
			
		||||
 
 | 
			
		||||
+    @Override
 | 
			
		||||
+    public boolean getAffectsSpawning() {
 | 
			
		||||
+        return this.getHandle().affectsSpawning;
 | 
			
		||||
+    }
 | 
			
		||||
+    // Paper end
 | 
			
		||||
+
 | 
			
		||||
     @Override
 | 
			
		||||
     public void updateCommands() {
 | 
			
		||||
         if (this.getHandle().connection == null) return;
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,22 @@
 | 
			
		|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
 | 
			
		||||
From: Byteflux <byte@byteflux.net>
 | 
			
		||||
Date: Tue, 1 Mar 2016 15:08:03 -0600
 | 
			
		||||
Subject: [PATCH] Remove invalid mob spawner tile entities
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
 | 
			
		||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
 | 
			
		||||
--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
 | 
			
		||||
+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
 | 
			
		||||
@@ -0,0 +0,0 @@ public class LevelChunk extends ChunkAccess {
 | 
			
		||||
             }
 | 
			
		||||
 
 | 
			
		||||
             // CraftBukkit start
 | 
			
		||||
+            // Paper start - Remove invalid mob spawner tile entities
 | 
			
		||||
+        } else if (blockEntity instanceof net.minecraft.world.level.block.entity.SpawnerBlockEntity
 | 
			
		||||
+            && !(getBlockState(blockposition).getBlock() instanceof net.minecraft.world.level.block.SpawnerBlock)) {
 | 
			
		||||
+            this.removeBlockEntity(blockEntity.getBlockPos());
 | 
			
		||||
+            // Paper end
 | 
			
		||||
         } else {
 | 
			
		||||
             System.out.println("Attempted to place a tile entity (" + blockEntity + ") at " + blockEntity.getBlockPos().getX() + "," + blockEntity.getBlockPos().getY() + "," + blockEntity.getBlockPos().getZ()
 | 
			
		||||
                 + " (" + this.getBlockState(blockposition) + ") where there was no entity tile!");
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,117 @@
 | 
			
		|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
 | 
			
		||||
From: Zach Brown <1254957+zachbr@users.noreply.github.com>
 | 
			
		||||
Date: Tue, 1 Mar 2016 14:32:43 -0600
 | 
			
		||||
Subject: [PATCH] Show 'Paper' in client crashes, server lists, and Mojang
 | 
			
		||||
 stats
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
diff --git a/src/main/java/net/minecraft/server/Eula.java b/src/main/java/net/minecraft/server/Eula.java
 | 
			
		||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
 | 
			
		||||
--- a/src/main/java/net/minecraft/server/Eula.java
 | 
			
		||||
+++ b/src/main/java/net/minecraft/server/Eula.java
 | 
			
		||||
@@ -0,0 +0,0 @@ public class Eula {
 | 
			
		||||
                 try {
 | 
			
		||||
                     Properties properties = new Properties();
 | 
			
		||||
                     properties.setProperty("eula", "false");
 | 
			
		||||
-                    properties.store(outputStream, "By changing the setting below to TRUE you are indicating your agreement to our EULA (https://account.mojang.com/documents/minecraft_eula).");
 | 
			
		||||
+                    properties.store(outputStream, "By changing the setting below to TRUE you are indicating your agreement to our EULA (https://account.mojang.com/documents/minecraft_eula).\nYou also agree that tacos are tasty, and the best food in the world.");  // Paper - fix lag;
 | 
			
		||||
                 } catch (Throwable var5) {
 | 
			
		||||
                     if (outputStream != null) {
 | 
			
		||||
                         try {
 | 
			
		||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
 | 
			
		||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
 | 
			
		||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
 | 
			
		||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
 | 
			
		||||
@@ -0,0 +0,0 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
 | 
			
		||||
 
 | 
			
		||||
     @DontObfuscate
 | 
			
		||||
     public String getServerModName() {
 | 
			
		||||
-        return "Spigot"; // Spigot - Spigot > // CraftBukkit - cb > vanilla!
 | 
			
		||||
+        return "Paper"; // Paper - Paper > // Spigot - Spigot > // CraftBukkit - cb > vanilla!
 | 
			
		||||
     }
 | 
			
		||||
 
 | 
			
		||||
     public SystemReport fillSystemReport(SystemReport details) {
 | 
			
		||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
 | 
			
		||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
 | 
			
		||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
 | 
			
		||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
 | 
			
		||||
@@ -0,0 +0,0 @@ import org.yaml.snakeyaml.error.MarkedYAMLException;
 | 
			
		||||
 import net.md_5.bungee.api.chat.BaseComponent; // Spigot
 | 
			
		||||
 
 | 
			
		||||
 public final class CraftServer implements Server {
 | 
			
		||||
-    private final String serverName = "CraftBukkit";
 | 
			
		||||
+    private final String serverName = "Paper"; // Paper
 | 
			
		||||
     private final String serverVersion;
 | 
			
		||||
     private final String bukkitVersion = Versioning.getBukkitVersion();
 | 
			
		||||
     private final Logger logger = Logger.getLogger("Minecraft");
 | 
			
		||||
diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java
 | 
			
		||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
 | 
			
		||||
--- a/src/main/java/org/bukkit/craftbukkit/Main.java
 | 
			
		||||
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java
 | 
			
		||||
@@ -0,0 +0,0 @@ public class Main {
 | 
			
		||||
                     deadline.add(Calendar.DAY_OF_YEAR, -7);
 | 
			
		||||
                     if (buildDate.before(deadline.getTime())) {
 | 
			
		||||
                         System.err.println("*** Error, this build is outdated ***");
 | 
			
		||||
-                        System.err.println("*** Please download a new build as per instructions from https://www.spigotmc.org/go/outdated-spigot ***");
 | 
			
		||||
+                        System.err.println("*** Please download a new build as per instructions from https://papermc.io/downloads ***"); // Paper
 | 
			
		||||
                         System.err.println("*** Server will start in 20 seconds ***");
 | 
			
		||||
                         Thread.sleep(TimeUnit.SECONDS.toMillis(20));
 | 
			
		||||
                     }
 | 
			
		||||
                 }
 | 
			
		||||
 
 | 
			
		||||
+                // Paper start - Log Java and OS versioning to help with debugging plugin issues
 | 
			
		||||
+                java.lang.management.RuntimeMXBean runtimeMX = java.lang.management.ManagementFactory.getRuntimeMXBean();
 | 
			
		||||
+                java.lang.management.OperatingSystemMXBean osMX = java.lang.management.ManagementFactory.getOperatingSystemMXBean();
 | 
			
		||||
+                if (runtimeMX != null && osMX != null) {
 | 
			
		||||
+                    String javaInfo = "Java " + runtimeMX.getSpecVersion() + " (" + runtimeMX.getVmName() + " " + runtimeMX.getVmVersion() + ")";
 | 
			
		||||
+                    String osInfo = "Host: " + osMX.getName() + " " + osMX.getVersion() + " (" + osMX.getArch() + ")";
 | 
			
		||||
+
 | 
			
		||||
+                    System.out.println("System Info: " + javaInfo + " " + osInfo);
 | 
			
		||||
+                } else {
 | 
			
		||||
+                    System.out.println("Unable to read system info");
 | 
			
		||||
+                }
 | 
			
		||||
+                // Paper end
 | 
			
		||||
+
 | 
			
		||||
                 System.out.println("Loading libraries, please wait...");
 | 
			
		||||
                 net.minecraft.server.Main.main(options);
 | 
			
		||||
             } catch (Throwable t) {
 | 
			
		||||
diff --git a/src/main/java/org/spigotmc/WatchdogThread.java b/src/main/java/org/spigotmc/WatchdogThread.java
 | 
			
		||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
 | 
			
		||||
--- a/src/main/java/org/spigotmc/WatchdogThread.java
 | 
			
		||||
+++ b/src/main/java/org/spigotmc/WatchdogThread.java
 | 
			
		||||
@@ -0,0 +0,0 @@ public class WatchdogThread extends Thread
 | 
			
		||||
 
 | 
			
		||||
     private WatchdogThread(long timeoutTime, boolean restart)
 | 
			
		||||
     {
 | 
			
		||||
-        super( "Spigot Watchdog Thread" );
 | 
			
		||||
+        super( "Paper Watchdog Thread" );
 | 
			
		||||
         this.timeoutTime = timeoutTime;
 | 
			
		||||
         this.restart = restart;
 | 
			
		||||
     }
 | 
			
		||||
@@ -0,0 +0,0 @@ public class WatchdogThread extends Thread
 | 
			
		||||
             {
 | 
			
		||||
                 Logger log = Bukkit.getServer().getLogger();
 | 
			
		||||
                 log.log( Level.SEVERE, "------------------------------" );
 | 
			
		||||
-                log.log( Level.SEVERE, "The server has stopped responding! This is (probably) not a Spigot bug." );
 | 
			
		||||
+                log.log( Level.SEVERE, "The server has stopped responding! This is (probably) not a Paper bug." ); // Paper
 | 
			
		||||
                 log.log( Level.SEVERE, "If you see a plugin in the Server thread dump below, then please report it to that author" );
 | 
			
		||||
                 log.log( Level.SEVERE, "\t *Especially* if it looks like HTTP or MySQL operations are occurring" );
 | 
			
		||||
                 log.log( Level.SEVERE, "If you see a world save or edit, then it means you did far more than your server can handle at once" );
 | 
			
		||||
                 log.log( Level.SEVERE, "\t If this is the case, consider increasing timeout-time in spigot.yml but note that this will replace the crash with LARGE lag spikes" );
 | 
			
		||||
-                log.log( Level.SEVERE, "If you are unsure or still think this is a Spigot bug, please report to https://www.spigotmc.org/" );
 | 
			
		||||
+                log.log( Level.SEVERE, "If you are unsure or still think this is a Paper bug, please report this to https://github.com/PaperMC/Paper/issues" );
 | 
			
		||||
                 log.log( Level.SEVERE, "Be sure to include ALL relevant console errors and Minecraft crash reports" );
 | 
			
		||||
-                log.log( Level.SEVERE, "Spigot version: " + Bukkit.getServer().getVersion() );
 | 
			
		||||
+                log.log( Level.SEVERE, "Paper version: " + Bukkit.getServer().getVersion() );
 | 
			
		||||
                 //
 | 
			
		||||
                 if ( net.minecraft.world.level.Level.lastPhysicsProblem != null )
 | 
			
		||||
                 {
 | 
			
		||||
@@ -0,0 +0,0 @@ public class WatchdogThread extends Thread
 | 
			
		||||
                 }
 | 
			
		||||
                 //
 | 
			
		||||
                 log.log( Level.SEVERE, "------------------------------" );
 | 
			
		||||
-                log.log( Level.SEVERE, "Server thread dump (Look for plugins here before reporting to Spigot!):" );
 | 
			
		||||
+                log.log( Level.SEVERE, "Server thread dump (Look for plugins here before reporting to Paper!):" ); // Paper
 | 
			
		||||
                 WatchdogThread.dumpThread( ManagementFactory.getThreadMXBean().getThreadInfo( MinecraftServer.getServer().serverThread.getId(), Integer.MAX_VALUE ), log );
 | 
			
		||||
                 log.log( Level.SEVERE, "------------------------------" );
 | 
			
		||||
                 //
 | 
			
		||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue