本文整理匯總了Java中net.minecraft.inventory.InventoryCrafting類的典型用法代碼示例。如果您正苦於以下問題:Java InventoryCrafting類的具體用法?Java InventoryCrafting怎麽用?Java InventoryCrafting使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
InventoryCrafting類屬於net.minecraft.inventory包,在下文中一共展示了InventoryCrafting類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getRemainingItems
import net.minecraft.inventory.InventoryCrafting; //導入依賴的package包/類
public ItemStack[] getRemainingItems(InventoryCrafting craftMatrix, World worldIn)
{
for (IRecipe irecipe : this.recipes)
{
if (irecipe.matches(craftMatrix, worldIn))
{
return irecipe.getRemainingItems(craftMatrix);
}
}
ItemStack[] aitemstack = new ItemStack[craftMatrix.getSizeInventory()];
for (int i = 0; i < aitemstack.length; ++i)
{
aitemstack[i] = craftMatrix.getStackInSlot(i);
}
return aitemstack;
}
示例2: getCraftingResult
import net.minecraft.inventory.InventoryCrafting; //導入依賴的package包/類
@Override
public ItemStack getCraftingResult(InventoryCrafting inv) {
ItemStack out = new ItemStack(ModItems.hoe);
if (adornmentMat == null) {
adornmentMat = ModMaterials.ADORNMENT_NULL;
}
if (headMat == null || haftMat == null || handleMat == null || adornmentMat == null) {
return ItemStack.EMPTY;
}
NBTTagCompound tag = new NBTTagCompound();
tag.setString(IHeadTool.HEAD_TAG, headMat.getName());
tag.setString(IHaftTool.HAFT_TAG, haftMat.getName());
tag.setString(IHandleTool.HANDLE_TAG, handleMat.getName());
tag.setString(IAdornedTool.ADORNMENT_TAG, adornmentMat.getName());
out.setTagCompound(tag);
return out;
}
示例3: test_useUpItem
import net.minecraft.inventory.InventoryCrafting; //導入依賴的package包/類
@Test
public void test_useUpItem()
{
DamageableShapelessOreRecipe recipe = new DamageableShapelessOreRecipe(new ResourceLocation("group"),
new int[] {60}, new ItemStack(Blocks.DIRT), new ItemStack(Items.WOODEN_SWORD));
InventoryCrafting inv = new InventoryCrafting(new Container()
{
@Override
public boolean canInteractWith(EntityPlayer playerIn)
{
return false;
}
}, 3, 3);
inv.setInventorySlotContents(3, new ItemStack(Items.WOODEN_SWORD));
assertTrue(recipe.matches(inv, null));
NonNullList<ItemStack> remaining = recipe.getRemainingItems(inv);
assertTrue(remaining.get(3).isEmpty());
}
示例4: getCraftingResult
import net.minecraft.inventory.InventoryCrafting; //導入依賴的package包/類
@Override
public ItemStack getCraftingResult(InventoryCrafting inv) {
ItemStack out = new ItemStack(ModItems.shovel);
if (adornmentMat == null) {
adornmentMat = ModMaterials.ADORNMENT_NULL;
}
if (headMat == null || haftMat == null || handleMat == null || adornmentMat == null) {
return ItemStack.EMPTY;
}
NBTTagCompound tag = new NBTTagCompound();
tag.setString(IHeadTool.HEAD_TAG, headMat.getName());
tag.setString(IHaftTool.HAFT_TAG, haftMat.getName());
tag.setString(IHandleTool.HANDLE_TAG, handleMat.getName());
tag.setString(IAdornedTool.ADORNMENT_TAG, adornmentMat.getName());
out.setTagCompound(tag);
return out;
}
示例5: getCraftingResult
import net.minecraft.inventory.InventoryCrafting; //導入依賴的package包/類
@Override
public ItemStack getCraftingResult(InventoryCrafting invCrafting) {
ItemStack potion = ItemStack.EMPTY;
ItemStack ammo = ItemStack.EMPTY;
for (int i = 0; i < invCrafting.getSizeInventory(); i++) {
ItemStack stack = invCrafting.getStackInSlot(i);
if (!stack.isEmpty()) {
if (stack.getItem() == Items.POTIONITEM) {
potion = stack;
} else {
ammo = stack;
}
}
}
ammo = ammo.copy();
ItemGunAmmo.setPotion(ammo, potion);
return ammo;
}
示例6: getRemainingItems
import net.minecraft.inventory.InventoryCrafting; //導入依賴的package包/類
public ItemStack[] getRemainingItems(InventoryCrafting inv)
{
ItemStack[] aitemstack = new ItemStack[inv.getSizeInventory()];
for (int i = 0; i < aitemstack.length; ++i)
{
ItemStack itemstack = inv.getStackInSlot(i);
if (itemstack != null && itemstack.getItem().hasContainerItem())
{
aitemstack[i] = new ItemStack(itemstack.getItem().getContainerItem());
}
}
return aitemstack;
}
示例7: getCraftingResult
import net.minecraft.inventory.InventoryCrafting; //導入依賴的package包/類
@Override
public ItemStack getCraftingResult(InventoryCrafting inv) {
// TODO Auto-generated method stub
ItemStack stack2 = ItemStack.EMPTY;
for (int x = 0; x < inv.getSizeInventory(); x++) {
ItemStack stack = inv.getStackInSlot(x);
if (!stack.isEmpty())
if (!(stack.getItem() == Items.FEATHER))
stack2 = stack;
}
// System.out.println("OutPut: "+stack2);
if (!stack2.isEmpty()) {
if(ItemFromData.isSameType(stack2, nameBefore))
stack2=ItemFromData.getNewStack(nameAfter);
}
return stack2;
}
示例8: getCraftingResult
import net.minecraft.inventory.InventoryCrafting; //導入依賴的package包/類
/**
* Returns an Item that is the result of this recipe
*/
public ItemStack getCraftingResult(InventoryCrafting inv)
{
ItemStack itemstack = null;
for (int i = 0; i < inv.getSizeInventory() && itemstack == null; ++i)
{
ItemStack itemstack1 = inv.getStackInSlot(i);
if (itemstack1 != null && itemstack1.getItem() == Items.filled_map)
{
itemstack = itemstack1;
}
}
itemstack = itemstack.copy();
itemstack.stackSize = 1;
if (itemstack.getTagCompound() == null)
{
itemstack.setTagCompound(new NBTTagCompound());
}
itemstack.getTagCompound().setBoolean("map_is_scaling", true);
return itemstack;
}
示例9: matches
import net.minecraft.inventory.InventoryCrafting; //導入依賴的package包/類
/**
* Used to check if a recipe matches current crafting inventory
*/
public boolean matches(InventoryCrafting inv, World worldIn)
{
for (int i = 0; i <= 3 - this.recipeWidth; ++i)
{
for (int j = 0; j <= 3 - this.recipeHeight; ++j)
{
if (this.checkMatch(inv, i, j, true))
{
return true;
}
if (this.checkMatch(inv, i, j, false))
{
return true;
}
}
}
return false;
}
示例10: getCraftingResult
import net.minecraft.inventory.InventoryCrafting; //導入依賴的package包/類
@Override
public ItemStack getCraftingResult(InventoryCrafting inv) {
ItemStack inputSlaw = inv.getStackInSlot(0);
byte additions = 0;
if (inputSlaw.hasTagCompound()) {
additions = inputSlaw.getTagCompound().getByte("additions");
}
additions += 1;
ItemStack outputStack = new ItemStack(ModItems.simic_slaw);
outputStack.setTagCompound(new NBTTagCompound());
outputStack.getTagCompound().setByte("additions", additions);
return outputStack;
}
示例11: getCraftingResult
import net.minecraft.inventory.InventoryCrafting; //導入依賴的package包/類
@Override
public ItemStack getCraftingResult(InventoryCrafting inventoryCrafting) {
ItemStack result = super.getCraftingResult(inventoryCrafting);
if (!result.isEmpty()) {
ItemStack portalGunItem = ItemStack.EMPTY;
for (int i = 0; i < inventoryCrafting.getSizeInventory(); ++i) {
ItemStack stack = inventoryCrafting.getStackInSlot(i);
if (!stack.isEmpty()) {
if (stack.getItem() instanceof PortalGunItem) {
portalGunItem = stack;
}
}
}
if (!portalGunItem.isEmpty()) {
int charge = PortalGunItem.getCharge(portalGunItem);
CartridgeItem.setCharge(result, charge);
}
}
return result;
}
示例12: getCraftingResult
import net.minecraft.inventory.InventoryCrafting; //導入依賴的package包/類
/**
* Returns an Item that is the result of this recipe
*/
public ItemStack getCraftingResult(InventoryCrafting inv)
{
ItemStack itemstack = this.getRecipeOutput().copy();
if (this.copyIngredientNBT)
{
for (int i = 0; i < inv.getSizeInventory(); ++i)
{
ItemStack itemstack1 = inv.getStackInSlot(i);
if (itemstack1 != null && itemstack1.hasTagCompound())
{
itemstack.setTagCompound((NBTTagCompound)itemstack1.getTagCompound().copy());
}
}
}
return itemstack;
}
示例13: matches
import net.minecraft.inventory.InventoryCrafting; //導入依賴的package包/類
public boolean matches(InventoryCrafting invCrafting, InventoryWorkbenchAdditionalMaterials materials,
World world)
{
for (int i = 0; i <= 3 - recipeWidth; ++i)
{
for (int j = 0; j <= 3 - recipeHeight; ++j)
{
if (checkMatch(invCrafting, materials, i, j, false))
{
return true;
}
if (mirrored && checkMatch(invCrafting, materials, i, j, true))
{
return true;
}
}
}
return false;
}
示例14: matches
import net.minecraft.inventory.InventoryCrafting; //導入依賴的package包/類
@Override
public boolean matches(InventoryCrafting inv, World worldIn) {
int count = 0;
boolean forge = false;
for (int i = 0; i < inv.getSizeInventory(); i++) {
ItemStack stack = inv.getStackInSlot(i);
if(!stack.isEmpty()) {
if(stack.getItem() instanceof ItemBlock && ((ItemBlock) stack.getItem()).getBlock() instanceof CraftiniumForge) {
if(forge && !this.combining) {
return false;
} else {
forge = true;
if(!stack.hasTagCompound() || stack.getSubCompound("randores") == null || !stack.getSubCompound("randores").hasKey("furnace_speed")) {
return false;
}
}
} else if (this.upgrades.keySet().stream().noneMatch(k -> k.apply(stack))) {
return false;
}
count++;
}
}
return count >= 2 && forge;
}
示例15: getCraftingResult
import net.minecraft.inventory.InventoryCrafting; //導入依賴的package包/類
@Override
public ItemStack getCraftingResult(InventoryCrafting inv) {
double speed = 0;
for (int i = 0; i < inv.getSizeInventory(); i++) {
ItemStack stack = inv.getStackInSlot(i);
if(stack.getItem() instanceof ItemBlock && ((ItemBlock) stack.getItem()).getBlock() instanceof CraftiniumForge) {
speed += stack.getSubCompound("randores").getInteger("furnace_speed");
} else {
speed += this.upgrades.entrySet().stream().filter(e -> e.getKey().apply(stack)).map(Entry::getValue).findFirst().orElse(0d);
}
}
int intSpeed = (int) speed;
if(intSpeed > this.clamp) {
intSpeed = this.clamp;
}
ItemStack res = new ItemStack(CraftingBlocks.forgeItem);
res.getOrCreateSubCompound("randores").setInteger("furnace_speed", intSpeed);
return res;
}