Skip to content

Commit

Permalink
🤔
Browse files Browse the repository at this point in the history
  • Loading branch information
Tesseract4D committed Aug 28, 2024
1 parent 89b577b commit 684c0f3
Show file tree
Hide file tree
Showing 8 changed files with 63 additions and 7 deletions.
3 changes: 2 additions & 1 deletion dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,6 @@
*/
dependencies {
runtimeOnlyNonPublishable("com.github.GTNewHorizons:NotEnoughItems:2.5.4-GTNH:dev")
implementation files("libs/+MysteriumLib-1.5.10.jar")
implementation files("libs/+MysteriumLib-1.5.10-dev.jar")
implementation "maven.modrinth:mysteriumlibunofficial:1.5.9-1.7.10"
}
Binary file not shown.
12 changes: 12 additions & 0 deletions src/main/java/mods/tesseract/underworld/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,27 @@
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import mods.tesseract.underworld.biomes.BiomeGenUnderworld;
import mods.tesseract.underworld.world.WorldProviderUnderworld;
import net.minecraft.client.renderer.EntityRenderer;
import net.minecraftforge.common.DimensionManager;
import net.tclproject.mysteriumlib.asm.common.CustomLoadingPlugin;
import net.tclproject.mysteriumlib.asm.common.FirstClassTransformer;
import net.tclproject.mysteriumlib.asm.core.MetaReader;
import net.tclproject.mysteriumlib.asm.core.MiscUtils;
import org.lwjgl.opengl.GL11;

import java.io.IOException;

@Mod(modid = "underworld", acceptedMinecraftVersions = "[1.7.10]")
public class Main extends CustomLoadingPlugin {
public static int underworld_y_offset = 120;
@Mod.EventHandler
public void preInit(FMLPreInitializationEvent e) {
try {
//System.out.println("&" + new MetaReader().getLocalVariables(EntityRenderer.class.getDeclaredMethod("setupFog", int.class, float.class)));
//System.out.println("&" + MiscUtils.getMemberInfo(GL11.class.getDeclaredMethod("glFogi", int.class, int.class)));
} catch (Exception ex) {
throw new RuntimeException(ex);
}
BiomeGenUnderworld.biome = (new BiomeGenUnderworld(26)).setColor(16711680).setBiomeName("Underworld").setDisableRain().setTemperatureRainfall(1.0F, 0.0F);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,16 @@
import net.minecraft.world.World;
import net.minecraft.world.biome.BiomeDecorator;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraft.world.gen.feature.WorldGenBigMushroom;

import java.util.Random;

public class UnderworldDecorator extends BiomeDecorator {
public UnderworldDecorator() {
super();
this.bigMushroomGen = new WorldGenBigMushroom(0);
}

@Override
public void decorateChunk(World worldIn, Random random, BiomeGenBase biome, int x, int z) {
if (this.currentWorld != null) {
Expand Down
29 changes: 26 additions & 3 deletions src/main/java/mods/tesseract/underworld/fix/FixesUnderworld.java
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
package mods.tesseract.underworld.fix;

import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import mods.tesseract.underworld.Main;
import mods.tesseract.underworld.util.ChunkPostField;
import mods.tesseract.underworld.util.RNG;
import mods.tesseract.underworld.world.ChunkProviderUnderworld;
import net.minecraft.block.Block;
import net.minecraft.client.gui.GuiIngame;
import net.minecraft.client.renderer.EntityRenderer;
import net.minecraft.init.Blocks;
import net.minecraft.world.World;
import net.minecraft.world.WorldServer;
Expand All @@ -13,6 +17,8 @@
import net.minecraftforge.common.DimensionManager;
import net.tclproject.mysteriumlib.asm.annotations.EnumReturnSetting;
import net.tclproject.mysteriumlib.asm.annotations.Fix;
import net.tclproject.mysteriumlib.asm.annotations.LocalVariable;
import org.lwjgl.opengl.GL11;

import java.util.Random;

Expand All @@ -28,13 +34,31 @@ public static void setWorld(DimensionManager c, int id, WorldServer world) {
}
}

@Fix(returnSetting = EnumReturnSetting.ON_TRUE, nullReturned = true)
@SideOnly(Side.CLIENT)
public static boolean renderVignette(GuiIngame c, float x, int y, int z) {
if (c.mc.theWorld.provider.dimensionId == -2) {
GL11.glDepthMask(true);
GL11.glEnable(2929);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
GL11.glBlendFunc(770, 771);
return true;
}
return false;
}

@Fix(insertOnInvoke = "org/lwjgl/opengl/GL11;glFogi(II)V", insertOnLine = 7)
private void setupFog(EntityRenderer c, int x, float z, @LocalVariable(index = 4) boolean flag, @LocalVariable(index = 6) float f1) {
if (!flag && c.mc.theWorld.provider.dimensionId == -2) f1 = 128;
}

@Fix(targetMethod = "<init>", insertOnLine = 1, returnSetting = EnumReturnSetting.ON_TRUE, nullReturned = true)
public static boolean Chunk(Chunk c, World world, Block[] blocks, int cx, int xz) {
int maxY = blocks.length / 256;
int base_x = c.xPosition << 4;
int base_z = c.zPosition << 4;
RNG rng = ((IWorld) world).rng;
if (world.provider.dimensionId == -2) {
RNG rng = ((IWorld) world).rng;
Random random = new Random(world.getSeed() * (long) ChunkPostField.getIntPairHash(c.xPosition, c.zPosition));
int y_offset = Main.underworld_y_offset;
double scale_xz = 0.015625;
Expand Down Expand Up @@ -153,9 +177,8 @@ public static boolean Chunk(Chunk c, World world, Block[] blocks, int cx, int xz
c.storageArrays[var10].func_150818_a(var6, var8 & 0xF, var7, var9);
if (var9.getLightValue() > 0) {
c.storageArrays[var10].setExtBlocklightValue(index, var8 & 15, var7, var9.getLightValue());
if (blocks[index + 1] == null) {
//if (blocks[index + 1] == null)
//this.addPendingBlocklightUpdate(base_x + var6, var8, base_z + var7);
}
}
}
var8 -= y_offset;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public class ChunkPostField {
private final Random random;
private final int type;
private final long hashed_type;
public long hashed_world_seed;
private long hashed_world_seed;
private final int post_max_radius_of_effect;
private final int post_max_radius_of_effect_sq;
private final int field_chunk_range;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package mods.tesseract.underworld.world;


import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import mods.tesseract.underworld.biomes.BiomeGenUnderworld;
import net.minecraft.util.Vec3;
import net.minecraft.world.WorldProvider;
Expand All @@ -10,7 +12,6 @@
public class WorldProviderUnderworld extends WorldProvider {

public void registerWorldChunkManager() {
this.isHellWorld = true;
this.hasNoSky = true;
this.dimensionId = -2;
this.worldChunkMgr = new WorldChunkManagerHell(BiomeGenUnderworld.biome, 0.0F);
Expand All @@ -21,6 +22,7 @@ public String getDimensionName() {
return "Underworld";
}

@SideOnly(Side.CLIENT)
public Vec3 getFogColor(float par1, float par2) {
int day_of_cycle = (int) ((this.worldObj.getTotalWorldTime() / 24000L) % 32);
int distance_from_peak = Math.abs(day_of_cycle - 16);
Expand All @@ -44,7 +46,16 @@ public boolean canRespawnHere() {
return false;
}

public boolean doesXZShowFog(int x, int y, int z) {
public boolean isSurfaceWorld() {
return false;
}

@SideOnly(Side.CLIENT)
public float getCloudHeight() {
return 8.0F;
}

public boolean doesXZShowFog(int x, int z) {
return true;
}
}
3 changes: 3 additions & 0 deletions src/main/resources/META-INF/underworld_at.cfg
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
public net.minecraft.world.chunk.Chunk field_76652_q # storageArrays
public net.minecraft.client.gui.GuiIngame field_73839_d # mc
public net.minecraft.client.renderer.EntityRenderer *
public net.minecraft.client.renderer.EntityRenderer *()

0 comments on commit 684c0f3

Please sign in to comment.