coolAlias's Avatar
Member
Level 71 Legendary Modder
193

Forum Posts

1 - 6 of 6

    2
    09/14/2017 10:42 pmhistory
    Level 71 : Legendary Modder
    coolAlias
    coolAlias's Avatar
    I don't recommend using a singleton (static instance) for your render factory - use a new instance of it for each entity, e.g.:

    ```
    RenderingRegistry.registerEntityRenderingHandler(EntityChu.class, new RenderEntityChu.Factory(new ModelSlime(16), 0.25F));
    ```

    Then make sure your render class extends one of the vanilla entity renderer classes and overrides / calls the required methods. Example.
    1
    01/01/2014 11:10 am
    Level 71 : Legendary Modder
    coolAlias
    coolAlias's Avatar
    Yes, Minecraft is its own beast ;p Knowing Java is the first step, though, and once you've got a good grasp of the basics it will be much easier to follow along with more advanced tutorials as well as figure stuff out on your own by looking at the vanilla classes (which is what all the advanced tutorials are based on!).

    That's really the best advice: look in vanilla code for something that is similar to what you want to do, copy that, and then change it until it's doing what you want. Pretty much everything you could want to do has already been done in vanilla code, and if it hasn't, then you're lucky because you get to code it from scratch! Trust me, when you get better at Java, much of the time you'll prefer doing it from scratch to messing with Minecraft's code.
    1
    01/01/2014 12:57 am
    Level 71 : Legendary Modder
    coolAlias
    coolAlias's Avatar
    Then I suggest you look up some Java tutorials. They will help you far more than you expect. The New Boston has an excellent and free course on programming / Java. If you follow all of those, you will be able to do so much more than you can now.

    Anyway, in your code you have access to the player object, right? That player is a member of the class EntityPlayer, which is a sub-class of Entity, meaning it has a World object you can use. All entities also have position coordinates, called posX, posY, and posZ.

    player.posX; // that's a double for the player's position
    player.worldObj; // that's the World object
    player.worldObj.rand; // there's your Random object

    etc. I'm sure you can figure out the rest.
    1
    12/31/2013 7:46 pm
    Level 71 : Legendary Modder
    coolAlias
    coolAlias's Avatar
    That's pretty basic Java. You need to get those variables from somewhere, such as the method paramaters. If there is no World object in the method's parameters, you can get one from any entity using "entity.worldObj"; par2, par3 and par4 are the position at which to spawn the particles, i.e. x/y/z coordinates, and they are doubles so that you can spawn anywhere within a block. par5Random can be gotten from the World object, wherever you got that from, using worldObj.rand.
    1
    12/31/2013 11:15 am
    Level 71 : Legendary Modder
    coolAlias
    coolAlias's Avatar
    You just need to add the potion effect for poison when you hit the entity.

    @Override
    public boolean hitEntity(ItemStack stack, EntityLivingBase target, EntityLivingBase attacker) {
    // parameters of PotionEffect are: id, amplifier, duration in ticks (20 = 1 second)
    target.addPotionEffect(new PotionEffect(Potion.poison.id, 1, 60));
    }

    if that doesn't work as expected, I may have gotten the 'target' and 'attacker' parameters backwards, but I'm pretty sure that's right So just switch them around if the mob isn't getting poisoned.
    1
    12/31/2013 11:09 am
    Level 71 : Legendary Modder
    coolAlias
    coolAlias's Avatar
    As this guy shows, it's totally possible. You can spawn any particle in Minecraft using the above code and the particle name, which can be found on the wiki here.

1 - 6 of 6

Planet Minecraft

Website

© 2010 - 2024
www.planetminecraft.com

Welcome