From 10f3320d0769f4857f412bb20000a6df0a213399 Mon Sep 17 00:00:00 2001 From: Richard-Rogalski Date: Fri, 1 Sep 2023 21:18:41 -0500 Subject: [PATCH] v2.0.0 --- .../java/ski/rrogal/farlands/CommonProxy.java | 12 ------ .../java/ski/rrogal/farlands/FarLands.java | 34 ++++++++++++--- .../rrogal/farlands/client/ClientProxy.java | 19 -------- .../mixins/MixinChunkProviderEnd.java | 2 +- .../mixins/MixinChunkProviderGenerate.java | 2 +- .../mixins/MixinChunkProviderHell.java | 2 +- .../mixins/MixinNoiseGeneratorOctaves.java | 43 +++++++++++++------ 7 files changed, 60 insertions(+), 54 deletions(-) delete mode 100644 src/main/java/ski/rrogal/farlands/CommonProxy.java delete mode 100644 src/main/java/ski/rrogal/farlands/client/ClientProxy.java diff --git a/src/main/java/ski/rrogal/farlands/CommonProxy.java b/src/main/java/ski/rrogal/farlands/CommonProxy.java deleted file mode 100644 index 094dc46..0000000 --- a/src/main/java/ski/rrogal/farlands/CommonProxy.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.kpabr.FarLands; -/* - * Created by Valiec2019 - * on July 25, 2015 - * currently using Minecraft Forge 10.13.4.1448 - */ -public class CommonProxy { - // Client stuff - public void registerRenderers() { - // Nothing here as the server doesn't render graphics or entities! - } -} diff --git a/src/main/java/ski/rrogal/farlands/FarLands.java b/src/main/java/ski/rrogal/farlands/FarLands.java index 51cc69e..956aac3 100644 --- a/src/main/java/ski/rrogal/farlands/FarLands.java +++ b/src/main/java/ski/rrogal/farlands/FarLands.java @@ -8,7 +8,7 @@ import java.io.IOException; import java.net.UnknownHostException; -import com.kpabr.FarLands.CommonProxy; +//import com.kpabr.FarLands.CommonProxy; import net.minecraft.block.material.Material; import net.minecraft.client.Minecraft; @@ -28,7 +28,7 @@ import cpw.mods.fml.common.FMLCommonHandler; import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.Mod.EventHandler; -import cpw.mods.fml.common.SidedProxy; +//import cpw.mods.fml.common.SidedProxy; import cpw.mods.fml.common.event.FMLInitializationEvent; import cpw.mods.fml.common.event.FMLPreInitializationEvent; import cpw.mods.fml.common.eventhandler.Event.Result; @@ -39,8 +39,10 @@ @Mod(modid = FarLands.MODID, version = FarLands.VERSION, name = FarLands.NAME) public class FarLands { + /* @SidedProxy(clientSide="com.kpabr.FarLands.client.ClientProxy", serverSide="com.kpabr.FarLands.CommonProxy") public static CommonProxy proxy; + */ /*Mod ID and Version declarations*/ public static final String MODID = "farlands"; @@ -52,7 +54,12 @@ public class FarLands public static int threshold; public static int thresholdNether; public static int thresholdEnd; + public static String directions; + public static boolean genNorth; + public static boolean genEast; + public static boolean genWest; + public static boolean genSouth; public static Configuration config; @@ -66,19 +73,33 @@ public void preInit(FMLPreInitializationEvent event) this.thresholdNether = FarLands.config.getInt("FarLandsStartNether", Configuration.CATEGORY_GENERAL, -1, -1, 12550820, "Approximate Far Lands start distance in the nether. If you want the farlands in the nether to line up with farlands in the overworld, set this to an eighth of the value. (set to -1 for default distance)"); this.thresholdEnd = FarLands.config.getInt("FarLandsStartEnd", Configuration.CATEGORY_GENERAL, -1, -1, 12550820, "Approximate Far Lands start distance in the end. (set to -1 for default distance)"); this.directions = FarLands.config.getString("generateInDirection", Configuration.CATEGORY_GENERAL, "NEWS", "Directions that farlands will generate. Examples: \"NEWS\" for all directions. \"NW\" to spawn them north and to the west. \"E\" to spawn them to the east."); - FarLands.config.save(); + FarLands.config.save(); //TODO: make farlands able to start after the default + + this.genNorth = false; this.genEast = false; this.genWest = false; this.genSouth = false; + + if(this.directions.contains("N")) + this.genNorth = true; + if(this.directions.contains("E")) + this.genEast = true; + if(this.directions.contains("W")) + this.genWest = true; + if(this.directions.contains("S")) + this.genSouth = true; } + @EventHandler public void load(FMLInitializationEvent event) { this.instance = this; FMLCommonHandler.instance().bus().register(this); - MinecraftForge.EVENT_BUS.register(this); - MinecraftForge.TERRAIN_GEN_BUS.register(this); + //MinecraftForge.EVENT_BUS.register(this); + //MinecraftForge.TERRAIN_GEN_BUS.register(this); - proxy.registerRenderers(); + //proxy.registerRenderers(); } + + /* @SubscribeEvent public void onGen(ChunkProviderEvent.InitNoiseField event) { @@ -102,5 +123,6 @@ else if(event.chunkProvider instanceof ChunkProviderHell)// && Minecraft.getMine //event.noisefield = ((ChunkProviderGenerate)DimensionManager.getProvider(0).createChunkGenerator()).initializeNoiseField(null, event.posX, event.posY, event.posZ, event.sizeX, event.sizeY, event.sizeZ); //} } + */ } diff --git a/src/main/java/ski/rrogal/farlands/client/ClientProxy.java b/src/main/java/ski/rrogal/farlands/client/ClientProxy.java deleted file mode 100644 index 160fdec..0000000 --- a/src/main/java/ski/rrogal/farlands/client/ClientProxy.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.kpabr.FarLands.client; -/* - * Created by Valiec2019 - * on July 25, 2015 - * currently using Minecraft Forge 10.13.4.1448 - */ -import com.kpabr.FarLands.CommonProxy; - -import cpw.mods.fml.client.registry.RenderingRegistry; -import net.minecraft.client.model.ModelBiped; -import net.minecraft.client.renderer.entity.RenderBiped; -import net.minecraftforge.client.MinecraftForgeClient; - -public class ClientProxy extends CommonProxy { - @Override - public void registerRenderers() - { - } -} diff --git a/src/main/java/ski/rrogal/farlands/mixins/MixinChunkProviderEnd.java b/src/main/java/ski/rrogal/farlands/mixins/MixinChunkProviderEnd.java index fe316df..4a2eb3a 100644 --- a/src/main/java/ski/rrogal/farlands/mixins/MixinChunkProviderEnd.java +++ b/src/main/java/ski/rrogal/farlands/mixins/MixinChunkProviderEnd.java @@ -38,7 +38,7 @@ private void injectCustomCode(int p_147419_1_, int p_147419_2_, Block[] p_147419 */ @ModifyArgs(method = "provideChunk", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/gen/ChunkProviderEnd;func_147420_a(II[Lnet/minecraft/block/Block;[Lnet/minecraft/world/biome/BiomeGenBase;)V")) private void thisShouldWork2(Args args) { - System.out.println("QQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQ" + FarLands.thresholdEnd + " " + args.get(0) + " " + args.get(1)); + //System.out.println("QQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQ" + FarLands.thresholdEnd + " " + args.get(0) + " " + args.get(1)); if(FarLands.thresholdEnd > 0){ int i = (int)args.get(0); if(Math.abs(args.get(0)) > FarLands.thresholdEnd/16){ diff --git a/src/main/java/ski/rrogal/farlands/mixins/MixinChunkProviderGenerate.java b/src/main/java/ski/rrogal/farlands/mixins/MixinChunkProviderGenerate.java index 2729565..3d19b75 100644 --- a/src/main/java/ski/rrogal/farlands/mixins/MixinChunkProviderGenerate.java +++ b/src/main/java/ski/rrogal/farlands/mixins/MixinChunkProviderGenerate.java @@ -177,7 +177,7 @@ private int modifyArgument3(int p_147423_3_) { @ModifyArgs(method = "func_147424_a", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/gen/ChunkProviderGenerate;func_147423_a(III)V")) private void thisShouldWork(Args args) { - System.out.println("QQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQ" + FarLands.thresholdNether + " " + args.get(0) + " " + args.get(1)); + //System.out.println("QQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQ" + FarLands.thresholdNether + " " + args.get(0) + " " + args.get(1)); if(FarLands.threshold > 0){ int i = (int)args.get(0); diff --git a/src/main/java/ski/rrogal/farlands/mixins/MixinChunkProviderHell.java b/src/main/java/ski/rrogal/farlands/mixins/MixinChunkProviderHell.java index 74d12f5..eb43969 100644 --- a/src/main/java/ski/rrogal/farlands/mixins/MixinChunkProviderHell.java +++ b/src/main/java/ski/rrogal/farlands/mixins/MixinChunkProviderHell.java @@ -38,7 +38,7 @@ private void injectCustomCode(int p_147419_1_, int p_147419_2_, Block[] p_147419 */ @ModifyArgs(method = "provideChunk", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/gen/ChunkProviderHell;func_147419_a(II[Lnet/minecraft/block/Block;)V")) private void thisShouldWork2(Args args) { - System.out.println("QQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQ" + FarLands.thresholdNether + " " + args.get(0) + " " + args.get(1)); + //System.out.println("QQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQ" + FarLands.thresholdNether + " " + args.get(0) + " " + args.get(1)); if(FarLands.thresholdNether > 0){ int i = (int)args.get(0); if(Math.abs(args.get(0)) > FarLands.thresholdNether/16){ diff --git a/src/main/java/ski/rrogal/farlands/mixins/MixinNoiseGeneratorOctaves.java b/src/main/java/ski/rrogal/farlands/mixins/MixinNoiseGeneratorOctaves.java index e11a951..7d2bd76 100644 --- a/src/main/java/ski/rrogal/farlands/mixins/MixinNoiseGeneratorOctaves.java +++ b/src/main/java/ski/rrogal/farlands/mixins/MixinNoiseGeneratorOctaves.java @@ -8,6 +8,7 @@ import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Overwrite; import org.spongepowered.asm.mixin.Shadow; +import com.kpabr.FarLands.FarLands; @Mixin(NoiseGeneratorOctaves.class) public class MixinNoiseGeneratorOctaves { @@ -32,21 +33,35 @@ public double[] generateNoiseOctaves(double[] p_76304_1_, int p_76304_2_, int p_ for (int l1 = 0; l1 < this.octaves; ++l1) { double d3 = (double)p_76304_2_ * d6 * p_76304_8_; - double d4 = (double)p_76304_3_ * d6 * p_76304_10_; + double d4 = (double)p_76304_3_ * d6 * p_76304_10_;// double d5 = (double)p_76304_4_ * d6 * p_76304_12_; - // remove farlands fix - // - //long i2 = MathHelper.floor_double_long(d3); - //long j2 = MathHelper.floor_double_long(d5); - //d3 -= (double)i2; - //d5 -= (double)j2; - // - //i2 %= 16777216L; - //j2 %= 16777216L; - // - //d3 += (double)i2; - //d5 += (double)j2; - // + long i2 = MathHelper.floor_double_long(d3); + long j2 = MathHelper.floor_double_long(d5); + + //System.out.println("WWWWWWWWWWWWWWWWWWWWWWWWWWWWWW " + p_76304_1_ + " " + p_76304_2_ + " " + p_76304_3_ + " " + p_76304_4_ + " " + p_76304_5_ + " " + p_76304_6_ + " " + p_76304_7_ + " " + p_76304_8_ + " " + p_76304_10_ + " " + p_76304_12_); + //System.out.println(i2 + " " + j2 + " " + d3 + " " + d4 + " " + d5); + + if(FarLands.genEast && d3 < 0){ //farlands in east d3 < 0 + d3 -= (double)i2; + i2 %= 16777216L; + d3 += (double)i2; + } + if(FarLands.genWest && d3 > 0){ + d3 -= (double)i2; + i2 %= 16777216L; + d3 += (double)i2; + } + if(FarLands.genSouth && d5 < 0){ //farlands in south d5 < 0 + d5 -= (double)j2; + j2 %= 16777216L; + d5 += (double)j2; + } + if(FarLands.genNorth && d5 > 0){ + d5 -= (double)j2; + j2 %= 16777216L; + d5 += (double)j2; + } + this.generatorCollection[l1].populateNoiseArray(p_76304_1_, d3, d4, d5, p_76304_5_, p_76304_6_, p_76304_7_, p_76304_8_ * d6, p_76304_10_ * d6, p_76304_12_ * d6, d6); d6 /= 2.0D; }