Merge pull request #11 from micdoodle8/master
Tanks will be added to creative/NEI depending on fuels registered.
This commit is contained in:
commit
69a33f940f
3 changed files with 51 additions and 5 deletions
29
src/minecraft/fluidmech/common/FluidEvents.java
Normal file
29
src/minecraft/fluidmech/common/FluidEvents.java
Normal file
|
@ -0,0 +1,29 @@
|
|||
package fluidmech.common;
|
||||
|
||||
import hydraulic.api.ColorCode;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
|
||||
import net.minecraftforge.event.ForgeSubscribe;
|
||||
import net.minecraftforge.liquids.LiquidDictionary.LiquidRegisterEvent;
|
||||
|
||||
public class FluidEvents
|
||||
{
|
||||
|
||||
@ForgeSubscribe
|
||||
public void onLiquidRegistered(LiquidRegisterEvent event)
|
||||
{
|
||||
if (event.Name != null)
|
||||
{
|
||||
if (event.Name.equals("Fuel") && !FluidMech.liquidTypes.contains(ColorCode.get(ColorCode.YELLOW).ordinal()))
|
||||
{
|
||||
FluidMech.liquidTypes.add(ColorCode.get(ColorCode.YELLOW).ordinal());
|
||||
}
|
||||
else if (event.Name.equals("Oil") && !FluidMech.liquidTypes.contains(ColorCode.get(ColorCode.BLACK).ordinal()))
|
||||
{
|
||||
FluidMech.liquidTypes.add(ColorCode.get(ColorCode.BLACK).ordinal());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -31,6 +31,7 @@ import hydraulic.api.ColorCode;
|
|||
import hydraulic.helpers.FluidHelper;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
|
@ -95,6 +96,9 @@ public class FluidMech extends DummyModContainer
|
|||
@Metadata(FluidMech.MOD_ID)
|
||||
public static ModMetadata meta;
|
||||
|
||||
/* LIQUID TYPES */
|
||||
public static ArrayList<Integer> liquidTypes = new ArrayList();
|
||||
|
||||
/* RESOURCE FILE PATHS */
|
||||
public static final String RESOURCE_PATH = "/mods/fluidmech/";
|
||||
public static final String TEXTURE_DIRECTORY = RESOURCE_PATH + "textures/";
|
||||
|
@ -139,6 +143,18 @@ public class FluidMech extends DummyModContainer
|
|||
|
||||
/* LOGGER - EXTENDS FORGE'S LOG SYSTEM */
|
||||
public static Logger FMLog = Logger.getLogger(FluidMech.MOD_NAME);
|
||||
|
||||
static
|
||||
{
|
||||
/* EVENT BUS (done here to ensure all fluid events are caught)*/
|
||||
MinecraftForge.EVENT_BUS.register(new FluidEvents());
|
||||
|
||||
/* ADD DEFAULT LIQUIDS */
|
||||
liquidTypes.add(ColorCode.get(ColorCode.BLUE).ordinal());
|
||||
liquidTypes.add(ColorCode.get(ColorCode.RED).ordinal());
|
||||
liquidTypes.add(ColorCode.get(ColorCode.NONE).ordinal());
|
||||
liquidTypes.add(ColorCode.get(ColorCode.WHITE).ordinal());
|
||||
}
|
||||
|
||||
@PreInit
|
||||
public void preInit(FMLPreInitializationEvent event)
|
||||
|
@ -149,7 +165,7 @@ public class FluidMech extends DummyModContainer
|
|||
|
||||
/* EVENT BUS */
|
||||
MinecraftForge.EVENT_BUS.register(new FluidHelper());
|
||||
|
||||
|
||||
instance = this;
|
||||
|
||||
/* UPDATE NOTIFIER */
|
||||
|
|
|
@ -17,6 +17,7 @@ import net.minecraftforge.liquids.LiquidContainerRegistry;
|
|||
import net.minecraftforge.liquids.LiquidStack;
|
||||
import universalelectricity.prefab.block.BlockAdvanced;
|
||||
import fluidmech.client.render.BlockRenderHelper;
|
||||
import fluidmech.common.FluidMech;
|
||||
import fluidmech.common.TabFluidMech;
|
||||
import fluidmech.common.tiles.TileEntityTank;
|
||||
|
||||
|
@ -157,9 +158,9 @@ public class BlockTank extends BlockAdvanced
|
|||
@Override
|
||||
public void getSubBlocks(int par1, CreativeTabs par2CreativeTabs, List par3List)
|
||||
{
|
||||
par3List.add(new ItemStack(par1, 1, 1));
|
||||
par3List.add(new ItemStack(par1, 1, 4));
|
||||
par3List.add(new ItemStack(par1, 1, 13));
|
||||
par3List.add(new ItemStack(par1, 1, 15));
|
||||
for (Integer i : FluidMech.liquidTypes)
|
||||
{
|
||||
par3List.add(new ItemStack(par1, 1, i));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue