Jump to content

Search the Community

Showing results for tags 'effects'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Minecraft Forge
    • Releases
    • Support & Bug Reports
    • Suggestions
    • General Discussion
  • Mod Developer Central
    • Modder Support
    • User Submitted Tutorials
  • Non-Forge
    • Site News (non-forge)
    • Minecraft General
    • Off-topic
  • Forge Mods
    • Mods

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


XMPP/GTalk


Gender


URL


Location


ICQ


AIM


Yahoo IM


MSN Messenger


Personal Text

Found 9 results

  1. I am wanting to give the armour in my mod special properties, but I have no idea how to do so. For the first armour set I want it to be the case that when the full set is worn it has the properties of a carved pumpkin, making it so you won't aggravate endermen when you look at them. The second, and presumably harder property is that for the second set I would like it to be the case that when the full set is worn, you can walk over the void without falling. (I was considering using the levitation to accomplish this but I wanted to check beforehand). Would both of these specialities be achievable for each armour set and how exactly would they both be done? Help would be much appreciated.
  2. I created a custom effect called "Fullness" that prevents the player from losing hunger when they get the effect. For this, I created a new java class called FullnessEffect. Everything is working fine, and the player isn't able to lose hunger, but I wanted to make it so that whenever you have the Fullness effect, your hunger bar changes color to gold, similar to how your hunger bar turns sickly green when you have the hunger effect. I searched online, but there seems to be no information regarding how to do this. Does anyone know how to do this? Here is the code for the FullnessEffect class in case anyone needs it (the import section is omitted): public class FullnessEffect extends MobEffect { public FullnessEffect (MobEffectCategory mobEffectCategory, int color) { super(mobEffectCategory, color); } @Override public boolean applyEffectTick (LivingEntity pLivingEntity, int pAmplifier) { if (!pLivingEntity.getCommandSenderWorld().isClientSide() && pLivingEntity instanceof Player player) { FoodData foodData = player.getFoodData(); float exhaustionLevel = foodData.getExhaustionLevel(); if (exhaustionLevel > 0.0F) { player.causeFoodExhaustion(-exhaustionLevel); } } super.applyEffectTick(pLivingEntity, pAmplifier); return true; } @Override public boolean shouldApplyEffectTickThisTick(int duration, int amplifier) { return true; } } I may sound a bit stupid because I'm a bit new to modding but any help would be greatly appreciated
  3. Hi, I need suggestions. I am a beginner in Minecraft Modding. I would like to apply custom effects to some armors, something like: more chance to drop seeds, change zombie awareness, drop more pieces of wood when chopping logs, and things like that. How would you recommend me to do it, is there any library that has something similar and which ones would you recommend me?.
  4. In forge 1.19.2 I used public static final DamageSource ENTROPY = (new DamageSource(TimeOfSacrifice.MOD_ID + "_entropy_effect").bypassArmor().bypassMagic()); But in 1.20.1 as I see there different method for this now, and I cannot figure out how it works.
  5. I have a problem, I am trying to put two different effects to two different armors but when I run it only the emerald armor effect works. This is the code public class ModArmorItem extends ArmorItem{ private static final Map<ArmorMaterial, MobEffectInstance> MATERIAL_TO_EFFECT_MAP = (new ImmutableMap.Builder<ArmorMaterial, MobEffectInstance>()) .put(ModArmorMaterials.EMERALD, new MobEffectInstance(MobEffects.HERO_OF_THE_VILLAGE,200, 1,false,false, true)) .put(ModArmorMaterials.OBSIDIAN, new MobEffectInstance(MobEffects.FIRE_RESISTANCE,200, 1,false,false, true)).build(); public ModArmorItem(ArmorMaterial pMaterial, Type pType, Properties pProperties) { super(pMaterial, pType, pProperties); } @Override public void onArmorTick(ItemStack stack, Level world, Player player){ if (!world.isClientSide()) { if (hasFullSuitOfArmorOn(player)) { evaluateArmorEffects(player); } } } private void evaluateArmorEffects(Player player) { for (Map.Entry<ArmorMaterial,MobEffectInstance> entry : MATERIAL_TO_EFFECT_MAP.entrySet()){ ArmorMaterial mapArmorMaterial = entry.getKey(); MobEffectInstance mapStatusEffect = entry.getValue(); if (hasCorrectArmorOn(mapArmorMaterial, player)) { addStatusEffectForMaterial(player, mapArmorMaterial, mapStatusEffect); } } } private void addStatusEffectForMaterial(Player player, ArmorMaterial mapArmorMaterial, MobEffectInstance mapStatusEffect) { boolean hasPlayerEffect = player.hasEffect(mapStatusEffect.getEffect()); if (hasCorrectArmorOn(mapArmorMaterial, player) && !hasPlayerEffect) { player.addEffect(new MobEffectInstance(mapStatusEffect)); } } private boolean hasCorrectArmorOn(ArmorMaterial material, Player player) { for (ItemStack armorStack : player.getInventory().armor){ if (!(armorStack.getItem() instanceof ArmorItem)) { return false; } } ArmorItem helmet = ((ArmorItem)player.getInventory().getArmor(3).getItem()); ArmorItem breastplace = ((ArmorItem)player.getInventory().getArmor(2).getItem()); ArmorItem leggins = ((ArmorItem)player.getInventory().getArmor(1).getItem()); ArmorItem boots = ((ArmorItem)player.getInventory().getArmor(0).getItem()); return helmet.getMaterial() == material && breastplace.getMaterial() == material && leggins.getMaterial() == material && boots.getMaterial() == material; } private boolean hasFullSuitOfArmorOn(Player player){ ItemStack helmet = player.getInventory().getArmor(3); ItemStack breastplace = player.getInventory().getArmor(2); ItemStack leggins = player.getInventory().getArmor(1); ItemStack boots = player.getInventory().getArmor(0); return !helmet.isEmpty() && !breastplace.isEmpty() && !leggins.isEmpty() && !boots.isEmpty(); } } Also when I place two effects on the same armor, the game crashes. Here is the crash file. The code is the same, only this part is different private static final Map<ArmorMaterial, MobEffectInstance> MATERIAL_TO_EFFECT_MAP = (new ImmutableMap.Builder<ArmorMaterial, MobEffectInstance>()) .put(ModArmorMaterials.EMERALD, new MobEffectInstance(MobEffects.HERO_OF_THE_VILLAGE,200, 1,false,false, true)) .put(ModArmorMaterials.EMERALD, new MobEffectInstance(MobEffects.FIRE_RESISTANCE,200, 1,false,false, true)).build(); I hope you guys can help me. Thanks.
  6. Hello. Where can I find how Vanilla jump boost effect works. I have been searching this class for a few hours but have not found it anywhere. I just want to use it functional in my mod.
  7. I'm trying to apply effects to the emerald armor but it doesn't work, I read that the onArmorTick() method doesn't work anymore, but I tried with inventoryTick, onInventoryTick and onArmorTick but they don't apply the effect either, I don't know if I'm writing it wrong, so I need help to fix it. This is the code in question: public class ModArmorItem extends ArmorItem{ private static final Map<ArmorMaterial, MobEffectInstance> MATERIAL_TO_EFFECT_MAP = (new ImmutableMap.Builder<ArmorMaterial, MobEffectInstance>()) .put(ModArmorMaterials.EMERALD, new MobEffectInstance( MobEffects.HERO_OF_THE_VILLAGE, 200, 1, false, false, true)) .build(); public ModArmorItem(ArmorMaterial pMaterial, Type pType, Properties pProperties) { super(pMaterial, pType, pProperties); } @Override public void onArmorTick(ItemStack stack, Level world, Player player){ if (!world.isClientSide()) { if (hasFullSuitOfArmorOn(player)) { evaluateArmorEffects(player); } } } private void evaluateArmorEffects(Player player) { for (Map.Entry<ArmorMaterial,MobEffectInstance> entry : MATERIAL_TO_EFFECT_MAP.entrySet()){ ArmorMaterial mapArmorMaterial = entry.getKey(); MobEffectInstance mapStatusEffect = entry.getValue(); if (hasCorrectArmorOn(mapArmorMaterial, player)) { addStatusEffectForMaterial(player, mapArmorMaterial, mapStatusEffect); } } } private void addStatusEffectForMaterial(Player player, ArmorMaterial mapArmorMaterial, MobEffectInstance mapStatusEffect) { boolean hasPlayerEffect = player.hasEffect(mapStatusEffect.getEffect()); if (hasCorrectArmorOn(mapArmorMaterial, player) && !hasPlayerEffect) { player.addEffect(new MobEffectInstance(mapStatusEffect)); } } private boolean hasCorrectArmorOn(ArmorMaterial material, Player player) { for (ItemStack armorStack : player.getInventory().armor){ if (!(armorStack.getItem() instanceof ArmorItem)) { return false; } } ArmorItem helmet = ((ArmorItem)player.getInventory().getArmor(3).getItem()); ArmorItem brestplace = ((ArmorItem)player.getInventory().getArmor(2).getItem()); ArmorItem leggins = ((ArmorItem)player.getInventory().getArmor(1).getItem()); ArmorItem boots = ((ArmorItem)player.getInventory().getArmor(0).getItem()); return helmet.getMaterial() == material && brestplace.getMaterial() == material && leggins.getMaterial() == material && boots.getMaterial() == material; } private boolean hasFullSuitOfArmorOn(Player player){ ItemStack helmet = player.getInventory().getArmor(3); ItemStack breastplace = player.getInventory().getArmor(2); ItemStack leggins = player.getInventory().getArmor(1); ItemStack boots = player.getInventory().getArmor(0); return !helmet.isEmpty() && !breastplace.isEmpty() && !leggins.isEmpty() && boots.isEmpty(); } } And here is the armor public static final RegistryObject<Item> EMERALD_HELMET = ITEMS.register( "emerald_helmet", () -> new ModArmorItem(ModArmorMaterials.EMERALD, ArmorItem.Type.HELMET, new Item.Properties()) ); public static final RegistryObject<Item> EMERALD_CHESTPLATE = ITEMS.register( "emerald_chestplate", () -> new ModArmorItem(ModArmorMaterials.EMERALD, ArmorItem.Type.CHESTPLATE, new Item.Properties()) ); public static final RegistryObject<Item> EMERALD_LEGGINS = ITEMS.register( "emerald_leggins", () -> new ModArmorItem(ModArmorMaterials.EMERALD, ArmorItem.Type.LEGGINGS, new Item.Properties()) ); public static final RegistryObject<Item> EMERALD_BOOTS = ITEMS.register( "emerald_boots", () -> new ModArmorItem(ModArmorMaterials.EMERALD, ArmorItem.Type.BOOTS, new Item.Properties()) ); I hope you can help me. Thanks.
  8. Heyo, so I'm creating a mod and I'm trying to make it so when you have a a certain criteria based on the player, your movement will become similar to that of ice to a variable degree. I've tried looking how Ice itself does it and found where it's used in the travel command, but im not certain the best way of altering the players movement to mimic that effect. Any guidance would be greatly appreciated.
×
×
  • Create New...

Important Information

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