ForgePatch/patches/minecraft/net/minecraft/world/WorldType.java.patch
LexManos f1cca475ea Initial patch update to 1.12.
Some things to note:
Netty is screwy so currently can't join single player. @cpw
Crafting has been MAJORY reworked. The current GameRegistry functions are nooped, this is IN THE WORKS.
  Just need to move the recipe list to a full class registry, and then re implement the in-code recipe registration.
  Also, it IS advised that modders move to JSON, because ideally we'll see a S->C recipe syncing system in 1.13
  which would allow servers to have custom recipes.
  OreDictionary currently 1/2 works, need to write a better algorithm for replacing ingredients.
  Please be patient
Rendering:
  A lot of functions got a new float parameter, this is similar to partial ticks, needs more research
2017-06-10 22:22:02 -04:00

156 lines
6.1 KiB
Diff

--- ../src-base/minecraft/net/minecraft/world/WorldType.java
+++ ../src-work/minecraft/net/minecraft/world/WorldType.java
@@ -27,6 +27,7 @@
private WorldType(int p_i1960_1_, String p_i1960_2_, int p_i1960_3_)
{
+ if (p_i1960_2_.length() > 16 && field_180272_g != null) throw new IllegalArgumentException("World type names must not be longer then 16: " + p_i1960_2_);
this.field_77133_f = p_i1960_2_;
this.field_77134_g = p_i1960_3_;
this.field_77140_h = true;
@@ -113,4 +114,145 @@
this.field_151361_l = true;
return this;
}
+
+ public net.minecraft.world.biome.BiomeProvider getBiomeProvider(World world)
+ {
+ if (this == field_77138_c)
+ {
+ net.minecraft.world.gen.FlatGeneratorInfo flatgeneratorinfo = net.minecraft.world.gen.FlatGeneratorInfo.func_82651_a(world.func_72912_H().func_82571_y());
+ return new net.minecraft.world.biome.BiomeProviderSingle(net.minecraft.world.biome.Biome.func_180276_a(flatgeneratorinfo.func_82648_a(), net.minecraft.init.Biomes.field_180279_ad));
+ }
+ else if (this == field_180272_g)
+ {
+ return new net.minecraft.world.biome.BiomeProviderSingle(net.minecraft.init.Biomes.field_76772_c);
+ }
+ else
+ {
+ return new net.minecraft.world.biome.BiomeProvider(world.func_72912_H());
+ }
+ }
+
+ public net.minecraft.world.gen.IChunkGenerator getChunkGenerator(World world, String generatorOptions)
+ {
+ if (this == field_77138_c) return new net.minecraft.world.gen.ChunkGeneratorFlat(world, world.func_72905_C(), world.func_72912_H().func_76089_r(), generatorOptions);
+ if (this == field_180272_g) return new net.minecraft.world.gen.ChunkGeneratorDebug(world);
+ if (this == field_180271_f) return new net.minecraft.world.gen.ChunkGeneratorOverworld(world, world.func_72905_C(), world.func_72912_H().func_76089_r(), generatorOptions);
+ return new net.minecraft.world.gen.ChunkGeneratorOverworld(world, world.func_72905_C(), world.func_72912_H().func_76089_r(), generatorOptions);
+ }
+
+ public int getMinimumSpawnHeight(World world)
+ {
+ return this == field_77138_c ? 4 : world.func_181545_F() + 1;
+ }
+
+ public double getHorizon(World world)
+ {
+ return this == field_77138_c ? 0.0D : 63.0D;
+ }
+
+ public double voidFadeMagnitude()
+ {
+ return this == field_77138_c ? 1.0D : 0.03125D;
+ }
+
+ public boolean handleSlimeSpawnReduction(java.util.Random random, World world)
+ {
+ return this == field_77138_c ? random.nextInt(4) != 1 : false;
+ }
+
+ /*=================================================== FORGE START ======================================*/
+ private static int getNextID()
+ {
+ for (int x = 0; x < field_77139_a.length; x++)
+ {
+ if (field_77139_a[x] == null)
+ {
+ return x;
+ }
+ }
+
+ int oldLen = field_77139_a.length;
+ field_77139_a = java.util.Arrays.copyOf(field_77139_a, 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() { }
+
+ /**
+ * Gets the spawn fuzz for players who join the world.
+ * Useful for void world types.
+ * @return Fuzz for entity initial spawn in blocks.
+ */
+ public int getSpawnFuzz(WorldServer world, net.minecraft.server.MinecraftServer server)
+ {
+ return Math.max(0, server.func_184108_a(world));
+ }
+
+ /**
+ * Called when the 'Customize' button is pressed on world creation GUI
+ * @param mc The Minecraft instance
+ * @param guiCreateWorld the createworld GUI
+ */
+ @SideOnly(Side.CLIENT)
+ public void onCustomizeButton(net.minecraft.client.Minecraft mc, net.minecraft.client.gui.GuiCreateWorld guiCreateWorld)
+ {
+ if (this == WorldType.field_77138_c)
+ {
+ mc.func_147108_a(new net.minecraft.client.gui.GuiCreateFlatWorld(guiCreateWorld, guiCreateWorld.field_146334_a));
+ }
+ else if (this == WorldType.field_180271_f)
+ {
+ mc.func_147108_a(new net.minecraft.client.gui.GuiCustomizeWorldScreen(guiCreateWorld, guiCreateWorld.field_146334_a));
+ }
+ }
+
+ /**
+ * Should world creation GUI show 'Customize' button for this world type?
+ * @return if this world type has customization parameters
+ */
+ public boolean isCustomizable()
+ {
+ return this == field_77138_c || this == WorldType.field_180271_f;
+ }
+
+
+ /**
+ * Get the height to render the clouds for this world type
+ * @return The height to render clouds at
+ */
+ public float getCloudHeight()
+ {
+ return 128.0F;
+ }
+
+ /**
+ * Creates the GenLayerBiome used for generating the world with the specified ChunkProviderSettings JSON String
+ * *IF AND ONLY IF* this WorldType == WorldType.CUSTOMIZED.
+ *
+ *
+ * @param worldSeed The world seed
+ * @param parentLayer The parent layer to feed into any layer you return
+ * @param chunkSettings The ChunkGeneratorSettings constructed from the custom JSON
+ * @return A GenLayer that will return ints representing the Biomes to be generated, see GenLayerBiome
+ */
+ public net.minecraft.world.gen.layer.GenLayer getBiomeLayer(long worldSeed, net.minecraft.world.gen.layer.GenLayer parentLayer, net.minecraft.world.gen.ChunkGeneratorSettings chunkSettings)
+ {
+ net.minecraft.world.gen.layer.GenLayer ret = new net.minecraft.world.gen.layer.GenLayerBiome(200L, parentLayer, this, chunkSettings);
+ ret = net.minecraft.world.gen.layer.GenLayerZoom.func_75915_a(1000L, ret, 2);
+ ret = new net.minecraft.world.gen.layer.GenLayerBiomeEdge(1000L, ret);
+ return ret;
+ }
}