mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-17 11:05:40 +00:00
Creative Container population hook.
This commit is contained in:
1 parent
9e28c51d23
commit
576ff2fadb
3 files changed
+74
-4
No files matched your search
@@ -101,7 +101,7 @@
|
||||
}
|
||||
|
||||
}
|
||||
@@ -805,6 +819,96 @@
|
||||
@@ -805,6 +819,104 @@
|
||||
return iblockaccess.isBlockNormalCube(i, j, k) ? 0.2F : 1.0F;
|
||||
}
|
||||
|
||||
@@ -194,6 +194,14 @@
|
||||
+ int i, int j, int k) {
|
||||
+ return world.setBlockWithNotify(i, j, k, 0);
|
||||
+ }
|
||||
+
|
||||
+ /* FORGE: Called when a new CreativeContainer is opened, populate the list
|
||||
+ * with all of the items for this block you want a player in creative mode
|
||||
+ * to have access to.
|
||||
+ */
|
||||
+ public void addCreativeItems(ArrayList itemList)
|
||||
+ {
|
||||
+ }
|
||||
+
|
||||
static Class _mthclass$(String s)
|
||||
{
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
--- ../src_base/minecraft/net/minecraft/src/ContainerCreative.java 0000-00-00 00:00:00.000000000 -0000
|
||||
+++ ../src_work/minecraft/net/minecraft/src/ContainerCreative.java 0000-00-00 00:00:00.000000000 -0000
|
||||
@@ -74,12 +74,20 @@
|
||||
}
|
||||
itemList.add(new ItemStack(ablock[l1], 1, k2));
|
||||
}
|
||||
+
|
||||
+ for(int x = 0; x < 256; x++)
|
||||
+ {
|
||||
+ if (Block.blocksList[x] != null)
|
||||
+ {
|
||||
+ Block.blocksList[x].addCreativeItems((ArrayList)itemList);
|
||||
+ }
|
||||
+ }
|
||||
|
||||
for(int i2 = 256; i2 < Item.itemsList.length; i2++)
|
||||
{
|
||||
- if(Item.itemsList[i2] != null && Item.itemsList[i2].shiftedIndex != Item.potion.shiftedIndex)
|
||||
+ if(Item.itemsList[i2] != null)
|
||||
{
|
||||
- itemList.add(new ItemStack(Item.itemsList[i2]));
|
||||
+ Item.itemsList[i2].addCreativeItems((ArrayList)itemList);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,14 @@
|
||||
--- ../src_base/minecraft/net/minecraft/src/Item.java 0000-00-00 00:00:00.000000000 -0000
|
||||
+++ ../src_work/minecraft/net/minecraft/src/Item.java 0000-00-00 00:00:00.000000000 -0000
|
||||
@@ -177,6 +177,9 @@
|
||||
@@ -5,6 +5,7 @@
|
||||
package net.minecraft.src;
|
||||
|
||||
import java.io.PrintStream;
|
||||
+import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
@@ -177,6 +178,9 @@
|
||||
private String field_39010_c;
|
||||
private String itemName;
|
||||
|
||||
@@ -10,7 +18,7 @@
|
||||
protected Item(int i)
|
||||
{
|
||||
maxStackSize = 64;
|
||||
@@ -231,6 +234,13 @@
|
||||
@@ -231,6 +235,13 @@
|
||||
return 1.0F;
|
||||
}
|
||||
|
||||
@@ -24,7 +32,7 @@
|
||||
public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer entityplayer)
|
||||
{
|
||||
return itemstack;
|
||||
@@ -278,6 +288,19 @@
|
||||
@@ -278,6 +289,19 @@
|
||||
return maxDamage > 0 && !hasSubtypes;
|
||||
}
|
||||
|
||||
@@ -44,3 +52,32 @@
|
||||
public boolean hitEntity(ItemStack itemstack, EntityLiving entityliving, EntityLiving entityliving1)
|
||||
{
|
||||
return false;
|
||||
@@ -473,6 +497,28 @@
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
+
|
||||
+ /* FORGE: Called when a new CreativeContainer is opened, populate the list
|
||||
+ * with all of the items for this item you want a player in creative mode
|
||||
+ * to have access to.
|
||||
+ */
|
||||
+ public void addCreativeItems(ArrayList itemList)
|
||||
+ {
|
||||
+ if (this.shiftedIndex != Item.potion.shiftedIndex)
|
||||
+ {
|
||||
+ if (this.shiftedIndex == Item.dyePowder.shiftedIndex)
|
||||
+ {
|
||||
+ for (int x = 0; x < 16; x++)
|
||||
+ {
|
||||
+ itemList.add(new ItemStack(Item.dyePowder, 1, x));
|
||||
+ }
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ itemList.add(new ItemStack(this, 1));
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
|
||||
static
|
||||
{
|
||||
Reference in new issue
Block a user