Slime code

Discussion in 'Plugin Development' started by Block34, Dec 7, 2013.

Thread Status:
Not open for further replies.
  1. Offline

    Block34

    Im just trying out some NMS here:
    Code:
    public class HyperSlime extends EntitySlime{
           
            public float h;
            public float i;
            public float j;
            @SuppressWarnings("unused")
            private int jumpDelay;
           
            public HyperSlime(World world) {
                super(world);
                int i = 1 << this.random.nextInt(3);
               
                this.height = 0.0F;
                this.jumpDelay = this.random.nextInt(10);
                this.setSize(i);
            }
           
        }
    If i want the slime's jump delay to be shorter do i remove the original and add this.jumpDelay = this.random.nextInt(10);
    Is it possible to modify the size of the slime also. Make it bigger maybe?
     
  2. Offline

    scarabcoder

    I have no idea if this will work, but it might. I've never tested this out:
    Certain creatures (skeletons, horses, etc) have subtypes. To get them, you do:
    Skeleton skeleton = world.spawnCreature(loc, CreatureType.SKELETON);
    Then you can do skeleton.setType(). Maybe if you did:
    Slime slime = world.spawnCreature(loc, CreatureType.SLIME);
    It would work. Again, I don't understand classes much. I'm really not sure if it will work :)
     
  3. Offline

    Block34

  4. Offline

    RawCode

    create normal slime and alter fields you want on it, extending mobs\blocks\whatever is unsafe.
     
    Block34 and samosaara like this.
  5. Offline

    scarabcoder

    Block34 I'm not exactly sure. Just do start typing slime.set and you might be able to find something.
     
  6. Offline

    Block34

    Epic fail. This code just crashes my game(client only). Im a noob at NMS.
     
  7. Offline

    RawCode

    net.minecraft.server.v1_7_R1.EntitySlime shoud be fully qualified, some bukkit\craftbukkit classes may shadow it with undefined results.

    you shoud not under any circumstances just create extended class instance, it is not registered inside netmanager and will knock client by mob with invalid network ID.

    you dont need class extension to edit fields, reflections will do it.


    if you want to edit method, you must carefully replace entity with extended version EVERYWHERE, not only in your plugin.
     
Thread Status:
Not open for further replies.

Share This Page