Java Code Examples for net.minecraft.item.Item.getClass()

The following are Jave code examples for showing how to use getClass() of the net.minecraft.item.Item class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: harshencastle   File:   Source Code and License Vote up 5 votes
protected boolean testIfLegit(Item componant) {
	boolean legit = componant.getRegistryName() != null;
		new NullPointerException("Tried to config a Item with no registry name. Item: " + componant.getClass());
	return super.testIfLegit(componant);
Example 2
Project: minecraft-quiverbow   File:   Source Code and License Vote up 5 votes
private boolean isInMatrix(InventoryCrafting matrix, Item item) 
	if (item == null) { return false; }	// Can't find what doesn't exist
	int counter = 0;
	ItemStack stack = matrix.getStackInSlot(counter);
	while (counter < matrix.getSizeInventory())	// scouring through the entire thing
		if (stack != null && stack.getItem().getClass() == item.getClass()) // Found one!
			if (stack.getItem() instanceof _WeaponBase)	// Is a weapon, so need to ensure that it's empty
				if (stack.getItemDamage() == stack.getMaxDamage()) { return true; }
				// else, isn't empty
			else if (stack.getItem() instanceof _AmmoBase)	// is ammo
				this.metadata = stack.getItemDamage();	// Keeping track of what this is gonna make, so I don't have to constantly recheck
				return true; 
			// else, don't care what this is
		// else, empty. That's fine
		// Next!
		counter += 1;
		stack = matrix.getStackInSlot(counter);
	return false;	// Fallback. Didn't find what I'm looking for