Added constructor to WorldType, and delegated the BiomeLayer management to it. Also updated the access transformer for Item/Block classes.

This commit is contained in:
Lex Manos 2013-12-23 22:38:39 -08:00
parent 90be589ffa
commit 08a875c39a
3 changed files with 102 additions and 23 deletions

View File

@ -1,7 +1,9 @@
--- ../src-base/minecraft/net/minecraft/world/WorldType.java
+++ ../src-work/minecraft/net/minecraft/world/WorldType.java
@@ -2,6 +2,9 @@
@@ -1,7 +1,11 @@
package net.minecraft.world;
+import java.util.Arrays;
import java.util.Random;
+import net.minecraft.client.Minecraft;
@ -10,7 +12,56 @@
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraft.world.biome.WorldChunkManager;
import net.minecraft.world.biome.WorldChunkManagerHell;
@@ -203,4 +206,47 @@
@@ -9,6 +13,10 @@
import net.minecraft.world.gen.ChunkProviderFlat;
import net.minecraft.world.gen.ChunkProviderGenerate;
import net.minecraft.world.gen.FlatGeneratorInfo;
+import net.minecraft.world.gen.layer.GenLayer;
+import net.minecraft.world.gen.layer.GenLayerBiome;
+import net.minecraft.world.gen.layer.GenLayerBiomeEdge;
+import net.minecraft.world.gen.layer.GenLayerZoom;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@@ -45,6 +53,7 @@
private WorldType(int par1, String par2Str, int par3)
{
+ if (par2Str.length() > 16) throw new IllegalArgumentException("World type names must not be longer then 16: " + par2Str.length());
this.worldType = par2Str;
this.generatorVersion = par3;
this.canBeCreated = true;
@@ -199,8 +208,92 @@
return this == FLAT ? random.nextInt(4) != 1 : false;
}
+ /*=================================================== FORGE START ======================================*/
+ private static int getNextID()
+ {
+ for (int x = 0; x < worldTypes.length; x++)
+ {
+ if (worldTypes[x] == null)
+ {
+ return x;
+ }
+ }
+
+ int oldLen = worldTypes.length;
+ worldTypes = Arrays.copyOf(worldTypes, oldLen + 16);
+ return oldLen;
+ }
+
/**
+ * Creates a new world type, the ID is hidden and should not be referenced by modders.
+ * It will automatically expand the underlying workdType array if there are no IDs left.
+ * @param name
+ */
+ public WorldType(String name)
+ {
+ this(getNextID(), name);
+ }
+
+ /**
* Called when 'Create New World' button is pressed before starting game
*/
public void onGUICreateWorldPress() { }
@ -56,5 +107,20 @@
+ public float getCloudHeight()
+ {
+ return 128.0F;
+ }
+
+ /**
+ * Creates the GenLayerBiome used for generating the world
+ *
+ * @param worldSeed The world seed
+ * @param parentLayer The parent layer to feed into any layer you return
+ * @return A GenLayer that will return ints representing the Biomes to be generated, see GenLayerBiome
+ */
+ public GenLayer getBiomeLayer(int worldSeed, GenLayer parentLayer)
+ {
+ GenLayer ret = new GenLayerBiome(200L, parentLayer, this);
+ ret = GenLayerZoom.magnify(1000L, ret, 2);
+ ret = new GenLayerBiomeEdge(1000L, ret);
+ return ret;
+ }
}

View File

@ -10,7 +10,7 @@
public abstract class GenLayer
{
// JAVADOC FIELD $$ field_75907_b
@@ -53,6 +56,7 @@
@@ -53,17 +56,12 @@
{
b0 = 4;
}
@ -18,7 +18,19 @@
GenLayer genlayer = GenLayerZoom.magnify(1000L, genlayer3, 0);
GenLayerRiverInit genlayerriverinit = new GenLayerRiverInit(100L, genlayer);
@@ -213,4 +217,11 @@
- Object object = new GenLayerBiome(200L, genlayer3, par2WorldType);
+ Object object = par2WorldType.getBiomeLayer(flag, genlayer3);
- if (!flag)
- {
- GenLayer genlayer2 = GenLayerZoom.magnify(1000L, (GenLayer)object, 2);
- object = new GenLayerBiomeEdge(1000L, genlayer2);
- }
-
GenLayer genlayer1 = GenLayerZoom.magnify(1000L, genlayerriverinit, 2);
GenLayerHills genlayerhills = new GenLayerHills(1000L, (GenLayer)object, genlayer1);
genlayer = GenLayerZoom.magnify(1000L, genlayerriverinit, 2);
@@ -213,4 +211,11 @@
{
return p_151617_2_ == p_151617_3_ && p_151617_3_ == p_151617_4_ ? p_151617_2_ : (p_151617_1_ == p_151617_2_ && p_151617_1_ == p_151617_3_ ? p_151617_1_ : (p_151617_1_ == p_151617_2_ && p_151617_1_ == p_151617_4_ ? p_151617_1_ : (p_151617_1_ == p_151617_3_ && p_151617_1_ == p_151617_4_ ? p_151617_1_ : (p_151617_1_ == p_151617_2_ && p_151617_3_ != p_151617_4_ ? p_151617_1_ : (p_151617_1_ == p_151617_3_ && p_151617_2_ != p_151617_4_ ? p_151617_1_ : (p_151617_1_ == p_151617_4_ && p_151617_2_ != p_151617_3_ ? p_151617_1_ : (p_151617_2_ == p_151617_3_ && p_151617_1_ != p_151617_4_ ? p_151617_2_ : (p_151617_2_ == p_151617_4_ && p_151617_1_ != p_151617_3_ ? p_151617_2_ : (p_151617_3_ == p_151617_4_ && p_151617_1_ != p_151617_2_ ? p_151617_3_ : this.func_151619_a(new int[] {p_151617_1_, p_151617_2_, p_151617_3_, p_151617_4_}))))))))));
}

View File

@ -29,19 +29,16 @@ public net.minecraft.item.ItemSpade <init>(Lnet.minecraft.item.Item$ToolMaterial
# EntityMinecart
#protected st.* #FD:EntityMinecart/* # All private -> protected
# Block
#public aqz.<init>(ILakc;)V #MD:Block/<init>(ILnet/minecraft/src/Material;) #Constructor
#public aqz.<init>(IILakc;)V #MD:Block/<init>(IILnet/minecraft/src/Material;) #Constructor
#public aqz.cH #FD:Block/field_72029_cc #blockResistance
#public aqz.cG #FD:Block/field_71989_cb #blockHardness
#public aqz.d(Ljava/lang/String;)Laqz; #MD:Block/func_111022_d #setIconName
#public aqz.a(Lard;)Laqz; #MD:Block/func_71884_a #setStepSound
#public aqz.b(F)Laqz; #MD:Block/func_71894_b #setResistance
#public aqz.c(F)Laqz; #MD:Block/func_71848_c #setHardness
#public aqz.k(I)Laqz; #MD:Block/func_71868_h #setLightOpacity
#public aqz.a(F)Laqz; #MD:Block/func_71900_a #setLightValue
#public aqz.r()Laqz; #MD:Block/func_71875_q #setBlockUnbreakable
#public aqz.b(Z)Laqz; #MD:Block/func_71907_b #setTickRandomly
#public aqz.a(FFFFFF)V #MD:Block/func_71905_a #setBlockBounds
public net.minecraft.block.Block <init>(Lnet/minecraft/src/Material;)V
public net.minecraft.block.Block func_149658_d(Ljava/lang/String;)Lnet.minecraft.block.Block; #setIconName
public net.minecraft.block.Block func_149672_a(Lnet.minecraft.block.Block$SoundType;)Lnet.minecraft.block.Block; #setStepSound
public net.minecraft.block.Block func_149752_b(F)Lnet.minecraft.block.Block; #setResistance
public net.minecraft.block.Block func_149711_c(F)Lnet.minecraft.block.Block; #setHardness
public net.minecraft.block.Block func_149713_g(I)Lnet.minecraft.block.Block; #setLightOpacity
public net.minecraft.block.Block func_149715_a(F)Lnet.minecraft.block.Block; #setLightValue
public net.minecraft.block.Block func_149722_s()Lnet.minecraft.block.Block; #setBlockUnbreakable
public net.minecraft.block.Block func_149675_a(Z)Lnet.minecraft.block.Block; #setTickRandomly
public net.minecraft.block.Block func_149676_a(FFFFFF)V #setBlockBounds
public net.minecraft.block.Block func_149657_c(Lnet/minecraft/world/World;IIII)V # dropXpOnBlockBreak
# NetServerHandler
#public ka.f #FD:NetServerHandler/field_72572_g #playerInAirTime
@ -50,11 +47,11 @@ public net.minecraft.block.Block func_149657_c(Lnet/minecraft/world/World;IIII)V
# BlockLeavesBase
#public arh.d #FD:BlockLeavesBase/field_72131_c #graphicsLevel
# Item
#public yc.<init>(I)V #MD:Item/<init>(I) #Constructor
#public yc.e(I)Lyc; #MD:Item/func_77656_e #setMaxDamage
#public-f yc.h(Lye;)Lms; #MD:Item/func_77650_f #getIconIndex
#public yc.c(Ljava/lang/String;)Lyc; #MD:Item/func_77631_c #setPotionEffect
#public yc.d(Ljava/lang/String;)Lyc; #MD:Item/func_111206_d #setIconName
public net.minecraft.item.Item func_77656_e(I)Lnet.minecraft.item.Item; #setMaxDamage
public-f net.minecraft.item.Item func_77650_f(Lnet.minecraft.item.ItemStack;)Lnet.minecraft.util.IIcon; #getIcon is Final for unknown reason
public net.minecraft.item.Item func_77627_a(Z)Lnet.minecraft.item.Item; #setHasSubtypes
public net.minecraft.item.Item func_77631_c(Ljava.lang.String;)Lnet.minecraft.item.Item; #setPotionEffect
public net.minecraft.item.Item func_111206_d(Ljava.lang.String;)Lnet.minecraft.item.Item; #setTextureName
# RailLogic
#public amz #CL:BlockBaseRailLogic
#public amz.a()I #MD:BlockBaseRailLogic/func_94505_a #getNAdjacentTiles
@ -164,4 +161,8 @@ default net.minecraft.item.ItemStack field_77991_e
public net.minecraft.world.gen.structure.StructureStrongholdPieces$Stronghold
# Packets
public net.minecraft.network.play.server.S23PacketBlockChange field_148883_d # Block
public net.minecraft.network.play.server.S23PacketBlockChange field_148884_e # Metadata
public net.minecraft.network.play.server.S23PacketBlockChange field_148884_e # Metadata
# WorldType
public-f net.minecraft.world.WorldType field_77139_a #worldTypes
# DamageSource
public net.minecraft.util.DamageSource *() #All methods public, most are already