Java Code Examples for net.minecraftforge.fml.common.FMLLog#severe()

The following examples show how to use net.minecraftforge.fml.common.FMLLog#severe() . 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: PythonCode.java    From pycode-minecraft with MIT License 5 votes vote down vote up
static public void failz0r(World world, BlockPos pos, String fmt, Object... args) {
    if (world.isRemote) return;
    ((WorldServer)world).spawnParticle(EnumParticleTypes.SPELL,
            pos.getX() + .5, pos.getY() + 1, pos.getZ() + .5,
            20, 0, 0, 0, .5, new int[0]);
    FMLLog.severe(fmt, args);
}
 
Example 3
Source File: PythonEngine.java    From pycode-minecraft with MIT License 5 votes vote down vote up
private PythonEngine() {
    ScriptEngineManager manager = new ScriptEngineManager();
    engine = (PyScriptEngine) manager.getEngineByName("python");
    if (engine == null) {
        FMLLog.severe("FAILED to getBlock Python");
    } else {
        FMLLog.fine("Got Python");
    }
    try {
        engine.eval("print 'Python Ready'");
    } catch (ScriptException e) {
        FMLLog.severe("Python failed: %s", e);
    }
}
 
Example 4
Source File: HandEntity.java    From pycode-minecraft with MIT License 5 votes vote down vote up
/**
 * Called when the entity is attacked.
 */
public boolean attackEntityFrom(DamageSource source, float amount) {
    if (!this.worldObj.isRemote && !this.isDead) {
        if (this.isEntityInvulnerable(source)) {
            return false;
        } else {
            this.setBeenAttacked();
            this.removePassengers();
            this.setDead();
            if (this.worldObj.getGameRules().getBoolean("doEntityDrops")) {
                ItemStack itemstack = new ItemStack(ModItems.python_hand, 1);
                itemstack.setStackDisplayName(this.getName());
                if (!itemstack.hasTagCompound()) {
                    itemstack.setTagCompound(new NBTTagCompound());
                }
                NBTTagCompound compound = itemstack.getTagCompound();
                if (compound == null) {
                    FMLLog.severe("Python Hand itemstack NBT missing??");
                } else {
                    this.writeToNBT(compound);
                }
                this.entityDropItem(itemstack, 0.0F);
            }

            return true;
        }
    } else {
        return true;
    }
}
 
Example 5
Source File: BaseMetals.java    From BaseMetals with GNU Lesser General Public License v2.1 5 votes vote down vote up
/**
 * Parses a String in the format (stack-size)*(modid):(item/block name)#(metadata value). The 
 * stacksize and metadata value parameters are optional.
 * @param str A String describing an itemstack (e.g. "4*minecraft:dye#15" or "minecraft:bow")
 * @param allowWildcard If true, then item strings that do not specify a metadata value will use 
 * the OreDictionary wildcard value. If false, then the default meta value is 0 instead.
 * @return An ItemStack representing the item, or null if the item is not found
 */
public static ItemStack parseStringAsItemStack(String str, boolean allowWildcard){
	str = str.trim();
	int count = 1;
	int meta;
	if(allowWildcard){
		meta = OreDictionary.WILDCARD_VALUE;
	} else {
		meta = 0;
	}
	int nameStart = 0;
	int nameEnd = str.length();
	if(str.contains("*")){
		count = Integer.parseInt(str.substring(0,str.indexOf("*")).trim());
		nameStart = str.indexOf("*")+1;
	}
	if(str.contains("#")){
		meta = Integer.parseInt(str.substring(str.indexOf("#")+1,str.length()).trim());
		nameEnd = str.indexOf("#");
	}
	String id = str.substring(nameStart,nameEnd).trim();
	if(Block.getBlockFromName(id) != null){
		// is a block
		return new ItemStack(Block.getBlockFromName(id),count,meta);
	} else if(Item.getByNameOrId(id) != null){
		// is an item
		return new ItemStack(Item.getByNameOrId(id),count,meta);
	} else {
		// item not found
		FMLLog.severe("Failed to find item or block for ID '"+id+"'");
		return null;
	}
}
 
Example 6
Source File: CrusherRecipeRegistry.java    From BaseMetals with GNU Lesser General Public License v2.1 5 votes vote down vote up
/**
 * Adds a new crusher recipe (for the crack hammer and other rock crushers) 
 * where the input item is specified by an ItemStack. This means that only 
 * the specified item will be converted into the specified output item. 
 * @param input Item to be crushed
 * @param output The item to create as the result of this crusher recipe.
 */
public static void addNewCrusherRecipe(final ItemStack input, final ItemStack output){
	if(input == null || output == null) FMLLog.severe("%s: %s: Crusher recipe not registered because of null input or output. \n %s", 
			BaseMetals.MODID, CrusherRecipeRegistry.class,
			Arrays.toString(Thread.currentThread().getStackTrace()).replace(", ", "\n").replace("[", "").replace("]", "")
			);
	getInstance().addRecipe(new ArbitraryCrusherRecipe(input,output));
}
 
Example 7
Source File: ItemMetalArmor.java    From BaseMetals with GNU Lesser General Public License v2.1 5 votes vote down vote up
public static ItemMetalArmor createHelmet(MetalMaterial metal){
	ArmorMaterial material = cyano.basemetals.init.Materials.getArmorMaterialFor(metal);
	if(material == null){
		// uh-oh
		FMLLog.severe("Failed to load armor material enum for "+metal);
	}
	return new ItemMetalArmor(metal,material,material.ordinal(),EntityEquipmentSlot.HEAD);
}
 
Example 8
Source File: ItemMetalArmor.java    From BaseMetals with GNU Lesser General Public License v2.1 5 votes vote down vote up
public static ItemMetalArmor createChestplate(MetalMaterial metal){
	ArmorMaterial material = cyano.basemetals.init.Materials.getArmorMaterialFor(metal);
	if(material == null){
		// uh-oh
		FMLLog.severe("Failed to load armor material enum for "+metal);
	}
	return new ItemMetalArmor(metal,material,material.ordinal(),EntityEquipmentSlot.CHEST);
}
 
Example 9
Source File: ItemMetalArmor.java    From BaseMetals with GNU Lesser General Public License v2.1 5 votes vote down vote up
public static ItemMetalArmor createLeggings(MetalMaterial metal){
	ArmorMaterial material = cyano.basemetals.init.Materials.getArmorMaterialFor(metal);
	if(material == null){
		// uh-oh
		FMLLog.severe("Failed to load armor material enum for "+metal);
	}
	return new ItemMetalArmor(metal,material,material.ordinal(),EntityEquipmentSlot.LEGS);
}
 
Example 10
Source File: ItemMetalArmor.java    From BaseMetals with GNU Lesser General Public License v2.1 5 votes vote down vote up
public static ItemMetalArmor createBoots(MetalMaterial metal){
	ArmorMaterial material = cyano.basemetals.init.Materials.getArmorMaterialFor(metal);
	if(material == null){
		// uh-oh
		FMLLog.severe("Failed to load armor material enum for "+metal);
	}
	return new ItemMetalArmor(metal,material,material.ordinal(),EntityEquipmentSlot.FEET);
}