Jump to content

Eridiah

Members
  • Posts

    3
  • Joined

  • Last visited

Everything posted by Eridiah

  1. Wow, I'm an idiot. Thanks so much! This is much more convenient!
  2. I am currently making a Sugarcane block. I'd like to have the block be able to be placed in multiple formations and directions, just like logs. To do this, I simply copied and edited vanilla Log code to get the desired results. However, this method seemed slightly inefficient, and I was wondering if there was a better way to do so, or at least more practical? Thanks! ~EridiahMods
  3. Although this thread is suuuper dead, in case anyone needs the working code, here it is: public void onUpdate(ItemStack stack, World world, Entity entity, int i, boolean bool) { super.onUpdate(stack, world, entity, i, bool); if(stack.isItemEnchanted() == false) { stack.addEnchantment(MainRegistry.customEnchantment, 2); // Or, Enchantments.whateverEnchantmentYouWant super.onUpdate(stack, world, entity, i, bool); } } Basically, the variables on the second super.onUpdate method were incorrect. Just match the variables of the super with the onUpdate method and everything should work. Also, take a look at where my code says: (MainRegistry.customEnchantment, 2); This line is swappable and will change. If you're doing in game enchantments, then do: (Enchantments.nameOfEnchantment, idOfTheEnchantment); The code I have is for custom enchantments, for which you call your main modding class.
×
×
  • Create New...

Important Information

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