Worked on debug blocks

Fixed void block not sucking in fluids, as well it stalled out the fluid
network oddly
Added textures
Added TileEntity registry
This commit is contained in:
DarkGuardsman 2013-08-26 13:33:53 -04:00
parent d95799cd0a
commit 053c4a2831
5 changed files with 74 additions and 15 deletions

View file

@ -1,7 +1,16 @@
package dark.common.debug;
import java.util.List;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.Icon;
import net.minecraft.world.World;
import net.minecraftforge.common.Configuration;
import dark.core.DarkMain;
@ -9,15 +18,17 @@ import dark.core.blocks.BlockMachine;
public class BlockDebug extends BlockMachine
{
enum debugBlocks
Icon load, source, vod, fluid;
public static enum debugBlocks
{
INF_POWER("infPower", TileEntityInfSupply.class),
INF_POWER("infSource", TileEntityInfSupply.class),
INF_FLUID("infFluid", TileEntityInfFluid.class),
VOID("void", TileEntityVoid.class),
INF_LOAD("infLoad", TileEntityInfLoad.class);
String name;
Class<? extends TileEntity> clazz;
public String name;
public Class<? extends TileEntity> clazz;
private debugBlocks(String name, Class<? extends TileEntity> clazz)
{
@ -29,6 +40,37 @@ public class BlockDebug extends BlockMachine
public BlockDebug(int blockID, Configuration config)
{
super("DebugBlock", config, blockID, Material.clay);
this.setCreativeTab(CreativeTabs.tabRedstone);
}
@SideOnly(Side.CLIENT)
@Override
public void registerIcons(IconRegister iconReg)
{
super.registerIcons(iconReg);
this.source = iconReg.registerIcon(DarkMain.getInstance().PREFIX + "infSource");
this.load = iconReg.registerIcon(DarkMain.getInstance().PREFIX + "infLoad");
this.vod = iconReg.registerIcon(DarkMain.getInstance().PREFIX + "void");
this.fluid = iconReg.registerIcon(DarkMain.getInstance().PREFIX + "infFluid");
}
@Override
@SideOnly(Side.CLIENT)
public Icon getIcon(int side, int meta)
{
switch (meta)
{
case 0:
return this.source;
case 1:
return this.fluid;
case 2:
return this.vod;
case 3:
return this.load;
default:
return this.blockIcon;
}
}
@Override
@ -55,4 +97,13 @@ public class BlockDebug extends BlockMachine
return null;
}
@Override
public void getSubBlocks(int par1, CreativeTabs par2CreativeTabs, List par3List)
{
for (int i = 0; i < debugBlocks.values().length; i++)
{
par3List.add(new ItemStack(par1, 1, i));
}
}
}

View file

@ -18,6 +18,10 @@ public class TileEntityInfLoad extends TileEntity implements IElectrical
@Override
public float receiveElectricity(ForgeDirection from, ElectricityPack receive, boolean doReceive)
{
if(receive != null)
{
System.out.print("Burning off "+receive.getWatts()+" watts of energy");
}
return this.canConnect(from) && receive != null ? receive.getWatts() : 0;
}

View file

@ -1,5 +1,7 @@
package dark.common.debug;
import java.util.HashMap;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.ForgeDirection;
import net.minecraftforge.fluids.Fluid;
@ -13,13 +15,16 @@ import net.minecraftforge.fluids.IFluidHandler;
* @author DarkGuardsman */
public class TileEntityVoid extends TileEntity implements IFluidHandler
{
//TODO later add to this to make it actually have an ingame use other than debug
public static HashMap<FluidStack,Long> storage = new HashMap<FluidStack, Long>();
FluidTank tank = new FluidTank(1000000);
@Override
public int fill(ForgeDirection from, FluidStack resource, boolean doFill)
{
//TODO add wrench toggle options to change amount actually drained
return resource != null && this.canDrain(from, resource.getFluid()) ? resource.amount : 0;
return resource != null && this.canFill(from, resource.getFluid()) ? resource.amount : 0;
}
@Override

View file

@ -24,6 +24,7 @@ import cpw.mods.fml.common.event.FMLServerStoppingEvent;
import cpw.mods.fml.common.network.NetworkMod;
import cpw.mods.fml.common.registry.GameRegistry;
import dark.common.debug.BlockDebug;
import dark.common.debug.BlockDebug.debugBlocks;
import dark.core.blocks.BlockMulti;
import dark.core.blocks.BlockOre;
import dark.core.blocks.TileEntityMulti;
@ -106,11 +107,15 @@ public class DarkMain extends ModPrefab
}
if (CoreRecipeLoader.blockDebug != null)
{
GameRegistry.registerBlock(CoreRecipeLoader.blockDebug, ItemBlockHolder.class, "DMOre");
GameRegistry.registerBlock(CoreRecipeLoader.blockDebug, ItemBlockHolder.class, "DMDebug");
for (int i = 0; i < debugBlocks.values().length; i++)
{
GameRegistry.registerTileEntity(debugBlocks.values()[i].clazz, "DMDebug" + i);
}
}
GameRegistry.registerBlock(blockMulti, "multiBlock");
GameRegistry.registerTileEntity(TileEntityMulti.class, "ALMulti");
GameRegistry.registerTileEntity(TileEntityMulti.class, "DMMultiBlock");
BlockOre.regiserOreNames();

View file

@ -41,14 +41,8 @@ public abstract class BlockMachine extends BlockAdvanced implements ITileEntityP
@Override
public void registerIcons(IconRegister iconReg)
{
this.blockIcon = iconReg.registerIcon(DarkMain.getInstance().PREFIX + "machine");
}
@Override
@SideOnly(Side.CLIENT)
public Icon getBlockTexture(IBlockAccess par1iBlockAccess, int par2, int par3, int par4, int par5)
{
return this.blockIcon;
if (this.blockIcon == null)
this.blockIcon = iconReg.registerIcon(DarkMain.getInstance().PREFIX + "machine");
}
@Override