Archiviert
13
0

Show off some WIP patches.

Dieser Commit ist enthalten in:
md_5 2013-06-20 17:52:17 +10:00
Ursprung 919070df83
Commit ccd447743e
3 geänderte Dateien mit 26 neuen und 113 gelöschten Zeilen

Datei anzeigen

@ -1,11 +1,11 @@
From 11e91bebc30bae349454231d0c0e120918de03aa Mon Sep 17 00:00:00 2001
From fe7535a22ad65e997e3bec6529f4a9ec49e51cfb Mon Sep 17 00:00:00 2001
From: md_5 <md_5@live.com.au>
Date: Tue, 11 Jun 2013 12:56:02 +1000
Subject: [PATCH] Better Chunk Tick Selection
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index e67f520..96190de 100644
index de052bd..bc692dd 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -66,13 +66,35 @@ public abstract class World implements IBlockAccess {
@ -45,24 +45,24 @@ index e67f520..96190de 100644
public BiomeBase getBiome(int i, int j) {
if (this.isLoaded(i, 0, j)) {
@@ -115,6 +137,11 @@ public abstract class World implements IBlockAccess {
@@ -117,6 +139,11 @@ public abstract class World implements IBlockAccess {
this.ticksPerAnimalSpawns = this.getServer().getTicksPerAnimalSpawns(); // CraftBukkit
this.ticksPerMonsterSpawns = this.getServer().getTicksPerMonsterSpawns(); // CraftBukkit
// CraftBukkit end
+ // Spigot start
+ this.chunkTickRadius = (byte) ( ( this.getServer().getViewDistance() < 7 ) ? this.getServer().getViewDistance() : 7 );
+ this.chunkTickList = new gnu.trove.map.hash.TLongShortHashMap( world.growthPerTick * 5, 0.7f, Long.MIN_VALUE, Short.MIN_VALUE );
+ this.chunkTickList = new gnu.trove.map.hash.TLongShortHashMap( spigotConfig.chunksPerTick * 5, 0.7f, Long.MIN_VALUE, Short.MIN_VALUE );
+ this.chunkTickList.setAutoCompactionFactor( 0 );
+ // Spigot end
this.O = this.random.nextInt(12000);
this.H = new int['\u8000'];
@@ -1954,24 +1981,44 @@ public abstract class World implements IBlockAccess {
@@ -1956,24 +1983,44 @@ public abstract class World implements IBlockAccess {
int j;
int k;
+ // Spigot start
+ int optimalChunks = this.getWorld().growthPerTick;
+ int optimalChunks = spigotConfig.chunksPerTick;
+ // Quick conditions to allow us to exist early
+ if ( optimalChunks <= 0 || players.isEmpty() )
+ {
@ -147,40 +147,22 @@ index 49360c1..6c3fcf1 100644
block.a(this, k2 + k, i3 + chunksection.getYPosition(), l2 + l, this.random);
}
}
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index e6fdbe5..a9b4e71 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -67,7 +67,10 @@ public class CraftWorld implements World {
private int chunkGCTickCount;
private static final Random rand = new Random();
-
+ // Spigot start
+ public int growthPerTick = 650;
+ // Spigot end
+
// Spigot start
public CraftWorld(WorldServer world, ChunkGenerator gen, Environment env) {
this( world, gen, env, "default" );
@@ -89,14 +92,17 @@ public class CraftWorld implements World {
// Load defaults first
boolean info = configuration.getBoolean( "world-settings.default.info", true );
+ growthPerTick = configuration.getInt( "world-settings.default.growth-chunks-per-tick", growthPerTick );
// Override defaults with world specific, if they exist
info = configuration.getBoolean( "world-settings." + name + ".info", info );
+ growthPerTick = configuration.getInt( "world-settings." + name + ".growth-chunks-per-tick", growthPerTick );
if ( info )
{
server.getLogger().info( "-------------- Spigot ----------------" );
server.getLogger().info( "-------- World Settings For [" + name + "] --------" );
+ server.getLogger().info( "Growth Per Tick: " + growthPerTick );
server.getLogger().info( "-------------------------------------------------" );
diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java
index b954278..7d4cf91 100644
--- a/src/main/java/org/spigotmc/SpigotWorldConfig.java
+++ b/src/main/java/org/spigotmc/SpigotWorldConfig.java
@@ -47,4 +47,11 @@ public class SpigotWorldConfig
config.addDefault( "world-settings.default." + path, def );
return config.getString( "world-settings." + worldName + "." + path, config.getString( "world-settings.default." + path ) );
}
+
+ public int chunksPerTick = 750;
+ private void chunksPerTick()
+ {
+ chunksPerTick = getInt( "chunks-per-tick", chunksPerTick );
+ log( "Chunks to Grow per Tick: " + chunksPerTick );
+ }
}
// Spigot end
--
1.8.1.2

Datei anzeigen

@ -1,4 +1,4 @@
From 6e1048caeaaa323e667d8bf92aa28f5ffed810e3 Mon Sep 17 00:00:00 2001
From 41fa2773f2174d13e06dc8696b97c5c95e9fa69c Mon Sep 17 00:00:00 2001
From: md_5 <md_5@live.com.au>
Date: Tue, 11 Jun 2013 13:55:57 +1000
Subject: [PATCH] Spigot Changes
@ -234,7 +234,7 @@ index 6c3fcf1..4a8d3f4 100644
}
}
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 2956e75..c234cac 100644
index 6cb50b7..c78bc0f 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -166,6 +166,13 @@ public final class CraftServer implements Server {
@ -298,75 +298,6 @@ index 2956e75..c234cac 100644
} catch (CommandException ex) {
player.sendMessage(ChatColor.RED + "An internal error occurred while attempting to tab-complete this command");
getLogger().log(Level.SEVERE, "Exception when " + player.getName() + " attempted to tab complete " + message, ex);
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index a9b4e71..9789ba4 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -69,6 +69,17 @@ public class CraftWorld implements World {
private static final Random rand = new Random();
// Spigot start
public int growthPerTick = 650;
+ public boolean randomLightingUpdates = false;
+ public int mobSpawnRange = 4;
+ public int aggregateTicks = 4;
+ // Crop growth rates:
+ public int wheatGrowthModifier = 100;
+ public int cactusGrowthModifier = 100;
+ public int melonGrowthModifier = 100;
+ public int pumpkinGrowthModifier = 100;
+ public int sugarGrowthModifier = 100;
+ public int treeGrowthModifier = 100;
+ public int mushroomGrowthModifier = 100;
// Spigot end
// Spigot start
@@ -93,16 +104,46 @@ public class CraftWorld implements World {
// Load defaults first
boolean info = configuration.getBoolean( "world-settings.default.info", true );
growthPerTick = configuration.getInt( "world-settings.default.growth-chunks-per-tick", growthPerTick );
+ randomLightingUpdates = configuration.getBoolean( "world-settings.default.random-light-updates", randomLightingUpdates );
+ mobSpawnRange = configuration.getInt( "world-settings.default.mob-spawn-range", mobSpawnRange );
+ aggregateTicks = Math.max( 1, configuration.getInt( "world-settings.default.aggregate-chunkticks", aggregateTicks ) );
+ wheatGrowthModifier = configuration.getInt( "world-settings.default.wheat-growth-modifier", wheatGrowthModifier );
+ cactusGrowthModifier = configuration.getInt( "world-settings.default.cactus-growth-modifier", cactusGrowthModifier );
+ melonGrowthModifier = configuration.getInt( "world-settings.default.melon-growth-modifier", melonGrowthModifier );
+ pumpkinGrowthModifier = configuration.getInt( "world-settings.default.pumpkin-growth-modifier", pumpkinGrowthModifier );
+ sugarGrowthModifier = configuration.getInt( "world-settings.default.sugar-growth-modifier", sugarGrowthModifier );
+ treeGrowthModifier = configuration.getInt( "world-settings.default.tree-growth-modifier", treeGrowthModifier );
+ mushroomGrowthModifier = configuration.getInt( "world-settings.default.mushroom-growth-modifier", mushroomGrowthModifier );
// Override defaults with world specific, if they exist
info = configuration.getBoolean( "world-settings." + name + ".info", info );
growthPerTick = configuration.getInt( "world-settings." + name + ".growth-chunks-per-tick", growthPerTick );
+ randomLightingUpdates = configuration.getBoolean( "world-settings." + name + ".random-light-updates", randomLightingUpdates );
+ mobSpawnRange = configuration.getInt( "world-settings." + name + ".mob-spawn-range", mobSpawnRange );
+ aggregateTicks = Math.max( 1, configuration.getInt( "world-settings." + name + ".aggregate-chunkticks", aggregateTicks ) );
+ wheatGrowthModifier = configuration.getInt( "world-settings." + name + ".wheat-growth-modifier", wheatGrowthModifier );
+ cactusGrowthModifier = configuration.getInt( "world-settings." + name + ".cactus-growth-modifier", cactusGrowthModifier );
+ melonGrowthModifier = configuration.getInt( "world-settings." + name + ".melon-growth-modifier", melonGrowthModifier );
+ pumpkinGrowthModifier = configuration.getInt( "world-settings." + name + ".pumpkin-growth-modifier", pumpkinGrowthModifier );
+ sugarGrowthModifier = configuration.getInt( "world-settings." + name + ".sugar-growth-modifier", sugarGrowthModifier );
+ treeGrowthModifier = configuration.getInt( "world-settings." + name + ".tree-growth-modifier", treeGrowthModifier );
+ mushroomGrowthModifier = configuration.getInt( "world-settings." + name + ".mushroom-growth-modifier", mushroomGrowthModifier );
if ( info )
{
server.getLogger().info( "-------------- Spigot ----------------" );
server.getLogger().info( "-------- World Settings For [" + name + "] --------" );
server.getLogger().info( "Growth Per Tick: " + growthPerTick );
+ server.getLogger().info( "Random Lighting Updates: " + randomLightingUpdates );
+ server.getLogger().info( "Mob Spawn Range: " + mobSpawnRange );
+ server.getLogger().info( "Aggregate Ticks: " + aggregateTicks );
+ server.getLogger().info( "Wheat Growth Modifier: " + wheatGrowthModifier );
+ server.getLogger().info( "Cactus Growth Modifier: " + cactusGrowthModifier );
+ server.getLogger().info( "Melon Growth Modifier: " + melonGrowthModifier );
+ server.getLogger().info( "Pumpkin Growth Modifier: " + pumpkinGrowthModifier );
+ server.getLogger().info( "Sugar Growth Modifier: " + sugarGrowthModifier );
+ server.getLogger().info( "Tree Growth Modifier: " + treeGrowthModifier );
+ server.getLogger().info( "Mushroom Growth Modifier: " + mushroomGrowthModifier );
server.getLogger().info( "-------------------------------------------------" );
}
// Spigot end
diff --git a/src/main/java/org/bukkit/craftbukkit/Spigot.java b/src/main/java/org/bukkit/craftbukkit/Spigot.java
new file mode 100644
index 0000000..2cd806e

Datei anzeigen

@ -1,14 +1,14 @@
From 40e0140e1cf0aa8874a75e36bcf4aa32ac69a25f Mon Sep 17 00:00:00 2001
From fbb1eeb9f5d6d721eed18bbe1ffae9cc31dd8ae5 Mon Sep 17 00:00:00 2001
From: md_5 <md_5@live.com.au>
Date: Tue, 11 Jun 2013 12:17:37 +1000
Subject: [PATCH] More Efficient GetCubes
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 96190de..dcad74f 100644
index bc692dd..afe3e4d 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -1043,19 +1043,47 @@ public abstract class World implements IBlockAccess {
@@ -1045,19 +1045,47 @@ public abstract class World implements IBlockAccess {
int i1 = MathHelper.floor(axisalignedbb.c);
int j1 = MathHelper.floor(axisalignedbb.f + 1.0D);