net.minecraft.item.ItemArmor.ArmorMaterial Java Examples

The following examples show how to use net.minecraft.item.ItemArmor.ArmorMaterial. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Materials.java    From BaseMetals with GNU Lesser General Public License v2.1 6 votes vote down vote up
protected static void registerMaterial(String name, MetalMaterial m){

		allMaterials.put(name, m);
		
		String enumName = m.getEnumName();
		String texName = m.getName();
		int[] protection = m.getDamageReductionArray();
		int durability = m.getArmorMaxDamageFactor();
		ArmorMaterial am = EnumHelper.addArmorMaterial(enumName, texName, durability, protection, m.getEnchantability(), SoundEvents.ITEM_ARMOR_EQUIP_IRON, (m.hardness > 10 ? (int)(m.hardness / 5) : 0));
		if(am == null){
			// uh-oh
			FMLLog.severe("Failed to create armor material enum for "+m);
		}
		armorMaterialMap.put(m, am);
		FMLLog.info("Created armor material enum "+am);
		
		ToolMaterial tm = EnumHelper.addToolMaterial(enumName, m.getToolHarvestLevel(), m.getToolDurability(), m.getToolEfficiency(), m.getBaseAttackDamage(), m.getEnchantability());
		if(tm == null){
			// uh-oh
			FMLLog.severe("Failed to create tool material enum for "+m);
		}
		toolMaterialMap.put(m, tm);
		FMLLog.info("Created tool material enum "+tm);
	}
 
Example #2
Source File: ItemArtifactArmor.java    From Artifacts with MIT License 5 votes vote down vote up
public ItemArtifactArmor(ArmorMaterial armorMaterial, int renderID, int iconNum, int damageIndex) {
	super(armorMaterial, renderID, damageIndex);
	iconn = iconNum;
	this.setCreativeTab(DragonArtifacts.tabArtifacts);
	this.setHasSubtypes(true);
	this.setMaxDamage(armorMaterial.getDurability(damageIndex)*2);
}
 
Example #3
Source File: ItemArtifactArmor.java    From Artifacts with MIT License 5 votes vote down vote up
@Override
public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type) {
	
	//The default texture (in case there is no given texture).
	String matName = stack.stackTagCompound.getString("matName").toLowerCase();
	if(type == null) {
		matName = "color";
	}
	String texture = "artifacts:textures/models/armor/"+matName+"_default_layer"+ (slot == 2 ? "2" : "1") +".png";
	
	if(stack.stackTagCompound == null) {
		return texture;
	}
	//Get the armor model texture map holding the textures mapped to the item's icon.
	HashMap<ArmorMaterial, String> modelMap = ArtifactsAPI.itemicons.armorModels.get( (type == null ? "color_" : "") + stack.stackTagCompound.getString("icon").toLowerCase());
	if(modelMap == null) {
		return texture;
	}
	
	//Get the texture for the material type.
	String modelTexture = modelMap.get(this.getArmorMaterial());
	if(modelTexture == null) {
		return texture;
	}
	else {
		texture = modelTexture;
	}
	
	return texture;
}
 
Example #4
Source File: FactoryItemIcons.java    From Artifacts with MIT License 5 votes vote down vote up
@Override
public void registerModelTexture(String icon, ArmorMaterial material, String modelTexture, String modelColor) {
	HashMap<ArmorMaterial, AbstractModelTexture> innerMap = modelMap.get(icon);

	if(innerMap == null) {
		innerMap = new HashMap<ArmorMaterial, AbstractModelTexture>();
	}

	innerMap.put(material, new AbstractModelTexture(modelTexture, modelColor));
	modelMap.put(icon, innerMap);
}
 
Example #5
Source File: FactoryItemIcons.java    From Artifacts with MIT License 4 votes vote down vote up
@Override
public void registerModelTexture(String icon, ArmorMaterial material, String modelTexture) {
	registerModelTexture(icon, material, modelTexture, null);
}
 
Example #6
Source File: FactoryItemIcons.java    From Artifacts with MIT License 4 votes vote down vote up
@Override
public IIcon registerIcons(IIconRegister iconReg) {
	IIcon defaultIcon = iconReg.registerIcon("artifacts:artifact1");
	icons.put("artifact1", defaultIcon);
	icons.put("artifact2", iconReg.registerIcon("artifacts:artifact2"));
	icons.put("artifact3", iconReg.registerIcon("artifacts:artifact2"));
	icons.put("artifact4", iconReg.registerIcon("artifacts:artifact2"));
	icons.put("artifact5", iconReg.registerIcon("artifacts:artifact2"));
	icons.put("artifact6", iconReg.registerIcon("artifacts:artifact2"));
	IIcon overlay = iconReg.registerIcon("artifacts:blank_overlay");
	icons.put("overlay_artifact1",overlay);
	icons.put("overlay_artifact2",overlay);
	icons.put("overlay_artifact3",overlay);
	icons.put("overlay_artifact4",overlay);
	icons.put("overlay_artifact5",overlay);
	icons.put("overlay_artifact6",overlay);
	
	HashMap<ArmorMaterial, String> modelsLayer1 = new HashMap<ArmorMaterial, String>();
	modelsLayer1.put(ArmorMaterial.CLOTH, "artifacts:textures/models/armor/leather_default_layer1.png");
	modelsLayer1.put(ArmorMaterial.CHAIN, "artifacts:textures/models/armor/chain_default_layer1.png");
	modelsLayer1.put(ArmorMaterial.IRON, "artifacts:textures/models/armor/iron_default_layer1.png");
	modelsLayer1.put(ArmorMaterial.GOLD, "artifacts:textures/models/armor/gold_default_layer1.png");
	modelsLayer1.put(ArmorMaterial.DIAMOND, "artifacts:textures/models/armor/diamond_default_layer1.png");
	
	HashMap<ArmorMaterial, String> modelsLayer2 = new HashMap<ArmorMaterial, String>();
	modelsLayer2.put(ArmorMaterial.CLOTH, "artifacts:textures/models/armor/leather_default_layer2.png");
	modelsLayer2.put(ArmorMaterial.CHAIN, "artifacts:textures/models/armor/chain_default_layer2.png");
	modelsLayer2.put(ArmorMaterial.IRON, "artifacts:textures/models/armor/iron_default_layer2.png");
	modelsLayer2.put(ArmorMaterial.GOLD, "artifacts:textures/models/armor/gold_default_layer2.png");
	modelsLayer2.put(ArmorMaterial.DIAMOND, "artifacts:textures/models/armor/diamond_default_layer2.png");
	
	HashMap<ArmorMaterial, String> colorsLayer1 = new HashMap<ArmorMaterial, String>();
	colorsLayer1.put(ArmorMaterial.CLOTH, "artifacts:textures/models/armor/color_default_layer1.png");
	colorsLayer1.put(ArmorMaterial.CHAIN, "artifacts:textures/models/armor/color_default_layer1.png");
	colorsLayer1.put(ArmorMaterial.IRON, "artifacts:textures/models/armor/color_default_layer1.png");
	colorsLayer1.put(ArmorMaterial.GOLD, "artifacts:textures/models/armor/color_default_layer1.png");
	colorsLayer1.put(ArmorMaterial.DIAMOND, "artifacts:textures/models/armor/color_default_layer1.png");
	
	HashMap<ArmorMaterial, String> colorsLayer2 = new HashMap<ArmorMaterial, String>();
	colorsLayer2.put(ArmorMaterial.CLOTH, "artifacts:textures/models/armor/color_default_layer2.png");
	colorsLayer2.put(ArmorMaterial.CHAIN, "artifacts:textures/models/armor/color_default_layer2.png");
	colorsLayer2.put(ArmorMaterial.IRON, "artifacts:textures/models/armor/color_default_layer2.png");
	colorsLayer2.put(ArmorMaterial.GOLD, "artifacts:textures/models/armor/color_default_layer2.png");
	colorsLayer2.put(ArmorMaterial.DIAMOND, "artifacts:textures/models/armor/color_default_layer2.png");
	
	armorModels.put("artifact2", modelsLayer1);
	armorModels.put("artifact3", modelsLayer1);
	armorModels.put("artifact4", modelsLayer1);
	armorModels.put("artifact5", modelsLayer2);
	
	armorModels.put("color_artifact2", colorsLayer1);
	armorModels.put("color_artifact3", colorsLayer1);
	armorModels.put("color_artifact4", colorsLayer1);
	armorModels.put("color_artifact5", colorsLayer2);
	
	AbstractIcon a;
	for(int i=0; i < iconList.size(); ++i) {
		a = (AbstractIcon)iconList.get(i);
		IIcon ico, ico2;
		if(a.overlay != null) {
			ico2 = iconReg.registerIcon(a.overlay);
			icons.put("overlay_" + a.type, ico2);
		}
		ico = iconReg.registerIcon(a.icon);
		icons.put(a.type, ico);
		
		if(modelMap.get(a.icon) != null) {
			HashMap<ArmorMaterial, AbstractModelTexture> thisMap = modelMap.get(a.icon);
			HashMap<ArmorMaterial, String> normalMap = new HashMap<ArmorMaterial, String>();
			HashMap<ArmorMaterial, String> colorMap = new HashMap<ArmorMaterial, String>();
			for(ArmorMaterial material : thisMap.keySet()) {
				String model = thisMap.get(material).model;
				String color = thisMap.get(material).color;
				if(model != null) {
					normalMap.put(material, model);
				}
				if(color != null) {
					colorMap.put(material, color);
				}
			}
			
			armorModels.put(a.type, normalMap);
			armorModels.put("color_" + a.type, colorMap);
		}
	}
	icons.put("radar",iconReg.registerIcon("artifacts:radarparticle"));
	return defaultIcon;
}
 
Example #7
Source File: Materials.java    From BaseMetals with GNU Lesser General Public License v2.1 2 votes vote down vote up
/**
 * Gets the armor material for a given metal 
 * @param m The metal of interest
 * @return The armor material for this metal, or null if there isn't one
 */
public static ArmorMaterial getArmorMaterialFor(MetalMaterial m){
	return armorMaterialMap.get(m);
}
 
Example #8
Source File: IItemIconAPI.java    From Artifacts with MIT License 2 votes vote down vote up
/**
 * Registers an armor model texture to be used by the artifact factory.
 * @param material The armor material type. 
 * @param icon The icon for the item which this model will render for (should be the icon passed in for {@link #registerArtifactIcon(String, String, String)},
 * not the overlay).
 * @param modelTexture The model texture. It should be the filepath to the texture from your mod's assets/textures folder. 
 * @see #registerModelTexture(String icon, ArmorMaterial material, String modelTexture, String modelColor)
 */
public void registerModelTexture(String icon, ArmorMaterial material, String modelTexture);
 
Example #9
Source File: IItemIconAPI.java    From Artifacts with MIT License 2 votes vote down vote up
/**
 * Registers an armor model texture to be used by the artifact factory, with a coloured layer as well.
 * @param material The armor material type. 
 * @param icon The icon for the item which this model will render for (should be the icon passed in for {@link #registerArtifactIcon(String, String, String)},
 * not the overlay).
 * @param modelTexture The model texture. It should be the filepath to the texture from your mod's assets/textures folder. 
 * @param modelColor A second model texture that renders under the first, and is coloured based on the artifact's overlay colour. 
 * It should have the same type of filepath as the modelTexture.  
 * @see #registerModelTexture(String icon, ArmorMaterial material, String modelTexture)
 */
public void registerModelTexture(String icon, ArmorMaterial material, String modelTexture, String modelColor);