Jump to content

[1.12.2] Replace world renderer


Cadiboo

Recommended Posts

I'm trying to recreate no-cubes for 1.12.2. How should I go about replacing the world renderer?

I see in these classes in CosmicDan's re-implementation use a core-mod (2 IClassTransformers and an IFMLLoadingPlugin).

Spoiler

BlockTweakInjector.java

Spoiler


package com.cosmicdan.nocubes.core;

import java.util.ListIterator;
import net.minecraft.launchwrapper.IClassTransformer;
import org.objectweb.asm.ClassReader;
import org.objectweb.asm.ClassWriter;
import org.objectweb.asm.tree.AbstractInsnNode;
import org.objectweb.asm.tree.ClassNode;
import org.objectweb.asm.tree.JumpInsnNode;
import org.objectweb.asm.tree.MethodInsnNode;
import org.objectweb.asm.tree.MethodNode;
import org.objectweb.asm.tree.VarInsnNode;

import com.cosmicdan.nocubes.Main;

/*
 * Original by Click_Me
 * Reverse-engineered and re-implemented (with permission) by CosmicDan
 * 
 */
public class BlockTweakInjector implements IClassTransformer {
       public byte[] transform(String name, String transformedName, byte[] bytes) {
              if(bytes == null) {
                 return null;
              } else if(!"net.minecraft.block.Block".equals(name)) {
                 return bytes;
              } else {
                 ClassNode classNode = new ClassNode();
                 ClassReader classReader = new ClassReader(bytes);
                 classReader.accept(classNode, 8);
                 MethodNode targetMethod = null;

                 for(MethodNode methodNode : classNode.methods) {
                    if(methodNode.name.equals("shouldSideBeRendered") && methodNode.desc.equals("(Lnet/minecraft/world/IBlockAccess;IIII)Z")) {
                       targetMethod = methodNode;
                       break;
                    }
                 }

                 if(targetMethod == null) {
                    return bytes;
                 } else {
                    //Main.LOGGER.warn("~~~ Inside the Block class: " + name);
                    MethodNode injectedMethod = new MethodNode();
                    ListIterator iterator = targetMethod.instructions.iterator();
                    int varCount = 0;

                    while(iterator.hasNext()) {
                       AbstractInsnNode instruction = (AbstractInsnNode)iterator.next();
                       
                       if(instruction.getOpcode() == 165) {
                          JumpInsnNode jumpInsnNode = (JumpInsnNode)instruction;
                          targetMethod.instructions.insert(instruction, new JumpInsnNode(154, jumpInsnNode.label));
                          targetMethod.instructions.insert(instruction, new MethodInsnNode(184, "com/cosmicdan/nocubes/Main", "shouldSmooth", "(Lnet/minecraft/block/Block;)Z"));
                          targetMethod.instructions.insert(instruction, new VarInsnNode(25, 24));
                          //Main.LOGGER.warn("~~~ Inserted instructions extra check");
                       }
                       

                       if(instruction.getOpcode() == 21) {
                          VarInsnNode varInsnNode = (VarInsnNode)instruction;
                          if(varInsnNode.var == 19) {
                             ++varCount;
                             if(varCount == 2) {
                                targetMethod.instructions.insertBefore(instruction, injectedMethod.instructions);
                                //Main.LOGGER.warn("~~~ Inserted instructions render hook");
                             }
                          }
                       }
                    }

                    ClassWriter writer = new ClassWriter(3);
                    classNode.accept(writer);
                    return writer.toByteArray();
                 }
              }
           }
        }

CorePlugin.java

Spoiler


package com.cosmicdan.nocubes.core;

import java.util.Map;

import net.minecraftforge.fml.relauncher.IFMLLoadingPlugin;

@IFMLLoadingPlugin.Name(value = "NoCubesCore")
@IFMLLoadingPlugin.MCVersion(value = "1.7.10")
@IFMLLoadingPlugin.TransformerExclusions(value = "com.cosmicdan.nocubes.")
@IFMLLoadingPlugin.SortingIndex(value = 1001) // How early your core mod is called - Use > 1000 to work with srg names
public class CorePlugin implements IFMLLoadingPlugin {
    @Override
    public String[] getASMTransformerClass() {
        return new String[]{
          WorldRenderInjector.class.getName(),
          BlockTweakInjector.class.getName()
        };
    }

    @Override
    public String getModContainerClass() {
        // TODO Auto-generated method stub
        return null;
    }

    @Override
    public String getSetupClass() {
        // TODO Auto-generated method stub
        return null;
    }

    @Override
    public void injectData(Map<String, Object> data) {
        // TODO Auto-generated method stub
        
    }

    @Override
    public String getAccessTransformerClass() {
        // TODO Auto-generated method stub
        return null;
    }
}

WorldRenderInjector.java

Spoiler


package com.cosmicdan.nocubes.core;

import java.util.ListIterator;
import net.minecraft.launchwrapper.IClassTransformer;
import org.objectweb.asm.ClassReader;
import org.objectweb.asm.ClassWriter;
import org.objectweb.asm.Label;
import org.objectweb.asm.tree.AbstractInsnNode;
import org.objectweb.asm.tree.ClassNode;
import org.objectweb.asm.tree.JumpInsnNode;
import org.objectweb.asm.tree.MethodInsnNode;
import org.objectweb.asm.tree.MethodNode;
import org.objectweb.asm.tree.VarInsnNode;

import com.cosmicdan.nocubes.Main;

/*
 * Original by Click_Me
 * Reverse-engineered and re-implemented (with permission) by CosmicDan
 * 
 */
public class WorldRenderInjector implements IClassTransformer {
   public byte[] transform(String name, String transformedName, byte[] bytes) {
      if(bytes == null) {
         return null;
      //} else if(!"blo".equals(name)) {
      } else if(!"net.minecraft.client.renderer.WorldRenderer".equals(name)) {
         return bytes;
      } else {
         ClassNode classNode = new ClassNode();
         ClassReader classReader = new ClassReader(bytes);
         classReader.accept(classNode, 8);
         MethodNode targetMethod = null;

         for(MethodNode methodNode : classNode.methods) {
            //if(methodNode.name.equals("a") && methodNode.desc.equals("(Lsv;)V")) {
            //if(methodNode.name.equals("func_147892_a") && methodNode.desc.equals("(Lnet/minecraft/entity/EntityLivingBase;)V")) {
            if(methodNode.name.equals("updateRenderer") && methodNode.desc.equals("(Lnet/minecraft/entity/EntityLivingBase;)V")) {
               targetMethod = methodNode;
               break;
            }
         }

         if(targetMethod == null) {
            return bytes;
         } else {
            //Main.LOGGER.warn("~~~ Inside the WorldRenderer class: " + name);
            MethodNode injectedMethod = new MethodNode();
            Label label0 = new Label();
            injectedMethod.visitLabel(label0);
            injectedMethod.visitVarInsn(21, 20);
            Label label1 = new Label();
            injectedMethod.visitJumpInsn(154, label1);
            Label label2 = new Label();
            injectedMethod.visitLabel(label2);
            injectedMethod.visitInsn(4);
            injectedMethod.visitVarInsn(54, 20);
            Label label3 = new Label();
            injectedMethod.visitLabel(label3);
            injectedMethod.visitVarInsn(25, 0);
            injectedMethod.visitVarInsn(21, 17);
            //injectedMethod.visitMethodInsn(183, "blo", "b", "(I)V");
            injectedMethod.visitMethodInsn(183, "net/minecraft/client/renderer/WorldRenderer", "preRenderBlocks", "(I)V");
            injectedMethod.visitLabel(label1);
            injectedMethod.visitFrame(2, 1, (Object[])null, 0, (Object[])null);
            injectedMethod.visitVarInsn(21, 19);
            injectedMethod.visitVarInsn(21, 17);
            injectedMethod.visitVarInsn(21, 2);
            injectedMethod.visitVarInsn(21, 3);
            injectedMethod.visitVarInsn(21, 4);
            injectedMethod.visitVarInsn(25, 15);
            injectedMethod.visitVarInsn(25, 16);
            injectedMethod.visitMethodInsn(184, "com/cosmicdan/nocubes/renderer/SurfaceNets", "renderChunk", "(IIIILnet/minecraft/world/IBlockAccess;Lnet/minecraft/client/renderer/RenderBlocks;)Z");
            injectedMethod.visitInsn(128);
            injectedMethod.visitVarInsn(54, 19);
            ListIterator iterator = targetMethod.instructions.iterator();
            int varCount = 0;

            while(iterator.hasNext()) {
               AbstractInsnNode instruction = (AbstractInsnNode)iterator.next();
               if(instruction.getOpcode() == 165) {
                  JumpInsnNode jumpInsnNode = (JumpInsnNode)instruction;
                  targetMethod.instructions.insert(instruction, new JumpInsnNode(154, jumpInsnNode.label));
                  targetMethod.instructions.insert(instruction, new MethodInsnNode(184, "com/cosmicdan/nocubes/Main", "shouldSmooth", "(Lnet/minecraft/block/Block;)Z"));
                  targetMethod.instructions.insert(instruction, new VarInsnNode(25, 24));
                  //Main.LOGGER.warn("~~~~ Inserted instructions extra check");
               }

               if(instruction.getOpcode() == 21) {
                  VarInsnNode varInsnNode = (VarInsnNode)instruction;
                  if(varInsnNode.var == 19) {
                     ++varCount;
                     if(varCount == 2) {
                        targetMethod.instructions.insertBefore(instruction, injectedMethod.instructions);
                        //Main.LOGGER.warn("~~~ Inserted instructions render hook");
                     }
                  }
               }
            }

            ClassWriter writer = new ClassWriter(3);
            classNode.accept(writer);
            return writer.toByteArray();
         }
      }
   }
}

 

I don't know anything about ASM, and I've heard its a massive pain. Would I be able to do this with reflection (or even better with registry events, though I don't think this is possible).

I just want to get a working world renderer (my one one) that works exactly like vanilla before trying to do anything with block smoothing.

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

Link to comment
Share on other sites

1 hour ago, Cadiboo said:

I don't know anything about ASM, and I've heard its a massive pain. Would I be able to do this with reflection (or even better with registry events, though I don't think this is possible). 

To be honest with you, ASM might be easier, but I believe that it can be done with reflection. The world renderers(BufferBuilder instances) are stored in an instance of RegionRenderCacheBuilder within an array that is mapped to BlockRenderLayer(its an enum). Which are then stored in ChunkRenderWorker and ChunkCompileTaskGenerator. The former is stored in ChunkRenderDispatcher, and I believe this is where it is mainly stored. Not sure where you can/should access these with reflection. The instance of ChunkRenderDispatcher is stored in RenderGlobal, which has a public instance in the Minecraft class.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Link to comment
Share on other sites

I want to do it without a core-mod for increased compatibility (haha its changing the entire rendering engine) and so that I don't have to use ASM. Can you explain in detail how the renderer works or tell me somewhere that does? As I understand it every time a block state in a chunk (16x16x16) is changed the renderer builds 1 big thing that can be passed directly to the GPU out of all the baked models in the chunk & caches this thing until a block state changes again. How it does any of this I have no idea.

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

Link to comment
Share on other sites

4 minutes ago, Cadiboo said:

I want to do it without a core-mod for increased compatibility (haha its changing the entire rendering engine) and so that I don't have to use ASM. Can you explain in detail how the renderer works or tell me somewhere that does? As I understand it every time a block state in a chunk (16x16x16) is changed the renderer builds 1 big thing that can be passed directly to the GPU out of all the baked models in the chunk & caches this thing until a block state changes again. How it does any of this I have no idea.

I don't believe you will have to worry about when it is rebuilt, but I can't quite tell you how it works as I have not even looked at this. Though I believe you will just need to handle the building aspect of the rendering. The "one thing" that is passed to the GPU is just all of the vertex data, texture ids, texture uv mappings, etc. But it is done in mass to reduce the amount of times it has to do this.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Link to comment
Share on other sites

No offense but it is kinda weird to be aiming to "replace the world renderer" and then asking questions about what the renderer even does...seems a bit ambitious versus your understanding.

 

What are you trying to accomplish specifically? There are a lot of render events to hook into, plus as mentioned it is possible to use combination of public instance fields and reflection to actually replace things (could just replace the RenderGlobal I guess). But it is a "big hammer" to apply.

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

Link to comment
Share on other sites

This is what I'm trying to achieve.

maxresdefault.jpg

@jabelar No offence taken, this is a pretty big project and I'm out of my depth.

In 1.7 (which is the MC version the old mod was ported to (not written for - theres a good story there)) there was an actual WorldRender class that was modified with ASM (I think, as I've said I've never used ASM, but that looks like what I expect it to be)

Edited by Cadiboo

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

Link to comment
Share on other sites

Oh and another thing I don't want to just change the graphics I also want to make the all the blocks (collision at least) bounding boxes change with the terrain, but this should be much easier than the graphics. (Once I've learned the ASM I'll need to edit wherever block#addCollsionBoundingBoxesToList is called)

Edited by Cadiboo

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

Link to comment
Share on other sites

On 9/22/2018 at 1:23 AM, Animefan8888 said:

To be honest with you, ASM might be easier, but I believe that it can be done with reflection. The world renderers(BufferBuilder instances) are stored in an instance of RegionRenderCacheBuilder within an array that is mapped to BlockRenderLayer(its an enum). Which are then stored in ChunkRenderWorker and ChunkCompileTaskGenerator. The former is stored in ChunkRenderDispatcher, and I believe this is where it is mainly stored. Not sure where you can/should access these with reflection. The instance of ChunkRenderDispatcher is stored in RenderGlobal, which has a public instance in the Minecraft class.

I’ve never used ASM before and only used really basic reflection, could you provide any examples of code that modifies a vanilla field / replaces vanilla code? I just need to replace whatever renders blocks as squares (with their models)

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

Link to comment
Share on other sites

Please do not instruct how to use ASM on the forums. Doing ASM wrong leaves your code fragile and prone to breaking unexpectedly, especially when other mods get involved, and when Minecraft crashes there will be no evidence that its YOUR code that caused the problem.

 

If you do not know how to use ASM already, then you should not be using ASM.

  • Like 1
  • Thanks 1

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

1 hour ago, Cadiboo said:

I’ve never used ASM before and only used really basic reflection, could you provide any examples of code that modifies a vanilla field / replaces vanilla code? I just need to replace whatever renders blocks as squares (with their models)

I agree with draco18s, so to tell you how to do the reflection part, ReflectionHelper has a setField or setValue. No replacing vanilla code just the instance that houses it.

Edited by Animefan8888

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Link to comment
Share on other sites

17 minutes ago, Draco18s said:

If you do not know how to use ASM already, then you should not be using ASM.

So as a programmer, I should never learn ASM even when writing other applications as I should never have to use it if I’m writing decent code?

 

10 minutes ago, Animefan8888 said:

to tell you how to do the reflection part, ReflectionHelper has a setField or setValue.

I’ve used such methods before for small replacements in ItemRendering & similar stuff, I was looking for an open source mod (off the top of anyone’s head) that overwrites some large part of vanilla’s code while still maintaining compatibility with other mods and using good code practices. (I realise that there might not be any mods that meet these requirements)

 

13 minutes ago, Animefan8888 said:

No replacing vanilla code just the instance that houses it.

I assume I’m going to have to make my own chunkRenderDispatcher (and build all the rendering from the ground up), replace the instance stored in RenderGlobal as you said, and make an API for mod interoperability. 

 

My first priority is just replacing the renderer so I can start testing.

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

Link to comment
Share on other sites

I was massively overthinking this aha, thanks so much @jabelar for your comment on some old thread that I was reading for no reason about how Minecraft.renderGlobal is public.

What I've done is massively overkill but I've just made a new RenderGlobal called ModRenderGlobal that is an exact copy of RenderGlobal (with all the methods and variables changed to public). I also had to make a copy of ViewFrustum because of it having a package method required by my RenderGlobal.

Here is my final code

@EventHandler
public void init(final FMLInitializationEvent event) {
	try {
		Minecraft.getMinecraft().renderGlobal = new ModRenderGlobal(Minecraft.getMinecraft());
		LOGGER.info("Successfully replaced Minecraft's RenderGlobal");
	} catch (final Throwable throwable) {
		LOGGER.error("Failed to replace Minecraft's RenderGlobal");
		// This should only happen rarely (never honestly) - so printing the Stack Trace shoudn't spam any logs
		throwable.printStackTrace();
		// TODO: throw the throwable? Maybe, keep it commented out for now
		// throw throwable;
	}
}

Which can be reduced to

@EventHandler
public void init(final FMLInitializationEvent event) {
	Minecraft.getMinecraft().renderGlobal = new ModRenderGlobal(Minecraft.getMinecraft());
}

And here is the final result - I'll probably post my results of the actual rendering here if I get it to work

1004207894_ScreenShot2018-09-25at4_06_37pm.thumb.png.2a6b394679f42c720087ce8fd5c7d056.png1771091692_ScreenShot2018-09-25at4_06_53pm.thumb.png.4d9cbebd9205b817be81685569696136.png

Thanks everyone for their help!

  • Like 1

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

Link to comment
Share on other sites

Unless you want your mod to be client-side only you can't do this

4 hours ago, Cadiboo said:

Minecraft.getMinecraft().renderGlobal = new ModRenderGlobal(Minecraft.getMinecraft());

in the FMLInitializationEvent.

And you do not want your mod to be client-only since you are planning to have dynamic collision boxes for your non-cubes. And the server needs to know about those.

Link to comment
Share on other sites

12 minutes ago, V0idWa1k3r said:

Unless you want your mod to be client-side only you can't do this

in the FMLInitializationEvent.

And you do not want your mod to be client-only since you are planning to have dynamic collision boxes for your non-cubes. And the server needs to know about those.

Yeah, right now its client side only - I want to recreate the original NoCubes before I add any features. Obviously I'll change this once I start adding stuff. Thanks for pointing it out though!

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

Link to comment
Share on other sites

I've had to copy & paste pretty much the entirety of Minecraft's rendering code (10 11 12 classes so far) just to add 2 hooks (Events) in RenderGlobal & BlockRenderDispatcher which is exactly 5 lines of modified code, should I learn ASM or make a PR to forge?

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

Link to comment
Share on other sites

3 minutes ago, V0idWa1k3r said:

If you think that these events will be usefull in any other scenario for modmakers then make a PR. New usefull events are always welcome.

Do you think anyone else will ever want to change how a chunk renders?

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

Link to comment
Share on other sites

I can see a use-case where someone wants to modify how terrain is rendered but not with the same rendering algorithm that I use. This is basically just a cancelable & block-exclusive version of RenderWorldLastEvent

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

Link to comment
Share on other sites

10 hours ago, Cadiboo said:

So as a programmer, I should never learn ASM even when writing other applications as I should never have to use it if I’m writing decent code?

ASM is java code that lets you modify java code while it's running. It's literally dangerous if not done correctly.

 

But in the vast majority of situations you ever find yourself in, ASM is not needed. The order of things to try first goes:

 

  1. Own code (extending, implementing)
  2. Events (handle existing hooks)
  3. Reflection (access private values)
  4. Making a PR to Forge to insert new events (and then doing #2)
  5. Not doing anything at all (stop touching it)
  6. Starting a new project (I said stop)
  7. ASM
  • Like 2

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

9 hours ago, Draco18s said:

Starting a new project (I said stop)

I found this youtube clip https://www.youtube.com/watch?v=Yek5Fu1cX7I

9 hours ago, Draco18s said:

Making a PR to Forge to insert new events (and then doing #2)

I'm trying to do this, but it probably won't get accepted (The way about going about the actual rendering inside the event is very technical & not straight forward) hence my questions about ASM.

Also am I allowed change protected Vanilla Minecraft methods to public in a PR?

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

Link to comment
Share on other sites

51 minutes ago, Cadiboo said:
10 hours ago, Draco18s said:

Starting a new project (I said stop)

I found this youtube clip https://www.youtube.com/watch?v=Yek5Fu1cX7I

And? Not sure how that's relevant to what I said.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

1 minute ago, Draco18s said:

And? Not sure how that's relevant to what I said.

Its not exactly - If you watch the video its a clip of development of a game that uses Marching Cubes to make their voxel terrain render smoothly - Exactly the same thing as I'm doing to MC

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

Link to comment
Share on other sites

Great! That doesn't explain how they replaced the renderer.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

5 hours ago, Draco18s said:

Great! That doesn't explain how they replaced the renderer.

They didn't. You said "Start a new project". Someone made their own game with their own renderer.

  • Haha 1

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.