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.

peuloom

Members
  • Joined

  • Last visited

  1. Did you try if(!(livingentity instanceof Player)){ }
  2. Update, I've seen that I need "TransientAttributeModifiers" to do that, I've managed to change the AI properly, but always something "Pacific" attacks me, the game crashes. The .put to add Attack Damage seems to not work somehow. public static Multimap<Attribute, AttributeModifier> getAttributeModifiers() { Multimap<Attribute, AttributeModifier> temp = LinkedHashMultimap.create(); temp.put(Attributes.ATTACK_DAMAGE, new AttributeModifier("ATTACK_DAMAGE", 1, AttributeModifier.Operation.ADDITION)); return temp; } @SubscribeEvent public static void onEntityJoinLevelEvent(EntityJoinLevelEvent event) { if(!(event.getEntity() instanceof PathfinderMob mob)) return; if(!mob.getAttributes().hasAttribute(Attributes.ATTACK_DAMAGE)){ mob.setCustomName(Component.literal("Pacific")); mob.getAttributes().addTransientAttributeModifiers(getAttributeModifiers()); } if(mob.getAttributes().hasAttribute(Attributes.ATTACK_DAMAGE)) { mob.setCustomName(Component.literal("Hostile")); mob.goalSelector.addGoal(1, new MeleeAttackGoal(mob, 1.0, false)); mob.goalSelector.addGoal(2, new LookAtPlayerGoal(mob, Player.class, 8.0F)); mob.targetSelector.addGoal(1, new NearestAttackableTargetGoal<>(mob, Player.class, true)); } } Thanks
  3. Hello, people, sorry for bothering. I'm trying to change every mob to be aggressive to the player, but I can't change their Attributes to add ATTACK_DAMAGE. Can someone help me? Mob mob = (Mob) event.getEntity(); if(!mob.getAttributes().hasAttribute(Attributes.ATTACK_DAMAGE)){ mob.getAttributes().assignValues(new AttributeMap(AttributeSupplier.builder().add(Attributes.ATTACK_DAMAGE, 1).build())); } if(mob.getAttributes().hasAttribute(Attributes.ATTACK_DAMAGE)) { mob.setCustomName(Component.literal("Aggressive")); mob.goalSelector.addGoal(1, new MeleeAttackGoal((PathfinderMob) mob, 1.0, false)); mob.goalSelector.addGoal(2, new LookAtPlayerGoal(mob, Player.class, 8.0F)); mob.targetSelector.addGoal(1, new NearestAttackableTargetGoal<>(mob, Player.class, true)); } Thanks.

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.