Jump to content

magic_man

Members
  • Posts

    37
  • Joined

  • Last visited

Everything posted by magic_man

  1. https://imgur.com/a/73pOavM it became weirder maybe it has to do with me adding a helmet? also changing it from layer 2 to layer 1 didn't change anything so now i think it's using something of the helmet
  2. https://imgur.com/a/fLDY01h removing the leggings from the texture just becomes the 'texture missing' texture
  3. instead of adding all 4 armor pieces, i only wanted the boots. that's why i only added the boots texture in the layer.png, but that didn't work so i added the leggings with it and it used the leggings instead of the boots and i have no idea why iteminit: public static final RegistryObject<ArmorItem> lIGHTNING_BOOTS = ITEMS.register("lightning_boots", () -> new ArmorItem(ArmorMaterialsInit.LIGHTNING_BOOTS, EquipmentSlot.FEET, new Item.Properties().tab(Electrified.ELECTRIFIED_TAB))); armorMaterialsInit: package com.tobywig.electrified.init; import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvents; import net.minecraft.util.LazyLoadedValue; import net.minecraft.world.entity.EquipmentSlot; import net.minecraft.world.item.ArmorMaterial; import net.minecraft.world.item.crafting.Ingredient; import java.util.function.Supplier; import com.tobywig.electrified.Electrified; public enum ArmorMaterialsInit implements ArmorMaterial { LIGHTNING_BOOTS("lightning_boots", 28, new int[]{3, 5, 8, 3}, 19, SoundEvents.ARMOR_EQUIP_GOLD, 2.0F, 0.0F, () -> Ingredient.of(itemInit.ELECTRIFIED_IRON_INGOT.get())); private static final int[] HEALTH_PER_SLOT = new int[]{13, 15, 16, 11}; private final String name; private final int durabilityMultiplier; private final int[] slotProtections; private final int enchantmentValue; private final SoundEvent sound; private final float toughness; private final float knockbackResistance; private final LazyLoadedValue<Ingredient> repairIngredient; ArmorMaterialsInit(String p_40474_, int p_40475_, int[] p_40476_, int p_40477_, SoundEvent p_40478_, float p_40479_, float p_40480_, Supplier<Ingredient> p_40481_) { this.name = p_40474_; this.durabilityMultiplier = p_40475_; this.slotProtections = p_40476_; this.enchantmentValue = p_40477_; this.sound = p_40478_; this.toughness = p_40479_; this.knockbackResistance = p_40480_; this.repairIngredient = new LazyLoadedValue<>(p_40481_); } public int getDurabilityForSlot(EquipmentSlot pSlot) { return HEALTH_PER_SLOT[pSlot.getIndex()] * this.durabilityMultiplier; } public int getDefenseForSlot(EquipmentSlot pSlot) { return this.slotProtections[pSlot.getIndex()]; } public int getEnchantmentValue() { return this.enchantmentValue; } public SoundEvent getEquipSound() { return this.sound; } public Ingredient getRepairIngredient() { return this.repairIngredient.get(); } public String getName() { return Electrified.MOD_ID + ":" + this.name; } public float getToughness() { return this.toughness; } public float getKnockbackResistance() { return this.knockbackResistance; } }
  4. this worked, but this isn't the part that should cause the issue @SubscribeEvent public static void onEntityKilled(EntityLeaveWorldEvent event) { Entity entity = event.getEntity(); if (entity instanceof ItemEntity itemEntity) { ItemStack itemStack = itemEntity.getItem(); if (itemStack.getItem() == itemInit.ELECTRIFIED_IRON_INGOT.get()) { System.out.println("# not allowed"); entity.spawnAtLocation(itemInit.ELECTRIFIED_IRON_INGOT.get()); } } } } it's this that should cause it: @SubscribeEvent public static void onLightningHitItem(EntityStruckByLightningEvent event) { Entity entity = event.getEntity(); if (entity instanceof ItemEntity itemEntity) { ItemStack itemStack = itemEntity.getItem(); if (itemStack.getItem() == Items.IRON_INGOT) { System.out.println("# iron ingot is struck by lightning"); entity.remove(Entity.RemovalReason.KILLED); entity.spawnAtLocation(itemInit.ELECTRIFIED_IRON_INGOT.get()); } } } }
  5. i tried it but didn't really get it to work and eventually thought like: what if i just say no to it deleting it?
  6. managed to do it like this: @SubscribeEvent public static void onEntityKilled(EntityLeaveWorldEvent event) { Entity entity = event.getEntity(); if (entity instanceof ItemEntity itemEntity) { ItemStack itemStack = itemEntity.getItem(); if (itemStack.getItem() == itemInit.ELECTRIFIED_IRON_INGOT.get()) { System.out.println("# not allowed"); entity.spawnAtLocation(itemInit.ELECTRIFIED_IRON_INGOT.get()); } } } } (cancelling the event didn't work) but i have a problem that if the iron stack on eachother instead of doing every single one individually it only gives one example: you drop 16 iron ingots, a lightning strike hits it, output is still 1
  7. removing the dist.client changes nothing the item that it has to transform into is there for a split second and then is gone
  8. is that done the same way as just doing it permanently or is that a whole different story also in case the problem is in my code here is the code: lightning_recipes: @Mod.EventBusSubscriber(Dist.CLIENT) public class lightning_recipes { @SubscribeEvent public static void onLightningHitItem(EntityStruckByLightningEvent event) { Entity entity = event.getEntity(); if (entity instanceof ItemEntity itemEntity) { ItemStack itemStack = itemEntity.getItem(); if (itemStack.getItem() == Items.IRON_INGOT) { System.out.println("# iron ingot is struck by lightning"); entity.remove(Entity.RemovalReason.KILLED); entity.spawnAtLocation(itemInit.ELECTRIFIED_IRON_INGOT.get()); } } } } serverevent: @Mod.EventBusSubscriber(Dist.DEDICATED_SERVER) public class serverEvent { @SubscribeEvent public static void onservertick(ServerTickEvent event) { } }
  9. is it also possible to make it invulnerable for only a certain time? for example 1 second after it is spawned in?
  10. i'm trying to make my own custom recipes using lightning, but the output item gets deleted because of the lightning how do i make that item invulnerable to the lightning?
  11. How do you spawn an item on the ground?
×
×
  • Create New...

Important Information

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