mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-18 03:25:18 +00:00
Make getSubItems non-client only. Use it for Ingredient iteration.
This commit is contained in:
1 parent
478a84e748
commit
efd8b38be9
18 files changed
+190
-16
No files matched your search
@@ -205,7 +205,15 @@
|
||||
public ItemStack func_185473_a(World p_185473_1_, BlockPos p_185473_2_, IBlockState p_185473_3_)
|
||||
{
|
||||
return new ItemStack(Item.func_150898_a(this), 1, this.func_180651_a(p_185473_3_));
|
||||
@@ -921,6 +937,7 @@
|
||||
@@ -831,7 +847,6 @@
|
||||
{
|
||||
}
|
||||
|
||||
- @SideOnly(Side.CLIENT)
|
||||
public CreativeTabs func_149708_J()
|
||||
{
|
||||
return this.field_149772_a;
|
||||
@@ -921,6 +936,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -213,7 +221,7 @@
|
||||
public SoundType func_185467_w()
|
||||
{
|
||||
return this.field_149762_H;
|
||||
@@ -936,6 +953,1218 @@
|
||||
@@ -936,6 +952,1218 @@
|
||||
{
|
||||
}
|
||||
|
||||
@@ -1432,7 +1440,7 @@
|
||||
public static void func_149671_p()
|
||||
{
|
||||
func_176215_a(0, field_176230_a, (new BlockAir()).func_149663_c("air"));
|
||||
@@ -1247,14 +2476,7 @@
|
||||
@@ -1247,14 +2475,7 @@
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -60,8 +60,19 @@
|
||||
return p_77621_1_.func_147447_a(vec3d, vec3d1, p_77621_3_, !p_77621_3_, false);
|
||||
}
|
||||
|
||||
@@ -411,6 +418,9 @@
|
||||
@SideOnly(Side.CLIENT)
|
||||
@@ -399,7 +406,6 @@
|
||||
return 0;
|
||||
}
|
||||
|
||||
- @SideOnly(Side.CLIENT)
|
||||
public void func_150895_a(CreativeTabs p_150895_1_, NonNullList<ItemStack> p_150895_2_)
|
||||
{
|
||||
if (this.func_194125_a(p_150895_1_))
|
||||
@@ -408,15 +414,16 @@
|
||||
}
|
||||
}
|
||||
|
||||
- @SideOnly(Side.CLIENT)
|
||||
protected boolean func_194125_a(CreativeTabs p_194125_1_)
|
||||
{
|
||||
+ for (CreativeTabs tab : this.getCreativeTabs())
|
||||
@@ -70,7 +81,13 @@
|
||||
CreativeTabs creativetabs = this.func_77640_w();
|
||||
return creativetabs != null && (p_194125_1_ == CreativeTabs.field_78027_g || p_194125_1_ == creativetabs);
|
||||
}
|
||||
@@ -438,11 +448,632 @@
|
||||
|
||||
@Nullable
|
||||
- @SideOnly(Side.CLIENT)
|
||||
public CreativeTabs func_77640_w()
|
||||
{
|
||||
return this.field_77701_a;
|
||||
@@ -438,11 +445,632 @@
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -703,7 +720,7 @@
|
||||
public static void func_150900_l()
|
||||
{
|
||||
func_179214_a(Blocks.field_150350_a, new ItemAir(Blocks.field_150350_a));
|
||||
@@ -1002,6 +1633,8 @@
|
||||
@@ -1002,6 +1630,8 @@
|
||||
private final float field_78010_h;
|
||||
private final float field_78011_i;
|
||||
private final int field_78008_j;
|
||||
@@ -712,7 +729,7 @@
|
||||
|
||||
private ToolMaterial(int p_i1874_3_, int p_i1874_4_, float p_i1874_5_, float p_i1874_6_, int p_i1874_7_)
|
||||
{
|
||||
@@ -1037,6 +1670,7 @@
|
||||
@@ -1037,6 +1667,7 @@
|
||||
return this.field_78008_j;
|
||||
}
|
||||
|
||||
@@ -720,7 +737,7 @@
|
||||
public Item func_150995_f()
|
||||
{
|
||||
if (this == WOOD)
|
||||
@@ -1060,5 +1694,21 @@
|
||||
@@ -1060,5 +1691,21 @@
|
||||
return this == DIAMOND ? Items.field_151045_i : null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
--- ../src-base/minecraft/net/minecraft/item/ItemAppleGold.java
|
||||
+++ ../src-work/minecraft/net/minecraft/item/ItemAppleGold.java
|
||||
@@ -47,7 +47,6 @@
|
||||
}
|
||||
}
|
||||
|
||||
- @SideOnly(Side.CLIENT)
|
||||
public void func_150895_a(CreativeTabs p_150895_1_, NonNullList<ItemStack> p_150895_2_)
|
||||
{
|
||||
if (this.func_194125_a(p_150895_1_))
|
||||
@@ -0,0 +1,18 @@
|
||||
--- ../src-base/minecraft/net/minecraft/item/ItemBanner.java
|
||||
+++ ../src-work/minecraft/net/minecraft/item/ItemBanner.java
|
||||
@@ -133,7 +133,6 @@
|
||||
func_185054_a(p_77624_1_, p_77624_3_);
|
||||
}
|
||||
|
||||
- @SideOnly(Side.CLIENT)
|
||||
public void func_150895_a(CreativeTabs p_150895_1_, NonNullList<ItemStack> p_150895_2_)
|
||||
{
|
||||
if (this.func_194125_a(p_150895_1_))
|
||||
@@ -157,7 +156,6 @@
|
||||
return itemstack;
|
||||
}
|
||||
|
||||
- @SideOnly(Side.CLIENT)
|
||||
public CreativeTabs func_77640_w()
|
||||
{
|
||||
return CreativeTabs.field_78031_c;
|
||||
@@ -9,3 +9,11 @@
|
||||
p_180614_2_.func_184133_a((EntityPlayer)null, p_180614_3_, soundtype.func_185841_e(), SoundCategory.BLOCKS, (soundtype.func_185843_a() + 1.0F) / 2.0F, soundtype.func_185847_b() * 0.8F);
|
||||
TileEntity tileentity = p_180614_2_.func_175625_s(blockpos);
|
||||
|
||||
@@ -113,7 +113,6 @@
|
||||
return super.func_77658_a() + "." + EnumDyeColor.func_176764_b(p_77667_1_.func_77960_j()).func_176762_d();
|
||||
}
|
||||
|
||||
- @SideOnly(Side.CLIENT)
|
||||
public void func_150895_a(CreativeTabs p_150895_1_, NonNullList<ItemStack> p_150895_2_)
|
||||
{
|
||||
if (this.func_194125_a(p_150895_1_))
|
||||
@@ -37,7 +37,21 @@
|
||||
{
|
||||
p_179222_3_ = EnumFacing.UP;
|
||||
}
|
||||
@@ -173,6 +161,36 @@
|
||||
@@ -149,13 +137,11 @@
|
||||
return this.field_150939_a.func_149739_a();
|
||||
}
|
||||
|
||||
- @SideOnly(Side.CLIENT)
|
||||
public CreativeTabs func_77640_w()
|
||||
{
|
||||
return this.field_150939_a.func_149708_J();
|
||||
}
|
||||
|
||||
- @SideOnly(Side.CLIENT)
|
||||
public void func_150895_a(CreativeTabs p_150895_1_, NonNullList<ItemStack> p_150895_2_)
|
||||
{
|
||||
if (this.func_194125_a(p_150895_1_))
|
||||
@@ -173,6 +159,36 @@
|
||||
|
||||
public Block func_179223_d()
|
||||
{
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
--- ../src-base/minecraft/net/minecraft/item/ItemCoal.java
|
||||
+++ ../src-work/minecraft/net/minecraft/item/ItemCoal.java
|
||||
@@ -19,7 +19,6 @@
|
||||
return p_77667_1_.func_77960_j() == 1 ? "item.charcoal" : "item.coal";
|
||||
}
|
||||
|
||||
- @SideOnly(Side.CLIENT)
|
||||
public void func_150895_a(CreativeTabs p_150895_1_, NonNullList<ItemStack> p_150895_2_)
|
||||
{
|
||||
if (this.func_194125_a(p_150895_1_))
|
||||
@@ -0,0 +1,10 @@
|
||||
--- ../src-base/minecraft/net/minecraft/item/ItemEnchantedBook.java
|
||||
+++ ../src-work/minecraft/net/minecraft/item/ItemEnchantedBook.java
|
||||
@@ -101,7 +101,6 @@
|
||||
return itemstack;
|
||||
}
|
||||
|
||||
- @SideOnly(Side.CLIENT)
|
||||
public void func_150895_a(CreativeTabs p_150895_1_, NonNullList<ItemStack> p_150895_2_)
|
||||
{
|
||||
if (p_150895_1_ == CreativeTabs.field_78027_g)
|
||||
@@ -0,0 +1,10 @@
|
||||
--- ../src-base/minecraft/net/minecraft/item/ItemFishFood.java
|
||||
+++ ../src-work/minecraft/net/minecraft/item/ItemFishFood.java
|
||||
@@ -47,7 +47,6 @@
|
||||
super.func_77849_c(p_77849_1_, p_77849_2_, p_77849_3_);
|
||||
}
|
||||
|
||||
- @SideOnly(Side.CLIENT)
|
||||
public void func_150895_a(CreativeTabs p_150895_1_, NonNullList<ItemStack> p_150895_2_)
|
||||
{
|
||||
if (this.func_194125_a(p_150895_1_))
|
||||
@@ -0,0 +1,18 @@
|
||||
--- ../src-base/minecraft/net/minecraft/item/ItemMonsterPlacer.java
|
||||
+++ ../src-work/minecraft/net/minecraft/item/ItemMonsterPlacer.java
|
||||
@@ -250,7 +250,6 @@
|
||||
}
|
||||
}
|
||||
|
||||
- @SideOnly(Side.CLIENT)
|
||||
public void func_150895_a(CreativeTabs p_150895_1_, NonNullList<ItemStack> p_150895_2_)
|
||||
{
|
||||
if (this.func_194125_a(p_150895_1_))
|
||||
@@ -264,7 +263,6 @@
|
||||
}
|
||||
}
|
||||
|
||||
- @SideOnly(Side.CLIENT)
|
||||
public static void func_185078_a(ItemStack p_185078_0_, ResourceLocation p_185078_1_)
|
||||
{
|
||||
NBTTagCompound nbttagcompound = p_185078_0_.func_77942_o() ? p_185078_0_.func_77978_p() : new NBTTagCompound();
|
||||
@@ -0,0 +1,10 @@
|
||||
--- ../src-base/minecraft/net/minecraft/item/ItemPotion.java
|
||||
+++ ../src-work/minecraft/net/minecraft/item/ItemPotion.java
|
||||
@@ -120,7 +120,6 @@
|
||||
return super.func_77636_d(p_77636_1_) || !PotionUtils.func_185189_a(p_77636_1_).isEmpty();
|
||||
}
|
||||
|
||||
- @SideOnly(Side.CLIENT)
|
||||
public void func_150895_a(CreativeTabs p_150895_1_, NonNullList<ItemStack> p_150895_2_)
|
||||
{
|
||||
if (this.func_194125_a(p_150895_1_))
|
||||
@@ -20,3 +20,11 @@
|
||||
{
|
||||
return EnumActionResult.FAIL;
|
||||
}
|
||||
@@ -128,7 +133,6 @@
|
||||
}
|
||||
}
|
||||
|
||||
- @SideOnly(Side.CLIENT)
|
||||
public void func_150895_a(CreativeTabs p_150895_1_, NonNullList<ItemStack> p_150895_2_)
|
||||
{
|
||||
if (this.func_194125_a(p_150895_1_))
|
||||
@@ -0,0 +1,10 @@
|
||||
--- ../src-base/minecraft/net/minecraft/item/ItemTippedArrow.java
|
||||
+++ ../src-work/minecraft/net/minecraft/item/ItemTippedArrow.java
|
||||
@@ -31,7 +31,6 @@
|
||||
return entitytippedarrow;
|
||||
}
|
||||
|
||||
- @SideOnly(Side.CLIENT)
|
||||
public void func_150895_a(CreativeTabs p_150895_1_, NonNullList<ItemStack> p_150895_2_)
|
||||
{
|
||||
if (this.func_194125_a(p_150895_1_))
|
||||
@@ -21,7 +21,7 @@
|
||||
+ this(new ItemStack[size]);
|
||||
+ }
|
||||
+
|
||||
private Ingredient(ItemStack... p_i47503_1_)
|
||||
protected Ingredient(ItemStack... p_i47503_1_)
|
||||
{
|
||||
this.field_193371_b = p_i47503_1_;
|
||||
+ Ingredient.INSTANCES.add(this);
|
||||
|
||||
@@ -527,7 +527,7 @@ public class CraftingHelper {
|
||||
|
||||
registerI("minecraft:item", (context, json) -> Ingredient.fromStacks(CraftingHelper.getItemStackBasic(json, context)));
|
||||
registerI("minecraft:empty", (context, json) -> Ingredient.EMPTY);
|
||||
registerI("minecraft:item_nbt", (context, json) -> Ingredient.fromStacks(CraftingHelper.getItemStack(json, context)));
|
||||
registerI("minecraft:item_nbt", (context, json) -> new IngredientNBT(CraftingHelper.getItemStack(json, context)));
|
||||
registerI("forge:ore_dict", (context, json) -> new OreIngredient(JsonUtils.getString(json, "ore")));
|
||||
}
|
||||
|
||||
|
||||
@@ -101,7 +101,6 @@ public class UniversalBucket extends Item
|
||||
return super.getContainerItem(itemStack);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void getSubItems(@Nullable CreativeTabs tab, @Nonnull NonNullList<ItemStack> subItems)
|
||||
{
|
||||
|
||||
@@ -596,7 +596,7 @@ public class OreDictionary
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return (target.getItem() == input.getItem() && ((target.getItemDamage() == WILDCARD_VALUE && !strict) || target.getItemDamage() == input.getItemDamage()));
|
||||
return (target.getItem() == input.getItem() && ((target.getMetadata() == WILDCARD_VALUE && !strict) || target.getMetadata() == input.getMetadata()));
|
||||
}
|
||||
|
||||
//Convenience functions that make for cleaner code mod side. They all drill down to registerOre(String, int, ItemStack)
|
||||
|
||||
@@ -25,6 +25,7 @@ import it.unimi.dsi.fastutil.ints.IntArrayList;
|
||||
import it.unimi.dsi.fastutil.ints.IntComparators;
|
||||
import it.unimi.dsi.fastutil.ints.IntList;
|
||||
import net.minecraft.client.util.RecipeItemHelper;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.Ingredient;
|
||||
import net.minecraft.util.NonNullList;
|
||||
@@ -35,6 +36,7 @@ public class OreIngredient extends Ingredient
|
||||
{
|
||||
private NonNullList<ItemStack> ores;
|
||||
private IntList itemIds = null;
|
||||
private ItemStack[] array = null;
|
||||
|
||||
public OreIngredient(String ore)
|
||||
{
|
||||
@@ -46,7 +48,19 @@ public class OreIngredient extends Ingredient
|
||||
@Nonnull
|
||||
public ItemStack[] getMatchingStacks()
|
||||
{
|
||||
return ores.toArray(new ItemStack[ores.size()]);
|
||||
if (array == null || this.array.length != ores.size())
|
||||
{
|
||||
NonNullList<ItemStack> lst = NonNullList.create();
|
||||
for (ItemStack itemstack : this.ores)
|
||||
{
|
||||
if (itemstack.getMetadata() == OreDictionary.WILDCARD_VALUE)
|
||||
itemstack.getItem().getSubItems(CreativeTabs.SEARCH, lst);
|
||||
else
|
||||
lst.add(itemstack);
|
||||
}
|
||||
this.array = lst.toArray(new ItemStack[lst.size()]);
|
||||
}
|
||||
return this.array;
|
||||
}
|
||||
|
||||
|
||||
@@ -61,7 +75,17 @@ public class OreIngredient extends Ingredient
|
||||
|
||||
for (ItemStack itemstack : this.ores)
|
||||
{
|
||||
this.itemIds.add(RecipeItemHelper.pack(itemstack));
|
||||
if (itemstack.getMetadata() == OreDictionary.WILDCARD_VALUE)
|
||||
{
|
||||
NonNullList<ItemStack> lst = NonNullList.create();
|
||||
itemstack.getItem().getSubItems(CreativeTabs.SEARCH, lst);
|
||||
for (ItemStack item : lst)
|
||||
this.itemIds.add(RecipeItemHelper.pack(item));
|
||||
}
|
||||
else
|
||||
{
|
||||
this.itemIds.add(RecipeItemHelper.pack(itemstack));
|
||||
}
|
||||
}
|
||||
|
||||
this.itemIds.sort(IntComparators.NATURAL_COMPARATOR);
|
||||
|
||||
Reference in new issue
Block a user