-
Change Block hardness in Event
Im using PlayerInteractEvent.LeftClickBlock event and I noticed theres no way to change hardness/strength of blocks. Is there something im missing? Earlier versions used Strength but it seems 1.17.1 took it out. Version 1.17.1 Latest
-
(1.14.4) How to get button id
Forgot to quote ur post
-
(1.14.4) How to get button id
So how would I know if someone clicks the difficulty button?
-
(1.14.4) How to get button id
I've been looking at https://skmedix.github.io/ForgeJavaDocs/javadoc/forge/1.9.4-12.17.0.2051/net/minecraft/client/gui/GuiButton.html#id but it seems for 1.14.4 everything got changed. I was wondering how would I get the id or string of a button that was clicked? For example the difficulty button.
-
(1.14.4) New Enchantment not showing up
Thanks for your help I managed to get it to work
-
(1.14.4) New Enchantment not showing up
Class: [EnchantmentList] @ObjectHolder(Main.modid) public class EnchantmentList { public static final Enchantment soul_eater = new SoulEater(); @Mod.EventBusSubscriber(modid = Main.modid) public static class RegistrationHandler { /** * On event. * * @param event the event */ @SubscribeEvent public static void onEvent(final RegistryEvent.Register<Enchantment> event) { // DEBUG System.out.println("Registering Enchantments"); final IForgeRegistry<Enchantment> registry = event.getRegistry(); registry.register(new SoulEater()); } } } Class: [Soul Eater] public class SoulEater extends Enchantment { public SoulEater() { super(Rarity.COMMON, EnchantmentType.WEAPON, new EquipmentSlotType[] {EquipmentSlotType.MAINHAND}); setRegistryName(new ResourceLocation(Main.modid + ":soul_eater")); } @Override public int getMinEnchantability(int enchantmentLevel) { return 20 * enchantmentLevel; } @Override public int getMaxEnchantability(int enchantmentLevel) { return this.getMinEnchantability(enchantmentLevel) + 10; } @Override public int getMaxLevel() { return 1; } //@Override //protected boolean canApplyTogether(Enchantment ench) { // return super.canApplyTogether(ench) && ench != Enchantments.BLAST_PROTECTION; //} } I watched a harry talks tutorial on making custom enchantments for 1.12.2 and I looked at Jabelar's Minecraft Forge Modding Tutorials. I cant seem to get the enchantment ingame. Am I doing something wrong?
-
(1.14.4) Changing Sword Damge on Right Click
I managed to get it to work with @Override public Multimap<String, AttributeModifier> getAttributeModifiers(EquipmentSlotType slot, ItemStack stack) { final Multimap<String, AttributeModifier> modifiers = super.getAttributeModifiers(slot, stack); if (slot == EquipmentSlotType.MAINHAND) { replaceModifier(modifiers, SharedMonsterAttributes.ATTACK_DAMAGE, ATTACK_DAMAGE_MODIFIER, WitherSword.withersworddamage); //replaceModifier(modifiers, SharedMonsterAttributes.ATTACK_SPEED, ATTACK_SPEED_MODIFIER, 1.5); } return modifiers; } private void replaceModifier(Multimap<String, AttributeModifier> modifierMultimap, IAttribute attribute, UUID id, double multiplier) { // Get the modifiers for the specified attribute final Collection<AttributeModifier> modifiers = modifierMultimap.get(attribute.getName()); // Find the modifier with the specified ID, if any final Optional<AttributeModifier> modifierOptional = modifiers.stream().filter(attributeModifier -> attributeModifier.getID().equals(id)).findFirst(); if (modifierOptional.isPresent()) { // If it exists, final AttributeModifier modifier = modifierOptional.get(); modifiers.remove(modifier); // Remove it modifiers.add(new AttributeModifier(modifier.getID(), modifier.getName(), modifier.getAmount() + multiplier, modifier.getOperation())); // Add the new modifier } } but the problem is how could I make it item specific for damage because right now it applys for all the wither swords
-
(1.14.4) Changing Sword Damge on Right Click
I'm building a weapon that on right click gives the item increased damage. The base damage of the sword is 7 damage, and when its right clicked I want it to be 10. I played around with item.addAttributeModifier(SharedMonsterAttributes.ATTACK_DAMAGE.getName(), new AttributeModifier("Weapon modifier",10, AttributeModifier.Operation.ADDITION), EquipmentSlotType.MAINHAND); but I cant figure out how to get rid of the attribute when I add it. Is this the way I should be changing damage on a sword or should I use NBT or is there some other way of doing this?
-
(1.14.4) Potion effect wont remove
Okay I'll get on that but why does the wither effect visual stay? I remove it the damage goes away but the visual effect stays
-
(1.14.4) Potion effect wont remove
public class WitherSwordItem extends SwordItem{ private ArrayList<String> active = new ArrayList<String>(); private CoolDowns cooldown = new CoolDowns(); public WitherSwordItem(IItemTier p_i484601, int damage, float p_i484603, Properties p_i484604) { super(p_i484601, damage, p_i484603, p_i484604); } @Override public ActionResult<ItemStack> onItemRightClick(World worldIn, PlayerEntity playerIn, Hand handIn){ String pName = playerIn.getDisplayName().toString(); ItemStack item = playerIn.getHeldItem(handIn); if(!worldIn.isRemote) { if (cooldown.isDone("WitherSwordRightClick", pName , 3000)){ if(!active.contains(pName)){ System.out.println("On"); active.add(pName); playerIn.addPotionEffect(new EffectInstance(Effects.WITHER, 999999999, 0)); item.addAttributeModifier(SharedMonsterAttributes.ATTACK_DAMAGE.getName(), new AttributeModifier(ATTACK_DAMAGE_MODIFIER, "Weapon modifier",10, AttributeModifier.Operation.ADDITION), EquipmentSlotType.MAINHAND); item.damageItem(100, playerIn, null); }else{ System.out.println("Off"); active.remove(pName); playerIn.removeActivePotionEffect(Effects.WITHER); } } } if(worldIn.isRemote) { if (cooldown.isDone("WitherSwordRightClick2", pName , 3000)){ if(!active.contains(pName)) { playerIn.playSound(SoundEvents.ENTITY_WITHER_AMBIENT, 30, 0); }else { playerIn.playSound(SoundEvents.BLOCK_LAVA_EXTINGUISH, 30, 0); } } } return new ActionResult<ItemStack>(ActionResultType.SUCCESS, item); } }
-
(1.14.4) Potion effect wont remove
How would I get rid of the visual effect on the client?
-
(1.14.4) Potion effect wont remove
The damage dealing goes away but the visual effect stays, isn't checking if world.isremote is false doing it server side?
-
(1.14.4) Potion effect wont remove
I managed to get everything to work except getting rid of the wither effect on the client side, I made a if(worldIn.isremote) statement to add the sounds which works fine. How would I get rid of the visual effect client side?
-
(1.14.4) Potion effect wont remove
Well all the code runs but the playsound, addpotioneffect, removepotioneffect does nothing when I have if(!worldIn.isremote)
-
(1.14.4) Potion effect wont remove
public class WitherSwordItem extends SwordItem{ private ArrayList<String> active = new ArrayList<String>(); private CoolDowns cooldown = new CoolDowns(); public WitherSwordItem(IItemTier p_i484601, int p_i484602, float p_i484603, Properties p_i484604) { super(p_i484601, p_i484602, p_i484603, p_i484604); } @Override public ActionResult<ItemStack> onItemRightClick(World worldIn, PlayerEntity playerIn, Hand handIn){ String pName = playerIn.getDisplayName().toString(); ItemStack item = playerIn.getHeldItem(handIn); if(!worldIn.isRemote) { if (cooldown.isDone("WitherSwordRightClick", pName , 3000)){ if(!active.contains(pName)){ System.out.println("On"); active.add(pName); playerIn.addPotionEffect(new EffectInstance(Effects.WITHER, 999999999, 0)); playerIn.playSound(SoundEvents.ENTITY_WITHER_AMBIENT, 100, 0); }else{ System.out.println("Off"); active.remove(pName); System.out.println(worldIn.isRemote()); playerIn.removeActivePotionEffect(Effects.WITHER); playerIn.playSound(SoundEvents.BLOCK_LAVA_EXTINGUISH, 100, 0); } item.damageItem(1, playerIn, null); } } return new ActionResult<ItemStack>(ActionResultType.SUCCESS, item); } } I know if(!worldIn.isRemote) makes it false but the code doesn't run, I'm sorry i'm not getting how to do this
IPS spam blocked by CleanTalk.