Java Code Examples for net.minecraftforge.fml.common.gameevent.PlayerEvent#ItemCraftedEvent

The following examples show how to use net.minecraftforge.fml.common.gameevent.PlayerEvent#ItemCraftedEvent . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TofuEventLoader.java    From TofuCraftReload with MIT License 5 votes vote down vote up
@SubscribeEvent
public void onCrafting(PlayerEvent.ItemCraftedEvent event) {
       EntityPlayer player = event.player;
       ItemStack item = event.crafting;
	IInventory craftMatrix = event.craftMatrix;
	
	if(craftMatrix instanceof InventoryCrafting){
	InventoryCrafting craftMatrix1 = (InventoryCrafting) craftMatrix;
	IRecipe recipe = ForgeRegistries.RECIPES.getValue(new ResourceLocation(TofuMain.MODID, "soymilk_cloth"));
	if(recipe!=null){
		if(!item.isEmpty()&&recipe.matches(craftMatrix1, player.world))
			player.inventory.addItemStackToInventory(new ItemStack(ItemLoader.material,1,11));
		}
	}
}
 
Example 2
Source File: AgentQuitFromCraftingItemImplementation.java    From malmo with MIT License 4 votes vote down vote up
@SubscribeEvent
@SideOnly(Side.CLIENT)
public void onItemCraft(PlayerEvent.ItemCraftedEvent event) {
    if (event.player instanceof EntityPlayerMP && !event.crafting.isEmpty())
        checkForMatch(event.crafting);
}
 
Example 3
Source File: RewardForPossessingItemImplementation.java    From malmo with MIT License 4 votes vote down vote up
@SubscribeEvent
public void onItemCraft(PlayerEvent.ItemCraftedEvent event) {
    if (event.player instanceof EntityPlayerMP && !event.crafting.isEmpty())
        checkForMatch(event.crafting);
}
 
Example 4
Source File: AgentQuitFromCollectingItemQuantityImplementation.java    From malmo with MIT License 4 votes vote down vote up
@SubscribeEvent
public void onItemCraft(PlayerEvent.ItemCraftedEvent event) {
    if (event.player instanceof EntityPlayerMP && !event.crafting.isEmpty())
        checkForMatch(event.crafting);
}
 
Example 5
Source File: AgentQuitFromPossessingItemImplementation.java    From malmo with MIT License 4 votes vote down vote up
@SubscribeEvent
public void onItemCraft(PlayerEvent.ItemCraftedEvent event) {
    if (event.player instanceof EntityPlayerMP && !event.crafting.isEmpty())
        checkForMatch(event.crafting);
}
 
Example 6
Source File: RewardForCraftingItemImplementation.java    From malmo with MIT License 4 votes vote down vote up
@SubscribeEvent
public void onItemCraft(PlayerEvent.ItemCraftedEvent event) {
    if (event.player instanceof EntityPlayerMP && !event.crafting.isEmpty())
        checkForMatch(event.crafting);
}
 
Example 7
Source File: RewardForCollectingItemQuantityImplementation.java    From malmo with MIT License 4 votes vote down vote up
@SubscribeEvent
public void onItemCraft(PlayerEvent.ItemCraftedEvent event) {
    if (event.player instanceof EntityPlayerMP && !event.crafting.isEmpty())
        checkForMatch(event.crafting);
}
 
Example 8
Source File: PLEvent.java    From Production-Line with MIT License 4 votes vote down vote up
@SubscribeEvent
public void onPlayerCrafting(PlayerEvent.ItemCraftedEvent event) {
    if (event.crafting.getItem().equals(PLBlocks.carbonizeFurnace.getItem())) {
        event.player.addStat(PLAchievement.getCarbonizeFurnace, 1);
    }
}