@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); } }
@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); }
@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; } }
@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); } } }
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); } } } }
@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); } } } }
@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; } } }
@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); } } } }
@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; } } } } }
@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; } }
@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); } }
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 }); } }
@SubscribeEvent public void onCrafting(ItemCraftedEvent e) { ItemStack itemstack = e.crafting; Item item = itemstack.getItem(); IInventory inventory = e.craftMatrix; if (item == null || inventory == null) return; }
@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); } }
@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); } } }
@SubscribeEvent public void itemCrafting(ItemCraftedEvent eventCrafted) { if(eventCrafted.crafting.getItem() == Item.getItemFromBlock(RoadStuffBlocks.blockAsphalt) && eventCrafted.crafting.getItemDamage() == 0) eventCrafted.player.triggerAchievement(RoadStuffAchievements.craftAsphalt); if(eventCrafted.crafting.getItem() == Item.getItemFromBlock(RoadStuffBlocks.blockConcrete) && eventCrafted.crafting.getItemDamage() == 0) eventCrafted.player.triggerAchievement(RoadStuffAchievements.craftConcrete); if(eventCrafted.crafting.getItem() == Item.getItemFromBlock(RoadStuffBlocks.blockCone)) eventCrafted.player.triggerAchievement(RoadStuffAchievements.craftCone); if(eventCrafted.crafting.getItem() == Item.getItemFromBlock(RoadStuffBlocks.blockAsphaltLine)) eventCrafted.player.triggerAchievement(RoadStuffAchievements.craftAsphaltLine); if(eventCrafted.crafting.getItem() == Item.getItemFromBlock(RoadStuffBlocks.blockAsphaltCorner)) eventCrafted.player.triggerAchievement(RoadStuffAchievements.craftAsphaltCorner); if(eventCrafted.crafting.getItem() == Item.getItemFromBlock(RoadStuffBlocks.blockConcreteLine)) eventCrafted.player.triggerAchievement(RoadStuffAchievements.craftConcreteLine); if(eventCrafted.crafting.getItem() == Item.getItemFromBlock(RoadStuffBlocks.blockConcreteCorner)) eventCrafted.player.triggerAchievement(RoadStuffAchievements.craftConcreteCorner); if(eventCrafted.crafting.getItem() == Item.getItemFromBlock(RoadStuffBlocks.blockTrafficSign) && eventCrafted.crafting.getItemDamage() == 1) eventCrafted.player.triggerAchievement(RoadStuffAchievements.craftSign); if(eventCrafted.crafting.getItem() == Item.getItemFromBlock(RoadStuffBlocks.blockReflector) && eventCrafted.crafting.getItemDamage() < 2) eventCrafted.player.triggerAchievement(RoadStuffAchievements.craftReflector); if(eventCrafted.crafting.getItem() == Item.getItemFromBlock(RoadStuffBlocks.blockReflector) && eventCrafted.crafting.getItemDamage() > 1) eventCrafted.player.triggerAchievement(RoadStuffAchievements.craftIlluminatedReflector); if(eventCrafted.crafting.getItem() == Item.getItemFromBlock(RoadStuffBlocks.singleSlabAsphalt) && eventCrafted.crafting.getItemDamage() == 0) eventCrafted.player.triggerAchievement(RoadStuffAchievements.craftAsphaltSlab); if(eventCrafted.crafting.getItem() == Item.getItemFromBlock(RoadStuffBlocks.singleSlabConcrete) && eventCrafted.crafting.getItemDamage() == 0) eventCrafted.player.triggerAchievement(RoadStuffAchievements.craftConcreteSlab); }
@SubscribeEvent(priority = EventPriority.LOWEST, receiveCanceled = false) public void onItemCrafted(final ItemCraftedEvent event) { if (event.crafting.isItemEqual(new ItemStack(BlockManager.thermalRecycler))) { event.player.addStat(feelingScrappy, 1); } else if(event.crafting.isItemEqual(new ItemStack(ItemManager.energyCell))) { event.player.addStat(powerUp, 1); } }
@SubscribeEvent public void onCrafting(ItemCraftedEvent e) { Item item = e.crafting.getItem(); ItemStack itemstack = e.crafting; int isDmg = e.crafting.getItemDamage(); IInventory iinventory = e.craftMatrix; if(iinventory != null) { if(item == ItemList.Powder && isDmg == 0) com.bioxx.tfc.Handlers.CraftingHandler.handleItem(e.player, e.craftMatrix, Recipes.hammers); } }
@SubscribeEvent public void onItemPickedUp(ItemCraftedEvent event) { if(event.crafting != null && event.crafting.getItem() instanceof ICraftAchievement) { Achievement achievement = ((ICraftAchievement) event.crafting.getItem()).getAchievementOnCraft(event.crafting, event.player, event.craftMatrix); if(achievement != null) event.player.addStat(achievement, 1); } }
@SubscribeEvent public void onCrafted(ItemCraftedEvent event) { Item item = event.crafting.getItem(); if (item.equals(TDETools.dark_stone_pickaxe) || item.equals(TDETools.dark_stone_axe) || item.equals(TDETools.dark_stone_shovel) || item.equals(TDETools.dark_stone_hoe) || item.equals(TDEWeapons.dark_stone_sword)) { AchievementHandler.setAchieved(TDEAchievements.stone_upgrade); ScoreStat.addScore(1); } if (item.equals(TDETools.steel_pickaxe) || item.equals(TDETools.steel_axe) || item.equals(TDETools.steel_shovel) || item.equals(TDETools.steel_hoe) || item.equals(TDEWeapons.steel_sword)) { AchievementHandler.setAchieved(TDEAchievements.steel_upgrade); ScoreStat.addScore(1); } }
private void handleMortar(ItemCraftedEvent event){ IInventory grid = event.craftMatrix; for (int i = 0; i < grid.getSizeInventory(); i++){ if (grid.getStackInSlot(i) != null){ ItemStack stack = grid.getStackInSlot(i); if (stack.getItem() != null && stack.getItem() == RecallItems.mortarPestle){ ItemStack newStack = new ItemStack(RecallItems.mortarPestle, 2, 0); grid.setInventorySlotContents(i, newStack); } } } }
@SubscribeEvent public void onPlayerItemCraft(ItemCraftedEvent event) { if (dpBlockItem == null) { dpBlockItem = Item.getItemFromBlock(ModBlocks.dimensionalPocket); } if (!event.player.worldObj.isRemote && event.crafting.getItem() == dpBlockItem && analytics.isActive()) { analytics.logItemCrafted(event.crafting.getUnlocalizedName(), event.crafting.stackSize); } }
@SubscribeEvent public void onCraft(ItemCraftedEvent e) { PlayerArmour storage = PlayerArmour.getFor(e.player); if (!storage.hasCraftedArmour) { if (e.crafting.getItem() instanceof IModularItem) { storage.hasCraftedArmour = true; InventoryUtil.givePlayerItem(e.player, Vanilla.defaultTablet); } } }
@SubscribeEvent public void onCrafting(ItemCraftedEvent e) { Item item = e.crafting.getItem(); IInventory craftMatrix = e.craftMatrix; if(craftMatrix != null) { if(item == LWSItems.itemLeatherWaterSac) { if (e.player.capabilities.isCreativeMode) e.crafting.setItemDamage(0); for(int i = 0; i < craftMatrix.getSizeInventory(); i++) { if(craftMatrix.getStackInSlot(i) == null) continue; for(int j = 0; j < Recipes.knives.length; j++) { if(craftMatrix.getStackInSlot(i).getItem() == Recipes.knives[j]) { ItemStack tfcKnife = craftMatrix.getStackInSlot(i).copy(); if(tfcKnife != null) { tfcKnife.damageItem(1, e.player); if(tfcKnife.getItemDamage() != 0 || e.player.capabilities.isCreativeMode) { craftMatrix.setInventorySlotContents(i, tfcKnife); craftMatrix.getStackInSlot(i).stackSize = 2; } } } } } } } }
@SubscribeEvent public void onCrafted(ItemCraftedEvent craft) { if (craft.crafting.getItem() == Item.getItemFromBlock(CCMain.CompactCobblestone) || craft.crafting.getItem() == Item.getItemFromBlock(CCMain.CompactDirt) || craft.crafting.getItem() == Item.getItemFromBlock(CCMain.CompactNetherrack) || craft.crafting.getItem() == Item.getItemFromBlock(CCMain.CompactCoalBlock) || craft.crafting.getItem() == CCMain.CompactCoal || craft.crafting.getItem() == Item.getItemFromBlock(CCMain.CompactSand)) { craft.player.addStat(CCMain.achievements.compactBlockAchieve, 1); } }
public void onPickupFromSlot(EntityPlayer par1EntityPlayer, ItemStack par2ItemStack) { ItemCraftedEvent itemCrafted = new ItemCraftedEvent(thePlayer, par2ItemStack, craftMatrix); soul_forest.craftHandler.onCrafting(itemCrafted); this.onCrafting(par2ItemStack); for (int i = 0; i < this.craftMatrix.getSizeInventory(); ++i) { ItemStack itemstack1 = this.craftMatrix.getStackInSlot(i); if (itemstack1 != null) { this.craftMatrix.decrStackSize(i, 1); if (itemstack1.getItem().hasContainerItem()) { ItemStack itemstack2 = itemstack1.getItem().getContainerItem(itemstack1); if (itemstack2.isItemStackDamageable() && itemstack2.getItemDamage() > itemstack2.getMaxDamage()) { MinecraftForge.EVENT_BUS.post(new PlayerDestroyItemEvent(thePlayer, itemstack2)); itemstack2 = null; } if (itemstack2 != null && (!itemstack1.getItem().doesContainerItemLeaveCraftingGrid(itemstack1) || !this.thePlayer.inventory.addItemStackToInventory(itemstack2))) { if (this.craftMatrix.getStackInSlot(i) == null) { this.craftMatrix.setInventorySlotContents(i, itemstack2); } else { this.thePlayer.dropPlayerItemWithRandomChoice(itemstack2, false); } } } } } }
private void handleRaygunCrafting(ItemCraftedEvent event, ItemAbstractBatteryUser gun) { int indexGun = -1; int indexBattery = -1; for(int i=0;i<event.craftMatrix.getSizeInventory();i++) { ItemStack curItem = event.craftMatrix.getStackInSlot(i); if(curItem == null) continue; if(curItem.getItem() instanceof ItemAbstractBatteryUser) { indexGun = i; } else if(curItem.getItem() instanceof ItemBattery || curItem.getItem() instanceof ItemBaseBattery) { indexBattery = i; } /*else { return; // wrong recipe }*/ } if(indexBattery != -1) { //float energyInOldBattery = ((ItemBattery)GCItems.battery).getElectricityStored(event.craftMatrix.getStackInSlot(indexBattery)); ItemStack newBattery = event.craftMatrix.getStackInSlot(indexBattery); if(indexGun != -1) { // there is another gun in the ingredients, so this is recharging ItemStack oldGunStack = event.craftMatrix.getStackInSlot(indexGun); ItemStack oldBattery = gun.getUsedBattery(event.craftMatrix.getStackInSlot(indexGun), true); event.player.inventory.addItemStackToInventory(oldBattery); // replace the nbt stuff NBTBase nbt = oldGunStack.stackTagCompound.copy(); event.crafting.stackTagCompound = (NBTTagCompound) nbt; } else { } // always set the energy of the battery from the ingredients to the finished gun //gun.setElectricity(event.crafting, energyInOldBattery); gun.setUsedBattery(event.crafting, newBattery); } }
@SubscribeEvent public void onItemCrafted(ItemCraftedEvent event){ handleMortar(event); handleInkUsage(event); handleInkCreation(event); }
@SubscribeEvent public void onThingCrafted(ItemCraftedEvent event) { if(event.crafting.getItem() instanceof ItemSMMDGStaff) event.player.triggerAchievement(SMMAchievementManager.dgstaff); }
@SubscribeEvent public void onCrafting(ItemCraftedEvent event) { ItemStack item = event.crafting; IInventory craftMatrix = event.craftMatrix; /* * This is Fur Pelt --> Leather + Fiber * 0-1-2 * 3-4-5 * 6-7-8 * * * * * 0-1 * 2-3 */ /* Check if Result is leather */ boolean isResultLeather = item.getItem() == Items.leather; if (!isResultLeather) return; /* * Check if Fur Pelt is the Only Thing on the Crafting Table If Anything is not fur, do Not Continue */ boolean contsinsFur = false; int furInSlot = 0; for (int i = 0; i < craftMatrix.getSizeInventory(); i++) { if (craftMatrix.getStackInSlot(i) == null) { continue; } if (craftMatrix.getStackInSlot(i).getItem() == ItemList.furPelt.get() && !contsinsFur) { contsinsFur = true; furInSlot = i; continue; } return; } if (!contsinsFur) return; ItemStack itemToPlace = new ItemStack(ItemList.genericCraftingItems.get(), 2, ItemGenerics.Properties.RawFiber.meta()); if (furInSlot == 0) { craftMatrix.setInventorySlotContents(1, itemToPlace); } else { craftMatrix.setInventorySlotContents(0, itemToPlace); } }
@SubscribeEvent public void onCrafting(ItemCraftedEvent event) { ItemStack item = event.crafting; IInventory craftMatrix = event.craftMatrix; // FMLCommonHandler.instance().bus().register(this); /* * This onCrafting Handle is for Sword and Coconut Recipe 0-1-2 3-4-5 6-7-8 */ /* Check if Result is leather */ boolean isResultDesired = item.getItem() == ItemList.coconutSeed.get(); if (!isResultDesired) return; boolean inventoryValidSize = craftMatrix.getSizeInventory() > 4; if (!inventoryValidSize) return; ItemStack shouldBeSword = craftMatrix.getStackInSlot(1); ItemStack shouldBeCoconut = craftMatrix.getStackInSlot(4); if (shouldBeSword != null && shouldBeCoconut != null && (shouldBeSword.getItem() == Items.wooden_sword || shouldBeSword.getItem() == Items.stone_sword || shouldBeSword.getItem() == Items.iron_sword || shouldBeSword.getItem() == Items.golden_sword || shouldBeSword .getItem() == Items.diamond_sword) && ItemList.coconutItem.isPresent() && shouldBeCoconut.getItem() == ItemList.coconutItem.get()) { /* Stacksize of placed must not be 1, as the 'recipe' will consume 1 of whatever item is present in matrix */ /* Increase Sword */ shouldBeSword.setItemDamage(shouldBeSword.getItemDamage() + 1); shouldBeSword.stackSize += 1; /* Place Coconut Milk */ if (ItemList.coconutMilkFragment.isPresent()) { ItemStack tempMilk = new ItemStack(ItemList.coconutMilkFragment.get(), 2); craftMatrix.setInventorySlotContents(3, tempMilk); } /* Place Coconut Shell */ if (ItemList.coconutShell.isPresent()) { ItemStack tempShell = new ItemStack(ItemList.coconutShell.get(), 2); craftMatrix.setInventorySlotContents(5, tempShell); } } }
@SubscribeEvent public void OnCraftEvent(ItemCraftedEvent event) { if(!Loader.isModLoaded("Baubles")) { if(event.crafting.getItem().equals(ModRings.fyrestoneRing)){ event.player.addStat(ModAchievements.pyromaniac, 1); } if(event.crafting.getItem().equals(ModRings.fyrestoneSilverRing)){ event.player.addStat(ModAchievements.pyromaniac, 1); } if(event.crafting.getItem().equals(ModRings.voidiumRing)){ event.player.addStat(ModAchievements.steveAlmighty, 1); } if(event.crafting.getItem().equals(ModRings.voidiumSilverRing)){ event.player.addStat(ModAchievements.steveAlmighty, 1); } if(event.crafting.getItem().equals(ModRings.ring)){ event.player.addStat(ModAchievements.jeweller, 1); } if(event.crafting.getItem().equals(ModRings.silverRing)){ event.player.addStat(ModAchievements.jeweller, 1); } if(event.crafting.getItem().equals(ModRings.diamondRing)){ event.player.addStat(ModAchievements.marry, 1); } if(event.crafting.getItem().equals(ModRings.diamondSilverRing)){ event.player.addStat(ModAchievements.marry, 1); } } else { if(event.crafting.getItem().equals(ModRingsBaubles.fyrestoneRing)){ event.player.addStat(ModAchievements.pyromaniac, 1); } if(event.crafting.getItem().equals(ModRingsBaubles.fyrestoneSilverRing)){ event.player.addStat(ModAchievements.pyromaniac, 1); } if(event.crafting.getItem().equals(ModRingsBaubles.voidiumRing)){ event.player.addStat(ModAchievements.steveAlmighty, 1); } if(event.crafting.getItem().equals(ModRingsBaubles.voidiumSilverRing)){ event.player.addStat(ModAchievements.steveAlmighty, 1); } if(event.crafting.getItem().equals(ModRingsBaubles.ring)){ event.player.addStat(ModAchievements.jeweller, 1); } if(event.crafting.getItem().equals(ModRingsBaubles.silverRing)){ event.player.addStat(ModAchievements.jeweller, 1); } if(event.crafting.getItem().equals(ModRingsBaubles.diamondRing)){ event.player.addStat(ModAchievements.marry, 1); } if(event.crafting.getItem().equals(ModRingsBaubles.diamondSilverRing)){ event.player.addStat(ModAchievements.marry, 1); } } if(event.crafting.getItem().equals(Item.getItemFromBlock(ModBlocks.cherryPlanks))){ event.player.addStat(ModAchievements.pink, 1); } if(event.crafting.getItem().equals(Items.diamond_hoe)){ event.player.addStat(ModAchievements.diamondHoe, 1); } if(event.crafting.getItem().equals(ModArmour.bootsRuby)){ event.player.addStat(ModAchievements.noPlace, 1); } }
@SubscribeEvent public void onItemCrafted(ItemCraftedEvent event) { triggerAchievement(AchievementSource.CRAFTING, event.player, event.crafting); }
public void onPickupFromSlot(EntityPlayer par1EntityPlayer, ItemStack par2ItemStack){ int damage = this.getDamage(); ItemCraftedEvent itemCrafted = new ItemCraftedEvent(thePlayer, par2ItemStack, craftMatrix); soul_forest.craftHandler.onCrafting(itemCrafted); this.onCrafting(par2ItemStack); for (int i = 0; i < this.craftMatrix.getSizeInventory(); ++i){ ItemStack itemstack1 = this.craftMatrix.getStackInSlot(i); if (itemstack1 != null){ this.craftMatrix.decrStackSize(i, 1); if (itemstack1.isItemStackDamageable() && itemstack1.getItemDamage() + damage >= itemstack1.getMaxDamage()){ MinecraftForge.EVENT_BUS.post(new PlayerDestroyItemEvent(thePlayer, itemstack1)); itemstack1 = null; } if(itemstack1 != null){ if (!itemstack1.getItem().doesContainerItemLeaveCraftingGrid(itemstack1)){ if (this.craftMatrix.getStackInSlot(i) == null){ this.craftMatrix.setInventorySlotContents(i, itemstack1); if(itemstack1.getItem() == SoulItems.CitrineAmuletStone.get()){ itemstack1.setItemDamage(itemstack1.getItemDamage() + damage); } } else{ this.thePlayer.dropPlayerItemWithRandomChoice(itemstack1, false); } } if (itemstack1.getItem().hasContainerItem()){ ItemStack itemstack2 = itemstack1.getItem().getContainerItem(itemstack1); if (itemstack2.isItemStackDamageable() && itemstack2.getItemDamage() > itemstack2.getMaxDamage()){ MinecraftForge.EVENT_BUS.post(new PlayerDestroyItemEvent(thePlayer, itemstack2)); itemstack2 = null; } if (itemstack2 != null && (!itemstack1.getItem().doesContainerItemLeaveCraftingGrid(itemstack1) || !this.thePlayer.inventory.addItemStackToInventory(itemstack2))){ if (this.craftMatrix.getStackInSlot(i) == null){ this.craftMatrix.setInventorySlotContents(i, itemstack2); } else{ this.thePlayer.dropPlayerItemWithRandomChoice(itemstack2, false); } } } } } } }
public void onPickupFromSlot(EntityPlayer par1EntityPlayer, ItemStack par2ItemStack){ int damage = this.getDamage(); ItemCraftedEvent itemCrafted = new ItemCraftedEvent(thePlayer, par2ItemStack, craftMatrix); soul_forest.craftHandler.onCrafting(itemCrafted); this.onCrafting(par2ItemStack); for (int i = 0; i < this.craftMatrix.getSizeInventory(); ++i){ ItemStack itemstack1 = this.craftMatrix.getStackInSlot(i); if (itemstack1 != null){ this.craftMatrix.decrStackSize(i, 1); if (itemstack1.isItemStackDamageable() && itemstack1.getItemDamage() + damage >= itemstack1.getMaxDamage()){ MinecraftForge.EVENT_BUS.post(new PlayerDestroyItemEvent(thePlayer, itemstack1)); itemstack1 = null; } if(itemstack1 != null){ if (!itemstack1.getItem().doesContainerItemLeaveCraftingGrid(itemstack1)){ if (this.craftMatrix.getStackInSlot(i) == null){ this.craftMatrix.setInventorySlotContents(i, itemstack1); if(itemstack1.getItem() == SoulItems.JetAmuletStone.get()){ itemstack1.setItemDamage(itemstack1.getItemDamage() + damage); } } else{ this.thePlayer.dropPlayerItemWithRandomChoice(itemstack1, false); } } if (itemstack1.getItem().hasContainerItem()){ ItemStack itemstack2 = itemstack1.getItem().getContainerItem(itemstack1); if (itemstack2.isItemStackDamageable() && itemstack2.getItemDamage() > itemstack2.getMaxDamage()){ MinecraftForge.EVENT_BUS.post(new PlayerDestroyItemEvent(thePlayer, itemstack2)); itemstack2 = null; } if (itemstack2 != null && (!itemstack1.getItem().doesContainerItemLeaveCraftingGrid(itemstack1) || !this.thePlayer.inventory.addItemStackToInventory(itemstack2))){ if (this.craftMatrix.getStackInSlot(i) == null){ this.craftMatrix.setInventorySlotContents(i, itemstack2); } else{ this.thePlayer.dropPlayerItemWithRandomChoice(itemstack2, false); } } } } } } }
public void onPickupFromSlot(EntityPlayer par1EntityPlayer, ItemStack par2ItemStack){ int damage = this.getDamage(); ItemCraftedEvent itemCrafted = new ItemCraftedEvent(thePlayer, par2ItemStack, craftMatrix); soul_forest.craftHandler.onCrafting(itemCrafted); this.onCrafting(par2ItemStack); for (int i = 0; i < this.craftMatrix.getSizeInventory(); ++i){ ItemStack itemstack1 = this.craftMatrix.getStackInSlot(i); if (itemstack1 != null){ this.craftMatrix.decrStackSize(i, 1); if (itemstack1.isItemStackDamageable() && itemstack1.getItemDamage() + damage >= itemstack1.getMaxDamage()){ MinecraftForge.EVENT_BUS.post(new PlayerDestroyItemEvent(thePlayer, itemstack1)); itemstack1 = null; } if(itemstack1 != null){ if (!itemstack1.getItem().doesContainerItemLeaveCraftingGrid(itemstack1)){ if (this.craftMatrix.getStackInSlot(i) == null){ this.craftMatrix.setInventorySlotContents(i, itemstack1); if(itemstack1.getItem() == SoulItems.ScarletiteAmuletStone.get()){ itemstack1.setItemDamage(itemstack1.getItemDamage() + damage); } } else{ this.thePlayer.dropPlayerItemWithRandomChoice(itemstack1, false); } } if (itemstack1.getItem().hasContainerItem()){ ItemStack itemstack2 = itemstack1.getItem().getContainerItem(itemstack1); if (itemstack2.isItemStackDamageable() && itemstack2.getItemDamage() > itemstack2.getMaxDamage()){ MinecraftForge.EVENT_BUS.post(new PlayerDestroyItemEvent(thePlayer, itemstack2)); itemstack2 = null; } if (itemstack2 != null && (!itemstack1.getItem().doesContainerItemLeaveCraftingGrid(itemstack1) || !this.thePlayer.inventory.addItemStackToInventory(itemstack2))){ if (this.craftMatrix.getStackInSlot(i) == null){ this.craftMatrix.setInventorySlotContents(i, itemstack2); } else{ this.thePlayer.dropPlayerItemWithRandomChoice(itemstack2, false); } } } } } } }