removed inner classes, remove redundant biome control

This commit is contained in:
Space Toad 2011-07-31 12:01:23 +00:00
parent c9685426b2
commit e6cc73ce55
5 changed files with 24 additions and 99 deletions

View file

@ -28,18 +28,12 @@ public class Configuration {
private boolean configBlocks[] = null;
public enum PropertyKind {
General, Block, Item
}
public static final int GENERAL_PROPERTY = 0;
public static final int BLOCK_PROPERTY = 1;
public static final int ITEM_PROPERTY = 2;
File file;
public static class Property {
public String name;
public String value;
public String comment;
}
public TreeMap<String, Property> blockProperties = new TreeMap<String, Property>();
public TreeMap<String, Property> itemProperties = new TreeMap<String, Property>();
public TreeMap<String, Property> generalProperties = new TreeMap<String, Property>();
@ -67,8 +61,8 @@ public class Configuration {
}
if (blockProperties.containsKey(key)) {
Property property = getOrCreateIntProperty(key, PropertyKind.Block,
defaultId);
Property property = getOrCreateIntProperty(key,
Configuration.BLOCK_PROPERTY, defaultId);
configBlocks[Integer.parseInt(property.value)] = true;
return property;
} else {
@ -97,7 +91,7 @@ public class Configuration {
}
}
public Property getOrCreateIntProperty(String key, PropertyKind kind,
public Property getOrCreateIntProperty(String key, int kind,
int defaultValue) {
Property prop = getOrCreateProperty(key, kind,
Integer.toString(defaultValue));
@ -112,7 +106,7 @@ public class Configuration {
}
}
public Property getOrCreateBooleanProperty(String key, PropertyKind kind,
public Property getOrCreateBooleanProperty(String key, int kind,
boolean defaultValue) {
Property prop = getOrCreateProperty(key, kind,
Boolean.toString(defaultValue));
@ -126,18 +120,18 @@ public class Configuration {
}
}
public Property getOrCreateProperty(String key, PropertyKind kind,
public Property getOrCreateProperty(String key, int kind,
String defaultValue) {
TreeMap<String, Property> source = null;
switch (kind) {
case General:
case GENERAL_PROPERTY:
source = generalProperties;
break;
case Block:
case BLOCK_PROPERTY:
source = blockProperties;
break;
case Item:
case ITEM_PROPERTY:
source = itemProperties;
break;
}

View file

@ -1,21 +0,0 @@
/**
* This software is provided under the terms of the Minecraft Forge Public
* License v1.0.
*/
package net.minecraft.src.forge;
import net.minecraft.src.BiomeGenBase;
import net.minecraft.src.World;
public interface IBiomePopulator {
/**
* This is called for each chunk, after the rest of the generation, and
* allow contributers to add additional blocks in the world.
*
* @see MinecraftForge#registerBiomePopulate(IBiomePopulator)
*/
public void populate(World world, BiomeGenBase biomegenbase, int x, int z);
}

View file

@ -17,7 +17,6 @@ import net.minecraft.src.World;
public class MinecraftForge {
private static LinkedList<IBucketHandler> bucketHandlers = new LinkedList<IBucketHandler>();
private static LinkedList<IBiomePopulator> biomePopulators = new LinkedList<IBiomePopulator>();
private static LinkedList<IHarvestHandler> harvestHandlers = new LinkedList<IHarvestHandler>();
/**
@ -26,13 +25,6 @@ public class MinecraftForge {
public static void registerCustomBucketHander(IBucketHandler handler) {
bucketHandlers.add(handler);
}
/**
* Registers a new biome contributer.
*/
public static void registerBiomePopulate(IBiomePopulator populator) {
biomePopulators.add(populator);
}
/**
* Registers a new harvest handler.
@ -56,16 +48,6 @@ public class MinecraftForge {
return null;
}
/**
* This is not supposed to be called outside of Minecraft internals.
*/
public static void populateBiome(World world, BiomeGenBase biomegenbase,
int x, int z) {
for (IBiomePopulator populator : biomePopulators) {
populator.populate(world, biomegenbase, x, z);
}
}
/**
* This is not supposed to be called outside of Minecraft internals.
*/

View file

@ -0,0 +1,12 @@
/**
* This software is provided under the terms of the Minecraft Forge Public
* License v1.0.
*/
package net.minecraft.src.forge;
public class Property {
public String name;
public String value;
public String comment;
}

View file

@ -59,27 +59,6 @@ diff -u -r --strip-trailing-cr ../src_base/minecraft/net/minecraft/src/Chunk.jav
blocks[i << 11 | k << 7 | j] = (byte)(byte0 & 0xff);
if(j1 != 0)
{
diff -u -r --strip-trailing-cr ../src_base/minecraft/net/minecraft/src/ChunkProviderGenerate.java ../src_work/minecraft/net/minecraft/src/ChunkProviderGenerate.java
--- ../src_base/minecraft/net/minecraft/src/ChunkProviderGenerate.java 2011-07-29 23:21:33.906999000 +0200
+++ ../src_work/minecraft/net/minecraft/src/ChunkProviderGenerate.java 2011-07-30 08:15:01.684144300 +0200
@@ -6,6 +6,8 @@
import java.util.Random;
+import net.minecraft.src.forge.MinecraftForge;
+
// Referenced classes of package net.minecraft.src:
// IChunkProvider, MapGenCaves, NoiseGeneratorOctaves, Block,
// BiomeGenBase, Chunk, World, WorldChunkManager,
@@ -632,6 +634,8 @@
int i25 = l + rand.nextInt(16) + 8;
(new WorldGenLiquids(Block.lavaMoving.blockID)).generate(worldObj, rand, i22, l23, i25);
}
+
+ MinecraftForge.populateBiome(worldObj, biomegenbase, k, l);
generatedTemperatures = worldObj.getWorldChunkManager().getTemperatures(generatedTemperatures, k + 8, l + 8, 16, 16);
for(int j19 = k + 8; j19 < k + 8 + 16; j19++)
diff -u -r --strip-trailing-cr ../src_base/minecraft/net/minecraft/src/EffectRenderer.java ../src_work/minecraft/net/minecraft/src/EffectRenderer.java
--- ../src_base/minecraft/net/minecraft/src/EffectRenderer.java 2011-07-29 23:21:33.988004400 +0200
+++ ../src_work/minecraft/net/minecraft/src/EffectRenderer.java 2011-07-30 08:15:01.696145000 +0200
@ -584,27 +563,6 @@ diff -u -r --strip-trailing-cr ../src_base/minecraft_server/net/minecraft/src/Ch
blocks[i << 11 | k << 7 | j] = (byte)(byte0 & 0xff);
if(j1 != 0)
{
diff -u -r --strip-trailing-cr ../src_base/minecraft_server/net/minecraft/src/ChunkProviderGenerate.java ../src_work/minecraft_server/net/minecraft/src/ChunkProviderGenerate.java
--- ../src_base/minecraft_server/net/minecraft/src/ChunkProviderGenerate.java 2011-07-29 23:21:50.088925000 +0200
+++ ../src_work/minecraft_server/net/minecraft/src/ChunkProviderGenerate.java 2011-07-30 08:15:01.786150200 +0200
@@ -6,6 +6,8 @@
import java.util.Random;
+import net.minecraft.src.forge.MinecraftForge;
+
// Referenced classes of package net.minecraft.src:
// IChunkProvider, MapGenCaves, NoiseGeneratorOctaves, Block,
// BiomeGenBase, Chunk, World, WorldChunkManager,
@@ -632,6 +634,8 @@
int i25 = l + rand.nextInt(16) + 8;
(new WorldGenLiquids(Block.lavaMoving.blockID)).generate(worldObj, rand, i22, l23, i25);
}
+
+ MinecraftForge.populateBiome(worldObj, biomegenbase, k, l);
generatedTemperatures = worldObj.getWorldChunkManager().getTemperatures(generatedTemperatures, k + 8, l + 8, 16, 16);
for(int j19 = k + 8; j19 < k + 8 + 16; j19++)
diff -u -r --strip-trailing-cr ../src_base/minecraft_server/net/minecraft/src/EntityPlayer.java ../src_work/minecraft_server/net/minecraft/src/EntityPlayer.java
--- ../src_base/minecraft_server/net/minecraft/src/EntityPlayer.java 2011-07-29 23:21:50.320938000 +0200
+++ ../src_work/minecraft_server/net/minecraft/src/EntityPlayer.java 2011-07-30 21:04:21.430487800 +0200