-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Gray liquids, to be RGD'd later in custom renderer
- Loading branch information
Showing
6 changed files
with
144 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
package HxCKDMS.HxCTiC; | ||
|
||
import HxCKDMS.HxCTiC.lib.Reference; | ||
import cpw.mods.fml.relauncher.Side; | ||
import cpw.mods.fml.relauncher.SideOnly; | ||
import net.minecraft.block.material.Material; | ||
import net.minecraft.client.renderer.texture.IIconRegister; | ||
import net.minecraft.creativetab.CreativeTabs; | ||
import net.minecraft.util.IIcon; | ||
import net.minecraft.world.IBlockAccess; | ||
import net.minecraft.world.World; | ||
import net.minecraftforge.fluids.BlockFluidClassic; | ||
import net.minecraftforge.fluids.Fluid; | ||
|
||
public class LeFluid extends BlockFluidClassic { | ||
|
||
@SideOnly(Side.CLIENT) | ||
protected IIcon stillIcon; | ||
@SideOnly(Side.CLIENT) | ||
protected IIcon flowingIcon; | ||
private int color; | ||
public LeFluid(Fluid fluid, int Color) { | ||
super(fluid, Material.lava); | ||
setCreativeTab(CreativeTabs.tabMisc); | ||
color = Color; | ||
} | ||
|
||
@Override | ||
public IIcon getIcon(int side, int meta) { | ||
return (side == 0 || side == 1)? stillIcon : flowingIcon; | ||
} | ||
|
||
@Override | ||
public int getBlockColor() { | ||
return color; | ||
} | ||
|
||
@SideOnly(Side.CLIENT) | ||
@Override | ||
public void registerBlockIcons(IIconRegister register) { | ||
stillIcon = register.registerIcon(Reference.MOD_ID + ":fluidStill"); | ||
flowingIcon = register.registerIcon(Reference.MOD_ID + ":fluidFlowing"); | ||
} | ||
|
||
@Override | ||
public boolean canDisplace(IBlockAccess world, int x, int y, int z) { | ||
if (world.getBlock(x, y, z).getMaterial().isLiquid()) return false; | ||
return super.canDisplace(world, x, y, z); | ||
} | ||
|
||
@Override | ||
public boolean displaceIfPossible(World world, int x, int y, int z) { | ||
if (world.getBlock(x, y, z).getMaterial().isLiquid()) return false; | ||
return super.displaceIfPossible(world, x, y, z); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package HxCKDMS.HxCTiC.lib; | ||
|
||
import HxCKDMS.HxCTiC.LeFluid; | ||
import cpw.mods.fml.common.registry.GameRegistry; | ||
import net.minecraft.block.Block; | ||
import net.minecraftforge.fluids.Fluid; | ||
import net.minecraftforge.fluids.FluidRegistry; | ||
import org.apache.commons.lang3.StringUtils; | ||
|
||
import java.util.HashMap; | ||
|
||
public class Registry { | ||
public static HashMap<String, Fluid> fluids = new HashMap<>(); | ||
public static HashMap<String, Block> leFluids = new HashMap<>(); | ||
|
||
public static void preinit() { | ||
Configurations.materials.keySet().forEach(mat -> | ||
fluids.putIfAbsent("fluid_" + mat.toLowerCase(), new Fluid("fluid_" + mat.toLowerCase()))); | ||
} | ||
|
||
public static void init () { | ||
fluids.forEach((name, fluid) -> { | ||
FluidRegistry.registerFluid(fluid); | ||
System.out.println(StringUtils.capitalize(name.substring(6))); | ||
Block lef = new LeFluid(fluid, Configurations.materials.get(StringUtils.capitalize(name.substring(6))).Colour).setBlockName(name); | ||
leFluids.putIfAbsent(name, lef); | ||
GameRegistry.registerBlock(lef, Reference.MOD_ID + "_fluid_" + name); | ||
fluid.setUnlocalizedName(lef.getUnlocalizedName()); | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
material.hxctic.potato=Potato Material | ||
material.hxctic.potato=Potato Material | ||
material.hxctic.carrot=Carrot Material | ||
material.hxctic.quartz=Quartz Material |