本文整理汇总了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);
}
}
示例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);
}
示例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;
}
}
示例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);
}
}
}
示例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);
}
}
}
}
示例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);
}
}
}
}
示例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;
}
}
}
示例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);
}
}
}
}
示例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;
}
}
}
}
}
示例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;
}
}
示例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);
}
}
示例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
});
}
}
示例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;
}
示例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);
}
}
示例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);
}
}
}