Posted October 20, 201311 yr Yeah i have problems with the fulids^^" Now the flowing part and the pumping in a tank works fine. But the fluid is not registered in the fluid dictionary and the name will be showen as: Fluid.Animal Gas Also the texture does not work! ConfigClass (Registerring) package speiger.src.api.common.config; import net.minecraft.block.Block; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.src.ModLoader; import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidContainerRegistry; import net.minecraftforge.fluids.FluidContainerRegistry.FluidContainerData; import net.minecraftforge.fluids.FluidRegistry; import net.minecraftforge.fluids.FluidStack; import speiger.src.api.common.blocks.BlockGas; import speiger.src.api.common.functions.PathProxy; import speiger.src.api.common.functions.TextureRegister; import speiger.src.api.common.items.ItemGasAbsorber; import speiger.src.api.common.items.ItemGasBucket; import speiger.src.api.common.items.LiquidContainer; import speiger.src.api.common.items.itemblocks.ItemBlockGas; import speiger.src.api.common.lib.APIIDs; import speiger.src.api.common.lib.APIStrings; public class APIItemBlockConfig { public static ConfigCore cc; public static APIItems ai; public static APIIDs ids; public static APIStrings as; public static TextureRegister at; public static boolean isBetas = true; public static void initialisiereItemBlocks() { ai.animalGas = new Fluid("Animal Gas").setGaseous(true).setDensity(1000); FluidRegistry.registerFluid(ai.animalGas); ai.gas = new BlockGas(cc.getBlock("block", "Gas Block", 802)); PathProxy.registBlock(ai.gas, ItemBlockGas.class, "Schweine Furze"); ai.animalGas.setBlockID(ai.gas); ai.gasBucket = new ItemGasBucket(cc.getItem("items", "Gas Bucket", 26041)); FluidContainerRegistry.registerFluidContainer(new FluidContainerData(new FluidStack(ai.animalGas, 1000), new ItemStack(APIItems.gasBucket), new ItemStack(Item.bucketEmpty))); ai.gasAbsorber = new ItemGasAbsorber(cc.getItem("items", "Vacum Pump", 26042)); PathProxy.registItem(ai.gasAbsorber, "Gas Pumpe"); ai.gasCell = new LiquidContainer(cc.getItem("items", "Gas Cell", 26043), "Gas Cell", at.gasZelle, 64, "Animal Gas", 1000); PathProxy.registItem(ai.gasCell, "Gas Zelle"); ai.compressedGasCell = new LiquidContainer(cc.getItem("items", "Compressed Gas Cell", 26044), "Compressed Gas Cell", at.bigGasCell, 64, "Animal Gas", 5000); PathProxy.registItem(ai.compressedGasCell, "Komprimierte Gas Celle"); ai.gasCan = new LiquidContainer(cc.getItem("items", "Gas Can", 26045), "Gas Can", at.gasCan, 64, "Animal Gas", 1000); PathProxy.registItem(ai.gasCan, "Gas Kanne"); ai.compressedGasCan = new LiquidContainer(cc.getItem("items", "Compressed Gas Can", 26046), "Compressed Gas Can", at.bigGasCan, 64, "Animal Gas", 5000); PathProxy.registItem(ai.compressedGasCan, "Komprimierte Gas Kanne"); } } Block Class package speiger.src.api.common.blocks; import java.util.Collection; import java.util.Iterator; import java.util.Random; import net.minecraft.block.Block; import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLiving; import net.minecraft.potion.Potion; import net.minecraft.potion.PotionEffect; import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.Icon; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidRegistry; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.IFluidBlock; import speiger.src.api.common.config.APIItems; import speiger.src.api.common.functions.TextureRegister; import speiger.src.api.common.functions.WorldReading; import cpw.mods.fml.common.Loader; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; public class BlockGas extends Block implements IFluidBlock { public Random rand = new Random(); public BlockGas(int par1) { super(par1, APIItems.GasMaterial); this.setTickRandomly(true); this.disableStats(); this.setHardness(100F); this.setLightOpacity(3); } @Override public boolean canCollideCheck(int par1, boolean par2) { return false; } public void setBlockBoundsForItemRender() { this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); } public boolean isBlockSolid(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5) { return false; } @Override public boolean isBlockReplaceable(World world, int x, int y, int z) { return true; } @Override public void updateTick(World par1World, int par2, int par3, int par4, Random par5Random) { super.updateTick(par1World, par2, par3, par4, par5Random); this.notifyNeighbors(par1World, par2, par3, par4); if(!par1World.isRemote) { flowing(par1World, par2, par3, par4); removeBlock(par1World, par2, par3, par4); } par1World.scheduleBlockUpdate(par2, par3, par4, blockID, tickRate(par1World)); } private void removeBlock(World par1, int par2, int par3, int par4) { if(par3 >= 149) { if(par1.getRainStrength(1.0F) > 0.2D) { par1.setBlock(par2, par3, par4, 0); } } } @Override public void onEntityCollidedWithBlock(World par1World, int par2, int par3, int par4, Entity par5Entity) { super.onEntityCollidedWithBlock(par1World, par2, par3, par4, par5Entity); if(par5Entity instanceof EntityLiving) { EntityLiving el = (EntityLiving) par5Entity; Collection<PotionEffect> potion = el.getActivePotionEffects(); int i = 0; if(!potion.isEmpty()) { Iterator between = potion.iterator(); while(between.hasNext()) { PotionEffect current = (PotionEffect) between.next(); if(current.getPotionID() == Potion.confusion.id) { i = current.getDuration(); } } } if(rand.nextInt(20) == 0) { el.addPotionEffect(new PotionEffect(Potion.confusion.id, i+10, 3)); } } } public void flowing(World par0, int par1, int par2, int par3) { } public void onBlockAdded(World world, int i, int j, int k) { world.scheduleBlockUpdate(i, j, k, blockID, tickRate(world)); } @Override public int tickRate(World par1World) { return 5; } public void notifyNeighbors(World world, int i, int j, int k) { world.notifyBlocksOfNeighborChange(i, j, k, blockID); world.notifyBlocksOfNeighborChange(i, j - 1, k, blockID); world.notifyBlocksOfNeighborChange(i, j + 1, k, blockID); world.notifyBlocksOfNeighborChange(i - 1, j, k, blockID); world.notifyBlocksOfNeighborChange(i + 1, j, k, blockID); world.notifyBlocksOfNeighborChange(i, j, k - 1, blockID); world.notifyBlocksOfNeighborChange(i, j, k + 1, blockID); } @Override public AxisAlignedBB getCollisionBoundingBoxFromPool(World par1World, int par2, int par3, int par4) { return null; } public boolean renderAsNormalBlock() { return false; } public boolean isOpaqueCube() { return false; } // @Override // public AxisAlignedBB getSelectedBoundingBoxFromPool(World par1, int par2, int par3, int par4) // { // return null; // } float[] biggnis = new float[]{0.0F, 0.1F, 0.2F, 0.3F, 0.4F, 0.5F, 0.6F, 0.7F, 0.8F, 0.9F, 0.95F, 0.96F}; public void setBlockBoundsBasedOnState(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) { int var5 = par1IBlockAccess.getBlockMetadata(par2, par3, par4); float var8 = 1.0F; if(var5 == 0) { this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, var8, 1.0F); } else { this.setBlockBounds(0.0F, biggnis[var5], 0.0F, 1.0F, var8, 1.0F); } } private Icon[] gas = new Icon[6]; @Override @SideOnly(Side.CLIENT) public void registerIcons(IconRegister par1IconRegister) { for(int i = 0;i<gas.length;i++) { gas[i] = par1IconRegister.registerIcon(TextureRegister.gasTextures[i]); } } @Override @SideOnly(Side.CLIENT) public Icon getBlockTexture(IBlockAccess par1iBlockAccess, int par2, int par3, int par4, int par5) { return gas[par5]; } @Override @SideOnly(Side.CLIENT) public Icon getIcon(int par1, int par2) { return gas[par1]; } @Override public Fluid getFluid() { return APIItems.animalGas; } @Override public FluidStack drain(World world, int x, int y, int z, boolean doDrain) { int meta = world.getBlockMetadata(x, y, z); int backMeta = 10 - meta; FluidStack gas = new FluidStack(APIItems.animalGas, 100*backMeta); if(doDrain) { world.setBlockToAir(x, y, z); } return gas.copy(); } @Override public boolean canDrain(World world, int x, int y, int z) { return true; } } So what i am doing wrong? a view things before! i need this block class for my fluid because its my custom movement^^" Thanks for reading and i hope you have a solve/idea.
October 20, 201311 yr You wouldn't be the first who use static incorrectly. Like trying to register a Fluid before the corresponding Block exist. Check that you are doing things in the correct order.
October 20, 201311 yr Author That do not help. I register the fluid and then the block. like bc. But i have no Textures and no name.
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.