当前位置: 首页>>代码示例>>Java>>正文


Java ItemCraftedEvent类代码示例

本文整理汇总了Java中cpw.mods.fml.common.gameevent.PlayerEvent.ItemCraftedEvent的典型用法代码示例。如果您正苦于以下问题:Java ItemCraftedEvent类的具体用法?Java ItemCraftedEvent怎么用?Java ItemCraftedEvent使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ItemCraftedEvent类属于cpw.mods.fml.common.gameevent.PlayerEvent包,在下文中一共展示了ItemCraftedEvent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onCrafting

import cpw.mods.fml.common.gameevent.PlayerEvent.ItemCraftedEvent; //导入依赖的package包/类
@SubscribeEvent
public void onCrafting(ItemCraftedEvent e)
{
	ItemStack itemstack = e.crafting;
	Item item = itemstack.getItem();
	IInventory inventory = e.craftMatrix;
	
	if (item == null || inventory == null) return;
        if(inventory != null)
       	{
            if(item == ModItems.itemWoodenTwig)
       	        com.bioxx.tfc.Handlers.CraftingHandler.handleItem(e.player, e.craftMatrix, Recipes.hammers);
            if(item == TFCItems.stick)
       	        com.bioxx.tfc.Handlers.CraftingHandler.handleItem(e.player, e.craftMatrix, Recipes.knives);
        }


}
 
开发者ID:Wahazar,项目名称:TFCPrimitiveTech,代码行数:19,代码来源:CraftingHandler.java

示例2: onCrafting

import cpw.mods.fml.common.gameevent.PlayerEvent.ItemCraftedEvent; //导入依赖的package包/类
@SubscribeEvent
public void onCrafting(ItemCraftedEvent e) {
	EntityPlayer player = e.player;
	ItemStack itemstack = e.crafting;
	Item item = itemstack.getItem();
	IInventory inventory = e.craftMatrix;
	
	if (item == null || inventory == null)
		return;
	
	// Tool dammage
	if (item instanceof ItemNugget || item instanceof ItemStripe) {
		List<ItemStack> chisels = OreDictionary.getOres("itemChisel", false);
		handleItem(player, inventory, chisels);
	}
	
	if (TFCTech.enableBCCore)
		CraftingHandlerBC.OnCraftingBC(e);
}
 
开发者ID:Shurgent,项目名称:TFCTech,代码行数:20,代码来源:CraftingHandler.java

示例3: onCrafting

import cpw.mods.fml.common.gameevent.PlayerEvent.ItemCraftedEvent; //导入依赖的package包/类
@SubscribeEvent
public void onCrafting(ItemCraftedEvent event){

    if(event.crafting.getItem() instanceof ItemRaygun) {
        handleRaygunCrafting(event, ARItems.raygun);
        return;
    }
    if(event.crafting.getItem() instanceof ItemCryogun) {
        handleRaygunCrafting(event, ARItems.cryogun);
        return;
    }
    if(event.crafting.getItem() instanceof ItemNanotool) {
        handleRaygunCrafting(event, ARItems.nanotool);
        return;
    }
}
 
开发者ID:katzenpapst,项目名称:amunra,代码行数:17,代码来源:CraftingHandler.java

示例4: onCrafting

import cpw.mods.fml.common.gameevent.PlayerEvent.ItemCraftedEvent; //导入依赖的package包/类
@SubscribeEvent
public void onCrafting(ItemCraftedEvent e)
{
	EntityPlayer player = e.player;
	ItemStack itemstack = e.crafting;
	Item item = itemstack.getItem();
	IInventory iinventory = e.craftMatrix;
	
	if(iinventory != null)
	{
		if(item == CWTFCItems.singlePlank)
		{
			List<ItemStack> saws = OreDictionary.getOres("itemSaw", false);
			CraftingHandler.handleItem(player, iinventory, saws);
		}
	}
}
 
开发者ID:StrayWolfe,项目名称:Cooking-with-TFC,代码行数:18,代码来源:CraftingMatrixHandler.java

示例5: handleInkCreation

import cpw.mods.fml.common.gameevent.PlayerEvent.ItemCraftedEvent; //导入依赖的package包/类
private void handleInkCreation(ItemCraftedEvent event){
	if (event.crafting.getItem() == RecallItems.ink && event.crafting.getItemDamage() != RecallSubtype.BLANK.ordinal()){
		NBTTagCompound tag = new NBTTagCompound();
		tag.setShort("usesRemaining", (short)Config.inkUses);
		event.crafting.setTagCompound(tag);
		
		IInventory grid = event.craftMatrix;
		for (int i = 0; i < grid.getSizeInventory(); i++){
			ItemStack stack = grid.getStackInSlot(i);
			if (stack != null && stack.getItem() == RecallItems.ink && stack.getItemDamage() == RecallSubtype.BLANK.ordinal()){
				grid.setInventorySlotContents(i, null);
			}
		}
		
	}
	
}
 
开发者ID:Zenith-One,项目名称:RecallResurrection,代码行数:18,代码来源:RecallCraftingHandler.java

示例6: onItemCraftedEvent

import cpw.mods.fml.common.gameevent.PlayerEvent.ItemCraftedEvent; //导入依赖的package包/类
@SubscribeEvent
public void onItemCraftedEvent(ItemCraftedEvent event) {

    if (event.craftMatrix instanceof InventoryCrafting) {
        if (ModItems.recipeNamePlate.matches((InventoryCrafting) event.craftMatrix, event.player.worldObj)) {
            // Find the name plate.
            ItemStack stack, namePlate = null;
            for (int i = 0; i < event.craftMatrix.getSizeInventory(); ++i) {
                stack = event.craftMatrix.getStackInSlot(i);
                if (stack != null && stack.getItem() instanceof NamePlate) {
                    namePlate = stack;
                }
            }

            if (namePlate != null) {
                // Damage and return name plate.
                namePlate.attemptDamageItem(1, SilentPets.instance.random);
                PlayerHelper.addItemToInventoryOrDrop(event.player, namePlate);
            }
        }
    }
}
 
开发者ID:SilentChaos512,项目名称:SilentPets,代码行数:23,代码来源:PetsEventHandler.java

示例7: onItemCrafted

import cpw.mods.fml.common.gameevent.PlayerEvent.ItemCraftedEvent; //导入依赖的package包/类
@SubscribeEvent
public void onItemCrafted(ItemCraftedEvent evt) {
    if (evt.player.worldObj.isRemote || !(evt.crafting.getItem() instanceof ItemPack)) {
        return;
    }
    
    PackBase outputPack = ((ItemPack) evt.crafting.getItem()).getPack(evt.crafting);
    if (outputPack.isArmored) {
        return;
    }
    
    for (int i = 0; i < evt.craftMatrix.getSizeInventory(); i++) {
        ItemStack input = evt.craftMatrix.getStackInSlot(i);
        if (input == null || !(input.getItem() instanceof ItemPack)) {
            continue;
        }
        PackBase inputPack = ((ItemPack) input.getItem()).getPack(input);
        if (inputPack != null && inputPack.isArmored && inputPack.platingMeta != null) {
            EntityItem item = evt.player.entityDropItem(new ItemStack(ModItems.armorPlatings, 1, inputPack.platingMeta), 0.0F);
            item.delayBeforeCanPickup = 0;
            break;
        }
    }
}
 
开发者ID:Tonius,项目名称:SimplyJetpacks,代码行数:25,代码来源:PlatingReturnHandler.java

示例8: onCraft

import cpw.mods.fml.common.gameevent.PlayerEvent.ItemCraftedEvent; //导入依赖的package包/类
@SubscribeEvent
public void onCraft(ItemCraftedEvent event) {
	if (event.crafting.getItem() instanceof ToolBase) {
		ToolBase tool = (ToolBase) event.crafting.getItem();
		if (!event.player.worldObj.isRemote) {
			RubedoStats stats = RubedoStats.get(event.player);

			if (!stats.rubedoGuide) {
				stats.rubedoGuide = true;

				ContentBook contentBook = Singleton
						.getInstance(ContentBook.class);

				EntityItem guide = new EntityItem(
						event.player.worldObj,
						event.player.posX,
						event.player.posY,
						event.player.posZ,
						GuideRegistry
								.getItemStackForBook(contentBook.rubedoGuide));
				event.player.worldObj.spawnEntityInWorld(guide);
			}
		}
	}
}
 
开发者ID:Katalliaan,项目名称:Rubedo,代码行数:26,代码来源:BookEventsHandler.java

示例9: returnGravelBowl

import cpw.mods.fml.common.gameevent.PlayerEvent.ItemCraftedEvent; //导入依赖的package包/类
@SubscribeEvent
public void returnGravelBowl(ItemCraftedEvent event) {
	if (event.crafting.getItem().equals(Items.flint)) {
		final int sizeInventory = event.craftMatrix.getSizeInventory();
		for (int i = 0; i < sizeInventory; i++) {
			ItemStack thisSlotStack = event.craftMatrix.getStackInSlot(i);
			if (thisSlotStack != null) {
				if (thisSlotStack.getItem().equals(Items.bowl)) {
					event.craftMatrix.setInventorySlotContents(
							i,
							new ItemStack(Items.bowl, event.craftMatrix
									.getStackInSlot(i).stackSize + 1));
					break;
				}
			}
		}
	}
}
 
开发者ID:Katalliaan,项目名称:Rubedo,代码行数:19,代码来源:MakeGravelEvent.java

示例10: onCrafting

import cpw.mods.fml.common.gameevent.PlayerEvent.ItemCraftedEvent; //导入依赖的package包/类
@SubscribeEvent
public void onCrafting(ItemCraftedEvent event) {
    if(event.crafting.getItem() == ForbiddenItems.primewell) {
        for(int x = 0; x < 9; ++x) {
            ItemStack item = event.craftMatrix.getStackInSlot(x);
            if(item != null && item.getItem() == ConfigItems.itemEldritchObject) {
                ++item.stackSize;
                event.craftMatrix.setInventorySlotContents(x, item);
            }
        }
    }
    if(Compat.bm && event.crafting.getItem() == ForbiddenItems.bloodOrb){
        EntityItem ent = event.player.entityDropItem(new ItemStack(ConfigItems.itemEldritchObject, 1, 3), 0);
        ent.motionY += randy.nextFloat() * 0.05F;
        ent.motionX += (randy.nextFloat() - randy.nextFloat()) * 0.1F;
        ent.motionZ += (randy.nextFloat() - randy.nextFloat()) * 0.1F;
    }
}
 
开发者ID:SpitefulFox,项目名称:ForbiddenMagic,代码行数:19,代码来源:FMEventHandler.java

示例11: onCrafting

import cpw.mods.fml.common.gameevent.PlayerEvent.ItemCraftedEvent; //导入依赖的package包/类
@SubscribeEvent
public void onCrafting(ItemCraftedEvent event)
{
	Item item = event.crafting.getItem();
	EntityPlayer player = event.player;
	if (item == Item.getItemFromBlock(MeteorBlocks.blockMeteorShield)) {
		player.addStat(HandlerAchievement.shieldCrafted, 1);
	} else if (item == MeteorItems.KreknoriteSword) {
		player.addStat(HandlerAchievement.craftedKreknoSword, 1);
	} else if (item == MeteorItems.itemMeteorProximityDetector ||
			   item == MeteorItems.itemMeteorTimeDetector ||
			   item == MeteorItems.itemMeteorCrashDetector) {
		player.addStat(HandlerAchievement.craftedDetector, 1);
	} else if (item == Item.getItemFromBlock(MeteorBlocks.blockMeteorTimer)) {
		player.addStat(HandlerAchievement.craftedMeteorTimer, 1);
	} else if (item == Item.getItemFromBlock(MeteorBlocks.blockFreezer)) {
		player.addStat(HandlerAchievement.craftedFreezer, 1);
	}
		
}
 
开发者ID:AlexDGr8r,项目名称:MeteorsMod,代码行数:21,代码来源:HandlerRecipe.java

示例12: OnCraftingBC

import cpw.mods.fml.common.gameevent.PlayerEvent.ItemCraftedEvent; //导入依赖的package包/类
public static void OnCraftingBC(ItemCraftedEvent e) {
	EntityPlayer player = e.player;
	ItemStack itemstack = e.crafting;
	Item item = itemstack.getItem();
	IInventory inventory = e.craftMatrix;
	
	if (item == BuildCraftCore.paintbrushItem) {
		CraftingHandler.handleItem(player, inventory, new Item[] {
			TFCItems.shears
		});
	}
}
 
开发者ID:Shurgent,项目名称:TFCTech,代码行数:13,代码来源:CraftingHandlerBC.java

示例13: onCrafting

import cpw.mods.fml.common.gameevent.PlayerEvent.ItemCraftedEvent; //导入依赖的package包/类
@SubscribeEvent
public void onCrafting(ItemCraftedEvent e)
{
	ItemStack itemstack = e.crafting;
	Item item = itemstack.getItem();
	IInventory inventory = e.craftMatrix;
	
	if (item == null || inventory == null) return;

}
 
开发者ID:Wahazar,项目名称:TerraFirmaProgressivePack,代码行数:11,代码来源:CraftingHandler.java

示例14: onItemCrafted

import cpw.mods.fml.common.gameevent.PlayerEvent.ItemCraftedEvent; //导入依赖的package包/类
@SubscribeEvent
public void onItemCrafted(ItemCraftedEvent event) {
    if (!addItemCrafted.isEmpty()) {
        hItemCrafted.addAll(addItemCrafted);
        addItemCrafted.clear();
    }
    for (Iterator<LIHandler> it = hItemCrafted.iterator(); it.hasNext(); ) {
        LIHandler handler = it.next();
        if (handler.isDead())
            it.remove();
        else
            handler.trigger(event);
    }
}
 
开发者ID:LambdaInnovation,项目名称:LambdaLib,代码行数:15,代码来源:LIFMLGameEventDispatcher.java

示例15: onCrafting

import cpw.mods.fml.common.gameevent.PlayerEvent.ItemCraftedEvent; //导入依赖的package包/类
@SubscribeEvent
public void onCrafting(ItemCraftedEvent e){
    EntityPlayer player = e.player;
    ItemStack itemstack = e.crafting;
    Item item = itemstack.getItem();
    int itemDamage = itemstack.getItemDamage();
    IInventory iinventory = e.craftMatrix;

    if(iinventory != null){
        if(item == Items.PlankPlaned){
            List<ItemStack> planers = OreDictionary.getOres("itemPlaner", false);
            handleItem(player, iinventory, planers);
        }
    }
}
 
开发者ID:raymondbh,项目名称:TFC-Additions,代码行数:16,代码来源:CraftingHandler.java


注:本文中的cpw.mods.fml.common.gameevent.PlayerEvent.ItemCraftedEvent类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。