
AzizD
Members-
Content Count
20 -
Joined
-
Last visited
Community Reputation
0 NeutralAbout AzizD
-
Rank
Tree Puncher
Recent Profile Visitors
177 profile views
-
[1.16.4] Checking an item with a certain enchantment.
AzizD replied to AzizD's topic in Modder Support
Wow that actually worked. Thank you very much! -
AzizD started following [1.16.4] Custom item enchantability and [1.16.4] Checking an item with a certain enchantment.
-
I made an event that ignites tnt if held item has fire aspect. I can ignite the tnt but i how can i detect the fire aspect enchantment? I tried using EnchantmentHelper but didn't find anything useful. Here is my code. @SubscribeEvent public static void fireAspectTnt(final PlayerInteractEvent event){ PlayerEntity player = event.getPlayer(); World world = event.getWorld(); BlockPos blockPos = event.getPos(); BlockState block = world.getBlockState(blockPos); Hand hand = event.getHand(); Item item = player.getHeldItem(hand).getItem();
-
You can change config options without running the game. Config folder is in the same directory as mods folder.
-
Maybe copper ore disabled in the config. Try to enable it.
-
I got it.
-
It looks way better. Thanks for the advice. @Override public boolean canApplyAtEnchantingTable(ItemStack stack, Enchantment enchantment) { Set e = ImmutableSet.of( Enchantments.SHARPNESS, Enchantments.LOOTING, Enchantments.FIRE_ASPECT, Enchantments.UNBREAKING, Enchantments.KNOCKBACK ); return e.contains(enchantment); }
-
@Override public boolean canApplyAtEnchantingTable(ItemStack stack, Enchantment enchantment) { Enchantment[] enchantments = { Enchantments.SHARPNESS, Enchantments.LOOTING, Enchantments.FIRE_ASPECT, Enchantments.UNBREAKING, Enchantments.KNOCKBACK, Enchantments.MENDING, }; for(int i=0;i<enchantments.length;i++){ if(enchantments[i] == enchantment){ return true; } } return false; } I wrote this and it wo
-
@Override public boolean canApplyAtEnchantingTable(ItemStack stack, Enchantment enchantment) { if(enchantment == Enchantments.SHARPNESS) { enchantment.canApply(stack); } return true; } I changed with this but same error.
-
@Override public boolean canApplyAtEnchantingTable(ItemStack stack, Enchantment enchantment) { enchantment = Enchantments.SHARPNESS; return enchantment.canApply(stack.getItem().getDefaultInstance()); } I tried to override this method. Whenever i put the item in the enchantment table game crashes with java.lang.StackOverflowError.
-
I created a custom item that extends TieredItem. I want it to be enchantable through the enchantment table with Sharpnes, Looting etc. I can enchant but only the unbreaking enchantment shows up.
-
Finally i fixed the all problems. I added this condition and thats all. world.chunkExists(specialItemEntity.chunkCoordX,specialItemEntity.chunkCoordZ) Final code is : EventHandler class package com.azizd.thunderbird.events; import com.azizd.thunderbird.Thunderbird; import com.azizd.thunderbird.entities.SpecialItemEntity; import com.azizd.thunderbird.init.itemInit; import net.minecraft.entity.Entity; import net.minecraft.entity.item.ItemEntity; import net.minecraft.item.ItemStack; import net.minecraft.world.World; import net.minecraftforge.event.entity.EntityJoinW
-
This is not the issue.
-
But i still have a bug. If specialItemEntity is in the world. I can't join that world.
-
Finally i fixed all the problems. Now it works exactly what i want. This is my EventHandler Method @SubscribeEvent public static void crimsonIngotCraft(EntityJoinWorldEvent event){ Entity entity = event.getEntity(); World world = entity.world; double posX = entity.getPosX(); double posY = entity.getPosY(); double posZ = entity.getPosZ(); if(entity instanceof ItemEntity && !(entity instanceof SpecialItemEntity)){ ItemEntity itemEntity = (ItemEntity) event.getEntity(); if(itemEntity.getItem().get
-
I solved the pickup bug. The only problem is SpecialItemEntity motion.