Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (โ‹ฎ) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Brun0_MF

Members
  • Joined

  • Last visited

Everything posted by Brun0_MF

  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. So what could be wrong here?
  7. 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?
  8. 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.๐Ÿค”
  9. 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.
  10. 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?
  11. 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.
  12. 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); } }
  13. 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,
  14. public static final AttributeModifier AM = new AttributeModifier("attributemodifier",5d, ? ); like that?
  15. I plan to change the movement speed parameters that is Attributes.MOVEMENT_SPEED was that what you wanted?๐Ÿค”
  16. diesieben07, the first thing in the comment was what you sent, it wasn't an attempt, it was just the basis for the attempts. I have a java course, but I haven't studied what each forge class has yet, and as the forge documentation is not very complete, it's difficult to know how to work with it. Spring, won't this code to remove entities slow down the game? Since it will check each entity that is generated and eliminate if it is a zombie... (Just out of curiosity, since your code works...) With what you said and with the code that Spring sent I got something... @SubscribeEvent(priority = EventPriority.HIGHEST) public static void entityJoinWorld(EntityJoinWorldEvent event){ Entity entity = event.getEntity(); if (entity.isAlive() && entity instanceof Zombie) { Zombie zombie = (Zombie) entity; zombie.getAttributes().addTransientAttributeModifiers(); //not complete //event.setCanceled(true); } } With this code how can I do to, for example, increase movement speed or maximum health? Something like: .addTransientAttributeModifiers(new AttributeModifier( ? ? ? )) How do I use the AttributeModifier?
  17. @SubscribeEvent public static void entityJoinWorld(EntityJoinWorldEvent event){ event.getEntity() // ? //Entity#getAttributes().addTransientAttributeModifiers ? //event.getAttributes().addTransientAttributeModifiers ? //event.getEntity.addTransientAttributeModifiers ? } Is it something like that? Does it work on 1.18.1? I'm putting it in a class that I named ForgeEvents. It's just that I'm really lost on this topic. Where for sure I have to put this code, because it gives an error in any part I put. ๐Ÿค” If it's simpler to explain, it could teach me how to remove the spawn of a mob (remove it completely (ex: stop spawning zombies)), so I remove the entity and change it for a custom one.
  18. I intend to change all entities. (ex: Change all zombies). It would be to change the attributes of all zombies, for example to get them with more health or to walk faster.๐Ÿค”
  19. You can better explain how to do this using events...? It's just that I haven't found much content on the internet and I really have no idea how to change something from vanilla. ๐Ÿ˜“ Suppose I want to change a zombie's attributes, how would I do that? ๐Ÿค”
  20. How can I modify an existing mob/entity, how to change the spawn, AI, life,...? I've already created custom entities, but this time I wanted to modify existing entities. They have something to do with "@override". I'm in Forge 1.18.1 Thanks!๐Ÿ˜„
  21. Thanks, I got it... ๐Ÿ˜„
  22. Where exactly is the "FMLClientSetupEvent#enqueueWork"? Can you indicate where in the code I put this line? I'm trying to add custom bow animation.
  23. public DevMod() { IEventBus eventBus = FMLJavaModLoadingContext.get().getModEventBus(); //Registar Items ModItems.register(eventBus); //Registar Blocos ModBlocks.register(eventBus); ItemProperties.register(ModItems.BWBOW.get(), new ResourceLocation("pull"), (p_174620_, p_174621_, p_174622_, p_174623_) -> { if (p_174622_ == null) { return 0.0F; } else { return (float)(p_174620_.getUseDuration() - p_174622_.getUseItemRemainingTicks()) / 20.0F; } }); ItemProperties.register(ModItems.BWBOW.get(), new ResourceLocation("pulling"), (p_174615_, p_174616_, p_174617_, p_174618_) -> { return p_174617_ != null && p_174617_.isUsingItem() && p_174617_.getUseItem() == p_174615_ ? 1.0F : 0.0F; }); //Don't Work // Register ourselves for server and other game events we are interested in MinecraftForge.EVENT_BUS.register(this); } Something like? Can you give an example of how it would be correct, because I really don't understand... Sorry. I changed things, I did it differently, if that's what you say I don't know how to solve it.
  24. Even though they're already in the game(already appear in the game when I run the runclient)? How could I do this? Sorry for the silly questions but I'm starting at Forge.

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions โ†’ Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.