mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-19 03:49:14 +00:00
Merge branch '1.7.10' - imports all the fluid fixups and other stuff from 1.7 into 1.8
Conflicts: fml/src/main/java/net/minecraftforge/fml/common/FMLCommonHandler.java fml/src/main/java/net/minecraftforge/fml/common/Loader.java patches/minecraft/net/minecraft/client/Minecraft.java.patch patches/minecraft/net/minecraft/client/renderer/texture/TextureMap.java.patch patches/minecraft/net/minecraft/item/ItemArmor.java.patch patches/minecraft/net/minecraft/nbt/CompressedStreamTools.java.patch patches/minecraft/net/minecraft/nbt/NBTTagCompound.java.patch patches/minecraft/net/minecraft/nbt/NBTTagList.java.patch patches/minecraft/net/minecraft/world/World.java.patch patches/minecraft/net/minecraft/world/WorldProvider.java.patch src/main/java/net/minecraftforge/common/ForgeVersion.java src/main/java/net/minecraftforge/common/network/ForgeMessage.java src/main/java/net/minecraftforge/fluids/BlockFluidBase.java src/main/java/net/minecraftforge/fluids/FluidContainerRegistry.java src/main/java/net/minecraftforge/fluids/FluidRegistry.java src/main/java/net/minecraftforge/oredict/OreDictionary.java
This commit is contained in:
commit
d02636213a
25 files changed
+722
-135
No files matched your search
@@ -11,6 +11,7 @@ import java.util.Set;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.google.common.collect.Sets;
|
||||
|
||||
import net.minecraftforge.fml.common.FMLLog;
|
||||
import net.minecraftforge.fml.common.eventhandler.Event;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.Item;
|
||||
@@ -20,16 +21,16 @@ import net.minecraftforge.common.MinecraftForge;
|
||||
/**
|
||||
* Register simple items that contain fluids here. Useful for buckets, bottles, and things that have
|
||||
* ID/metadata mappings.
|
||||
*
|
||||
*
|
||||
* For more complex items, use {@link IFluidContainerItem} instead.
|
||||
*
|
||||
*
|
||||
* @author King Lemming
|
||||
*
|
||||
*
|
||||
*/
|
||||
public abstract class FluidContainerRegistry
|
||||
{
|
||||
// Holder object that implements HashCode for an ItemStack,
|
||||
// the local maps are not guaranteed to have the same internal generic structure,
|
||||
// Holder object that implements HashCode for an ItemStack,
|
||||
// the local maps are not guaranteed to have the same internal generic structure,
|
||||
// but the external interface for checking ItemStacks will still exist.
|
||||
private static class ContainerKey
|
||||
{
|
||||
@@ -51,7 +52,7 @@ public abstract class FluidContainerRegistry
|
||||
code = 31*code + container.getItem().hashCode();
|
||||
code = 31*code + container.getItemDamage();
|
||||
if (fluid != null)
|
||||
code = 31*code + fluid.fluidID;
|
||||
code = 31*code + fluid.getFluid().hashCode();
|
||||
return code;
|
||||
}
|
||||
@Override
|
||||
@@ -64,7 +65,7 @@ public abstract class FluidContainerRegistry
|
||||
if (fluid == null && ck.fluid != null) return false;
|
||||
if (fluid != null && ck.fluid == null) return false;
|
||||
if (fluid == null && ck.fluid == null) return true;
|
||||
if (fluid.fluidID != ck.fluid.fluidID) return false;
|
||||
if (fluid.getFluid() != ck.fluid.getFluid()) return false;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -89,7 +90,7 @@ public abstract class FluidContainerRegistry
|
||||
|
||||
/**
|
||||
* Register a new fluid containing item.
|
||||
*
|
||||
*
|
||||
* @param stack
|
||||
* FluidStack containing the type and amount of the fluid stored in the item.
|
||||
* @param filledContainer
|
||||
@@ -106,7 +107,7 @@ public abstract class FluidContainerRegistry
|
||||
/**
|
||||
* Register a new fluid containing item. The item is assumed to hold 1000 mB of fluid. Also
|
||||
* registers the Fluid if possible.
|
||||
*
|
||||
*
|
||||
* @param fluid
|
||||
* Fluid type that is stored in the item.
|
||||
* @param filledContainer
|
||||
@@ -126,12 +127,12 @@ public abstract class FluidContainerRegistry
|
||||
|
||||
/**
|
||||
* Register a new fluid containing item that does not have an empty container.
|
||||
*
|
||||
*
|
||||
* @param stack
|
||||
* FluidStack containing the type and amount of the fluid stored in the item.
|
||||
* @param filledContainer
|
||||
* 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)
|
||||
{
|
||||
@@ -141,12 +142,12 @@ public abstract class FluidContainerRegistry
|
||||
/**
|
||||
* Register a new fluid containing item that does not have an empty container. The item is
|
||||
* assumed to hold 1000 mB of fluid. Also registers the Fluid if possible.
|
||||
*
|
||||
*
|
||||
* @param fluid
|
||||
* Fluid type that is stored in the item.
|
||||
* @param filledContainer
|
||||
* 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)
|
||||
{
|
||||
@@ -159,17 +160,22 @@ public abstract class FluidContainerRegistry
|
||||
|
||||
/**
|
||||
* Register a new fluid containing item.
|
||||
*
|
||||
*
|
||||
* @param data
|
||||
* 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)
|
||||
{
|
||||
if (isFilledContainer(data.filledContainer))
|
||||
if (isFilledContainer(data.filledContainer) || data.filledContainer == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (data.fluid == null || data.fluid.getFluid() == null)
|
||||
{
|
||||
FMLLog.bigWarning("Invalid registration attempt for a fluid container item %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);
|
||||
|
||||
if (data.emptyContainer != null && data.emptyContainer != NULL_EMPTYCONTAINER)
|
||||
@@ -184,7 +190,7 @@ public abstract class FluidContainerRegistry
|
||||
|
||||
/**
|
||||
* Determines the fluid type and amount inside a container.
|
||||
*
|
||||
*
|
||||
* @param container
|
||||
* The fluid container.
|
||||
* @return FluidStack representing stored fluid.
|
||||
@@ -202,9 +208,9 @@ public abstract class FluidContainerRegistry
|
||||
|
||||
/**
|
||||
* Attempts to fill an empty container with a fluid.
|
||||
*
|
||||
*
|
||||
* NOTE: Returns null on fail, NOT the empty container.
|
||||
*
|
||||
*
|
||||
* @param fluid
|
||||
* FluidStack containing the type and amount of fluid to fill.
|
||||
* @param container
|
||||
@@ -228,7 +234,7 @@ public abstract class FluidContainerRegistry
|
||||
|
||||
/**
|
||||
* Attempts to empty a full container.
|
||||
*
|
||||
*
|
||||
* @param container
|
||||
* ItemStack representing the full container.
|
||||
* @return Empty container if successful, otherwise null.
|
||||
@@ -251,7 +257,7 @@ public abstract class FluidContainerRegistry
|
||||
|
||||
/**
|
||||
* Determines the capacity of a full container.
|
||||
*
|
||||
*
|
||||
* @param container
|
||||
* The full container.
|
||||
* @return The containers capacity, or 0 if the ItemStack does not represent
|
||||
@@ -264,7 +270,7 @@ public abstract class FluidContainerRegistry
|
||||
|
||||
/**
|
||||
* Determines the capacity of a container.
|
||||
*
|
||||
*
|
||||
* @param fluid
|
||||
* FluidStack containing the type of fluid the capacity should be
|
||||
* determined for (ignored for full containers).
|
||||
@@ -361,7 +367,7 @@ public abstract class FluidContainerRegistry
|
||||
public final ItemStack filledContainer;
|
||||
public final ItemStack emptyContainer;
|
||||
|
||||
|
||||
|
||||
public FluidContainerData(FluidStack stack, ItemStack filledContainer, ItemStack emptyContainer)
|
||||
{
|
||||
this(stack, filledContainer, emptyContainer, false);
|
||||
|
||||
Reference in new issue
Block a user