mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-19 19:59:42 +00:00
Initial 1.11-pre1 update
This commit is contained in:
1 parent
c177219ff3
commit
4e6a774075
294 files changed
+3099
-2846
No files matched your search
@@ -22,6 +22,7 @@ package net.minecraftforge.common;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.WeightedRandom;
|
||||
|
||||
public class DungeonHooks
|
||||
@@ -42,7 +43,7 @@ public class DungeonHooks
|
||||
* Meaning, Zombies are twice as common as spiders or skeletons.
|
||||
* @return The new rarity of the monster,
|
||||
*/
|
||||
public static float addDungeonMob(String name, int rarity)
|
||||
public static float addDungeonMob(ResourceLocation name, int rarity)
|
||||
{
|
||||
if (rarity <= 0)
|
||||
{
|
||||
@@ -85,21 +86,17 @@ public class DungeonHooks
|
||||
* @param rand World generation random number generator
|
||||
* @return The mob name
|
||||
*/
|
||||
public static String getRandomDungeonMob(Random rand)
|
||||
public static ResourceLocation getRandomDungeonMob(Random rand)
|
||||
{
|
||||
DungeonMob mob = WeightedRandom.getRandomItem(rand, dungeonMobs);
|
||||
if (mob == null)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
return mob.type;
|
||||
}
|
||||
|
||||
|
||||
public static class DungeonMob extends WeightedRandom.Item
|
||||
{
|
||||
public String type;
|
||||
public DungeonMob(int weight, String type)
|
||||
public ResourceLocation type;
|
||||
public DungeonMob(int weight, ResourceLocation type)
|
||||
{
|
||||
super(weight);
|
||||
this.type = type;
|
||||
@@ -114,8 +111,8 @@ public class DungeonHooks
|
||||
|
||||
static
|
||||
{
|
||||
addDungeonMob("Skeleton", 100);
|
||||
addDungeonMob("Zombie", 200);
|
||||
addDungeonMob("Spider", 100);
|
||||
addDungeonMob(new ResourceLocation("skeleton"), 100);
|
||||
addDungeonMob(new ResourceLocation("zombie"), 200);
|
||||
addDungeonMob(new ResourceLocation("spider"), 100);
|
||||
}
|
||||
}
|
||||
@@ -78,6 +78,7 @@ import net.minecraft.util.EnumActionResult;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.JsonUtils;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.WeightedRandom;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
@@ -146,7 +147,7 @@ public class ForgeHooks
|
||||
SeedEntry entry = WeightedRandom.getRandomItem(rand, seedList);
|
||||
if (entry == null || entry.seed == null)
|
||||
{
|
||||
return null;
|
||||
return ItemStack.field_190927_a;
|
||||
}
|
||||
return entry.getStack(rand, fortune);
|
||||
}
|
||||
@@ -264,14 +265,14 @@ public class ForgeHooks
|
||||
public static int getTotalArmorValue(EntityPlayer player)
|
||||
{
|
||||
int ret = 0;
|
||||
for (int x = 0; x < player.inventory.armorInventory.length; x++)
|
||||
for (int x = 0; x < player.inventory.armorInventory.size(); x++)
|
||||
{
|
||||
ItemStack stack = player.inventory.armorInventory[x];
|
||||
if (stack != null && stack.getItem() instanceof ISpecialArmor)
|
||||
ItemStack stack = player.inventory.armorInventory.get(x);
|
||||
if (stack.getItem() instanceof ISpecialArmor)
|
||||
{
|
||||
ret += ((ISpecialArmor)stack.getItem()).getArmorDisplay(player, stack, x);
|
||||
}
|
||||
else if (stack != null && stack.getItem() instanceof ItemArmor)
|
||||
else if (stack.getItem() instanceof ItemArmor)
|
||||
{
|
||||
ret += ((ItemArmor)stack.getItem()).damageReduceAmount;
|
||||
}
|
||||
@@ -297,6 +298,7 @@ public class ForgeHooks
|
||||
public static boolean onPickBlock(RayTraceResult target, EntityPlayer player, World world)
|
||||
{
|
||||
/*
|
||||
boolean flag = this.thePlayer.capabilities.isCreativeMode;
|
||||
TileEntity tileentity = null;
|
||||
ItemStack itemstack;
|
||||
|
||||
@@ -306,14 +308,14 @@ public class ForgeHooks
|
||||
IBlockState iblockstate = this.theWorld.getBlockState(blockpos);
|
||||
Block block = iblockstate.getBlock();
|
||||
|
||||
if (iblockstate.getMaterial() == Material.air)
|
||||
if (iblockstate.getMaterial() == Material.AIR)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
itemstack = block.func_185473_a(this.theWorld, blockpos, iblockstate);
|
||||
itemstack = block.getItem(this.theWorld, blockpos, iblockstate);
|
||||
|
||||
if (itemstack == null)
|
||||
if (itemstack.func_190926_b())
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -332,24 +334,24 @@ public class ForgeHooks
|
||||
|
||||
if (this.objectMouseOver.entityHit instanceof EntityPainting)
|
||||
{
|
||||
itemstack = new ItemStack(Items.painting);
|
||||
itemstack = new ItemStack(Items.PAINTING);
|
||||
}
|
||||
else if (this.objectMouseOver.entityHit instanceof EntityLeashKnot)
|
||||
{
|
||||
itemstack = new ItemStack(Items.lead);
|
||||
itemstack = new ItemStack(Items.LEAD);
|
||||
}
|
||||
else if (this.objectMouseOver.entityHit instanceof EntityItemFrame)
|
||||
{
|
||||
EntityItemFrame entityitemframe = (EntityItemFrame)this.objectMouseOver.entityHit;
|
||||
ItemStack itemstack1 = entityitemframe.getDisplayedItem();
|
||||
|
||||
if (itemstack1 == null)
|
||||
if (itemstack1.func_190926_b())
|
||||
{
|
||||
itemstack = new ItemStack(Items.item_frame);
|
||||
itemstack = new ItemStack(Items.ITEM_FRAME);
|
||||
}
|
||||
else
|
||||
{
|
||||
itemstack = ItemStack.copyItemStack(itemstack1);
|
||||
itemstack = itemstack1.copy();
|
||||
}
|
||||
}
|
||||
else if (this.objectMouseOver.entityHit instanceof EntityMinecart)
|
||||
@@ -357,52 +359,96 @@ public class ForgeHooks
|
||||
EntityMinecart entityminecart = (EntityMinecart)this.objectMouseOver.entityHit;
|
||||
Item item;
|
||||
|
||||
switch (entityminecart.func_184264_v())
|
||||
switch (entityminecart.getType())
|
||||
{
|
||||
case FURNACE:
|
||||
item = Items.furnace_minecart;
|
||||
item = Items.FURNACE_MINECART;
|
||||
break;
|
||||
case CHEST:
|
||||
item = Items.chest_minecart;
|
||||
item = Items.CHEST_MINECART;
|
||||
break;
|
||||
case TNT:
|
||||
item = Items.tnt_minecart;
|
||||
item = Items.TNT_MINECART;
|
||||
break;
|
||||
case HOPPER:
|
||||
item = Items.hopper_minecart;
|
||||
item = Items.HOPPER_MINECART;
|
||||
break;
|
||||
case COMMAND_BLOCK:
|
||||
item = Items.command_block_minecart;
|
||||
item = Items.COMMAND_BLOCK_MINECART;
|
||||
break;
|
||||
default:
|
||||
item = Items.minecart;
|
||||
item = Items.MINECART;
|
||||
}
|
||||
|
||||
itemstack = new ItemStack(item);
|
||||
}
|
||||
else if (this.objectMouseOver.entityHit instanceof EntityBoat)
|
||||
{
|
||||
itemstack = new ItemStack(((EntityBoat)this.objectMouseOver.entityHit).func_184455_j());
|
||||
itemstack = new ItemStack(((EntityBoat)this.objectMouseOver.entityHit).getItemBoat());
|
||||
}
|
||||
else if (this.objectMouseOver.entityHit instanceof EntityArmorStand)
|
||||
{
|
||||
itemstack = new ItemStack(Items.armor_stand);
|
||||
itemstack = new ItemStack(Items.ARMOR_STAND);
|
||||
}
|
||||
else if (this.objectMouseOver.entityHit instanceof EntityEnderCrystal)
|
||||
{
|
||||
itemstack = new ItemStack(Items.field_185158_cP);
|
||||
itemstack = new ItemStack(Items.END_CRYSTAL);
|
||||
}
|
||||
else
|
||||
{
|
||||
String s = EntityList.getEntityString(this.objectMouseOver.entityHit);
|
||||
ResourceLocation resourcelocation = EntityList.func_191301_a(this.objectMouseOver.entityHit);
|
||||
|
||||
if (!EntityList.entityEggs.containsKey(s))
|
||||
if (resourcelocation == null || !EntityList.ENTITY_EGGS.containsKey(resourcelocation))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
itemstack = new ItemStack(Items.spawn_egg);
|
||||
ItemMonsterPlacer.func_185078_a(itemstack, s);
|
||||
itemstack = new ItemStack(Items.SPAWN_EGG);
|
||||
ItemMonsterPlacer.applyEntityIdToItemStack(itemstack, resourcelocation);
|
||||
}
|
||||
}
|
||||
|
||||
if (itemstack.func_190926_b())
|
||||
{
|
||||
String s = "";
|
||||
|
||||
if (this.objectMouseOver.typeOfHit == RayTraceResult.Type.BLOCK)
|
||||
{
|
||||
s = ((ResourceLocation)Block.REGISTRY.getNameForObject(this.theWorld.getBlockState(this.objectMouseOver.getBlockPos()).getBlock())).toString();
|
||||
}
|
||||
else if (this.objectMouseOver.typeOfHit == RayTraceResult.Type.ENTITY)
|
||||
{
|
||||
s = EntityList.func_191301_a(this.objectMouseOver.entityHit).toString();
|
||||
}
|
||||
|
||||
LOGGER.warn("Picking on: [{}] {} gave null item", new Object[] {this.objectMouseOver.typeOfHit, s});
|
||||
}
|
||||
else
|
||||
{
|
||||
InventoryPlayer inventoryplayer = this.thePlayer.inventory;
|
||||
|
||||
if (tileentity != null)
|
||||
{
|
||||
this.storeTEInStack(itemstack, tileentity);
|
||||
}
|
||||
|
||||
int i = inventoryplayer.getSlotFor(itemstack);
|
||||
|
||||
if (flag)
|
||||
{
|
||||
inventoryplayer.setPickedItemStack(itemstack);
|
||||
this.playerController.sendSlotPacket(this.thePlayer.getHeldItem(EnumHand.MAIN_HAND), 36 + inventoryplayer.currentItem);
|
||||
}
|
||||
else if (i != -1)
|
||||
{
|
||||
if (InventoryPlayer.isHotbar(i))
|
||||
{
|
||||
inventoryplayer.currentItem = i;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.playerController.pickItem(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
@@ -756,7 +802,7 @@ public class ForgeHooks
|
||||
{
|
||||
// handle all placement events here
|
||||
int meta = itemstack.getItemDamage();
|
||||
int size = itemstack.stackSize;
|
||||
int size = itemstack.func_190916_E();
|
||||
NBTTagCompound nbt = null;
|
||||
if (itemstack.getTagCompound() != null)
|
||||
{
|
||||
@@ -768,14 +814,14 @@ public class ForgeHooks
|
||||
world.captureBlockSnapshots = true;
|
||||
}
|
||||
|
||||
EnumActionResult ret = itemstack.getItem().onItemUse(itemstack, player, world, pos, hand, side, hitX, hitY, hitZ);
|
||||
EnumActionResult ret = itemstack.getItem().onItemUse(player, world, pos, hand, side, hitX, hitY, hitZ);
|
||||
world.captureBlockSnapshots = false;
|
||||
|
||||
if (ret == EnumActionResult.SUCCESS)
|
||||
{
|
||||
// save new item data
|
||||
int newMeta = itemstack.getItemDamage();
|
||||
int newSize = itemstack.stackSize;
|
||||
int newSize = itemstack.func_190916_E();
|
||||
NBTTagCompound newNBT = null;
|
||||
if (itemstack.getTagCompound() != null)
|
||||
{
|
||||
@@ -788,7 +834,7 @@ public class ForgeHooks
|
||||
|
||||
// make sure to set pre-placement item data for event
|
||||
itemstack.setItemDamage(meta);
|
||||
itemstack.stackSize = size;
|
||||
itemstack.func_190920_e(size);
|
||||
if (nbt != null)
|
||||
{
|
||||
itemstack.setTagCompound(nbt);
|
||||
@@ -817,7 +863,7 @@ public class ForgeHooks
|
||||
{
|
||||
// Change the stack to its new content
|
||||
itemstack.setItemDamage(newMeta);
|
||||
itemstack.stackSize = newSize;
|
||||
itemstack.func_190920_e(newSize);
|
||||
if (nbt != null)
|
||||
{
|
||||
itemstack.setTagCompound(newNBT);
|
||||
@@ -883,12 +929,12 @@ public class ForgeHooks
|
||||
* @param inv Crafting inventory
|
||||
* @return Crafting inventory contents after the recipe.
|
||||
*/
|
||||
public static ItemStack[] defaultRecipeGetRemainingItems(InventoryCrafting inv)
|
||||
public static NonNullList<ItemStack> defaultRecipeGetRemainingItems(InventoryCrafting inv)
|
||||
{
|
||||
ItemStack[] ret = new ItemStack[inv.getSizeInventory()];
|
||||
for (int i = 0; i < ret.length; i++)
|
||||
NonNullList<ItemStack> ret = NonNullList.func_191197_a(inv.getSizeInventory(), ItemStack.field_190927_a);
|
||||
for (int i = 0; i < ret.size(); i++)
|
||||
{
|
||||
ret[i] = getContainerItem(inv.getStackInSlot(i));
|
||||
ret.set(i, getContainerItem(inv.getStackInSlot(i)));
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
@@ -983,25 +1029,25 @@ public class ForgeHooks
|
||||
return git == null ? null : git.hitVec;
|
||||
}
|
||||
|
||||
public static boolean onInteractEntityAt(EntityPlayer player, Entity entity, RayTraceResult ray, ItemStack stack, EnumHand hand)
|
||||
public static boolean onInteractEntityAt(EntityPlayer player, Entity entity, RayTraceResult ray, EnumHand hand)
|
||||
{
|
||||
Vec3d vec3d = new Vec3d(ray.hitVec.xCoord - entity.posX, ray.hitVec.yCoord - entity.posY, ray.hitVec.zCoord - entity.posZ);
|
||||
return onInteractEntityAt(player, entity, vec3d, stack, hand);
|
||||
return onInteractEntityAt(player, entity, vec3d, hand);
|
||||
}
|
||||
|
||||
public static boolean onInteractEntityAt(EntityPlayer player, Entity entity, Vec3d vec3d, ItemStack stack, EnumHand hand)
|
||||
public static boolean onInteractEntityAt(EntityPlayer player, Entity entity, Vec3d vec3d, EnumHand hand)
|
||||
{
|
||||
return MinecraftForge.EVENT_BUS.post(new PlayerInteractEvent.EntityInteractSpecific(player, hand, stack, entity, vec3d));
|
||||
return MinecraftForge.EVENT_BUS.post(new PlayerInteractEvent.EntityInteractSpecific(player, hand, entity, vec3d));
|
||||
}
|
||||
|
||||
public static boolean onInteractEntity(EntityPlayer player, Entity entity, ItemStack item, EnumHand hand)
|
||||
public static boolean onInteractEntity(EntityPlayer player, Entity entity, EnumHand hand)
|
||||
{
|
||||
return MinecraftForge.EVENT_BUS.post(new PlayerInteractEvent.EntityInteract(player, hand, item, entity));
|
||||
return MinecraftForge.EVENT_BUS.post(new PlayerInteractEvent.EntityInteract(player, hand, entity));
|
||||
}
|
||||
|
||||
public static boolean onItemRightClick(EntityPlayer player, EnumHand hand, ItemStack stack)
|
||||
public static boolean onItemRightClick(EntityPlayer player, EnumHand hand)
|
||||
{
|
||||
return MinecraftForge.EVENT_BUS.post(new PlayerInteractEvent.RightClickItem(player, hand, stack));
|
||||
return MinecraftForge.EVENT_BUS.post(new PlayerInteractEvent.RightClickItem(player, hand));
|
||||
}
|
||||
|
||||
public static PlayerInteractEvent.LeftClickBlock onLeftClickBlock(EntityPlayer player, BlockPos pos, EnumFacing face, Vec3d hitVec)
|
||||
@@ -1011,9 +1057,9 @@ public class ForgeHooks
|
||||
return evt;
|
||||
}
|
||||
|
||||
public static PlayerInteractEvent.RightClickBlock onRightClickBlock(EntityPlayer player, EnumHand hand, ItemStack stack, BlockPos pos, EnumFacing face, Vec3d hitVec)
|
||||
public static PlayerInteractEvent.RightClickBlock onRightClickBlock(EntityPlayer player, EnumHand hand, BlockPos pos, EnumFacing face, Vec3d hitVec)
|
||||
{
|
||||
PlayerInteractEvent.RightClickBlock evt = new PlayerInteractEvent.RightClickBlock(player, hand, stack, pos, face, hitVec);
|
||||
PlayerInteractEvent.RightClickBlock evt = new PlayerInteractEvent.RightClickBlock(player, hand, pos, face, hitVec);
|
||||
MinecraftForge.EVENT_BUS.post(evt);
|
||||
return evt;
|
||||
}
|
||||
|
||||
@@ -50,17 +50,17 @@ import net.minecraftforge.fml.common.versioning.ComparableVersion;
|
||||
public class ForgeVersion
|
||||
{
|
||||
//This number is incremented every time we remove deprecated code/major API changes, never reset
|
||||
public static final int majorVersion = 12;
|
||||
public static final int majorVersion = 13;
|
||||
//This number is incremented every minecraft release, never reset
|
||||
public static final int minorVersion = 18;
|
||||
public static final int minorVersion = 19;
|
||||
//This number is incremented every time a interface changes or new major feature is added, and reset every Minecraft version
|
||||
public static final int revisionVersion = 2;
|
||||
public static final int revisionVersion = 0;
|
||||
//This number is incremented every time Jenkins builds Forge, and never reset. Should always be 0 in the repo code.
|
||||
public static final int buildVersion = 0;
|
||||
// This is the minecraft version we're building for - used in various places in Forge/FML code
|
||||
public static final String mcVersion = "1.10.2";
|
||||
public static final String mcVersion = "1.11_pre1";
|
||||
// This is the MCP data version we're using
|
||||
public static final String mcpVersion = "9.32";
|
||||
public static final String mcpVersion = "9.34";
|
||||
@SuppressWarnings("unused")
|
||||
private static Status status = PENDING;
|
||||
@SuppressWarnings("unused")
|
||||
|
||||
@@ -32,6 +32,7 @@ import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemArmor;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.NonNullList;
|
||||
|
||||
/**
|
||||
* This interface is to be implemented by ItemArmor classes. It will allow to
|
||||
@@ -110,7 +111,7 @@ public interface ISpecialArmor
|
||||
* @param damage The total damage being done
|
||||
* @return The left over damage that has not been absorbed by the armor
|
||||
*/
|
||||
public static float applyArmor(EntityLivingBase entity, ItemStack[] inventory, DamageSource source, double damage)
|
||||
public static float applyArmor(EntityLivingBase entity, NonNullList<ItemStack> inventory, DamageSource source, double damage)
|
||||
{
|
||||
if (DEBUG)
|
||||
{
|
||||
@@ -118,10 +119,10 @@ public interface ISpecialArmor
|
||||
}
|
||||
damage *= 25;
|
||||
ArrayList<ArmorProperties> dmgVals = new ArrayList<ArmorProperties>();
|
||||
for (int x = 0; x < inventory.length; x++)
|
||||
for (int x = 0; x < inventory.size(); x++)
|
||||
{
|
||||
ItemStack stack = inventory[x];
|
||||
if (stack == null)
|
||||
ItemStack stack = inventory.get(x);
|
||||
if (stack.func_190926_b())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@@ -161,7 +162,7 @@ public interface ISpecialArmor
|
||||
double absorb = damage * prop.AbsorbRatio;
|
||||
if (absorb > 0)
|
||||
{
|
||||
ItemStack stack = inventory[prop.Slot];
|
||||
ItemStack stack = inventory.get(prop.Slot);
|
||||
int itemDamage = (int)(absorb / 25D < 1 ? 1 : absorb / 25D);
|
||||
if (stack.getItem() instanceof ISpecialArmor)
|
||||
{
|
||||
@@ -175,13 +176,13 @@ public interface ISpecialArmor
|
||||
}
|
||||
stack.damageItem(itemDamage, entity);
|
||||
}
|
||||
if (stack.stackSize <= 0)
|
||||
if (stack.func_190926_b())
|
||||
{
|
||||
/*if (entity instanceof EntityPlayer)
|
||||
{
|
||||
stack.onItemDestroyedByUse((EntityPlayer)entity);
|
||||
}*/
|
||||
inventory[prop.Slot] = null;
|
||||
inventory.set(prop.Slot, ItemStack.field_190927_a);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ public abstract class AbstractBrewingRecipe<T> implements IBrewingRecipe {
|
||||
@Override
|
||||
public ItemStack getOutput(ItemStack input, ItemStack ingredient)
|
||||
{
|
||||
return isInput(input) && isIngredient(ingredient) ? ItemStack.copyItemStack(getOutput()) : null;
|
||||
return isInput(input) && isIngredient(ingredient) ? getOutput().copy() : null;
|
||||
}
|
||||
|
||||
public ItemStack getInput()
|
||||
|
||||
@@ -23,6 +23,9 @@ import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.NonNullList;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
public class BrewingRecipeRegistry {
|
||||
|
||||
@@ -84,10 +87,11 @@ public class BrewingRecipeRegistry {
|
||||
* Returns the output ItemStack obtained by brewing the passed input and
|
||||
* ingredient. Null if no matches are found.
|
||||
*/
|
||||
public static ItemStack getOutput(ItemStack input, ItemStack ingredient)
|
||||
@Nonnull
|
||||
public static ItemStack getOutput(@Nonnull ItemStack input, ItemStack ingredient)
|
||||
{
|
||||
if (input == null || input.getMaxStackSize() != 1 || input.stackSize != 1) return null;
|
||||
if (ingredient == null || ingredient.stackSize <= 0) return null;
|
||||
if (input.func_190926_b() || input.getMaxStackSize() != 1 || input.func_190916_E() != 1) return ItemStack.field_190927_a;
|
||||
if (ingredient.func_190926_b()) return ItemStack.field_190927_a;
|
||||
|
||||
for (IBrewingRecipe recipe : recipes)
|
||||
{
|
||||
@@ -97,7 +101,7 @@ public class BrewingRecipeRegistry {
|
||||
return output;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
return ItemStack.field_190927_a;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -105,7 +109,7 @@ public class BrewingRecipeRegistry {
|
||||
*/
|
||||
public static boolean hasOutput(ItemStack input, ItemStack ingredient)
|
||||
{
|
||||
return getOutput(input, ingredient) != null;
|
||||
return !getOutput(input, ingredient).func_190926_b();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -113,13 +117,13 @@ public class BrewingRecipeRegistry {
|
||||
* Extra parameters exist to allow modders to create bigger brewing stands
|
||||
* without much hassle
|
||||
*/
|
||||
public static boolean canBrew(ItemStack[] inputs, ItemStack ingredient, int[] inputIndexes)
|
||||
public static boolean canBrew(NonNullList<ItemStack> inputs, @Nonnull ItemStack ingredient, int[] inputIndexes)
|
||||
{
|
||||
if (ingredient == null || ingredient.stackSize <= 0) return false;
|
||||
if (ingredient.func_190926_b()) return false;
|
||||
|
||||
for (int i : inputIndexes)
|
||||
{
|
||||
if (hasOutput(inputs[i], ingredient))
|
||||
if (hasOutput(inputs.get(i), ingredient))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -132,14 +136,14 @@ public class BrewingRecipeRegistry {
|
||||
* Used by the brewing stand to brew its inventory Extra parameters exist to
|
||||
* allow modders to create bigger brewing stands without much hassle
|
||||
*/
|
||||
public static void brewPotions(ItemStack[] inputs, ItemStack ingredient, int[] inputIndexes)
|
||||
public static void brewPotions(NonNullList<ItemStack> inputs, @Nonnull ItemStack ingredient, int[] inputIndexes)
|
||||
{
|
||||
for (int i : inputIndexes)
|
||||
{
|
||||
ItemStack output = getOutput(inputs[i], ingredient);
|
||||
if (output != null)
|
||||
ItemStack output = getOutput(inputs.get(i), ingredient);
|
||||
if (!output.func_190926_b())
|
||||
{
|
||||
inputs[i] = output;
|
||||
inputs.set(i, output);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -148,9 +152,9 @@ public class BrewingRecipeRegistry {
|
||||
* Returns true if the passed ItemStack is a valid ingredient for any of the
|
||||
* recipes in the registry.
|
||||
*/
|
||||
public static boolean isValidIngredient(ItemStack stack)
|
||||
public static boolean isValidIngredient(@Nonnull ItemStack stack)
|
||||
{
|
||||
if (stack == null || stack.stackSize <= 0) return false;
|
||||
if (stack.func_190926_b()) return false;
|
||||
|
||||
for (IBrewingRecipe recipe : recipes)
|
||||
{
|
||||
@@ -166,9 +170,9 @@ public class BrewingRecipeRegistry {
|
||||
* Returns true if the passed ItemStack is a valid input for any of the
|
||||
* recipes in the registry.
|
||||
*/
|
||||
public static boolean isValidInput(ItemStack stack)
|
||||
public static boolean isValidInput(@Nonnull ItemStack stack)
|
||||
{
|
||||
if (stack == null || stack.getMaxStackSize() != 1 || stack.stackSize != 1) return false;
|
||||
if (stack.getMaxStackSize() != 1 || stack.func_190916_E() != 1) return false;
|
||||
|
||||
for (IBrewingRecipe recipe : recipes)
|
||||
{
|
||||
|
||||
@@ -44,7 +44,7 @@ public class FakePlayer extends EntityPlayerMP
|
||||
|
||||
@Override public Vec3d getPositionVector(){ return new Vec3d(0, 0, 0); }
|
||||
@Override public boolean canCommandSenderUseCommand(int i, String s){ return false; }
|
||||
@Override public void addChatComponentMessage(ITextComponent chatmessagecomponent){}
|
||||
@Override public void addChatComponentMessage(ITextComponent chatmessagecomponent, boolean type){}
|
||||
@Override public void addStat(StatBase par1StatBase, int par2){}
|
||||
@Override public void openGui(Object mod, int modGuiId, World world, int x, int y, int z){}
|
||||
@Override public boolean isEntityInvulnerable(DamageSource source){ return true; }
|
||||
|
||||
Reference in new issue
Block a user