• 1

    posted a message on TheInstitution's Modding Tutorials + FORGE TUTS
    Quote from Hiphopopotamus17

    what are the potion IDs i cant find them


    If you can't find the IDs of the potions then you haven't progressed far enough in your education to need to know how to apply them to Entities.
    Posted in: Tutorials
  • 0

    posted a message on TheInstitution's Modding Tutorials + FORGE TUTS
    Quote from Hiphopopotamus17

    Or just give me the code please help!


    entity.addPotionEffect(effectID, durationInSeconds*20)

    Where entity is the entity being hit.
    It's something similar to that, too lazy to go look in my own stuff.
    Posted in: Tutorials
  • 0

    posted a message on [256x,64x][1.4.6] G's Smooth Modern HD .discontinued.
    I haven't shown up in a long time...I need to mess with this again.
    Posted in: Resource Packs
  • 0

    posted a message on Having Issues with Fireball on Right Click
    Quote from lordofroosters

    ...So I'd just look into the attackEntity void and pretty much copy the directional code? Ah, thanks. Unfortunately, I am incapable of working with keybindings (I know there's a Modloader function with it, and since my mod ATM is currently using Modloader, I could use it but I can't figure it out. I'm so incompetent. >_<)


    Don't worry, you'll figure it out, whether you do it now, or later with more experience.
    When I first ported my code to Forge after running out of sprites I had a hell of a time trying to add my arrows back in with the provided hooks. I eventually had to give up on trying. Later when I had more experience I had a moment where I realized "HERP DERP all I have to do is this tiny simple thing...DERP" and had it working in ~5 minutes.

    Unfortunately I haven't done keybinds either or I'd be a bigger help here.
    Posted in: Modification Development
  • 0

    posted a message on [Forge] [Not beginner post] Persisting the Player's inventory beyond death
    Quote from Bryguy

    I don't know how Forge works, but I know that when the player dies it simply empties out the players inventory.

    EntityPlayer.java, onDeath(). Look for inventory.dropAllItems();. Hopefully that will give you something more to go off of :)

    Edit: Actually, in theory you could create an inventory identical to the players. If the conditions are met, then when the player respawns you'd set his/her inventory to the one you've created. Or something.


    Your edit restates what I already said I knew, and already said I was trying to do.

    Also, editing EntityPlayer.onDeath() doesn't do what you would expect, and would require editing EntityPlayer anyway. I've already tried it.
    It does not simply empty the player's inventory, that method is there to force-drop all of the items before respawning, because when you respawn it deletes the inventory.
    Posted in: Modification Development
  • 0

    posted a message on [Forge] [Not beginner post] Persisting the Player's inventory beyond death
    Quote from meeees

    I've never used forge so I'm not sure exactly how it works, but what I would do is I would make a new IInventory object and just set it to the players inventory ItemStack by ItemStack using a for loop (because just doing = means when one changes the other does too, at least that's how it's seemed to me when messing with this), but only do this if the conditions are met
    then when the player respawns, use another for loop with the saved items and the players inventory, taking the copied items and giving them back to the player


    Yeah I've got a feeling I'll have to figure that out...unless what I'm trying now works.
    Posted in: Modification Development
  • 0

    posted a message on Opal block crashes game whenever it is crafted
    Quote from RANKSHANK

     java.lang.NullPointerException
    at net.minecraft.src.ItemStack.getIconIndex(ItemStack.java:105)
    at net.minecraft.src.RenderItem.renderItemIntoGUI(RenderItem.java:270)

    Well from that your either declaring the icon index wrong or havent done so at all


    this
    Posted in: Modification Development
  • 0

    posted a message on [Forge] [Not beginner post] Persisting the Player's inventory beyond death
    Hello everyone. I'm currently attempting to develop a way for the player to "keep" their inventory after they've died if certain conditions are met. Unfortunately, however, I'm a bit stuck on exactly how to pull this off; here's the full situation:

    Mods/APIs:
    ModLoader
    Forge API

    The file I'm editing:
    EntityUpdateHandler, which implements IEntityUpdateHandler

    What IEntityUpdateHandler is and why I made it:
    IEntityUpdateHandler is a custom Forge interface that I wrote earlier today. I'm currently testing it, and if it serves its purpose I'll message one of the Forge team and ask them if they'll patch it into the main API. The purpose of this interface is to provide a direct hook into Entity.onEntityUpdate() at the beginning and end of the method, because that is the root updating method of all Entities, and hooking into it means that modders will have access to a one-stop-shop for modifying the tick updating function of any Entity they desire. Currently this hook functions as intended.

    The contents of the current file, what I have working, and what I need help with:

    EntityUpdateHandler:

    package net.minecraft.src;
    
    import net.minecraft.src.forge.IEntityUpdateHandler;
    
    public class EntityUpdateHandler implements IEntityUpdateHandler
    {
    
    /** The first time onEntityUpdateStart(entity) has been run */
    private boolean firstTime1 = true;
    /** The first time onEntityUpdateEnd(entity) has been run */
    private boolean firstTime2 = true;
    /** The instance of Entity passed in */
    private Entity theEntity;
    /** Set on the tick that the player is determined as dead */
    private boolean playerHasDied = false;
    
    public void onEntityUpdateStart(Entity entity)
    {
    this.theEntity = entity;
    
    /* Prints a short message into the console at the start of the first tick that the player updates
    * Used for insuring that this method was run */
    if (entity instanceof EntityPlayer)
    {
    if (this.firstTime1)
    {
    System.out.println("Start!");
    this.firstTime1 = false;
    }
    
    /* If the "deathTime" field in EntityPlayer is above 0 the player is dead,
    * as such I've used it as the means of detecting when the player is dead or alive.
    * This performs detection correctly. */
    if (((EntityPlayer) entity).deathTime > 0)
    {
    this.playerHasDied = true;
    System.out.println(((EntityPlayer) entity).deathTime + " " + playerHasDied);
    }
    
    /* If the player has died and the "deathTime" field in EntityPlayer is now 0
    * then the player is alive again, thus this is used to detect when the player has been respawned.
    * This performs detection correctly. */
    if (playerHasDied == true && ((EntityPlayer) entity).deathTime == 0)
    {
    playerHasDied = false;
    System.out.println(((EntityPlayer) entity).deathTime + " " + playerHasDied);
    }
    }
    }
    
    public void onEntityUpdateEnd(Entity entity)
    {
    this.theEntity = entity;
    
    /* Prints a short message into the console at the end of the first tick that the player updates
    * Used for insuring that this method was run */
    if (entity instanceof EntityPlayer)
    {
    if (this.firstTime2)
    {
    System.out.println("End!");
    this.firstTime2 = false;
    }
    }
    }
    
    }


    The fields used are commented with clear javadoc descriptions.
    As you can see by the remaining comments in the code, I have all of the methods running correctly, and all of the code for detecting when the player is dead and alive functioning correctly.

    Now that that's out of the way, here's my problem.
    EntityPlayer and related Inventory classes possess several methods for managing the contents of the player's inventory, including one that should allow you to copy the entire contents of the inventory and store it in an instance of InventoryPlayer. I've determined that I need to store a copy of the player inventory each tick prior to death, and then reapply the inventory to the player after a respawn is detected, however, I can neither figure out how to store a copy of the inventory, nor reapply the inventory from the instance of InventoryPlayer that it's stored in.

    In short:
    How do I store the player's inventory in an instance of InventoryPlayer?
    How do I reapply an instance of InventoryPlayer containing a copy of the inventory to the player?


    Help is highly appreciated.
    Posted in: Modification Development
  • 0

    posted a message on how would one make a panelike block?

    ok, it doesn't work, how would i work out the texture ID?


    I honestly don't know...:mellow:

    ModLoader doesn't always assign the same texture to the same texture ID, so having it use a specific number won't work...

    If you could find a way to get the ID of the texture ModLoader assigns you could assign it to a variable and use that variable in the block initilializing line...but I don't know how to do that.
    Posted in: Modification Development
  • 0

    posted a message on how would one make a panelike block?

    EDIT: reread your post, so that means i can pass it the front texture, but i use a custom texture for it, so it doesn't have any coords... Still rather confusing.


    When you use ModLoader to override a texture, ModLoader actually places that sprite into a free terrain.png/items.png slot in memory, and thus its ID becomes the ID of that texture slot.

    If you'll notice:

    itemNameHere.iconIndex = ModLoader.addOverride("/gui/items.png", "/ModTextures/Items/NameHere.png");


    In this typical line of texture assignment code, the iconIndex of the specified item is assigned as the ModLoader override.

    In theory (I haven't done this and don't have my normal mod open for an immediate test) you could just place the
    "ModLoader.addOverride("/gui/items.png", "/ModTextures/Items/NameHere.png");" line in place of the number for the texture ID.

    Try that and tell me if it actually lets you.
    Posted in: Modification Development
  • 0

    posted a message on Accessing EntityPlayer in the onUpdate() void in another entity.
    Quote from ruben381

    No, it's a new entity file that I've created. Not a vanilla one.


    That doesn't answer the question.


    Quote from StarshadesJack

    If you're using ModLoader, you can call ModLoader.getMinecraftInstance().thePlayer to return an instance of the player whenever you want.


    We don't know whether he actually needs a new instance of the player or not.
    Posted in: Modification Development
  • 0

    posted a message on Accessing EntityPlayer in the onUpdate() void in another entity.
    You have to tell us from what file you tried to access it from and how.
    Accessing EntityPlayer from Entity, for example, is trivial.
    Posted in: Modification Development
  • 0

    posted a message on how would one make a panelike block?

    ahh, i get what you mean, so the boolean should be true. But what about those extra ints and Material. Would i give the public static final line, the par3 int, for the int, and the par4Material for the material.
    or do i give the int the render function, 18. I'm rather confused.


    The first two ints and the Material are the exact same as any normal block.
    The unfamiliar int should probably be the same texture ID as you used for the block. (it's a texture ID, same as normal, but for the side of the block, rather than its face)
    You already understand the boolean.
    Posted in: Modification Development
  • 0

    posted a message on how would one make a panelike block?

    i'm working on making a pane-like block, since i had no idea how, i used the BlockPane class. But minecraft didn't like me doing that unless i added this to my
     public static final RiceScreen = new BlockRiceScreen(141, 0).//etc etc
    :
     new BlockRiceScreen(141,0,0,Material.glass, false).//etc etc 
    . But whenever i placed the block ingame, the game crashed. The annoying thing is, it doesn't give you the error report, in ModLoader.txt or on screen. So could someone explain what the extra int and boolean mean, I searched the BlockPane code for anything that would give some insight, but to no avail.



    The field names and constructor of the BlockPane class tell you exactly what they do...hell, they're the only two things there that are explicitly enumerated in a unique way.
    Posted in: Modification Development
  • 0

    posted a message on Problems Adding Custom Armor to Minecraft using ModLoader
    Quote from Grim_Remilia

    http://www.minecraft...st__p__14451620
    There it was. However it enchants armor with diamond rate, not your own.


    Yeah that "fix" just makes it use the EnumArmorMaterial for diamond, rather than a new one. It's a pain...
    Posted in: Modification Development
  • To post a comment, please .