Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Androm

Members
  • Posts

    58
  • Joined

  • Last visited

Posts posted by Androm

  1. Hey, it wouldnt work if you just do "setStepSound()". this will mean you have to actualy walk on top of them. But since you climb a ladder it wouldnt work.

    In the vanilla codes, "BlockLadder", I found this. add it to your code and see if it worked out

    @Override
        public boolean isLadder(IBlockAccess world, int x, int y, int z, EntityLivingBase entity)
        {
            return true;
        }

    This wouldn't change anything, because he extends BlockLadder already (he can already climb), but correct me if I am wrong!

  2. Hello modders,

    If you have a RenderLivingEntityEvent.Pre and you know, that a Player is being rendered, how can you check, which LayerRenderer is rendering (like a custom one). Is this even possible,? If not, how can you register your own LayerRenderer and remove all other LayerRenderers? I don`t want code, an idea is enough. Thanks for your help!

  3. 1. If you set the MaxPermSize too high, the java garbage collector needs more time - So normally you can choose a high number and lower it (half the amount everytime), till you get an error (not this error). Then just double it and you have the perfect amount (normally it is 256m, but not more than 2048m!!(and that's rare))

    2. Optifine is causing the trouble....

     

    And sorry, that I was telling you something wrong...

  4. No, M_ModelRenderer.mRs wasn't null, but it couldn't get the value for the key. In the hashmap is an object called new ModelDwarFemale, but if i used the key new ModelDwarfFemale or cast it to ModelBase the key doesn't exist. I solved the problem with adding a '.getClass().getName()'. Now there is no error, but nothing is rendered..

  5. If I go in the Thirdperson view, minecraft crashes with following error:

     

     

    [13:59:12] [Client thread/FATAL]: Reported exception thrown!

    net.minecraft.util.ReportedException: Rendering entity in world

    at net.minecraft.client.renderer.entity.RenderManager.doRenderEntity(RenderManager.java:425) ~[RenderManager.class:?]

    at net.minecraft.client.renderer.entity.RenderManager.renderEntityStatic(RenderManager.java:334) ~[RenderManager.class:?]

    at net.minecraft.client.renderer.entity.RenderManager.renderEntitySimple(RenderManager.java:301) ~[RenderManager.class:?]

    at net.minecraft.client.renderer.RenderGlobal.renderEntities(RenderGlobal.java:657) ~[RenderGlobal.class:?]

    at net.minecraft.client.renderer.EntityRenderer.renderWorldPass(EntityRenderer.java:1350) ~[EntityRenderer.class:?]

    at net.minecraft.client.renderer.EntityRenderer.renderWorld(EntityRenderer.java:1263) ~[EntityRenderer.class:?]

    at net.minecraft.client.renderer.EntityRenderer.updateCameraAndRender(EntityRenderer.java:1088) ~[EntityRenderer.class:?]

    at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1108) ~[Minecraft.class:?]

    at net.minecraft.client.Minecraft.run(Minecraft.java:376) [Minecraft.class:?]

    at net.minecraft.client.main.Main.main(Main.java:117) [Main.class:?]

    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_75]

    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) ~[?:1.7.0_75]

    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.7.0_75]

    at java.lang.reflect.Method.invoke(Method.java:606) ~[?:1.7.0_75]

    at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.11.jar:?]

    at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.11.jar:?]

    at net.minecraftforge.gradle.GradleStartCommon.launch(Unknown Source) [start/:?]

    at GradleStart.main(Unknown Source) [start/:?]

    Caused by: java.lang.NullPointerException

    at com.myhtrpg.www.entities.Models.Layers.M_LayerDwarfFemale.doRenderLayer(M_LayerDwarfFemale.java:44) ~[M_LayerDwarfFemale.class:?]

    at com.myhtrpg.www.entities.Models.Layers.M_LayerDwarfFemale.doRenderLayer(M_LayerDwarfFemale.java:57) ~[M_LayerDwarfFemale.class:?]

    at com.myhtrpg.www.Events.PlayerRenderEvents.onRenderLiving(PlayerRenderEvents.java:69) ~[PlayerRenderEvents.class:?]

    at net.minecraftforge.fml.common.eventhandler.ASMEventHandler_9_PlayerRenderEvents_onRenderLiving_Pre.invoke(.dynamic) ~[?:?]

    at net.minecraftforge.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:55) ~[ASMEventHandler.class:?]

    at net.minecraftforge.fml.common.eventhandler.EventBus.post(EventBus.java:138) ~[EventBus.class:?]

    at net.minecraft.client.renderer.entity.RendererLivingEntity.doRender(RendererLivingEntity.java:100) ~[RendererLivingEntity.class:?]

    at net.minecraft.client.renderer.entity.RenderPlayer.func_180596_a(RenderPlayer.java:70) ~[RenderPlayer.class:?]

    at net.minecraft.client.renderer.entity.RenderPlayer.doRender(RenderPlayer.java:273) ~[RenderPlayer.class:?]

    at net.minecraft.client.renderer.entity.RenderManager.doRenderEntity(RenderManager.java:377) ~[RenderManager.class:?]

    ... 17 more

    [13:59:12] [Client thread/INFO] [sTDOUT]: [net.minecraft.init.Bootstrap:printToSYSOUT:660]: ---- Minecraft Crash Report ----

    // But it works on my machine.

     

    Time: 05.04.15 13:59

    Description: Rendering entity in world

     

    java.lang.NullPointerException: Rendering entity in world

    at com.myhtrpg.www.entities.Models.Layers.M_LayerDwarfFemale.doRenderLayer(M_LayerDwarfFemale.java:44)

    at com.myhtrpg.www.entities.Models.Layers.M_LayerDwarfFemale.doRenderLayer(M_LayerDwarfFemale.java:57)

    at com.myhtrpg.www.Events.PlayerRenderEvents.onRenderLiving(PlayerRenderEvents.java:69)

    at net.minecraftforge.fml.common.eventhandler.ASMEventHandler_9_PlayerRenderEvents_onRenderLiving_Pre.invoke(.dynamic)

    at net.minecraftforge.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:55)

    at net.minecraftforge.fml.common.eventhandler.EventBus.post(EventBus.java:138)

    at net.minecraft.client.renderer.entity.RendererLivingEntity.doRender(RendererLivingEntity.java:100)

    at net.minecraft.client.renderer.entity.RenderPlayer.func_180596_a(RenderPlayer.java:70)

    at net.minecraft.client.renderer.entity.RenderPlayer.doRender(RenderPlayer.java:273)

    at net.minecraft.client.renderer.entity.RenderManager.doRenderEntity(RenderManager.java:377)

    at net.minecraft.client.renderer.entity.RenderManager.renderEntityStatic(RenderManager.java:334)

    at net.minecraft.client.renderer.entity.RenderManager.renderEntitySimple(RenderManager.java:301)

    at net.minecraft.client.renderer.RenderGlobal.renderEntities(RenderGlobal.java:657)

    at net.minecraft.client.renderer.EntityRenderer.renderWorldPass(EntityRenderer.java:1350)

    at net.minecraft.client.renderer.EntityRenderer.renderWorld(EntityRenderer.java:1263)

    at net.minecraft.client.renderer.EntityRenderer.updateCameraAndRender(EntityRenderer.java:1088)

    at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1108)

    at net.minecraft.client.Minecraft.run(Minecraft.java:376)

    at net.minecraft.client.main.Main.main(Main.java:117)

    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

    at java.lang.reflect.Method.invoke(Method.java:606)

    at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)

    at net.minecraft.launchwrapper.Launch.main(Launch.java:28)

    at net.minecraftforge.gradle.GradleStartCommon.launch(Unknown Source)

    at GradleStart.main(Unknown Source)

     

     

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

    ---------------------------------------------------------------------------------------

     

    -- Head --

    Stacktrace:

    at com.myhtrpg.www.entities.Models.Layers.M_LayerDwarfFemale.doRenderLayer(M_LayerDwarfFemale.java:44)

    at com.myhtrpg.www.entities.Models.Layers.M_LayerDwarfFemale.doRenderLayer(M_LayerDwarfFemale.java:57)

    at com.myhtrpg.www.Events.PlayerRenderEvents.onRenderLiving(PlayerRenderEvents.java:69)

    at net.minecraftforge.fml.common.eventhandler.ASMEventHandler_9_PlayerRenderEvents_onRenderLiving_Pre.invoke(.dynamic)

    at net.minecraftforge.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:55)

    at net.minecraftforge.fml.common.eventhandler.EventBus.post(EventBus.java:138)

    at net.minecraft.client.renderer.entity.RendererLivingEntity.doRender(RendererLivingEntity.java:100)

    at net.minecraft.client.renderer.entity.RenderPlayer.func_180596_a(RenderPlayer.java:70)

    at net.minecraft.client.renderer.entity.RenderPlayer.doRender(RenderPlayer.java:273)

     

    -- Entity being rendered --

    Details:

    Entity Type: null (net.minecraft.client.entity.EntityPlayerSP)

    Entity ID: 181

    Entity Name: Player694

    Entity's Exact location: 0,00, 78,00, 0,00

    Entity's Block location: 0,00,78,00,0,00 - World: (0,78,0), Chunk: (at 0,4,0 in 0,0; contains blocks 0,0,0 to 15,255,15), Region: (0,0; contains chunks 0,0 to 31,31, blocks 0,0,0 to 511,255,511)

    Entity's Momentum: 0,00, -0,08, 0,00

    Entity's Rider: ~~ERROR~~ NullPointerException: null

    Entity's Vehicle: ~~ERROR~~ NullPointerException: null

     

    -- Renderer details --

    Details:

    Assigned renderer: net.minecraft.client.renderer.entity.RenderPlayer@6800f291

    Location: 0,00,0,00,0,00 - World: (0,0,0), Chunk: (at 0,0,0 in 0,0; contains blocks 0,0,0 to 15,255,15), Region: (0,0; contains chunks 0,0 to 31,31, blocks 0,0,0 to 511,255,511)

    Rotation: -202.95001

    Delta: 0.3445344

    Stacktrace:

    at net.minecraft.client.renderer.entity.RenderManager.doRenderEntity(RenderManager.java:377)

    at net.minecraft.client.renderer.entity.RenderManager.renderEntityStatic(RenderManager.java:334)

    at net.minecraft.client.renderer.entity.RenderManager.renderEntitySimple(RenderManager.java:301)

    at net.minecraft.client.renderer.RenderGlobal.renderEntities(RenderGlobal.java:657)

    at net.minecraft.client.renderer.EntityRenderer.renderWorldPass(EntityRenderer.java:1350)

    at net.minecraft.client.renderer.EntityRenderer.renderWorld(EntityRenderer.java:1263)

     

    -- Affected level --

    Details:

    Level name: MpServer

    All players: 1 total; [EntityPlayerSP['Player694'/181, l='MpServer', x=0,00, y=78,00, z=0,00]]

    Chunk stats: MultiplayerChunkCache: 25, 25

    Level seed: 0

    Level generator: ID 00 - default, ver 1. Features enabled: false

    Level generator options:

    Level spawn location: 13,00,64,00,277,00 - World: (13,64,277), Chunk: (at 13,4,5 in 0,17; contains blocks 0,0,272 to 15,255,287), Region: (0,0; contains chunks 0,0 to 31,31, blocks 0,0,0 to 511,255,511)

    Level time: 789 game time, 789 day time

    Level dimension: 0

    Level storage version: 0x00000 - Unknown?

    Level weather: Rain time: 0 (now: false), thunder time: 0 (now: false)

    Level game mode: Game mode: creative (ID 1). Hardcore: false. Cheats: false

    Forced entities: 44 total; [EntitySkeleton['Skeleton'/205, l='MpServer', x=45,50, y=19,00, z=53,50], EntityCreeper['Creeper'/204, l='MpServer', x=39,50, y=18,00, z=57,50], EntityCreeper['Creeper'/207, l='MpServer', x=39,50, y=18,00, z=58,50], EntityZombie['Zombie'/206, l='MpServer', x=46,50, y=19,00, z=57,50], EntityRabbit['Rabbit'/201, l='MpServer', x=53,34, y=96,00, z=-1,66], EntityRabbit['Rabbit'/200, l='MpServer', x=53,34, y=96,00, z=-4,66], EntityZombie['Zombie'/203, l='MpServer', x=-39,50, y=30,00, z=35,50], EntityBat['Bat'/202, l='MpServer', x=-28,19, y=14,75, z=58,31], EntityCreeper['Creeper'/197, l='MpServer', x=-0,50, y=38,00, z=48,50], EntityWitch['Witch'/196, l='MpServer', x=-15,50, y=24,00, z=63,50], EntityBat['Bat'/199, l='MpServer', x=-10,75, y=13,06, z=-39,28], EntityCreeper['Creeper'/198, l='MpServer', x=-4,50, y=38,00, z=55,50], EntityRabbit['Rabbit'/193, l='MpServer', x=51,50, y=86,00, z=1,50], EntityCreeper['Creeper'/192, l='MpServer', x=13,50, y=20,00, z=-47,50], EntityBat['Bat'/195, l='MpServer', x=-8,25, y=15,28, z=60,25], EntityCreeper['Creeper'/194, l='MpServer', x=0,50, y=38,00, z=48,50], EntitySkeleton['Skeleton'/220, l='MpServer', x=63,50, y=38,00, z=-45,50], EntityZombie['Zombie'/221, l='MpServer', x=48,50, y=19,00, z=58,50], EntityCreeper['Creeper'/222, l='MpServer', x=51,50, y=19,00, z=48,50], EntitySkeleton['Skeleton'/223, l='MpServer', x=48,19, y=19,00, z=52,66], EntityCreeper['Creeper'/216, l='MpServer', x=-40,50, y=16,00, z=-39,50], EntitySkeleton['Skeleton'/217, l='MpServer', x=60,50, y=31,00, z=-47,50], EntityZombie['Zombie'/218, l='MpServer', x=61,69, y=32,00, z=-45,88], EntitySpider['Spider'/219, l='MpServer', x=61,50, y=38,00, z=-45,50], EntityBat['Bat'/212, l='MpServer', x=-40,78, y=24,00, z=-43,53], EntityBat['Bat'/213, l='MpServer', x=-36,53, y=25,31, z=-45,66], EntityBat['Bat'/214, l='MpServer', x=-49,81, y=26,00, z=-32,44], EntityItem['item.tile.gravel'/215, l='MpServer', x=-37,69, y=-57,47, z=-41,88], EntityCreeper['Creeper'/208, l='MpServer', x=36,50, y=36,00, z=62,50], EntityZombie['Zombie'/209, l='MpServer', x=-47,97, y=14,00, z=-36,47], EntityZombie['Zombie'/210, l='MpServer', x=-46,63, y=14,00, z=-42,03], EntitySpider['Spider'/211, l='MpServer', x=-46,72, y=14,02, z=-35,72], EntityPlayerSP['Player694'/181, l='MpServer', x=0,00, y=78,00, z=0,00], EntityZombie['Zombie'/224, l='MpServer', x=48,50, y=19,00, z=54,50], EntityRabbit['Rabbit'/186, l='MpServer', x=-26,63, y=77,00, z=-8,38], EntityRabbit['Rabbit'/187, l='MpServer', x=-21,06, y=83,00, z=-14,97], EntityBat['Bat'/184, l='MpServer', x=5,75, y=16,09, z=38,25], EntityRabbit['Rabbit'/185, l='MpServer', x=-29,50, y=77,00, z=-6,50], EntityRabbit['Rabbit'/190, l='MpServer', x=-19,50, y=89,02, z=-20,25], EntityCreeper['Creeper'/191, l='MpServer', x=13,50, y=20,00, z=-46,50], EntityEnderman['Enderman'/188, l='MpServer', x=30,50, y=23,00, z=45,50], EntityRabbit['Rabbit'/189, l='MpServer', x=-19,91, y=90,00, z=-22,28], EntityRabbit['Rabbit'/182, l='MpServer', x=-24,03, y=77,00, z=0,47], EntitySkeleton['Skeleton'/183, l='MpServer', x=9,50, y=20,00, z=39,50]]

    Retry entities: 0 total; []

    Server brand: fml,forge

    Server type: Integrated singleplayer server

    Stacktrace:

    at net.minecraft.client.multiplayer.WorldClient.addWorldInfoToCrashReport(WorldClient.java:392)

    at net.minecraft.client.Minecraft.addGraphicsAndWorldToCrashReport(Minecraft.java:2601)

    at net.minecraft.client.Minecraft.run(Minecraft.java:397)

    at net.minecraft.client.main.Main.main(Main.java:117)

    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

    at java.lang.reflect.Method.invoke(Method.java:606)

    at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)

    at net.minecraft.launchwrapper.Launch.main(Launch.java:28)

    at net.minecraftforge.gradle.GradleStartCommon.launch(Unknown Source)

    at GradleStart.main(Unknown Source)

     

     

    Something is null, but I don`t what because the doRender(....) is called and the arguments aren`t null...

    Event, where it happens:

    @SubscribeEvent(priority = EventPriority.HIGHEST)
    public void onRenderLiving(RenderLivingEvent.Pre rlep) {
    	if(rlep.entity instanceof EntityPlayer) {
    		EntityPlayer player = (EntityPlayer)rlep.entity;
    		LayerRenderer lr = new M_LayerDwarfFemale(new RenderManagerUtils().getValueOfSkinMap("default"));
    		lr.doRenderLayer((EntityLivingBase)player, 1F, 1F, ClientEvents.partialTicks, (float)player.posX, (float)player.posY, (float)player.posZ, 1F);
    		System.out.println("Tried to render player");
    	}
    }
    

    No class changed since I posted them. Anyone can help me?

     

     

     

  6. I managed to write some LayerRenderers and apply them to all players, but do I really have to delete the LayerRenderers which I don't need, or is there an event where I can cancel special LayerRenderers?

    Some of my classes: (If you have problems to understand it, tell it me please)

     

     

    LayerRenderer for ModelDwarfFemale:

    package com.myhtrpg.www.entities.Models.Layers;
    
    import net.minecraft.client.renderer.GlStateManager;
    import net.minecraft.client.renderer.entity.RenderPlayer;
    import net.minecraft.client.renderer.entity.layers.LayerRenderer;
    import net.minecraft.entity.EntityLivingBase;
    import net.minecraft.entity.player.EntityPlayer;
    import net.minecraft.util.MathHelper;
    
    import com.myhtrpg.www.entities.Models.ModelDwarfFemale;
    import com.myhtrpg.www.entities.Models.ModelRenderer.M_ModelRenderer;
    import com.myhtrpg.www.utils.ResourceHelper;
    
    public class M_LayerDwarfFemale implements LayerRenderer {
    public ModelDwarfFemale mDF = new ModelDwarfFemale();
    public RenderPlayer pR;
    
    public M_LayerDwarfFemale(RenderPlayer render) {
    	this.pR = render;
    }
    
    public void doRenderLayer(EntityPlayer player, float f, float f1,
    		float renderTick, float f2, float f3, float f4, float f5) {
    	if ((!player.isInvisible())) {
    		this.pR.bindTexture(ResourceHelper.location_DwarfFemale);
    
    		GlStateManager.pushMatrix();
    		if (player.isSneaking()) {
    			GlStateManager.translate(0.0F, 0.265F, 0.0F);
    		}
    		GlStateManager.rotate(
    				M_ModelRenderer.interpolateRotation(
    						player.prevRotationYawHead, player.rotationYawHead,
    						renderTick)
    						- M_ModelRenderer.interpolateRotation(
    								player.prevRenderYawOffset,
    								player.renderYawOffset, renderTick), 0.0F,
    				1.0F, 0.0F);
    		GlStateManager.rotate(
    				M_ModelRenderer.interpolateRotation(
    						player.prevRotationPitch, player.rotationPitch,
    						renderTick), 1.0F, 0.0F, 0.0F);
    
    		M_ModelRenderer.mRs.get(this.mDF).render(0.0625F);
    
    		GlStateManager.popMatrix();
    	}
    }
    
    public boolean shouldCombineTextures() {
    	return false;
    }
    
    public void doRenderLayer(EntityLivingBase p_177141_1_, float p_177141_2_,
    		float p_177141_3_, float p_177141_4_, float p_177141_5_,
    		float p_177141_6_, float p_177141_7_, float p_177141_8_) {
    	doRenderLayer((EntityPlayer) p_177141_1_, p_177141_2_, p_177141_3_,
    			p_177141_4_, p_177141_5_, p_177141_6_, p_177141_7_, p_177141_8_);
    }
    }
    
    

    The other LayerRenderers are the same, just with others locations and modells.

     

    My ModelRenderer:

    package com.myhtrpg.www.entities.Models.ModelRenderer;
    
    import java.util.ArrayList;
    import java.util.HashMap;
    
    import com.myhtrpg.www.entities.Models.ModelDwarfFemale;
    import com.myhtrpg.www.entities.Models.ModelDwarfMale;
    import com.myhtrpg.www.entities.Models.ModelElfFemale;
    import com.myhtrpg.www.entities.Models.ModelElfMale;
    import com.myhtrpg.www.entities.Models.ModelOrkFemale;
    import com.myhtrpg.www.entities.Models.ModelOrkMale;
    
    import net.minecraft.client.model.ModelBase;
    import net.minecraft.client.model.ModelRenderer;
    
    public class M_ModelRenderer {
    
    public static HashMap<ModelBase, ModelRenderer> mRs;
    
    public M_ModelRenderer() {
    	mRs = new HashMap<ModelBase, ModelRenderer>();
    	ArrayList<ModelBase> mBs = new ArrayList<ModelBase>();
    	mBs.add(new ModelDwarfFemale());
    	mBs.add(new ModelDwarfMale());
    	mBs.add(new ModelElfFemale());
    	mBs.add(new ModelElfMale());
    	mBs.add(new ModelOrkFemale());
    	mBs.add(new ModelOrkMale());
    	ModelRenderer temp;
    
    	for(int i = 0; i < mBs.size(); i++) {
    		ModelBase mB = mBs.get(i);
    		temp = new ModelRenderer(mB);
    		mRs.put(mB, temp);
    	}
    
    }
    
    public static float interpolateRotation(float prevRotation, float nextRotation, float partialTick)
      {
    	float rot = nextRotation - prevRotation;
    	while (rot >= 180.0F) {
    	      rot -= 360.0F;
    	    }
    	while (rot >= 180.0F) {
    	      rot -= 360.0F;
    	    }
        return prevRotation + partialTick * rot;
      }
    }
    

    In my client proxy:

    @Override
    public void init() {
    	RenderManagerUtils rmu = new RenderManagerUtils();
    	M_RendererHelper mrh = new M_RendererHelper();
    
    	//default
    	RenderPlayer rp_default = rmu.getValueOfSkinMap("default");
    	//LayerRenderers
    	List<LayerRenderer> layerrenderers = new M_RendererHelper().getListOfLayerRenderers(rp_default);
    	layerrenderers.add(new M_LayerDwarfFemale(rp_default));
    	layerrenderers.add(new M_LayerDwarfMale(rp_default));
    	layerrenderers.add(new M_LayerElfFemale(rp_default));
    	layerrenderers.add(new M_LayerElfMale(rp_default));
    	layerrenderers.add(new M_LayerOrkFemale(rp_default));
    	layerrenderers.add(new M_LayerOrkMale(rp_default));
    	mrh.addLayers(rp_default, (LayerRenderer[]) layerrenderers.toArray());
    
    	//slim
    	RenderPlayer rp_slim = rmu.getValueOfSkinMap("slim");
    	//LayerRenderers
    	layerrenderers = new M_RendererHelper().getListOfLayerRenderers(rp_slim);
    	layerrenderers.add(new M_LayerDwarfFemale(rp_slim));
    	layerrenderers.add(new M_LayerDwarfMale(rp_slim));
    	layerrenderers.add(new M_LayerElfFemale(rp_slim));
    	layerrenderers.add(new M_LayerElfMale(rp_slim));
    	layerrenderers.add(new M_LayerOrkFemale(rp_slim));
    	layerrenderers.add(new M_LayerOrkMale(rp_slim));
    	mrh.addLayers(rp_slim, (LayerRenderer[]) layerrenderers.toArray());
    
    	//apply patches now
    	rmu.setValueOfKeyInSkinMap(rp_default, "default");
    	rmu.setValueOfKeyInSkinMap(rp_slim, "slim");
    	rmu.applyPatch();
    }
    

    RenderManagerUtils:

    package com.myhtrpg.www.utils;
    
    import java.lang.reflect.Field;
    import java.util.Map;
    
    import net.minecraft.client.Minecraft;
    import net.minecraft.client.renderer.entity.RenderManager;
    import net.minecraft.client.renderer.entity.RenderPlayer;
    import net.minecraftforge.fml.relauncher.Side;
    import net.minecraftforge.fml.relauncher.SideOnly;
    
    import com.google.common.collect.Maps;
    
    @SideOnly(Side.CLIENT)
    public class RenderManagerUtils {
    
    private Map M_skinMap;
    private Map old;
    private boolean readingSucces;
    private boolean nothinginside;
    
    public RenderManagerUtils() {
    	this.M_skinMap = Maps.newHashMap();
    	this.old = Maps.newHashMap();
    	RenderManager rm = Minecraft.getMinecraft().getRenderManager();
    	try {
    		Field privateSkinMapMinecraft = rm.getClass().getDeclaredField("skinMap");
    		privateSkinMapMinecraft.setAccessible(true);
    		M_skinMap = (Map) privateSkinMapMinecraft.get(rm);
    		privateSkinMapMinecraft.setAccessible(false);
    		old = M_skinMap;
    	} catch (Exception e) {
    		this.readingSucces = false;
    		e.printStackTrace();
    	}
    	this.readingSucces = true;
    	if(M_skinMap == null) this.nothinginside = true;
    	else {
    		this.nothinginside = false;
    	}
    }
    
    public RenderPlayer getValueOfSkinMap(String key) { //keys are "default" and "slim"
    	if(readingSucces && !nothinginside && this.M_skinMap.containsKey(key)) return (RenderPlayer) this.M_skinMap.get(key);
    	else return null;
    }
    
    public boolean setValueOfKeyInSkinMap(RenderPlayer rp, String key) {
    	if(readingSucces && !nothinginside) {
    		this.M_skinMap.put(key, rp);
    		if(this.M_skinMap.get("default").equals(rp) && this.M_skinMap.get("slim").equals(rp)) return true;
    		else return false;
    	} else return false;
    }
    
    public boolean applyPatch() {
    	RenderManager rm = Minecraft.getMinecraft().getRenderManager();
    	Map newMap = Maps.newHashMap();
    	Field privateSkinMapMinecraft = null;
    	try {
    		privateSkinMapMinecraft = rm.getClass().getDeclaredField("skinMap");
    		privateSkinMapMinecraft.setAccessible(true);
    		newMap = (Map) privateSkinMapMinecraft.get(rm);
    		privateSkinMapMinecraft.setAccessible(false);
    	} catch (Exception e) {
    		e.printStackTrace();
    		return false;
    	}
    	if(newMap == null) return false;
    	else {
    		if(newMap.equals(old) && privateSkinMapMinecraft != null) {
    			privateSkinMapMinecraft.setAccessible(true);
    			try {
    				privateSkinMapMinecraft.set(rm, M_skinMap);
    				if(privateSkinMapMinecraft.get(rm).equals(M_skinMap)) {
    					privateSkinMapMinecraft.setAccessible(false);
    					return true;
    				}
    				privateSkinMapMinecraft.setAccessible(false);
    				return false;
    			} catch (Exception e) {
    				e.printStackTrace();
    				return false;
    			}
    		} else return false; //TODO Maybe trying to check changes
    	}
    }
    }
    

    My RendererHelper (needed a special package, because I am using protected methodes):

    package net.minecraft.client.renderer.entity;
    
    import java.util.Collection;
    import java.util.HashSet;
    import java.util.Iterator;
    import java.util.List;
    
    import com.myhtrpg.www.entities.Models.Layers.M_LayerDwarfFemale;
    
    import net.minecraft.client.renderer.entity.layers.LayerRenderer;
    
    public class M_RendererHelper {
    
    public RenderPlayer addLayer(RenderPlayer old, LayerRenderer layer) {
    	old.addLayer(layer);
    	return old;
    }
    
    public RenderPlayer removeLayer(RenderPlayer old, LayerRenderer layer) {
    	old.removeLayer(layer);
    	return old;
    }
    
    public boolean containsLayer(RenderPlayer old, LayerRenderer layer) {
    	return old.layerRenderers.contains(layer);
    }
    
    public boolean containsLayers(RenderPlayer old, Collection layers) {
    	return old.layerRenderers.containsAll(layers);
    }
    
    public List<LayerRenderer> getListOfLayerRenderers(RenderPlayer old) {
    	return old.layerRenderers;
    }
    
    public RenderPlayer setListOfLayerRenderers(RenderPlayer old, List<LayerRenderer> lrs) {
    	old.layerRenderers = lrs;
    	return old;
    }
    
    public RenderPlayer addLayers(RenderPlayer old, LayerRenderer[] layers) {
    	for (LayerRenderer layer : layers) old.addLayer(layer);
    	return old;
    }
    
    public RenderPlayer removeLayers(RenderPlayer old, LayerRenderer[] layers) {
    	for (LayerRenderer layer : layers) old.removeLayer(layer);
    	return old;
    }
    }
    

     

     

  7. Hello modders,

    I have some questions about rendering the player. Since forge 1.8 RenderPlayerEvents are useless. So now there are ayers.

    1. If I want to change the player model and the rendering stuff (like Entities), will I have to redo all layers or is there a better solution?

    2. The RenderLivingEntity event still exists, so can I render the EntityPlayer there without doing all the stuff with layers? (I think this wouldn`t work but I better asked)

    3. Are the layers cancelable? I don`t want currently armor being rendered. (What else option do I have?)

    4. Can I just copy paste minecraft/minecraftforge`s code for layers and just change some values, or is "expands" better?

    5. If I have to add my own Layers, where can I register them? And how can I check if the layer, which is currently rendered, if it is my own layer?

    6. If i have more models  (3 different types and for every type 2 different texture) can I just make 3 different Layers which have 2 different texture registered (register a layer with texture 1, set ResourceLocation to texture 2 and register the same layer with a different texture a second time?

     

    I am currently looking in the source code to find the answers, but if somebody can answer it faster, please do.

    If I found an answer, I will post it.

    Sorry for my bad English and thanks for your help.

    Androm

  8. The model change but I there isn´t the right texture. Forge tries to set the steve texture on my custom model. I know I forgot it. The problem is i don´t know how to change the texture. Maybe too with ObfuscationReflectionHelper or is there an easy method? Thanks for your help! (I know I can optimize my code, but please don´t say it)

     

    package de.MhytRPG.www.events;
    
    import net.minecraft.client.model.ModelBase;
    import net.minecraftforge.client.event.RenderPlayerEvent;
    import cpw.mods.fml.common.ObfuscationReflectionHelper;
    import cpw.mods.fml.common.eventhandler.SubscribeEvent;
    import de.MhytRPG.www.mobs.Modells.ModelDwarfFemale;
    import de.MhytRPG.www.mobs.Modells.ModelDwarfMale;
    import de.MhytRPG.www.mobs.Modells.ModelElfFemale;
    import de.MhytRPG.www.mobs.Modells.ModelElfMale;
    import de.MhytRPG.www.mobs.Modells.ModelOrkFemale;
    import de.MhytRPG.www.mobs.Modells.ModelOrkMale;
    import de.MhytRPG.www.utils.PlayerEntity;
    
    public class OnRenderPlayerEvents {
    
    private ModelBase value;
    
    @SubscribeEvent
    public void onRenderPlayerPre(RenderPlayerEvent.Pre pre) {
    	value = ObfuscationReflectionHelper.getPrivateValue(net.minecraft.client.renderer.entity.RendererLivingEntity.class, pre.renderer, new String[] { "mainModel", "field_77045_g" });
    	int type = 0;
    	if(PlayerEntity.getPlayerEntity(pre.entityPlayer) != null) {
    		type = PlayerEntity.getPlayerEntity(pre.entityPlayer);
    	}
    	switch (type) {
    	case 0:
    		ObfuscationReflectionHelper.setPrivateValue(net.minecraft.client.renderer.entity.RendererLivingEntity.class, pre.renderer, new ModelDwarfMale(), new String[] { "mainModel", "field_77045_g" });
    		break;
    	case 1:
    		ObfuscationReflectionHelper.setPrivateValue(net.minecraft.client.renderer.entity.RendererLivingEntity.class, pre.renderer, new ModelDwarfFemale(), new String[] { "mainModel", "field_77045_g" });
    		break;
    	case 2:
    		ObfuscationReflectionHelper.setPrivateValue(net.minecraft.client.renderer.entity.RendererLivingEntity.class, pre.renderer, new ModelOrkMale(), new String[] { "mainModel", "field_77045_g" });
    		break;
    	case 3:
    		ObfuscationReflectionHelper.setPrivateValue(net.minecraft.client.renderer.entity.RendererLivingEntity.class, pre.renderer, new ModelOrkFemale(), new String[] { "mainModel", "field_77045_g" });
    		break;
    	case 4:
    		ObfuscationReflectionHelper.setPrivateValue(net.minecraft.client.renderer.entity.RendererLivingEntity.class, pre.renderer, new ModelElfMale(), new String[] { "mainModel", "field_77045_g" });
    		break;
    	case 5:
    		ObfuscationReflectionHelper.setPrivateValue(net.minecraft.client.renderer.entity.RendererLivingEntity.class, pre.renderer, new ModelElfFemale(), new String[] { "mainModel", "field_77045_g" });
    		break;
    	default:
    		break;
    	}
    }
    
    @SubscribeEvent
    public void onRenderPlayerPost(RenderPlayerEvent.Post post) {
    	ObfuscationReflectionHelper.setPrivateValue(net.minecraft.client.renderer.entity.RendererLivingEntity.class, post.renderer, value, new String[] { "mainModel", "field_77045_g" });
    }
    
    }
    
    

     

  9. Do you mean that:

     

    package de.MhytRPG.www.events;
    
    import net.minecraft.client.model.ModelBiped;
    import net.minecraft.client.renderer.entity.RenderPlayer;
    import net.minecraftforge.client.event.RenderPlayerEvent;
    import cpw.mods.fml.common.ObfuscationReflectionHelper;
    import cpw.mods.fml.common.eventhandler.SubscribeEvent;
    import de.MhytRPG.www.entitys.Dwarf;
    import de.MhytRPG.www.mobs.Modells.ModelDwarf;
    import de.MhytRPG.www.mobs.Modells.ModelElfFemale;
    import de.MhytRPG.www.mobs.Modells.ModelElfMale;
    import de.MhytRPG.www.mobs.Modells.ModelOrk;
    import de.MhytRPG.www.utils.PlayerEntity;
    
    public class OnRenderPlayerEvents {
    
    @SubscribeEvent
    public void onRenderPlayerPre(RenderPlayerEvent.Pre pre) {
    	int type = 0;
    	if(PlayerEntity.getPlayerEntity(pre.entityPlayer) != null) {
    		type = PlayerEntity.getPlayerEntity(pre.entityPlayer);
    	}
    	switch (type) {
    	case 0:
    		ObfuscationReflectionHelper.setPrivateValue(net.minecraft.client.renderer.entity.RendererLivingEntity.class, pre.renderer, new ModelDwarfMale(), new String[] { "mainModel", "field_77045_g" });
    		break;
    	case 1:
    		ObfuscationReflectionHelper.setPrivateValue(net.minecraft.client.renderer.entity.RendererLivingEntity.class, pre.renderer, new ModelDwarfFemale(), new String[] { "mainModel", "field_77045_g" });
    		break;
    	case 2:
    		ObfuscationReflectionHelper.setPrivateValue(net.minecraft.client.renderer.entity.RendererLivingEntity.class, pre.renderer, new ModelOrkMale(), new String[] { "mainModel", "field_77045_g" });
    		break;
    	case 3:
    		ObfuscationReflectionHelper.setPrivateValue(net.minecraft.client.renderer.entity.RendererLivingEntity.class, pre.renderer, new ModelOrkFemale(), new String[] { "mainModel", "field_77045_g" });
    		break;
    	case 4:
    		ObfuscationReflectionHelper.setPrivateValue(net.minecraft.client.renderer.entity.RendererLivingEntity.class, pre.renderer, new ModelElfMale(), new String[] { "mainModel", "field_77045_g" });
    		break;
    	case 5:
    		ObfuscationReflectionHelper.setPrivateValue(net.minecraft.client.renderer.entity.RendererLivingEntity.class, pre.renderer, new ModelElfFemale(), new String[] { "mainModel", "field_77045_g" });
    		break;
    	default:
    		break;
    	}
    	//ObfuscationReflectionHelper.setPrivateValue(net.minecraft.client.renderer.entity.RendererLivingEntity.class, pre.renderer, new ModelDwarf(), new String[] { "mainModel", "field_77045_g" });
    }
    
    @SubscribeEvent
    public void onRenderPlayerPost(RenderPlayerEvent.Post post) {
    	ObfuscationReflectionHelper.setPrivateValue(net.minecraft.client.renderer.entity.RendererLivingEntity.class, post.renderer, new ModelBiped(), new String[] { "mainModel", "field_77045_g" });
    }
    
    }
    

     

    So you can see three players on server and they will have different models (just need to change the steve texture)?

     

  10. //I tried that before but it doesn´t work (no crash, but no other model)

    //pre.renderer.setRenderPassModel(new ModelDwarf());

                    //That changed the model, but the skin wasn´t changed and there were no rotations(my fault?) That´s what I got from decompiling a mod (Custom Player Models[beta])

    //ObfuscationReflectionHelper.setPrivateValue(net.minecraft.client.renderer.entity.RendererLivingEntity.class, pre.renderer, new ModelDwarf(), new String[] { "mainModel", "field_77045_g" });

     

    I tried something but ObsucationReflectionHandler... sets the Main model of all players.

  11. Hello there,

    maybe it's a stupid question but how do you change the player model? I searched in goggle and later I recompiled a mod which change the player model. But nothing helped.

    I want that the player is rendered with a special model and a special texture (all the time).

    My code:

     

    package de.MhytRPG.www.events;
    
    import net.minecraft.client.renderer.entity.RenderPlayer;
    import net.minecraftforge.client.event.RenderPlayerEvent;
    import cpw.mods.fml.common.ObfuscationReflectionHelper;
    import cpw.mods.fml.common.eventhandler.SubscribeEvent;
    import de.MhytRPG.www.entitys.Dwarf;
    import de.MhytRPG.www.mobs.Modells.ModelDwarf;
    import de.MhytRPG.www.utils.PlayerEntity;
    
    public class OnRenderPlayerEvents {
    
    @SubscribeEvent
    public void onRenderPlayerPre(RenderPlayerEvent.Pre pre) {
    	int type = 0;
                    //not used now. Later it will return the type of the model as int --> example: 1 = ModelFirst, 2 = ModelSecond
    	if(PlayerEntity.getPlayerEntity(pre.entityPlayer) != null) {
    		type = PlayerEntity.getPlayerEntity(pre.entityPlayer);
    	}
                    //not used now
    	switch (type) {
    	case 0:
    		break;
    	case 1:
    
    		break;
    	case 2:
    
    		break;
    	case 3:
    
    		break;
    	case 4:
    
    		break;
    	case 5:
    
    		break;
    	case 6:
    
    		break;
    	default:
    		break;
    	}
                    //I tried that before but it doesn´t work (no crash, but no other model)
    	//pre.renderer.setRenderPassModel(new ModelDwarf());
                    //That changed the model, but the skin wasn´t changed and there were no rotations(my fault?) That´s what I got from decompiling a mod (Custom Player Models[beta])
    	//ObfuscationReflectionHelper.setPrivateValue(net.minecraft.client.renderer.entity.RendererLivingEntity.class, pre.renderer, new ModelDwarf(), new String[] { "mainModel", "field_77045_g" });
    }
    
    @SubscribeEvent
    public void onRenderPlayerPost(RenderPlayerEvent.Post post) {
    
    }
    
    }
    
    

     

    I think there is an easy way to do it and I am just too stupid. Thanks for your help!

  12. Thanks for your help. But now i have another problem:

    event.player.addChatMessage(new ChatComponentTranslation("msg.badkarma.txt", new Object[0]));

    works, but it isn´t colored anymore.

    In the .lang file:

    msg.badkarma.txt=You got §1Zeus §fangry! §4NOW FEEL HIS PAYBACK!

    §1 = DARK_BLUE; §f = WHITE; §4 = DARK_RED.

    In the chat is written:

    You got ?1Zeus ?fangry! ?4NOW FEEL HIS PAYBACK!

     

    EDIT: Solved the problem. Thread can be locked now!

×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.