Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

ArmorMaterial broke...


Recommended Posts

Hi!

I don't know why, but when I write this line:

	NONE_ARMOR("none", 9900, new int[] {4, 5, 6, 7}, 17, SoundEvents.LAVA_AMBIENT, 
			99f, 12.5f, () -> Ingredient.fromItems(ItemInit.NONE_INGOT.get()));

my code break apart. I don't know why, actually, I've coppied it from my another project where it works right.

ANd also!!! How should I set a vanilla item as a repair material? I can't figure it out

My entire class:

public class LavaMaterial implements IArmorMaterial {


	NONE_ARMOR("none", 9900, new int[] {4, 5, 6, 7}, 17, SoundEvents.LAVA_AMBIENT, 
			99f, 12.5f, () -> Ingredient.fromItems(ItemInit.NONE_INGOT.get()));
	
	private static final int[] baseDurability = { 128, 144, 169, 112};
	private final String name;
	private final int durabilityMultiplier;
	private final int[] armorVal; //boots leggings chest helmet
	private final int enchantability;
	private final SoundEvent equipSound;
	private final float toughness;
	private final float knockbackResistence;
	private final Ingredient repairIngredient;
	
	LavaMaterial(String name, int durabilityMultiplier, int[] armorVal, int enchantability, 
			SoundEvent equipSound, float toughness, float knockbackResistence, Supplier<Ingredient> repairIngredient) {
		this.name = name;
		this.durabilityMultiplier =durabilityMultiplier;
		this.armorVal = armorVal; 
		this.enchantability = enchantability;
		this.equipSound = equipSound;
		this.toughness = toughness;
		this.knockbackResistence = knockbackResistence;
		this.repairIngredient = repairIngredient.get();
	}

	@Override
	public int getDurabilityForSlot(EquipmentSlotType slotIn) {
		// TODO Auto-generated method stub
		return this.baseDurability[slotIn.getIndex()] * this.durabilityMultiplier;
	}

	@Override
	public int getDefenseForSlot(EquipmentSlotType slotIn) {
		// TODO Auto-generated method stub
		return this.armorVal[slotIn.getIndex()];
	}

	@Override
	public int getEnchantmentValue() {
		// TODO Auto-generated method stub
		return this.enchantability;
	}

	@Override
	public SoundEvent getEquipSound() {
		// TODO Auto-generated method stub
		return this.equipSound;
	}

	@Override
	public Ingredient getRepairIngredient() {
		// TODO Auto-generated method stub
		return this.repairIngredient;
	}

	@Override
	public String getName() {
		// TODO Auto-generated method stub
		return this.name;
	}

	@Override
	public float getToughness() {
		// TODO Auto-generated method stub
		return this.toughness;
	}

	@Override
	public float getKnockbackResistance() {
		// TODO Auto-generated method stub
		return this.knockbackResistence;
	}


}

 

Edited by urabaros
Link to post
Share on other sites

The first thing was fized by uploading mappings, I was using official insted of snapshot.

 

Yea, Items., but when I write something like this it don't work and I don't remember what should I import.
 

	NONE_ARMOR("lava", 9900, new int[] {4, 5, 6, 4}, 17, SoundEvents.ITEM_ARMOR_EQUIP_GENERIC, 
			99f, 12.5f, () -> Ingredient.fromItems(Items.LAVA_BUCKET));

 

Link to post
Share on other sites
10 hours ago, urabaros said:

The first thing was fized by uploading mappings, I was using official insted of snapshot.

whats the problem?, if you use different mappings between your projects you can use the forge bot on discord to convert the mapping names

 

10 hours ago, urabaros said:

Yea, Items., but when I write something like this it don't work and I don't remember what should I import.

the import: net.minecraft.item.Items
I think you are using eclipse as an IDE, because the code auto correction in enums doesn't work
if i'm right you can use CTRL + SHIFT + O to organize imports, it will add the imports automatically

  • Like 1
Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Recently Browsing

    No registered users viewing this page.

  • Posts

    • I don't even have Optifine installed and the game doesn't start, it crashes right away
    • public enum ModArmorMaterial implements IArmorMaterial { ARGENTITE(Alcamod.ModID + ":argentite", 40, new int[] { 3, 6, 8, 3 }, 12, SoundEvents.ITEM_ARMOR_EQUIP_GENERIC, 3.5F, 0.15F, () -> { return Ingredient.fromItems(ModItems.ARGENTITE_INGOT.get()); }), AZURITE(Alcamod.ModID + ":azurite", 45, new int[] { 3, 6, 8, 3 }, 10, SoundEvents.ITEM_ARMOR_EQUIP_GENERIC, 3.7F, 0.16F, () -> { return Ingredient.fromItems(ModItems.AZURITE_INGOT.get()); }), EMATITE(Alcamod.ModID + ":ematite", 50, new int[] { 3, 6, 8, 3 }, 8, SoundEvents.ITEM_ARMOR_EQUIP_GENERIC, 4.0F, 0.17F, () -> { return Ingredient.fromItems(ModItems.EMATITE_INGOT.get()); }), BARITE(Alcamod.ModID + ":barite", 60, new int[] { 3, 6, 8, 3 }, 6, SoundEvents.ITEM_ARMOR_EQUIP_GENERIC, 4.2F, 0.19F, () -> { return Ingredient.fromItems(ModItems.BARITE_INGOT.get()); }), UNPOWERED_NETHER_STAR(Alcamod.ModID + ":unpowered_nether_star", 70, new int[] { 3, 6, 8, 3 }, 6, SoundEvents.ITEM_ARMOR_EQUIP_GENERIC, 4.0F, 0.21F, () -> { return Ingredient.fromItems(Items.NETHER_STAR.getItem()); }), NETHER_STAR(Alcamod.ModID + ":nether_star", 80, new int[] { 3, 6, 8, 3 }, 2, SoundEvents.ITEM_ARMOR_EQUIP_GENERIC, 5.0F, 0.35F, () -> { return Ingredient.fromItems(ModItems.POWERED_NETHER_STAR.get()); }), INVERTED_NETHER_STAR(Alcamod.ModID + ":inverted_nether_star", 100, new int[] { 3, 6, 8, 3 }, 2, SoundEvents.ITEM_ARMOR_EQUIP_GENERIC, 6.0F, 0.60F, () -> { return Ingredient.fromItems(ModItems.INVERTED_NETHER_STAR.get()); }); private static final int[] MAX_DAMAGE_ARRAY = new int[] { 11, 16, 15, 13 }; private final String name; private final int maxDamageFactor; private final int[] damageReductionAmountArray; private final int enchantability; private final SoundEvent soundEvent; private final float toughness; private final float knockBackResistance; private final Supplier<Ingredient> repairMaterial; ModArmorMaterial(String name, int maxDamageFactor, int[] damageReductionAmountArray, int enchantability, SoundEvent soundEvent, float toughness, float knockbackResistance, Supplier<Ingredient> repairMaterial) { this.name = name; this.maxDamageFactor = maxDamageFactor; this.damageReductionAmountArray = damageReductionAmountArray; this.enchantability = enchantability; this.soundEvent = soundEvent; this.toughness = toughness; this.repairMaterial = repairMaterial; this.knockBackResistance = knockbackResistance; } @Override public int getDurability(EquipmentSlotType slotIn) { return MAX_DAMAGE_ARRAY[slotIn.getIndex()] * this.maxDamageFactor; } @Override public int getDamageReductionAmount(EquipmentSlotType slotIn) { return this.damageReductionAmountArray[slotIn.getIndex()]; } @Override public int getEnchantability() { return this.enchantability; } @Override public SoundEvent getSoundEvent() { return this.soundEvent; } @Override public Ingredient getRepairMaterial() { return this.repairMaterial.get(); } @Override public String getName() { return this.name; } @OnlyIn( Dist.CLIENT ) @Override public float getToughness() { return this.toughness; } public float getKnockbackResistance() { return this.knockBackResistance; } }  
    • Just upload it here or use pastbin.
    • And how to show the debug.log?  
  • Topics

  • Who's Online (See full list)

×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.