Skip to content

Commit

Permalink
v2.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Richard-Rogalski committed Sep 2, 2023
1 parent ec1329a commit 10f3320
Show file tree
Hide file tree
Showing 7 changed files with 60 additions and 54 deletions.
12 changes: 0 additions & 12 deletions src/main/java/ski/rrogal/farlands/CommonProxy.java

This file was deleted.

34 changes: 28 additions & 6 deletions src/main/java/ski/rrogal/farlands/FarLands.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -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";
Expand All @@ -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;

Expand All @@ -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)
{
Expand All @@ -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);
//}
}
*/
}

19 changes: 0 additions & 19 deletions src/main/java/ski/rrogal/farlands/client/ClientProxy.java

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -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){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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;
}
Expand Down

0 comments on commit 10f3320

Please sign in to comment.