Fixed the Assembly Halo getting recipe events from mod blocks and creating cheaty recipes.

This commit is contained in:
Lizbeth Rika committed 2014-12-20 16:47:54 +00:00
1 parent f9ddecf0bc
commit eb0f1ea3e3
3 files changed
+63 -2

No files matched your search

@@ -14,12 +14,47 @@ package vazkii.botania.client.gui.crafting;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.ContainerWorkbench;
import net.minecraft.inventory.Slot;
import net.minecraft.inventory.SlotCrafting;
import net.minecraft.world.World;
public class ContainerCraftingHalo extends ContainerWorkbench {
public ContainerCraftingHalo(InventoryPlayer p_i1808_1_, World p_i1808_2_) {
super(p_i1808_1_, p_i1808_2_, 0, 0, 0);
craftMatrix = new InventoryCraftingHalo(this, 3, 3);
inventorySlots.clear();
inventoryItemStacks.clear();
// Le copypasta
this.addSlotToContainer(new SlotCrafting(p_i1808_1_.player, this.craftMatrix, this.craftResult, 0, 124, 35));
int l;
int i1;
for (l = 0; l < 3; ++l)
{
for (i1 = 0; i1 < 3; ++i1)
{
this.addSlotToContainer(new Slot(this.craftMatrix, i1 + l * 3, 30 + i1 * 18, 17 + l * 18));
}
}
for (l = 0; l < 3; ++l)
{
for (i1 = 0; i1 < 9; ++i1)
{
this.addSlotToContainer(new Slot(p_i1808_1_, i1 + l * 9 + 9, 8 + i1 * 18, 84 + l * 18));
}
}
for (l = 0; l < 9; ++l)
{
this.addSlotToContainer(new Slot(p_i1808_1_, l, 8 + l * 18, 142));
}
this.onCraftMatrixChanged(this.craftMatrix);
}
@Override
@@ -0,0 +1,23 @@
/**
* This class was created by <Vazkii>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* Botania is Open Source and distributed under a
* Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License
* (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB)
*
* File Created @ [Dec 20, 2014, 4:29:09 PM (GMT)]
*/
package vazkii.botania.client.gui.crafting;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.InventoryCrafting;
public class InventoryCraftingHalo extends InventoryCrafting {
public InventoryCraftingHalo(Container p_i1807_1_, int p_i1807_2_, int p_i1807_3_) {
super(p_i1807_1_, p_i1807_2_, p_i1807_3_);
}
}
@@ -46,13 +46,13 @@ import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
import vazkii.botania.client.core.handler.ClientTickHandler;
import vazkii.botania.client.core.helper.RenderHelper;
import vazkii.botania.client.gui.crafting.InventoryCraftingHalo;
import vazkii.botania.client.lib.LibResources;
import vazkii.botania.common.Botania;
import vazkii.botania.common.core.helper.InventoryHelper;
import vazkii.botania.common.core.helper.Vector3;
import vazkii.botania.common.core.helper.InventoryHelper.GenericInventory;
import vazkii.botania.common.core.helper.ItemNBTHelper;
import vazkii.botania.common.core.helper.Vector3;
import vazkii.botania.common.lib.LibGuiIDs;
import vazkii.botania.common.lib.LibItemNames;
import cpw.mods.fml.common.FMLCommonHandler;
@@ -211,6 +211,9 @@ public class ItemCraftingHalo extends ItemMod {
@SubscribeEvent
public void onItemCrafted(ItemCraftedEvent event) {
if(!(event.craftMatrix instanceof InventoryCraftingHalo))
return;
for(int i = 0; i < event.player.inventory.getSizeInventory(); i++) {
ItemStack stack = event.player.inventory.getStackInSlot(i);
if(stack != null && stack.getItem() == this)