Checking in the new crafting hook.
This commit is contained in:
parent
72864e4bc2
commit
231c65da06
4 changed files with 81 additions and 0 deletions
|
@ -7,6 +7,7 @@ package net.minecraft.src.forge;
|
|||
import net.minecraft.src.Block;
|
||||
import net.minecraft.src.World;
|
||||
import net.minecraft.src.EntityPlayer;
|
||||
import net.minecraft.src.IInventory;
|
||||
import net.minecraft.src.ItemStack;
|
||||
import net.minecraft.src.Item;
|
||||
|
||||
|
@ -15,6 +16,14 @@ import java.util.*;
|
|||
public class ForgeHooks {
|
||||
// TODO: move all app-side hooks from MinecraftForge
|
||||
//
|
||||
public static void onTakenFromCrafting(EntityPlayer player, ItemStack ist,
|
||||
IInventory craftMatrix) {
|
||||
for (ICraftingHandler handler : craftingHandlers) {
|
||||
handler.onTakenFromCrafting(player,ist,craftMatrix);
|
||||
}
|
||||
}
|
||||
|
||||
static LinkedList<ICraftingHandler> craftingHandlers = new LinkedList<ICraftingHandler>();
|
||||
|
||||
public static boolean canHarvestBlock(Block bl,
|
||||
EntityPlayer player, int md) {
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
/**
|
||||
* This software is provided under the terms of the Minecraft Forge Public
|
||||
* License v1.0.
|
||||
*/
|
||||
|
||||
package net.minecraft.src.forge;
|
||||
|
||||
import net.minecraft.src.IInventory;
|
||||
import net.minecraft.src.EntityPlayer;
|
||||
import net.minecraft.src.ItemStack;
|
||||
|
||||
public interface ICraftingHandler {
|
||||
|
||||
/**
|
||||
* Called after an item is taken from crafting.
|
||||
*/
|
||||
public void onTakenFromCrafting(EntityPlayer player, ItemStack ist,
|
||||
IInventory craftMatrix);
|
||||
|
||||
}
|
|
@ -20,11 +20,24 @@ public class MinecraftForge {
|
|||
|
||||
/**
|
||||
* Registers a new custom bucket handler.
|
||||
* @deprecated Spelling mistake, don't use this function! It will go away
|
||||
* soon.
|
||||
*/
|
||||
public static void registerCustomBucketHander(IBucketHandler handler) {
|
||||
bucketHandlers.add(handler);
|
||||
}
|
||||
|
||||
public static void registerCustomBucketHandler(IBucketHandler handler) {
|
||||
bucketHandlers.add(handler);
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a new crafting handler.
|
||||
*/
|
||||
public static void registerCraftingHandler(ICraftingHandler handler) {
|
||||
ForgeHooks.craftingHandlers.add(handler);
|
||||
}
|
||||
|
||||
/**
|
||||
* This is not supposed to be called outside of Minecraft internals.
|
||||
*/
|
||||
|
|
|
@ -1288,6 +1288,25 @@ diff -u -r --strip-trailing-cr ../src_base/minecraft/net/minecraft/src/RenderIte
|
|||
}
|
||||
int k1 = Item.itemsList[i].getColorFromDamage(j);
|
||||
float f = (float)(k1 >> 16 & 0xff) / 255F;
|
||||
diff -u -r --strip-trailing-cr ../src_base/minecraft/net/minecraft/src/SlotCrafting.java ../src_work/minecraft/net/minecraft/src/SlotCrafting.java
|
||||
--- ../src_base/minecraft/net/minecraft/src/SlotCrafting.java 2011-08-11 17:02:11.000000000 -0400
|
||||
+++ ../src_work/minecraft/net/minecraft/src/SlotCrafting.java 2011-08-17 11:26:26.000000000 -0400
|
||||
@@ -3,6 +3,7 @@
|
||||
// Decompiler options: packimports(3) braces deadcode
|
||||
|
||||
package net.minecraft.src;
|
||||
+import net.minecraft.src.forge.ForgeHooks;
|
||||
|
||||
|
||||
// Referenced classes of package net.minecraft.src:
|
||||
@@ -60,6 +61,7 @@
|
||||
thePlayer.addStat(AchievementList.buildSword, 1);
|
||||
}
|
||||
ModLoader.TakenFromCrafting(thePlayer, itemstack);
|
||||
+ ForgeHooks.onTakenFromCrafting(thePlayer, itemstack, craftMatrix);
|
||||
for(int i = 0; i < craftMatrix.getSizeInventory(); i++)
|
||||
{
|
||||
ItemStack itemstack1 = craftMatrix.getStackInSlot(i);
|
||||
diff -u -r --strip-trailing-cr ../src_base/minecraft/net/minecraft/src/Tessellator.java ../src_work/minecraft/net/minecraft/src/Tessellator.java
|
||||
--- ../src_base/minecraft/net/minecraft/src/Tessellator.java 2011-08-11 17:02:11.000000000 -0400
|
||||
+++ ../src_work/minecraft/net/minecraft/src/Tessellator.java 2011-08-11 23:13:28.000000000 -0400
|
||||
|
@ -1572,6 +1591,7 @@ diff -u -r --strip-trailing-cr ../src_base/minecraft/net/minecraft/src/World.jav
|
|||
public int difficultySetting;
|
||||
public Random rand;
|
||||
public boolean isNewWorld;
|
||||
Only in ../src_work/minecraft/net/minecraft/src: World.java.orig
|
||||
diff -u -r --strip-trailing-cr ../src_base/minecraft/net/minecraft/src/WorldRenderer.java ../src_work/minecraft/net/minecraft/src/WorldRenderer.java
|
||||
--- ../src_base/minecraft/net/minecraft/src/WorldRenderer.java 2011-08-11 17:02:11.000000000 -0400
|
||||
+++ ../src_work/minecraft/net/minecraft/src/WorldRenderer.java 2011-08-12 19:23:40.000000000 -0400
|
||||
|
@ -2622,6 +2642,25 @@ diff -u -r --strip-trailing-cr ../src_base/minecraft_server/net/minecraft/src/Pl
|
|||
updateTileEntity(worldserver.getBlockTileEntity(j1, i2, k2));
|
||||
}
|
||||
}
|
||||
diff -u -r --strip-trailing-cr ../src_base/minecraft_server/net/minecraft/src/SlotCrafting.java ../src_work/minecraft_server/net/minecraft/src/SlotCrafting.java
|
||||
--- ../src_base/minecraft_server/net/minecraft/src/SlotCrafting.java 2011-08-11 17:02:12.000000000 -0400
|
||||
+++ ../src_work/minecraft_server/net/minecraft/src/SlotCrafting.java 2011-08-17 11:26:29.000000000 -0400
|
||||
@@ -3,6 +3,7 @@
|
||||
// Decompiler options: packimports(3) braces deadcode
|
||||
|
||||
package net.minecraft.src;
|
||||
+import net.minecraft.src.forge.ForgeHooks;
|
||||
|
||||
|
||||
// Referenced classes of package net.minecraft.src:
|
||||
@@ -60,6 +61,7 @@
|
||||
field_25004_e.addStat(AchievementList.field_27101_r, 1);
|
||||
}
|
||||
ModLoader.TakenFromCrafting(field_25004_e, itemstack);
|
||||
+ ForgeHooks.onTakenFromCrafting(field_25004_e, itemstack, craftMatrix);
|
||||
for(int i = 0; i < craftMatrix.getSizeInventory(); i++)
|
||||
{
|
||||
ItemStack itemstack1 = craftMatrix.getStackInSlot(i);
|
||||
diff -u -r --strip-trailing-cr ../src_base/minecraft_server/net/minecraft/src/World.java ../src_work/minecraft_server/net/minecraft/src/World.java
|
||||
--- ../src_base/minecraft_server/net/minecraft/src/World.java 2011-08-11 17:02:12.000000000 -0400
|
||||
+++ ../src_work/minecraft_server/net/minecraft/src/World.java 2011-08-12 19:51:26.000000000 -0400
|
||||
|
|
Loading…
Reference in a new issue