From fb1cd9be889fcca8112f64183b3f32e03908f6f5 Mon Sep 17 00:00:00 2001 From: LexManos Date: Fri, 2 Dec 2011 03:57:11 +0000 Subject: [PATCH] Moved dye creative adds to the ItemDye class. --- .../src/ContainerCreative.java.patch | 10 ++++++- .../net/minecraft/src/Item.java.patch | 14 ++-------- .../net/minecraft/src/ItemDye.java.patch | 26 ++++++++++++++++--- 3 files changed, 34 insertions(+), 16 deletions(-) diff --git a/patches/minecraft/net/minecraft/src/ContainerCreative.java.patch b/patches/minecraft/net/minecraft/src/ContainerCreative.java.patch index 44c2bbd4d8..ec26b86266 100644 --- a/patches/minecraft/net/minecraft/src/ContainerCreative.java.patch +++ b/patches/minecraft/net/minecraft/src/ContainerCreative.java.patch @@ -1,6 +1,6 @@ --- ../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 @@ +@@ -74,20 +74,23 @@ } itemList.add(new ItemStack(ablock[l1], 1, k2)); } @@ -23,3 +23,11 @@ } } +- for(int j2 = 1; j2 < 16; j2++) +- { +- itemList.add(new ItemStack(Item.dyePowder.shiftedIndex, 1, j2)); +- } +- + InventoryPlayer inventoryplayer = entityplayer.inventory; + for(int l2 = 0; l2 < 9; l2++) + { diff --git a/patches/minecraft/net/minecraft/src/Item.java.patch b/patches/minecraft/net/minecraft/src/Item.java.patch index ac62ae845a..c9753669ce 100644 --- a/patches/minecraft/net/minecraft/src/Item.java.patch +++ b/patches/minecraft/net/minecraft/src/Item.java.patch @@ -52,7 +52,7 @@ public boolean hitEntity(ItemStack itemstack, EntityLiving entityliving, EntityLiving entityliving1) { return false; -@@ -473,6 +497,28 @@ +@@ -473,6 +497,18 @@ { return 0; } @@ -65,17 +65,7 @@ + { + 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)); -+ } ++ itemList.add(new ItemStack(this, 1)); + } + } diff --git a/patches/minecraft/net/minecraft/src/ItemDye.java.patch b/patches/minecraft/net/minecraft/src/ItemDye.java.patch index d78e4dea68..6d7d6c8c43 100644 --- a/patches/minecraft/net/minecraft/src/ItemDye.java.patch +++ b/patches/minecraft/net/minecraft/src/ItemDye.java.patch @@ -1,14 +1,16 @@ --- ../src_base/minecraft/net/minecraft/src/ItemDye.java 0000-00-00 00:00:00.000000000 -0000 +++ ../src_work/minecraft/net/minecraft/src/ItemDye.java 0000-00-00 00:00:00.000000000 -0000 -@@ -3,6 +3,7 @@ +@@ -3,7 +3,9 @@ // Decompiler options: packimports(3) braces deadcode fieldsfirst package net.minecraft.src; +import net.minecraft.src.forge.ForgeHooks; ++import java.util.ArrayList; import java.util.Random; -@@ -45,13 +46,18 @@ + // Referenced classes of package net.minecraft.src: +@@ -45,13 +47,18 @@ public boolean onItemUse(ItemStack itemstack, EntityPlayer entityplayer, World world, int i, int j, int k, int l) { @@ -28,7 +30,7 @@ if(i1 == Block.sapling.blockID) { if(!world.multiplayerWorld) -@@ -118,13 +124,7 @@ +@@ -118,13 +125,7 @@ world.setBlockAndMetadataWithNotify(k1, l1, i2, Block.tallGrass.blockID, 1); continue; } @@ -43,3 +45,21 @@ } } +@@ -147,5 +148,17 @@ + } + } + } ++ ++ /* 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) ++ { ++ for (int x = 0; x < 16; x++) ++ { ++ itemList.add(new ItemStack(this, 1, x)); ++ } ++ } + + }