Jump to content

Brun0_MF

Members
  • Posts

    26
  • Joined

  • Last visited

Converted

  • Gender
    Male

Recent Profile Visitors

6507 profile views

Brun0_MF's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. I put the method as static and it worked... I also took the other one just from the client... Thanks! ๐Ÿ™‚
  2. https://github.com/Brun0MF/RustikMod OK, I believe this is correct now.
  3. Sorry! I don't know how to use Github, so I tried my best not to have to use it...๐Ÿ˜“ And you Draco18s, do you have any idea what the error might be? ๐Ÿค”
  4. https://github.com/Brun0MF/RustikMod The file set was too big so I zipped everything up. ๐Ÿค” Just download everything and extract the .zip
  5. https://github.com/Brun0MF/RustikMInecraftMod
  6. But when I wanted to disable an event I used "event.setCanceled (true);", when I modified the entity I didn't use the event anymore but the "zombie.getAttributes(). AddTransientAttributeModifiers (EntityModify());" (I used "zombie" and not event). Don't we have to pass the zombie class to the event?
  7. I went to do some tests and found that the error is here: @SubscribeEvent(priority = EventPriority.HIGHEST) public void entityJoinWorld(EntityJoinWorldEvent event){ Entity entity = event.getEntity(); if (entity.isAlive() && entity instanceof Zombie) { Zombie zombie = (Zombie) entity; zombie.getAttributes().addTransientAttributeModifiers(EntityModify()); //event.setCanceled(true); } } Error: Entity is not modified. An instance of the Zombie class is created based on the event, but we don't modify the event, so nothing happens. The event had to be exchanged for the modified entity "zombie", but I can't find a way to do that...๐Ÿ˜“ Another question, how to completely disable the natural generation of an entity, without waiting for it to spawn and then despawn.๐Ÿค”
  8. I tried it and it worked, then I commented. It has 2000 because it didn't work with low values so I put a high value to see if it made a difference.
  9. public static final AttributeModifier AM = new AttributeModifier("attributemodifier",2000d, AttributeModifier.Operation.ADDITION); public static Multimap<Attribute,AttributeModifier> EntityModify(){ Multimap<Attribute, AttributeModifier> map = HashMultimap.create(); map.put(Attributes.MOVEMENT_SPEED,AM); return map; } @SubscribeEvent(priority = EventPriority.HIGHEST) public void entityJoinWorld(EntityJoinWorldEvent event){ Entity entity = event.getEntity(); if (entity.isAlive() && entity instanceof Zombie) { Zombie zombie = (Zombie) entity; zombie.getAttributes().addTransientAttributeModifiers(EntityModify()); //event.setCanceled(true); } } This is the code... It turns out that something must be missing, because it's not affecting the entity. event.setCanceled(true) works, but the rest doesn't. I think it's because we haven't sent data for the event yet. We create an instance of a zombie based on the event, but we don't send the data back to it. Could you tell me how to make it work?
  10. I've been looking at examples of how to use multimap and most used it like that, so I decided to do that too. I don't think it makes a difference. Ah thank you! I really hadn't noticed.
  11. Okay, an update... I managed to create the multimap, I don't know if it's 100% correct (if not, thanks for the corrections)... The problem is that it gives an error when I put it in ".addTransientAttributeModifiers(EntityModify());" public static final AttributeModifier AM = new AttributeModifier("attributemodifier",5d, AttributeModifier.Operation.ADDITION); public static Multimap<String,AttributeModifier> EntityModify(){ Multimap<String, AttributeModifier> map = HashMultimap.create(); map.put(Attributes.MOVEMENT_SPEED.getDescriptionId(),AM); return map; } @SubscribeEvent(priority = EventPriority.HIGHEST) public void entityJoinWorld(EntityJoinWorldEvent event){ Entity entity = event.getEntity(); if (entity.isAlive() && entity instanceof Zombie) { Zombie zombie = (Zombie) entity; zombie.getAttributes().addTransientAttributeModifiers(EntityModify()); //Error here //event.setCanceled(true); } }
  12. OK, now that I have the attributemodifier created how should I put it in that method and how will I define in which attribute it should add those values.๐Ÿค” public static final AttributeModifier AM = new AttributeModifier("attributemodifier",5d, AttributeModifier.Operation.ADDITION); zombie.getAttributes().addTransientAttributeModifiers(); simply do "addTransientAttributeModifiers(AM);" doesn't work because it requires a Multimap <edit> I've been reading a bit about multimap but I'm still not sure how to create a multimap correctly if they can tell me how to create a mutimap. I appreciate it,
  13. public static final AttributeModifier AM = new AttributeModifier("attributemodifier",5d, ? ); like that?
×
×
  • Create New...

Important Information

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