From 08a875c39a59091c6bf6cf422fb8c49f2b68291c Mon Sep 17 00:00:00 2001 From: Lex Manos Date: Mon, 23 Dec 2013 22:38:39 -0800 Subject: [PATCH] Added constructor to WorldType, and delegated the BiomeLayer management to it. Also updated the access transformer for Item/Block classes. --- .../net/minecraft/world/WorldType.java.patch | 70 ++++++++++++++++++- .../world/gen/layer/GenLayer.java.patch | 16 ++++- src/main/resources/forge_at.cfg | 39 ++++++----- 3 files changed, 102 insertions(+), 23 deletions(-) diff --git a/patches/minecraft/net/minecraft/world/WorldType.java.patch b/patches/minecraft/net/minecraft/world/WorldType.java.patch index 4436cb558..d72b803fc 100644 --- a/patches/minecraft/net/minecraft/world/WorldType.java.patch +++ b/patches/minecraft/net/minecraft/world/WorldType.java.patch @@ -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; + } } diff --git a/patches/minecraft/net/minecraft/world/gen/layer/GenLayer.java.patch b/patches/minecraft/net/minecraft/world/gen/layer/GenLayer.java.patch index 7a5eb41be..953da9d26 100644 --- a/patches/minecraft/net/minecraft/world/gen/layer/GenLayer.java.patch +++ b/patches/minecraft/net/minecraft/world/gen/layer/GenLayer.java.patch @@ -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_})))))))))); } diff --git a/src/main/resources/forge_at.cfg b/src/main/resources/forge_at.cfg index 1f7e29a61..6d64803c6 100644 --- a/src/main/resources/forge_at.cfg +++ b/src/main/resources/forge_at.cfg @@ -29,19 +29,16 @@ public net.minecraft.item.ItemSpade (Lnet.minecraft.item.Item$ToolMaterial # EntityMinecart #protected st.* #FD:EntityMinecart/* # All private -> protected # Block -#public aqz.(ILakc;)V #MD:Block/(ILnet/minecraft/src/Material;) #Constructor -#public aqz.(IILakc;)V #MD:Block/(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 (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.(I)V #MD:Item/(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 \ No newline at end of file +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 \ No newline at end of file