Merge pull request #1791 from KingLemming/1.7.10-fluid
FCR Warning + Denial
This commit is contained in:
commit
6d3494a853
1 changed files with 11 additions and 7 deletions
|
@ -7,10 +7,9 @@ import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import com.google.common.collect.Maps;
|
import com.google.common.collect.Maps;
|
||||||
import com.google.common.collect.Sets;
|
import com.google.common.collect.Sets;
|
||||||
|
import cpw.mods.fml.common.FMLLog;
|
||||||
import cpw.mods.fml.common.eventhandler.Event;
|
import cpw.mods.fml.common.eventhandler.Event;
|
||||||
import net.minecraft.init.Items;
|
import net.minecraft.init.Items;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
|
@ -113,7 +112,7 @@ public abstract class FluidContainerRegistry
|
||||||
* ItemStack representing the container when it is full.
|
* ItemStack representing the container when it is full.
|
||||||
* @param emptyContainer
|
* @param emptyContainer
|
||||||
* ItemStack representing the container when it is empty.
|
* ItemStack representing the container when it is empty.
|
||||||
* @return True if container was successfully registered; false if it already is.
|
* @return True if container was successfully registered; false if it already is, or an invalid parameter was passed.
|
||||||
*/
|
*/
|
||||||
public static boolean registerFluidContainer(Fluid fluid, ItemStack filledContainer, ItemStack emptyContainer)
|
public static boolean registerFluidContainer(Fluid fluid, ItemStack filledContainer, ItemStack emptyContainer)
|
||||||
{
|
{
|
||||||
|
@ -131,7 +130,7 @@ public abstract class FluidContainerRegistry
|
||||||
* FluidStack containing the type and amount of the fluid stored in the item.
|
* FluidStack containing the type and amount of the fluid stored in the item.
|
||||||
* @param filledContainer
|
* @param filledContainer
|
||||||
* ItemStack representing the container when it is full.
|
* ItemStack representing the container when it is full.
|
||||||
* @return True if container was successfully registered; false if it already is.
|
* @return True if container was successfully registered; false if it already is, or an invalid parameter was passed.
|
||||||
*/
|
*/
|
||||||
public static boolean registerFluidContainer(FluidStack stack, ItemStack filledContainer)
|
public static boolean registerFluidContainer(FluidStack stack, ItemStack filledContainer)
|
||||||
{
|
{
|
||||||
|
@ -146,7 +145,7 @@ public abstract class FluidContainerRegistry
|
||||||
* Fluid type that is stored in the item.
|
* Fluid type that is stored in the item.
|
||||||
* @param filledContainer
|
* @param filledContainer
|
||||||
* ItemStack representing the container when it is full.
|
* ItemStack representing the container when it is full.
|
||||||
* @return True if container was successfully registered; false if it already is.
|
* @return True if container was successfully registered; false if it already is, or an invalid parameter was passed.
|
||||||
*/
|
*/
|
||||||
public static boolean registerFluidContainer(Fluid fluid, ItemStack filledContainer)
|
public static boolean registerFluidContainer(Fluid fluid, ItemStack filledContainer)
|
||||||
{
|
{
|
||||||
|
@ -162,14 +161,19 @@ public abstract class FluidContainerRegistry
|
||||||
*
|
*
|
||||||
* @param data
|
* @param data
|
||||||
* See {@link FluidContainerData}.
|
* See {@link FluidContainerData}.
|
||||||
* @return True if container was successfully registered; false if it already is.
|
* @return True if container was successfully registered; false if it already is, or an invalid parameter was passed.
|
||||||
*/
|
*/
|
||||||
public static boolean registerFluidContainer(FluidContainerData data)
|
public static boolean registerFluidContainer(FluidContainerData data)
|
||||||
{
|
{
|
||||||
if (isFilledContainer(data.filledContainer))
|
if (isFilledContainer(data.filledContainer) || data.filledContainer == null)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
if (data.fluid == null || data.fluid.getFluid() == null)
|
||||||
|
{
|
||||||
|
FMLLog.bigWarning("Invalid registration attempt for a fluid container item %s (type %s) has occurred. The registration has been denied to prevent crashes. The mod responsible for the registration needs to correct this.", data.filledContainer.getItem().getUnlocalizedName(data.filledContainer));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
containerFluidMap.put(new ContainerKey(data.filledContainer), data);
|
containerFluidMap.put(new ContainerKey(data.filledContainer), data);
|
||||||
|
|
||||||
if (data.emptyContainer != null && data.emptyContainer != NULL_EMPTYCONTAINER)
|
if (data.emptyContainer != null && data.emptyContainer != NULL_EMPTYCONTAINER)
|
||||||
|
|
Loading…
Reference in a new issue