Jump to content

HoBoS_TaCo

Forge Modder
  • Posts

    140
  • Joined

  • Last visited

Posts posted by HoBoS_TaCo

  1. I've been trying to give a player some items on their first spawn in a world (singleplayer) and different items on respawn (multiplayer). I figured that if these events were added it would help a lot (It would also be good for triggering achievements, potion effects etc upon joining a custom world type). If you know how I can do this without these events i'd like to know, thanks.

     

     

    PlayerSpawn Event - Triggered on first spawn in a world.

     

     

    PlayerRespawn Event - Triggered on a player's respawn.

  2. Hmm I'm not too sure about this white box problem but it seems to be a render issue. I had some problems getting my bullets to render when they extended EntityArrow/RenderArrow so I changed them to extend EntityThrowable/RenderThrowable which simplified a lot of things, especially textures. I can also suggest making sure in your EntityRocket class that the rocket spawn position is correct.

  3. I'll show you how I did mine. This is probably the best way to use proxies. Note: Common proxy's DayZload method is empty. Hope this helps :D

     

     

    The mod file:

    
    
          @SidedProxy(clientSide = "dayz.common.ClientProxy", serverSide = "dayz.common.CommonProxy")
        public static CommonProxy proxy;
         @Init
        public void DayZload(FMLInitializationEvent event)
        {
            EntityRegistry.registerModEntity(EntityBullet.class, "Bullet", 1, this, 250, 5, true);
             proxy.DayZload();
        }
    
    

    ClientProxy:

     

    
    
    @Override
       public void DayZload() 
       {
            RenderingRegistry.registerEntityRenderingHandler(EntityBullet.class, new RenderBullet());
       }
    
    

     

     

     

  4. I've never looked at Rei's code so it might be better then my way, but here is what I did:

     

    First you need to set up your tick handler to also trigger on render ticks,

    http://www.minecraftforge.net/wiki/Tutorials/Upgrading_To_Forge_for_1.3.1#Ticking

     

    Don't open a gui screen, instead draw the elements you want during a render tick. (has to be during the  render tick or the images flicker)

    Ahh okay. Thanks i'll look into it.
  5. I'm trying to make my Gui run on the side of the screen mid-game without becoming the main focus (much like how Rei's minimap is on screen but the mouse doesn't pop up and the player keeps moving). I've stopped the gui from pausing the game with doesGuiPauseGame() but it still stops the player moving and the mouse pops up. Does anyone have any ideas on how I would fix this?

  6. Mmk so I rage quit from this for a few days and ended up figuring it out. Turns out I may be slightly retarded since I didn't read correctly how to do the @SidedProxy. I did find though that I had to put

    @SidedProxy(clientSide = "net.minecraft.src.DayZ_ClientProxy", serverSide = "net.minecraft.src.DayZ_CommonProxy")

    when I worked out of MCP. When I reobfuscated I changed it to

    @SidedProxy(clientSide = "DayZ_ClientProxy", serverSide = "DayZ_CommonProxy")

    so all good now :D thanks for the help.

     

     

  7. I had a look at how IronChest does it and made some changes. The server starts now but nothing in the client proxy is rendered in either the client or the server. I also noticed that in  RenderingRegistry.instance().registerEntityRenderingHandler the .instance() comes out as deprecated.

     

     

    DayZ_Base

    package net.minecraft.src;
    
    
    import java.util.Map;
    import cpw.mods.fml.common.FMLCommonHandler;
    import cpw.mods.fml.common.Mod;
    import cpw.mods.fml.common.Mod.Instance;
    import net.minecraftforge.client.MinecraftForgeClient;
    import net.minecraftforge.common.AchievementPage;
    import net.minecraftforge.common.EnumHelper;
    import cpw.mods.fml.common.Mod.Init;
    import cpw.mods.fml.common.event.FMLInitializationEvent;
    import cpw.mods.fml.common.network.NetworkMod;
    import cpw.mods.fml.common.registry.EntityRegistry;
    import cpw.mods.fml.common.registry.GameRegistry;
    import cpw.mods.fml.common.registry.LanguageRegistry;
    import cpw.mods.fml.common.SidedProxy;
    
    
    @NetworkMod(clientSideRequired = true, serverSideRequired = false)
    @Mod(modid = "dayzminecraft", name = "Day Z", version = "5.0")
    public class DayZ_Base
    {
    @SidedProxy(clientSide = "DayZ_ClientProxy", serverSide = "DayZ_CommonProxy")
    public static DayZ_CommonProxy proxy;
    @Instance
    public static DayZ_Base instance;
        
        @Init
        public void DayZload(FMLInitializationEvent event)
        {        
        	//Load stuff in CommonProxy.
        	proxy.loadClientData();
    
    
            //Registers the entities
            EntityRegistry.registerGlobalEntityID(DayZ_EntityZombie.class, "DayZZombie", ModLoader.getUniqueEntityId());
            EntityRegistry.registerGlobalEntityID(DayZ_EntityBandit.class, "Bandit", ModLoader.getUniqueEntityId());
            EntityRegistry.registerGlobalEntityID(DayZ_EntityCrawler.class, "Crawler", ModLoader.getUniqueEntityId());
            //Registers the entities here.
            EntityRegistry.registerModEntity(DayZ_EntityBullet.class, "Bullet", 1, this, 250, 5, true);
            EntityRegistry.registerModEntity(DayZ_EntityGrenade.class, "Grenade", 1, this, 250, 5, true);
            //This is pretty much the old ModLoader method (in fact, the ModLoader method just calls this)
            EntityRegistry.registerGlobalEntityID(DayZ_EntityBullet.class, "Bullet", 219);//last param is entity ID, must be unique.
            EntityRegistry.registerGlobalEntityID(DayZ_EntityGrenade.class, "Grenade", 218);//last param is entity ID, must be unique.
            
            //Setting Localization.
            LanguageRegistry.instance().addStringLocalization("entity.Crawler.name", "en_US", "Crawler");
            LanguageRegistry.instance().addStringLocalization("entity.DayZZombie.name", "en_US", "Zombie");
            LanguageRegistry.instance().addStringLocalization("entity.Bandit.name", "en_US", "Bandit");
            LanguageRegistry.instance().addStringLocalization("generator.DAYZ", "en_US", "Day Z");
    
    
              LanguageRegistry.instance().addName(DayZ_Base.barbedwire, "Barbed Wire");
        }
    }
    

     

     

    DayZ_CommonProxy

     

     

    
    package net.minecraft.src;
    
    
    import net.minecraftforge.client.MinecraftForgeClient;
    import cpw.mods.fml.common.Mod.Instance;
    import cpw.mods.fml.common.network.IGuiHandler;
    
    
    public class DayZ_CommonProxy implements IGuiHandler
    {
        public static void loadClientData()
        {
        	
        }
    
        @Override
        public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z)
        {
            return null;
        }
    
    
        @Override
        public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z)
        {
            return null;
        }
    }
    

     

    DayZ_ClientProxy

     

    
    package net.minecraft.src;
    
    
    import java.io.File;
    import net.minecraft.client.Minecraft;
    import net.minecraftforge.client.MinecraftForgeClient;
    import cpw.mods.fml.client.registry.RenderingRegistry;
    import cpw.mods.fml.common.SidedProxy;
    import cpw.mods.fml.common.Mod.Instance;
    import cpw.mods.fml.common.registry.LanguageRegistry;
    
    
    public class DayZ_ClientProxy extends DayZ_CommonProxy
    {
        public static void loadClientData()
        {
        	//Render entities.
            RenderingRegistry.instance().registerEntityRenderingHandler(DayZ_EntityZombie.class, new RenderBiped(new ModelZombie(), 0.5F));
            RenderingRegistry.instance().registerEntityRenderingHandler(DayZ_EntityCrawler.class, new DayZ_RenderCrawler(new DayZ_ModelCrawler(), 0.5F));
            RenderingRegistry.instance().registerEntityRenderingHandler(DayZ_EntityBandit.class, new RenderBiped(new ModelBiped(), 0.5F));
            RenderingRegistry.instance().registerEntityRenderingHandler(DayZ_EntityBullet.class, new DayZ_RenderBullet());
            
            //Preload the textures.
            MinecraftForgeClient.preloadTexture("/DayZ/weapons.png");
            MinecraftForgeClient.preloadTexture("/DayZ/heal.png");
            MinecraftForgeClient.preloadTexture("/DayZ/food.png");
            MinecraftForgeClient.preloadTexture("/DayZ/terrain.png");
            MinecraftForgeClient.preloadTexture("/DayZ/armor.png");
            
            //Install sounds.
            Minecraft mc = ModLoader.getMinecraftInstance();
            mc.installResource("newsound/DayZ/reload.ogg", new File(mc.mcDataDir, "resources/newsound/DayZ/reload.ogg"));
            mc.installResource("newsound/DayZ/ak74u.ogg", new File(mc.mcDataDir, "resources/newsound/DayZ/ak74u.ogg"));
            mc.installResource("newsound/DayZ/makarov.ogg", new File(mc.mcDataDir, "resources/newsound/DayZ/makarov.ogg"));
            mc.installResource("newsound/DayZ/remington.ogg", new File(mc.mcDataDir, "resources/newsound/DayZ/remington.ogg"));
            
            //Adds Achievements
            ModLoader.addAchievementDesc(DayZ_Base.achievementFirstKill, "BRRAAAAAIINS", "Killed Your First Zombie");
            ModLoader.addAchievementDesc(DayZ_Base.achievementFoundGun, "Lock and Load", "Found A Gun");
            ModLoader.addAchievementDesc(DayZ_Base.achievementTakenPainkillers, "Pill Popper", "Taken Painkillers");
        }
    }
    

  8.        //Load the sound(s) in ClientProxy.
            DayZ_ClientProxy.loadDayzSounds();
            //Load the renderer(s) in ClientProxy.
            DayZ_ClientProxy.registerRenderInformation();

    You have hard references to client proxy.

    Thats bad, take a look at SideProxy

     

     

    D:

     

     

    So to fix this I would put

     

     

     

    @SidedProxy(clientSide = "net.minecraft.src.DayZ_ClientProxy", serverSide = "net.minecraft.src.DayZ_CommonProxy")

    in the DayZ_Base file?

     

     

     

     

     

     

  9. DayZ_Base - I removed all the references to the items, blocks, .addName etc.

    package net.minecraft.src;
    
    
    import java.util.Map;
    import net.minecraftforge.client.MinecraftForgeClient;
    import cpw.mods.fml.common.FMLCommonHandler;
    import cpw.mods.fml.common.Mod;
    import net.minecraftforge.common.AchievementPage;
    import net.minecraftforge.common.EnumHelper;
    import cpw.mods.fml.common.Mod.Init;
    import cpw.mods.fml.common.event.FMLInitializationEvent;
    import cpw.mods.fml.common.network.NetworkMod;
    import cpw.mods.fml.common.registry.EntityRegistry;
    import cpw.mods.fml.common.registry.GameRegistry;
    import cpw.mods.fml.common.registry.LanguageRegistry;
    
    
    
    @NetworkMod(clientSideRequired = true, serverSideRequired = false)
    @Mod(modid = "dayzminecraft", name = "Day Z", version = "5.0")
    public class DayZ_Base
    {
        public static DayZ_WorldType DayZ_WorldType = new DayZ_WorldType();
        public static final BiomeGenBase dayzforest = (new DayZ_BiomeGenForest(25)).setColor(747097).setBiomeName("Forest");
    
    
        @Init
        public void DayZload(FMLInitializationEvent event)
        {        
        	//Load the sound(s) in ClientProxy.
            DayZ_ClientProxy.loadDayzSounds();
            //Load the renderer(s) in ClientProxy.
            DayZ_ClientProxy.registerRenderInformation();
          	//Registers Blocks
          	GameRegistry.registerBlock(barbedwire);
            //Registers the biome.
            GameRegistry.addBiome(dayzforest);
            //Registers the entities
            EntityRegistry.registerGlobalEntityID(DayZ_EntityZombie.class, "DayZZombie", ModLoader.getUniqueEntityId());
            EntityRegistry.registerGlobalEntityID(DayZ_EntityBandit.class, "Bandit", ModLoader.getUniqueEntityId());
            EntityRegistry.registerGlobalEntityID(DayZ_EntityCrawler.class, "Crawler", ModLoader.getUniqueEntityId());
            //Registers the entities here.
            EntityRegistry.registerModEntity(DayZ_EntityBullet.class, "Bullet", 1, this, 250, 5, true);
            //This is pretty much the old ModLoader method (in fact, the ModLoader method just calls this)
            EntityRegistry.registerGlobalEntityID(DayZ_EntityBullet.class, "Bullet", 219);//last param is entity ID, must be unique.
            //Preload the textures.
            MinecraftForgeClient.preloadTexture("/DayZ/weapons.png");
            MinecraftForgeClient.preloadTexture("/DayZ/heal.png");
            MinecraftForgeClient.preloadTexture("/DayZ/food.png");
            MinecraftForgeClient.preloadTexture("/DayZ/terrain.png");
            MinecraftForgeClient.preloadTexture("/DayZ/armor.png");
            //Setting Localization.
            LanguageRegistry.instance().addStringLocalization("entity.Crawler.name", "en_US", "Crawler");
            LanguageRegistry.instance().addStringLocalization("entity.DayZZombie.name", "en_US", "Zombie");
            LanguageRegistry.instance().addStringLocalization("entity.Bandit.name", "en_US", "Bandit");
            LanguageRegistry.instance().addStringLocalization("generator.DAYZ", "en_US", "Day Z");
        }
    }
    

     

    DayZ_CommonProxy

     

    package net.minecraft.src;
    import java.io.File;
    import net.minecraft.client.Minecraft;
    import cpw.mods.fml.common.Mod.Instance;
    import cpw.mods.fml.common.network.IGuiHandler;
    
    
    public class DayZ_CommonProxy implements IGuiHandler
    {
        public static void registerRenderInformation()
        {
            //No rendering for servers.
        }
        
        public static void loadDayzSounds()
        {
            //No sounds for servers.
        }
    
    
        @Override
        public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z)
        {
            return null;
        }
    
    
        @Override
        public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z)
        {
            return null;
        }
    }
    

     

    DayZ_ClientProxy

     

     

    
    
    package net.minecraft.src;
    
    
    import java.io.File;
    import net.minecraft.client.Minecraft;
    import net.minecraftforge.client.MinecraftForgeClient;
    import cpw.mods.fml.client.registry.RenderingRegistry;
    import cpw.mods.fml.common.Mod.Instance;
    
    
    public class DayZ_ClientProxy extends DayZ_CommonProxy
    {
        public static void registerRenderInformation()
        {
        	//Basically the same as the old way to render entities.
            RenderingRegistry.instance().registerEntityRenderingHandler(DayZ_EntityZombie.class, new RenderBiped(new ModelZombie(), 0.5F));
            RenderingRegistry.instance().registerEntityRenderingHandler(DayZ_EntityCrawler.class, new DayZ_RenderCrawler(new DayZ_ModelCrawler(), 0.5F));
            RenderingRegistry.instance().registerEntityRenderingHandler(DayZ_EntityBandit.class, new RenderBiped(new ModelBiped(), 0.5F));
            RenderingRegistry.instance().registerEntityRenderingHandler(DayZ_EntityBullet.class, new DayZ_RenderBullet());
        }
    
    
        public static void loadDayzSounds()
        {
            Minecraft mc = ModLoader.getMinecraftInstance();
            mc.installResource("newsound/DayZ/reload.ogg", new File(mc.mcDataDir, "resources/newsound/DayZ/reload.ogg"));
            mc.installResource("newsound/DayZ/ak74u.ogg", new File(mc.mcDataDir, "resources/newsound/DayZ/ak74u.ogg"));
            mc.installResource("newsound/DayZ/makarov.ogg", new File(mc.mcDataDir, "resources/newsound/DayZ/makarov.ogg"));
            mc.installResource("newsound/DayZ/remington.ogg", new File(mc.mcDataDir, "resources/newsound/DayZ/remington.ogg"));
        }
    }
    

     

    This is really bugging me as the error makes no cents. I did a search of the common source folder and the only file with ModelBiped in it is DayZ_ClientProxy. I haven't touched anywhere else.

  10. I get this weird error which I can't seem to remove.

    
    [iNFO] [sTDERR] 2012-08-17 16:45:55 [sEVERE] Encountered an unexpected exception LoaderException
    cpw.mods.fml.common.LoaderException: java.lang.reflect.InvocationTargetException
       at cpw.mods.fml.common.LoadController.transition(LoadController.java:106)
       at cpw.mods.fml.common.Loader.initializeMods(Loader.java:603)
       at cpw.mods.fml.server.FMLServerHandler.finishServerLoading(FMLServerHandler.java:116)
       at cpw.mods.fml.common.FMLCommonHandler.onServerStarted(FMLCommonHandler.java:356)
       at ft.b(DedicatedServer.java:111)
       at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:415)
       at ep.run(SourceFile:539)
    Caused by: java.lang.reflect.InvocationTargetException
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:597)
       at cpw.mods.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:308)
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:597)
       at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:69)
       at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:45)
       at com.google.common.eventbus.EventBus.dispatch(EventBus.java:317)
       at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:300)
       at com.google.common.eventbus.EventBus.post(EventBus.java:268)
       at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:127)
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:597)
       at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:69)
       at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:45)
       at com.google.common.eventbus.EventBus.dispatch(EventBus.java:317)
       at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:300)
       at com.google.common.eventbus.EventBus.post(EventBus.java:268)
       at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:85)
       at cpw.mods.fml.common.Loader.initializeMods(Loader.java:602)
       ... 5 more
    Caused by: java.lang.NoClassDefFoundError: arp
       at DayZ_Base.DayZload(DayZ_Base.java:60)
       ... 31 more
    Caused by: java.lang.ClassNotFoundException: arp
       at cpw.mods.fml.relauncher.RelaunchClassLoader.findClass(RelaunchClassLoader.java:99)
       at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
       at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
       ... 32 more
    Caused by: java.lang.NullPointerException
       at org.objectweb.asm.ClassReader.<init>(Unknown Source)
       at cpw.mods.fml.common.asm.transformers.SideTransformer.transform(SideTransformer.java:28)
       at cpw.mods.fml.relauncher.RelaunchClassLoader.runTransformers(RelaunchClassLoader.java:141)
       at cpw.mods.fml.relauncher.RelaunchClassLoader.findClass(RelaunchClassLoader.java:92)
       ... 34 more
    

     

    I looked into the class not found error and learnt that class arp is ModelBase. I also looked into line 60 of DayZ_Base which is

     

    DayZ_ClientProxy.loadDayzSounds();

     

    DayZ_ClientProxy

     

    package net.minecraft.src;
    
    
    import java.io.File;
    import net.minecraft.client.Minecraft;
    import net.minecraftforge.client.MinecraftForgeClient;
    import cpw.mods.fml.client.registry.RenderingRegistry;
    import cpw.mods.fml.common.Mod.Instance;
    
    
    public class DayZ_ClientProxy extends DayZ_CommonProxy
    {
        public static void registerRenderInformation()
        {
            RenderingRegistry.instance().registerEntityRenderingHandler(DayZ_EntityZombie.class, new RenderBiped(new ModelZombie(), 0.5F));
            RenderingRegistry.instance().registerEntityRenderingHandler(DayZ_EntityCrawler.class, new DayZ_RenderCrawler(new DayZ_ModelCrawler(), 0.5F));
            RenderingRegistry.instance().registerEntityRenderingHandler(DayZ_EntityBandit.class, new RenderBiped(new ModelBiped(), 0.5F));
            RenderingRegistry.instance().registerEntityRenderingHandler(DayZ_EntityBullet.class, new DayZ_RenderBullet());
        }
    
    
        public static void loadDayzSounds()
        {
            Minecraft mc = ModLoader.getMinecraftInstance();
            mc.installResource("newsound/DayZ/reload.ogg", new File(mc.mcDataDir, "resources/newsound/DayZ/reload.ogg"));
            mc.installResource("newsound/DayZ/ak74u.ogg", new File(mc.mcDataDir, "resources/newsound/DayZ/ak74u.ogg"));
            mc.installResource("newsound/DayZ/makarov.ogg", new File(mc.mcDataDir, "resources/newsound/DayZ/makarov.ogg"));
            mc.installResource("newsound/DayZ/remington.ogg", new File(mc.mcDataDir, "resources/newsound/DayZ/remington.ogg"));
        }
    }
    

     

    Any help would be appreciated.

×
×
  • Create New...

Important Information

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