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.

IPECTER

Members
  • Joined

  • Last visited

  1. avokado723 started following IPECTER
  2. mob.addEffect(MobEffects.HEALTH_BOOST, ?????????????) I want to add 10 heart for life (infinite)
  3. mob.addEffect(MobEffectInstance????????) IDK How to use MobEffectInstance....
  4. AddPermanentModifier does not exist in Mob.
  5. before player rejoin the world, 1980/2000 (hp/max hp) after player rejoin the world, 20/2000
  6. @Mod.EventBusSubscriber(modid = "x100health", bus = Mod.EventBusSubscriber.Bus.FORGE, value = Dist.CLIENT) public class EntityJoinWorld { private static final AttributeModifier x100MaxHealth = new AttributeModifier("x100 Max Health", 99, AttributeModifier.Operation.MULTIPLY_BASE); @SubscribeEvent public static void onMobSpawn(EntityJoinWorldEvent e) { if (e.getEntity() instanceof Mob) { Mob mob = (Mob) e.getEntity(); mob.getAttribute(Attributes.MAX_HEALTH).addTransientModifier(x100MaxHealth); if (!mob.getPersistentData().contains("x100health")){ mob.getPersistentData().putBoolean("x100health", true); mob.setHealth(mob.getHealth() * 100); } } } } When the player joins the world, the mob's current hp is initialized.
  7. @Mod.EventBusSubscriber(modid = "x100health", bus = Mod.EventBusSubscriber.Bus.FORGE, value = Dist.CLIENT) public class EntityJoinWorld { private static final AttributeModifier x100MaxHealth = new AttributeModifier("x100 Max Health", 99, AttributeModifier.Operation.MULTIPLY_BASE); @SubscribeEvent public static void onMobSpawn(EntityJoinWorldEvent e) { if (e.getEntity() instanceof Mob) { Mob mob = (Mob) e.getEntity(); mob.getAttribute(Attributes.MAX_HEALTH).addTransientModifier(x100MaxHealth); if (!mob.getPersistentData().contains("x100health")){ mob.getPersistentData().putBoolean("x100health", true); mob.setHealth(mob.getHealth() * 100); } } } } like this! right?
  8. mob.getPersistentData().put("x100health", true); Required type: Tag Provided: boolean ......
  9. @Mod.EventBusSubscriber(modid = "x100health", bus = Mod.EventBusSubscriber.Bus.FORGE, value = Dist.CLIENT) public class EntityJoinWorld { private static final AttributeModifier x100MaxHealth = new AttributeModifier("x100 Max Health", 99, AttributeModifier.Operation.MULTIPLY_BASE); @SubscribeEvent public static void onMobSpawn(EntityJoinWorldEvent e) { if (e.getEntity() instanceof Mob) { Mob mob = (Mob) e.getEntity(); mob.getAttribute(Attributes.MAX_HEALTH).addTransientModifier(x100MaxHealth); if (!mob.getPersistentData().getBoolean("x100health")){ mob.getPersistentData().put("x100health", tag..?); mob.setHealth(mob.getHealth() * 100); } } } } mob.getPersistentData().put("x100health", tag..?); tag..???? What I should do?
  10. private static final AttributeModifier x100MaxHealth = new AttributeModifier("x100 Max Health", 99, AttributeModifier.Operation.MULTIPLY_BASE); @SubscribeEvent public static void onMobSpawn(EntityJoinWorldEvent e) { if (e.getEntity() instanceof Mob) { Mob mob = (Mob) e.getEntity(); mob.getAttribute(Attributes.MAX_HEALTH).addTransientModifier(x100MaxHealth); } } like this? When mobs spawn for the first time, Mobs have to have full hp.
  11. success. thx. but.... private static final AttributeModifier x100MaxHealth = new AttributeModifier("x100 Max Health", 99, AttributeModifier.Operation.MULTIPLY_BASE); @SubscribeEvent public static void onMobSpawn(EntityJoinWorldEvent e) { if (e.getEntity() instanceof Mob) { Mob mob = (Mob) e.getEntity(); if (mob.getHealth() > mob.getAttribute(Attributes.MAX_HEALTH).getBaseValue()) { mob.getAttribute(Attributes.MAX_HEALTH).addTransientModifier(x100MaxHealth); mob.setHealth(mob.getHealth() * 100); } } } private static final AttributeModifier x100MaxHealth = new AttributeModifier("x100 Max Health", 99, AttributeModifier.Operation.MULTIPLY_BASE); @SubscribeEvent public static void onMobSpawn(EntityJoinWorldEvent e) { if (e.getEntity() instanceof Mob) { Mob mob = (Mob) e.getEntity(); if (mob.getHealth() >= mob.getAttribute(Attributes.MAX_HEALTH).getBaseValue()) { mob.getAttribute(Attributes.MAX_HEALTH).addTransientModifier(x100MaxHealth); mob.setHealth(mob.getHealth() * 100); } } } Every time a player join the world, even if the mob's hp is lower than the maximum hp, all hp is recovered. What should I do?
  12. sorry..... I only succeeded in raising the mob's hp above 1024. Now I have to find a way to control Mob's physical strength using AttributeModifier.
  13. private static final AttributeModifier x100MaxHealth = new AttributeModifier(Attributes.MAX_HEALTH, "x100 Max Health", 100, AttributeModifier.Operation.MULTIPLY_BASE); error... Cannot resolve constructor 'AttributeModifier(net.minecraft.world.entity.ai.attributes.Attribute, java.lang.String, int, net.minecraft.world.entity.ai.attributes.AttributeModifier.Operation)
  14. It's been solved. Thank you so much for helping me.
  15. public X100health() { FMLJavaModLoadingContext.get().getModEventBus().addListener(this::commonSetup); MinecraftForge.EVENT_BUS.register(EntityJoinWorld.class); } protected static void replaceAttributeValue(RangedAttribute attribute, double maxValue) { attribute.maxValue = maxValue; } private void commonSetup(FMLCommonSetupEvent e) { e.enqueueWork(() -> { replaceAttributeValue((RangedAttribute) Attributes.MAX_HEALTH, 131072); }); } success!!!! thx everyone for help

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.