From 02a6aa4a24662815664ad86cb81d2a3f167775d7 Mon Sep 17 00:00:00 2001 From: makamys Date: Tue, 10 Mar 2020 22:54:52 +0100 Subject: Initial commit (basic Mixin setup) --- src/main/java/makamys/lodmod/LODMod.java | 45 ++++++++++++++++++++++ .../java/makamys/lodmod/mixin/IRenderGlobal.java | 26 +++++++++++++ .../makamys/lodmod/mixin/MixinSoundManager.java | 22 +++++++++++ src/main/resources/lodmod.mixin.json | 11 ++++++ src/main/resources/mcmod.info | 15 ++++++++ 5 files changed, 119 insertions(+) create mode 100644 src/main/java/makamys/lodmod/LODMod.java create mode 100644 src/main/java/makamys/lodmod/mixin/IRenderGlobal.java create mode 100644 src/main/java/makamys/lodmod/mixin/MixinSoundManager.java create mode 100644 src/main/resources/lodmod.mixin.json create mode 100644 src/main/resources/mcmod.info (limited to 'src/main') diff --git a/src/main/java/makamys/lodmod/LODMod.java b/src/main/java/makamys/lodmod/LODMod.java new file mode 100644 index 0000000..c31a5d7 --- /dev/null +++ b/src/main/java/makamys/lodmod/LODMod.java @@ -0,0 +1,45 @@ +package makamys.lodmod; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.OpenGlHelper; +import net.minecraft.client.renderer.texture.TextureManager; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.init.Blocks; +import net.minecraft.launchwrapper.Launch; +import net.minecraft.util.MathHelper; +import net.minecraft.util.ResourceLocation; +import net.minecraftforge.common.MinecraftForge; + +import java.nio.IntBuffer; + +import org.lwjgl.BufferUtils; +import org.lwjgl.opengl.GL11; +import org.lwjgl.opengl.GL12; + +import cpw.mods.fml.common.FMLCommonHandler; +import cpw.mods.fml.common.Mod; +import cpw.mods.fml.common.Mod.EventHandler; +import cpw.mods.fml.common.event.FMLInitializationEvent; +import cpw.mods.fml.common.event.FMLPreInitializationEvent; +import cpw.mods.fml.common.eventhandler.SubscribeEvent; +import cpw.mods.fml.common.gameevent.TickEvent.ClientTickEvent; +import makamys.lodmod.mixin.IRenderGlobal; + +@Mod(modid = LODMod.MODID, version = LODMod.VERSION) +public class LODMod +{ + public static final String MODID = "lodmod"; + public static final String VERSION = "0.0"; + + @EventHandler + public void init(FMLInitializationEvent event) + { + FMLCommonHandler.instance().bus().register(this); + } + + @SubscribeEvent + public void onClientTick(ClientTickEvent event) { + + } +} diff --git a/src/main/java/makamys/lodmod/mixin/IRenderGlobal.java b/src/main/java/makamys/lodmod/mixin/IRenderGlobal.java new file mode 100644 index 0000000..d5ac050 --- /dev/null +++ b/src/main/java/makamys/lodmod/mixin/IRenderGlobal.java @@ -0,0 +1,26 @@ +package makamys.lodmod.mixin; + +import java.nio.IntBuffer; +import java.util.ArrayList; +import java.util.List; + +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.gen.Accessor; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.multiplayer.WorldClient; +import net.minecraft.client.renderer.RenderBlocks; +import net.minecraft.client.renderer.RenderGlobal; +import net.minecraft.client.renderer.WorldRenderer; +import net.minecraft.client.renderer.texture.TextureManager; +import net.minecraft.entity.Entity; +import net.minecraft.util.ResourceLocation; +import net.minecraft.world.IWorldAccess; + +@Mixin(RenderGlobal.class) +public interface IRenderGlobal { + @Accessor("cloudTickCounter") + int cloudTickCounter(); +} \ No newline at end of file diff --git a/src/main/java/makamys/lodmod/mixin/MixinSoundManager.java b/src/main/java/makamys/lodmod/mixin/MixinSoundManager.java new file mode 100644 index 0000000..3cdb58b --- /dev/null +++ b/src/main/java/makamys/lodmod/mixin/MixinSoundManager.java @@ -0,0 +1,22 @@ +package makamys.lodmod.mixin; + +import java.util.List; + +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +import net.minecraft.client.audio.SoundManager; + + +@Mixin(SoundManager.class) +abstract class MixinSoundManager { + + @Inject(method = "*", at = @At("RETURN")) + private void onConstructed(CallbackInfo ci) { + System.out.println("(MIXIN EXAMPLE) Running injector mixin for SoundManager constructor!"); + } + + +} diff --git a/src/main/resources/lodmod.mixin.json b/src/main/resources/lodmod.mixin.json new file mode 100644 index 0000000..d8455bf --- /dev/null +++ b/src/main/resources/lodmod.mixin.json @@ -0,0 +1,11 @@ +{ + "required": true, + "minVersion": "0.6", + "package": "makamys.lodmod.mixin", + "refmap": "lodmod.mixin.refmap.json", + "compatibilityLevel": "JAVA_8", + "mixins": [ + "MixinSoundManager", + "IRenderGlobal" + ] +} diff --git a/src/main/resources/mcmod.info b/src/main/resources/mcmod.info new file mode 100644 index 0000000..7d06cb6 --- /dev/null +++ b/src/main/resources/mcmod.info @@ -0,0 +1,15 @@ +[ +{ + "modid": "lodmod", + "name": "LOD mod", + "description": "Increases render distance by rendering distant chunks with a low level of detail", + "version": "${version}", + "mcversion": "${mcversion}", + "url": "", + "updateUrl": "", + "authorList": ["makamys"], + "logoFile": "", + "screenshots": [], + "dependencies": [] +} +] -- cgit