Jump to content
  • Home
  • Files
  • Docs
  • Merch
Topics
  • All Content

  • This Topic
  • This Forum

  • Advanced Search
  • Existing user? Sign In  

    Sign In



    • Not recommended on shared computers


    • Forgot your password?

  • Sign Up
  • All Activity
  • Home
  • Mod Developer Central
  • Modder Support
  • [1.8][SOLVED]Reflection - Am I doing it right?
1.13 Update Notes for Mod Creators
Sign in to follow this  
Followers 1
gummby8

[1.8][SOLVED]Reflection - Am I doing it right?

By gummby8, April 11, 2016 in Modder Support

  • Reply to this topic
  • Start new topic

Recommended Posts

gummby8    26

gummby8

gummby8    26

  • Diamond Finder
  • gummby8
  • Members
  • 26
  • 479 posts
Posted April 11, 2016

So this is a first for me, trying to use reflection.

 

I am trying to set the shader for a client when they right click an item.

 

Dinking around in minecraft one day I saw that the "Secret Settings..." Button would change the shader to give some interesting visual effects. I wanted to use that without having the randomness.

 

in the gui the button does this

 

 

    public void activateNextShader()
    {
        if (OpenGlHelper.shadersSupported)
        {
            if (this.mc.getRenderViewEntity() instanceof EntityPlayer)
            {
                if (this.theShaderGroup != null)
                {
                    this.theShaderGroup.deleteShaderGroup();
                }

                this.shaderIndex = (this.shaderIndex + 1) % (shaderResourceLocations.length + 1);

                if (this.shaderIndex != shaderCount)
                {
                    this.loadShader(shaderResourceLocations[this.shaderIndex]);
                }
                else
                {
                    this.theShaderGroup = null;
                }
            }
        }
    }

 

 

 

 

That in turn does

 

 

    private void loadShader(ResourceLocation p_175069_1_)
    {
        try
        {
            this.theShaderGroup = new ShaderGroup(this.mc.getTextureManager(), this.resourceManager, this.mc.getFramebuffer(), p_175069_1_);
            this.theShaderGroup.createBindFramebuffers(this.mc.displayWidth, this.mc.displayHeight);
            this.useShader = true;
        }
        catch (IOException ioexception)
        {
            logger.warn("Failed to load shader: " + p_175069_1_, ioexception);
            this.shaderIndex = shaderCount;
            this.useShader = false;
        }
        catch (JsonSyntaxException jsonsyntaxexception)
        {
            logger.warn("Failed to load shader: " + p_175069_1_, jsonsyntaxexception);
            this.shaderIndex = shaderCount;
            this.useShader = false;
        }
    }

 

 

 

loadShader is private so I thought I would try reflection.

 

The code below works. Just wondering if this is the best way to go about doing this.

 

    public ItemStack onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPlayer playerIn)
    {
    	
    	
    	if (worldIn.isRemote){
        
    	try {
			load = EntityRenderer.class.getDeclaredMethod("loadShader", ResourceLocation.class);
		} catch (NoSuchMethodException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (SecurityException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
    	
    		load.setAccessible(true);
    	
    		try {
			load.invoke(Minecraft.getMinecraft().entityRenderer, new ResourceLocation("shaders/post/invert.json"));
		} catch (IllegalAccessException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IllegalArgumentException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (InvocationTargetException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

    	}
    	
        return itemStackIn;
        
    }

  • Quote

Share this post


Link to post
Share on other sites

Ernio    597

Ernio

Ernio    597

  • Reality Controller
  • Ernio
  • Forge Modder
  • 597
  • 2638 posts
Posted April 11, 2016

As in plain java - yeah, why not.

 

As in modding - you NEED to use ObfuscationReflectionHelper and its methods.

After releasing a mod standard reflection will not work.

 

Also:

I am not sure but I think (I heard it somewhere) that secret settings were removed in 1.8.9 or 1.9. Idk really.

  • Quote

Share this post


Link to post
Share on other sites

BusyBeever    26

BusyBeever

BusyBeever    26

  • Creeper Killer
  • BusyBeever
  • Members
  • 26
  • 201 posts
Posted April 11, 2016

Correct me if im wrong but the helper does not have a mapping of the obfuscated names

  • Quote

Share this post


Link to post
Share on other sites

BusyBeever    26

BusyBeever

BusyBeever    26

  • Creeper Killer
  • BusyBeever
  • Members
  • 26
  • 201 posts
Posted April 11, 2016

also you should not find the find field every time the item is rightclicked. do it once and reuse the field u get

  • Quote

Share this post


Link to post
Share on other sites

Draco18s    2090

Draco18s

Draco18s    2090

  • Reality Controller
  • Draco18s
  • Members
  • 2090
  • 14008 posts
Posted April 11, 2016

Couple things:

That references a client-slide-only object, you should move that whole reflection chunk into your Client Proxy and do MainModClass.instance.proxy.doTheThing(), this might even avoid the need for reflection in the first place.

 

Two, don't reflect the field more than once.  Once you have a reference, save it! Then you don't have to do the expensive reflection call ever again.

 

Three, that doesn't take into account the SRG name that Minecraft's source code will have once your mod is compiled, so even on the client it'll fail to locate the method.

  • Quote

Share this post


Link to post
Share on other sites

jeffryfisher    182

jeffryfisher

jeffryfisher    182

  • World Shaper
  • jeffryfisher
  • Members
  • 182
  • 1283 posts
Posted April 11, 2016

you NEED to use ObfuscationReflectionHelper and its methods.

After releasing a mod standard reflection will not work.

A couple of my mods use reflection on vanilla classes. They compile and work fine even though I've never heard of ObfuscationReflectionHelper. Did I just get lucky, or might the helper be needed only for certain advanced reflection techniques that won't work without it?

  • Quote

Share this post


Link to post
Share on other sites

Choonster    1623

Choonster

Choonster    1623

  • Reality Controller
  • Choonster
  • Forge Modder
  • 1623
  • 5050 posts
Posted April 12, 2016

you NEED to use ObfuscationReflectionHelper and its methods.

After releasing a mod standard reflection will not work.

A couple of my mods use reflection on vanilla classes. They compile and work fine even though I've never heard of ObfuscationReflectionHelper. Did I just get lucky, or might the helper be needed only for certain advanced reflection techniques that won't work without it?

 

Any time you use reflection to access a vanilla field/method, you need to try both its MCP and SRG names. You can do this manually with Java's standard reflection API or use

ObfuscationReflectionHelper

, which makes things easier by taking multiple names for a field/method and trying each of them.

  • Quote

Share this post


Link to post
Share on other sites

gummby8    26

gummby8

gummby8    26

  • Diamond Finder
  • gummby8
  • Members
  • 26
  • 479 posts
Posted April 12, 2016

As per the norm I have done something wrong.

 

    	if (worldIn.isRemote){
    	ObfuscationReflectionHelper.setPrivateValue(EntityRenderer.class, Minecraft.getMinecraft().entityRenderer, new ResourceLocation("shaders/post/invert.json"), "loadShader", "p_175069_1_");
    	}

 

Problem is this is meant to set a field, how can I get it to use a private method like I was before?

 

I didn't see any methods in the ObfuscationReflectionHelper that will help me use a private method from vanilla minecraft.

  • Quote

Share this post


Link to post
Share on other sites

Choonster    1623

Choonster

Choonster    1623

  • Reality Controller
  • Choonster
  • Forge Modder
  • 1623
  • 5050 posts
Posted April 12, 2016

Instead of using

ObfuscationReflectionHelper

, use

ReflectionHelper

. This has

findField

and

findMethod

methods to get a

Field

or

Method

, respectively.

 

Use these methods and store the

Field

/

Method

in a static final field. Use this stored reference to get/set the field's value or invoke the method.

  • Quote

Share this post


Link to post
Share on other sites

gummby8    26

gummby8

gummby8    26

  • Diamond Finder
  • gummby8
  • Members
  • 26
  • 479 posts
Posted April 12, 2016

Welp, it works in Eclipse, but crashes a server or client after compiled

 

Item

package com.Splosions.ModularBosses.items;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;

import com.Splosions.ModularBosses.client.entity.EntityCartographer;
import com.Splosions.ModularBosses.client.entity.EntityCustomFallingBlock;
import com.Splosions.ModularBosses.client.entity.projectile.EntityChorpSlimeBlob;
import com.Splosions.ModularBosses.client.models.item.ModelLegendsSword;
import com.Splosions.ModularBosses.client.render.items.ModelItemLegendsSword;
import com.Splosions.ModularBosses.util.Schematic;
import com.Splosions.ModularBosses.world.PortalLandingWorldData;
import com.google.gson.JsonSyntaxException;

import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.EntityRenderer;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.shader.ShaderGroup;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumAction;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemSword;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
import net.minecraft.world.WorldSavedData;
import net.minecraft.world.storage.MapStorage;
import net.minecraftforge.fml.common.ObfuscationReflectionHelper;
import net.minecraftforge.fml.relauncher.ReflectionHelper;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import java.lang.reflect.*;



public class ItemLegendsSword extends ItemSword {

private static final Method f_loadShader = ReflectionHelper.findMethod(EntityRenderer.class, Minecraft.getMinecraft().entityRenderer, new String[]{"loadShader", "func_148042_a"}, ResourceLocation.class);

public ItemLegendsSword(ToolMaterial material) {
	super(material);
}

    /**
     * Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer
     */
    public ItemStack onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPlayer playerIn)
    {
    	if (worldIn.isRemote){
    	
    		try {
			f_loadShader.invoke(Minecraft.getMinecraft().entityRenderer, new ResourceLocation("shaders/post/sobel.json"));
		} catch (IllegalAccessException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IllegalArgumentException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (InvocationTargetException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
    		
    	}


    	
        return itemStackIn;
        
    }

    
}

 

I got "func_148042_a" from http://export.mcpbot.bspk.rs/  mcp_stable-18-1.8.zip

 

 

Crash report

 

[20:01:56] [server thread/INFO] [FML]: Injecting itemstacks
[20:01:56] [server thread/INFO] [FML]: Itemstack injection complete
[20:01:56] [server thread/ERROR] [FML]: Fatal errors were detected during the transition from PREINITIALIZATION to INITIALIZATION. Loading cannot continue
[20:01:56] [server thread/ERROR] [FML]: 
States: 'U' = Unloaded 'L' = Loaded 'C' = Constructed 'H' = Pre-initialized 'I' = Initialized 'J' = Post-initialized 'A' = Available 'D' = Disabled 'E' = Errored
UCH	mcp{9.05} [Minecraft Coder Pack] (minecraft.jar) 
UCH	FML{8.0.99.99} [Forge Mod Loader] (forge.jar) 
UCH	Forge{11.14.4.1563} [Minecraft Forge] (forge.jar) 
UCH	zeldaswordskills{1.8-3.0.3b} [Zelda Sword Skills] (1.8-zeldaswordskills-3.0.3b.jar) 
UCH	LunatriusCore{1.1.2.30} [LunatriusCore] (LunatriusCore-1.8-1.1.2.30-universal.jar) 
UCE	mb{1.0} [Modular Bosses] (mb-1.0.jar) 
UCH	Schematica{1.7.7.140} [schematica] (Schematica-1.8-1.7.7.140-universal.jar) 
UCH	worldedit{6.1} [WorldEdit] (worldedit-forge-mc1.8-6.1.jar) 
[20:01:56] [server thread/ERROR] [FML]: The following problems were captured during this phase
[20:01:56] [server thread/ERROR] [FML]: Caught exception from mb
java.lang.NoClassDefFoundError: net/minecraft/client/renderer/EntityRenderer
at com.Splosions.ModularBosses.items.ItemLegendsSword.<clinit>(ItemLegendsSword.java:43) ~[itemLegendsSword.class:?]
at com.Splosions.ModularBosses.items.ModularBossesItems.init(ModularBossesItems.java:97) ~[ModularBossesItems.class:?]
at com.Splosions.ModularBosses.ModularBosses.preInit(ModularBosses.java:38) ~[ModularBosses.class:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_73]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_73]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_73]
at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_73]
at net.minecraftforge.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:553) ~[forge.jar:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_73]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_73]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_73]
at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_73]
at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) ~[minecraft_server.1.8.jar:?]
at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) ~[minecraft_server.1.8.jar:?]
at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) ~[minecraft_server.1.8.jar:?]
at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) ~[minecraft_server.1.8.jar:?]
at com.google.common.eventbus.EventBus.post(EventBus.java:275) ~[minecraft_server.1.8.jar:?]
at net.minecraftforge.fml.common.LoadController.sendEventToModContainer(LoadController.java:212) ~[forge.jar:?]
at net.minecraftforge.fml.common.LoadController.propogateStateMessage(LoadController.java:190) ~[forge.jar:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_73]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_73]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_73]
at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_73]
at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) ~[minecraft_server.1.8.jar:?]
at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) ~[minecraft_server.1.8.jar:?]
at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) ~[minecraft_server.1.8.jar:?]
at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) ~[minecraft_server.1.8.jar:?]
at com.google.common.eventbus.EventBus.post(EventBus.java:275) ~[minecraft_server.1.8.jar:?]
at net.minecraftforge.fml.common.LoadController.distributeStateMessage(LoadController.java:119) [LoadController.class:?]
at net.minecraftforge.fml.common.Loader.preinitializeMods(Loader.java:550) [Loader.class:?]
at net.minecraftforge.fml.server.FMLServerHandler.beginServerLoading(FMLServerHandler.java:88) [FMLServerHandler.class:?]
at net.minecraftforge.fml.common.FMLCommonHandler.onServerStart(FMLCommonHandler.java:355) [FMLCommonHandler.class:?]
at net.minecraft.server.dedicated.DedicatedServer.func_71197_b(DedicatedServer.java:117) [po.class:?]
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:438) [MinecraftServer.class:?]
at java.lang.Thread.run(Unknown Source) [?:1.8.0_73]
Caused by: java.lang.ClassNotFoundException: net.minecraft.client.renderer.EntityRenderer
at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLoader.java:191) ~[launchwrapper-1.12.jar:?]
at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.8.0_73]
at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.8.0_73]
... 35 more
Caused by: net.minecraftforge.fml.common.asm.ASMTransformerWrapper$TransformerException: Exception in class transformer net.minecraftforge.fml.common.asm.transformers.SideTransformer@46271dd6 from coremod FMLCorePlugin
at net.minecraftforge.fml.common.asm.ASMTransformerWrapper$TransformerWrapper.transform(ASMTransformerWrapper.java:234) ~[forge.jar:?]
at net.minecraft.launchwrapper.LaunchClassLoader.runTransformers(LaunchClassLoader.java:279) ~[launchwrapper-1.12.jar:?]
at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLoader.java:176) ~[launchwrapper-1.12.jar:?]
at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.8.0_73]
at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.8.0_73]
... 35 more
Caused by: java.lang.RuntimeException: Attempted to load class cji for invalid side SERVER
at net.minecraftforge.fml.common.asm.transformers.SideTransformer.transform(SideTransformer.java:49) ~[forge.jar:?]
at net.minecraftforge.fml.common.asm.ASMTransformerWrapper$TransformerWrapper.transform(ASMTransformerWrapper.java:230) ~[forge.jar:?]
at net.minecraft.launchwrapper.LaunchClassLoader.runTransformers(LaunchClassLoader.java:279) ~[launchwrapper-1.12.jar:?]
at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLoader.java:176) ~[launchwrapper-1.12.jar:?]
at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.8.0_73]
at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.8.0_73]
... 35 more
[20:01:56] [server thread/ERROR] [net.minecraft.server.MinecraftServer]: Encountered an unexpected exception
net.minecraftforge.fml.common.LoaderException: java.lang.NoClassDefFoundError: net/minecraft/client/renderer/EntityRenderer

at net.minecraftforge.fml.common.LoadController.transition(LoadController.java:163) ~[LoadController.class:?]
at net.minecraftforge.fml.common.Loader.preinitializeMods(Loader.java:553) ~[Loader.class:?]
at net.minecraftforge.fml.server.FMLServerHandler.beginServerLoading(FMLServerHandler.java:88) ~[FMLServerHandler.class:?]
at net.minecraftforge.fml.common.FMLCommonHandler.onServerStart(FMLCommonHandler.java:355) ~[FMLCommonHandler.class:?]
at net.minecraft.server.dedicated.DedicatedServer.func_71197_b(DedicatedServer.java:117) ~[po.class:?]
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:438) [MinecraftServer.class:?]
at java.lang.Thread.run(Unknown Source) [?:1.8.0_73]
Caused by: java.lang.NoClassDefFoundError: net/minecraft/client/renderer/EntityRenderer
at com.Splosions.ModularBosses.items.ItemLegendsSword.<clinit>(ItemLegendsSword.java:43) ~[itemLegendsSword.class:?]
at com.Splosions.ModularBosses.items.ModularBossesItems.init(ModularBossesItems.java:97) ~[ModularBossesItems.class:?]
at com.Splosions.ModularBosses.ModularBosses.preInit(ModularBosses.java:38) ~[ModularBosses.class:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_73]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_73]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_73]
at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_73]
at net.minecraftforge.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:553) ~[forge.jar:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_73]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_73]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_73]
at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_73]
at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) ~[minecraft_server.1.8.jar:?]
at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) ~[minecraft_server.1.8.jar:?]
at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) ~[minecraft_server.1.8.jar:?]
at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) ~[minecraft_server.1.8.jar:?]
at com.google.common.eventbus.EventBus.post(EventBus.java:275) ~[minecraft_server.1.8.jar:?]
at net.minecraftforge.fml.common.LoadController.sendEventToModContainer(LoadController.java:212) ~[LoadController.class:?]
at net.minecraftforge.fml.common.LoadController.propogateStateMessage(LoadController.java:190) ~[LoadController.class:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_73]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_73]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_73]
at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_73]
at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) ~[minecraft_server.1.8.jar:?]
at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) ~[minecraft_server.1.8.jar:?]
at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) ~[minecraft_server.1.8.jar:?]
at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) ~[minecraft_server.1.8.jar:?]
at com.google.common.eventbus.EventBus.post(EventBus.java:275) ~[minecraft_server.1.8.jar:?]
at net.minecraftforge.fml.common.LoadController.distributeStateMessage(LoadController.java:119) ~[LoadController.class:?]
at net.minecraftforge.fml.common.Loader.preinitializeMods(Loader.java:550) ~[Loader.class:?]
... 5 more
Caused by: java.lang.ClassNotFoundException: net.minecraft.client.renderer.EntityRenderer
at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLoader.java:191) ~[launchwrapper-1.12.jar:?]
at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.8.0_73]
at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.8.0_73]
at com.Splosions.ModularBosses.items.ItemLegendsSword.<clinit>(ItemLegendsSword.java:43) ~[itemLegendsSword.class:?]
at com.Splosions.ModularBosses.items.ModularBossesItems.init(ModularBossesItems.java:97) ~[ModularBossesItems.class:?]
at com.Splosions.ModularBosses.ModularBosses.preInit(ModularBosses.java:38) ~[ModularBosses.class:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_73]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_73]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_73]
at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_73]
at net.minecraftforge.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:553) ~[forge.jar:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_73]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_73]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_73]
at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_73]
at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) ~[minecraft_server.1.8.jar:?]
at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) ~[minecraft_server.1.8.jar:?]
at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) ~[minecraft_server.1.8.jar:?]
at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) ~[minecraft_server.1.8.jar:?]
at com.google.common.eventbus.EventBus.post(EventBus.java:275) ~[minecraft_server.1.8.jar:?]
at net.minecraftforge.fml.common.LoadController.sendEventToModContainer(LoadController.java:212) ~[LoadController.class:?]
at net.minecraftforge.fml.common.LoadController.propogateStateMessage(LoadController.java:190) ~[LoadController.class:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_73]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_73]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_73]
at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_73]
at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) ~[minecraft_server.1.8.jar:?]
at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) ~[minecraft_server.1.8.jar:?]
at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) ~[minecraft_server.1.8.jar:?]
at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) ~[minecraft_server.1.8.jar:?]
at com.google.common.eventbus.EventBus.post(EventBus.java:275) ~[minecraft_server.1.8.jar:?]
at net.minecraftforge.fml.common.LoadController.distributeStateMessage(LoadController.java:119) ~[LoadController.class:?]
at net.minecraftforge.fml.common.Loader.preinitializeMods(Loader.java:550) ~[Loader.class:?]
... 5 more
Caused by: net.minecraftforge.fml.common.asm.ASMTransformerWrapper$TransformerException: Exception in class transformer net.minecraftforge.fml.common.asm.transformers.SideTransformer@46271dd6 from coremod FMLCorePlugin
at net.minecraftforge.fml.common.asm.ASMTransformerWrapper$TransformerWrapper.transform(ASMTransformerWrapper.java:234) ~[forge.jar:?]
at net.minecraft.launchwrapper.LaunchClassLoader.runTransformers(LaunchClassLoader.java:279) ~[launchwrapper-1.12.jar:?]
at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLoader.java:176) ~[launchwrapper-1.12.jar:?]
at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.8.0_73]
at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.8.0_73]
at com.Splosions.ModularBosses.items.ItemLegendsSword.<clinit>(ItemLegendsSword.java:43) ~[itemLegendsSword.class:?]
at com.Splosions.ModularBosses.items.ModularBossesItems.init(ModularBossesItems.java:97) ~[ModularBossesItems.class:?]
at com.Splosions.ModularBosses.ModularBosses.preInit(ModularBosses.java:38) ~[ModularBosses.class:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_73]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_73]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_73]
at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_73]
at net.minecraftforge.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:553) ~[forge.jar:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_73]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_73]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_73]
at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_73]
at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) ~[minecraft_server.1.8.jar:?]
at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) ~[minecraft_server.1.8.jar:?]
at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) ~[minecraft_server.1.8.jar:?]
at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) ~[minecraft_server.1.8.jar:?]
at com.google.common.eventbus.EventBus.post(EventBus.java:275) ~[minecraft_server.1.8.jar:?]
at net.minecraftforge.fml.common.LoadController.sendEventToModContainer(LoadController.java:212) ~[LoadController.class:?]
at net.minecraftforge.fml.common.LoadController.propogateStateMessage(LoadController.java:190) ~[LoadController.class:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_73]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_73]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_73]
at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_73]
at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) ~[minecraft_server.1.8.jar:?]
at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) ~[minecraft_server.1.8.jar:?]
at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) ~[minecraft_server.1.8.jar:?]
at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) ~[minecraft_server.1.8.jar:?]
at com.google.common.eventbus.EventBus.post(EventBus.java:275) ~[minecraft_server.1.8.jar:?]
at net.minecraftforge.fml.common.LoadController.distributeStateMessage(LoadController.java:119) ~[LoadController.class:?]
at net.minecraftforge.fml.common.Loader.preinitializeMods(Loader.java:550) ~[Loader.class:?]
... 5 more
Caused by: java.lang.RuntimeException: Attempted to load class cji for invalid side SERVER
at net.minecraftforge.fml.common.asm.transformers.SideTransformer.transform(SideTransformer.java:49) ~[forge.jar:?]
at net.minecraftforge.fml.common.asm.ASMTransformerWrapper$TransformerWrapper.transform(ASMTransformerWrapper.java:230) ~[forge.jar:?]
at net.minecraft.launchwrapper.LaunchClassLoader.runTransformers(LaunchClassLoader.java:279) ~[launchwrapper-1.12.jar:?]
at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLoader.java:176) ~[launchwrapper-1.12.jar:?]
at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.8.0_73]
at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.8.0_73]
at com.Splosions.ModularBosses.items.ItemLegendsSword.<clinit>(ItemLegendsSword.java:43) ~[itemLegendsSword.class:?]
at com.Splosions.ModularBosses.items.ModularBossesItems.init(ModularBossesItems.java:97) ~[ModularBossesItems.class:?]
at com.Splosions.ModularBosses.ModularBosses.preInit(ModularBosses.java:38) ~[ModularBosses.class:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_73]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_73]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_73]
at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_73]
at net.minecraftforge.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:553) ~[forge.jar:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_73]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_73]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_73]
at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_73]
at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) ~[minecraft_server.1.8.jar:?]
at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) ~[minecraft_server.1.8.jar:?]
at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) ~[minecraft_server.1.8.jar:?]
at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) ~[minecraft_server.1.8.jar:?]
at com.google.common.eventbus.EventBus.post(EventBus.java:275) ~[minecraft_server.1.8.jar:?]
at net.minecraftforge.fml.common.LoadController.sendEventToModContainer(LoadController.java:212) ~[LoadController.class:?]
at net.minecraftforge.fml.common.LoadController.propogateStateMessage(LoadController.java:190) ~[LoadController.class:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_73]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_73]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_73]
at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_73]
at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) ~[minecraft_server.1.8.jar:?]
at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) ~[minecraft_server.1.8.jar:?]
at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) ~[minecraft_server.1.8.jar:?]
at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) ~[minecraft_server.1.8.jar:?]
at com.google.common.eventbus.EventBus.post(EventBus.java:275) ~[minecraft_server.1.8.jar:?]
at net.minecraftforge.fml.common.LoadController.distributeStateMessage(LoadController.java:119) ~[LoadController.class:?]
at net.minecraftforge.fml.common.Loader.preinitializeMods(Loader.java:550) ~[Loader.class:?]
... 5 more
[20:01:56] [server thread/ERROR] [net.minecraft.server.MinecraftServer]: This crash report has been saved to: C:\Users\Derp\Desktop\Forge 1.8 Test Server\.\crash-reports\crash-2016-04-11_20.01.56-server.txt

 

 

 

EDIT: Just saw how many imports my test item has, I use it to test a lot of things, I should clean those up.

 

  • Quote

Share this post


Link to post
Share on other sites

coolAlias    745

coolAlias

coolAlias    745

  • Reality Controller
  • coolAlias
  • Members
  • 745
  • 2805 posts
Posted April 12, 2016

That's because you're trying to use a client-side only class on the server, where it does not exist. You need to run that code through your proxy system.

  • Quote

Share this post


Link to post
Share on other sites

Draco18s    2090

Draco18s

Draco18s    2090

  • Reality Controller
  • Draco18s
  • Members
  • 2090
  • 14008 posts
Posted April 12, 2016

You didn't put a catch for ClassNotFoundException, because Eclipse didn't tell you you needed it because it can see the class just fine.

 

That references a client-slide-only object, you should move that whole reflection chunk into your Client Proxy and do MainModClass.instance.proxy.doTheThing(), this might even avoid the need for reflection in the first place.

  • Quote

Share this post


Link to post
Share on other sites

gummby8    26

gummby8

gummby8    26

  • Diamond Finder
  • gummby8
  • Members
  • 26
  • 479 posts
Posted April 12, 2016

K I put everything in my ClientProxy class

 

Server loads up fine now, but the minecraft client still crashes.

 

I tried putting in a catch for ClassNotFoundException or NoSuchMethodException but eclipse won't let me saying, "Unreachable catch block for NoSuchMethodException. This exception is never thrown from the try statement body"

 

The crash reporst shows there is a problem on line 41 of my ClientProxy which is

private static final Method f_loadShader = ReflectionHelper.findMethod(EntityRenderer.class, Minecraft.getMinecraft().entityRenderer, new String[]{"loadShader", "func_148042_a"}, ResourceLocation.class);

 

So what am I doing wrong here?

 

 

private static final Method f_loadShader = ReflectionHelper.findMethod(EntityRenderer.class, Minecraft.getMinecraft().entityRenderer, new String[]{"loadShader", "func_148042_a"}, ResourceLocation.class);

public static void sobelShader(){
	try {
		f_loadShader.invoke(Minecraft.getMinecraft().entityRenderer, new ResourceLocation("shaders/post/sobel.json"));
	} catch (IllegalAccessException e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	} catch (IllegalArgumentException e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	} catch (InvocationTargetException e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	} catch (UnableToFindMethodException e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	}

}

 

 

 

 

 

---- Minecraft Crash Report ----

WARNING: coremods are present:
  NowWithRendering (redstonepaste-mc1.8-1.7.1.jar)
Contact their authors BEFORE contacting forge

// There are four lights!

Time: 4/12/16 7:26 AM
Description: There was a severe problem during mod loading that has caused the game to fail

net.minecraftforge.fml.common.LoaderException: java.lang.ExceptionInInitializerError
at net.minecraftforge.fml.common.LoadController.transition(LoadController.java:163)
at net.minecraftforge.fml.common.Loader.loadMods(Loader.java:538)
at net.minecraftforge.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:214)
at net.minecraft.client.Minecraft.func_71384_a(Minecraft.java:413)
at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:325)
at net.minecraft.client.main.Main.main(SourceFile:120)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)
at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
Caused by: java.lang.ExceptionInInitializerError
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:344)
at net.minecraftforge.fml.common.ProxyInjector.inject(ProxyInjector.java:60)
at net.minecraftforge.fml.common.FMLModContainer.constructMod(FMLModContainer.java:517)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74)
at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47)
at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322)
at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304)
at com.google.common.eventbus.EventBus.post(EventBus.java:275)
at net.minecraftforge.fml.common.LoadController.sendEventToModContainer(LoadController.java:212)
at net.minecraftforge.fml.common.LoadController.propogateStateMessage(LoadController.java:190)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74)
at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47)
at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322)
at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304)
at com.google.common.eventbus.EventBus.post(EventBus.java:275)
at net.minecraftforge.fml.common.LoadController.distributeStateMessage(LoadController.java:119)
at net.minecraftforge.fml.common.Loader.loadMods(Loader.java:507)
... 10 more
Caused by: net.minecraftforge.fml.relauncher.ReflectionHelper$UnableToFindMethodException: java.lang.NoSuchMethodException: net.minecraft.client.renderer.EntityRenderer.func_148042_a(net.minecraft.util.ResourceLocation)
at net.minecraftforge.fml.relauncher.ReflectionHelper.findMethod(ReflectionHelper.java:183)
at com.Splosions.ModularBosses.proxy.ClientProxy.<clinit>(ClientProxy.java:41)
... 36 more
Caused by: java.lang.NoSuchMethodException: net.minecraft.client.renderer.EntityRenderer.func_148042_a(net.minecraft.util.ResourceLocation)
at java.lang.Class.getDeclaredMethod(Class.java:2122)
at net.minecraftforge.fml.relauncher.ReflectionHelper.findMethod(ReflectionHelper.java:174)
... 37 more


A detailed walkthrough of the error, its code path and all known details is as follows:
---------------------------------------------------------------------------------------

-- System Details --
Details:
Minecraft Version: 1.8
Operating System: Windows 7 (amd64) version 6.1
Java Version: 1.8.0_25, Oracle Corporation
Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
Memory: 137731168 bytes (131 MB) / 286924800 bytes (273 MB) up to 1060372480 bytes (1011 MB)
Mod Pack: LiteLoader startup failed
LiteLoader Mods: LiteLoader startup failed
LaunchWrapper: 21 active transformer(s)
          - Transformer: net.minecraftforge.fml.common.asm.transformers.PatchingTransformer
          - Transformer: $wrapper.net.minecraftforge.fml.common.asm.transformers.BlamingTransformer
          - Transformer: $wrapper.net.minecraftforge.fml.common.asm.transformers.SideTransformer
          - Transformer: $wrapper.net.minecraftforge.fml.common.asm.transformers.EventSubscriptionTransformer
          - Transformer: $wrapper.net.minecraftforge.fml.common.asm.transformers.EventSubscriberTransformer
          - Transformer: $wrapper.net.minecraftforge.classloading.FluidIdTransformer
          - Transformer: $wrapper.net.fybertech.nwr.NowWithRendering
          - Transformer: com.mumfrey.liteloader.transformers.event.EventProxyTransformer
          - Transformer: com.mumfrey.liteloader.launch.LiteLoaderTransformer
          - Transformer: com.mumfrey.liteloader.client.transformers.CrashReportTransformer
          - Transformer: net.minecraftforge.fml.common.asm.transformers.DeobfuscationTransformer
          - Transformer: net.minecraftforge.fml.common.asm.transformers.AccessTransformer
          - Transformer: net.minecraftforge.fml.common.asm.transformers.ModAccessTransformer
          - Transformer: net.minecraftforge.fml.common.asm.transformers.ItemStackTransformer
          - Transformer: net.minecraftforge.fml.common.asm.transformers.TerminalTransformer
          - Transformer: com.mumfrey.liteloader.transformers.event.EventTransformer
          - Transformer: com.mumfrey.liteloader.common.transformers.LiteLoaderPacketTransformer
          - Transformer: com.mumfrey.liteloader.client.transformers.LiteLoaderEventInjectionTransformer
          - Transformer: com.mumfrey.liteloader.client.transformers.MinecraftTransformer
          - Transformer: com.mumfrey.liteloader.transformers.event.json.ModEventInjectionTransformer
          - Transformer: net.minecraftforge.fml.common.asm.transformers.ModAPITransformer
JVM Flags: 6 total; -XX:HeapDumpPath=MojangTricksIntelDriversForPerformance_javaw.exe_minecraft.exe.heapdump -Xmx1G -XX:+UseConcMarkSweepGC -XX:+CMSIncrementalMode -XX:-UseAdaptiveSizePolicy -Xmn128M
IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0
FML: MCP v9.10 FML v8.0.99.99 Minecraft Forge 11.14.3.1521 11 mods loaded, 11 mods active
States: 'U' = Unloaded 'L' = Loaded 'C' = Constructed 'H' = Pre-initialized 'I' = Initialized 'J' = Post-initialized 'A' = Available 'D' = Disabled 'E' = Errored
UC	mcp{9.05} [Minecraft Coder Pack] (minecraft.jar) 
UC	FML{8.0.99.99} [Forge Mod Loader] (forge-1.8-11.14.3.1521.jar) 
UC	Forge{11.14.3.1521} [Minecraft Forge] (forge-1.8-11.14.3.1521.jar) 
UC	zeldaswordskills{1.8-3.0.3b} [Zelda Sword Skills] (1.8-zeldaswordskills-3.0.3b.jar) 
UC	iChunUtil{5.5.0} [iChunUtil] (iChunUtil-5.5.0.jar) 
UC	LunatriusCore{1.1.2.30} [LunatriusCore] (LunatriusCore-1.8-1.1.2.30-universal.jar) 
UE	mb{1.0} [Modular Bosses] (mb-1.0.jar) 
UC	redstonepaste{1.7.1} [Redstone Paste] (redstonepaste-mc1.8-1.7.1.jar) 
UC	Schematica{1.7.7.140} [schematica] (Schematica-1.8-1.7.7.140-universal.jar) 
UC	Tabula{5.1.0} [Tabula] (Tabula-5.1.0.jar) 
UC	worldedit{6.1} [WorldEdit] (worldedit-forge-mc1.8-6.1.jar) 
Loaded coremods (and transformers): 
NowWithRendering (redstonepaste-mc1.8-1.7.1.jar)
  net.fybertech.nwr.NowWithRendering
GL info: ' Vendor: 'NVIDIA Corporation' Version: '4.5.0 NVIDIA 361.75' Renderer: 'GeForce GTX 960/PCIe/SSE2'

  • Quote

Share this post


Link to post
Share on other sites

Draco18s    2090

Draco18s

Draco18s    2090

  • Reality Controller
  • Draco18s
  • Members
  • 2090
  • 14008 posts
Posted April 12, 2016

Don't reflect the method in the static variable declaration point, declare the variable and wait until one of the Init phases to define it.

  • Quote

Share this post


Link to post
Share on other sites

Choonster    1623

Choonster

Choonster    1623

  • Reality Controller
  • Choonster
  • Forge Modder
  • 1623
  • 5050 posts
Posted April 12, 2016

You have the wrong SRG name for the method.

EntityRenderer#loadShader

is

func_175069_a

,

func_148042_a

is

Shader#loadShader

.

 

The instance argument of

ReflectionHelper#findMethod

is never used, I suggest passing

null

to it (since

Minecraft#entityRenderer

will be

null

anyway when your class is loaded).

  • Quote

Share this post


Link to post
Share on other sites

gummby8    26

gummby8

gummby8    26

  • Diamond Finder
  • gummby8
  • Members
  • 26
  • 479 posts
Posted April 12, 2016

You have the wrong SRG name for the method.

EntityRenderer#loadShader

is

func_175069_a

,

func_148042_a

is

Shader#loadShader

.

 

*facepalm*

 

The instance argument of

ReflectionHelper#findMethod

is never used, I suggest passing

null

to it (since

Minecraft#entityRenderer

will be

null

anyway when your class is loaded).

 

*done*

 

Don't reflect the method in the static variable declaration point, declare the variable and wait until one of the Init phases to define it.

 

*done*

I put the reflection in my registerRenderes method. seems to be working.

 

Now it works. Thanks guys

  • Quote

Share this post


Link to post
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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  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.

  • Insert image from URL
×
  • Desktop
  • Tablet
  • Phone
Sign in to follow this  
Followers 1
Go To Topic Listing



  • Recently Browsing

    No registered users viewing this page.

  • Posts

    • Rohman
      [1.12.2 Build 2847] Server Crash on startup

      By Rohman · Posted 33 minutes ago

      Here you go. Thanks for having a look. debug(1).log
    • diesieben07
      Server Cannot Start

      By diesieben07 · Posted 54 minutes ago

      You installed a client-only mod (Controllable) on the server. Mods have the ability to indicate their client-only-ness to Forge and it will not load the mod on a server. This mod has not done so, please report this bug to the mod author.
    • diesieben07
      [1.12.2] How do i make it so my sword renders in my mobs hand?.

      By diesieben07 · Posted 1 hour ago

      Why would you replace them?! This is a simple method override and you are calling super. There is no need to replace anything. Again: Please learn Java basics before making a mod.
    • diesieben07
      [1.12.2 Build 2847] Server Crash on startup

      By diesieben07 · Posted 1 hour ago

      Post the debug.log file.
    • diesieben07
      Need your help pls

      By diesieben07 · Posted 1 hour ago

      1.8.9 is no longer supported on this forum due to it's age. Update to a modern version of Minecraft to receive support.
  • Topics

    • Rohman
      2
      [1.12.2 Build 2847] Server Crash on startup

      By Rohman
      Started 2 hours ago

    • The_Unkown675
      1
      Server Cannot Start

      By The_Unkown675
      Started 4 hours ago

    • J0WAY
      17
      [1.12.2] How do i make it so my sword renders in my mobs hand?.

      By J0WAY
      Started Thursday at 09:10 PM

    • _jiriik_
      1
      Need your help pls

      By _jiriik_
      Started 3 hours ago

    • Kuaka
      0
      My Forge 1.12 and 1.12.2 Keep Crashing when i start it up

      By Kuaka
      Started 1 hour ago

  • Who's Online (See full list)

    • Ugdhar
    • Gnaux
    • plugsmustard
    • vaartis
    • HussNuss
    • AkosM
    • Ollie_Bear
    • Kuaka
  • All Activity
  • Home
  • Mod Developer Central
  • Modder Support
  • [1.8][SOLVED]Reflection - Am I doing it right?
  • Theme
  • Contact Us
  • Discord

Copyright © 2019 ForgeDevelopment LLC · Ads by Curse Powered by Invision Community