Jershy Posted July 25, 2014 Share Posted July 25, 2014 I have been having trouble making a water block that like the vanilla block has certain heights it can achieve. But unlike the normal water block this block degrades the height of the parent block as it sets the preceding blocks. Also it moves blocks as well (you don't have to worry about that that is not the problem nor is it yet been added). it does not duplicate but just sits except when you place it near other normal water blocks. package IVWeather.iv.block; import net.minecraft.block.Block; import net.minecraft.block.BlockLiquid; import net.minecraft.block.material.Material; import net.minecraft.init.Blocks; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; public class BlockRushingWater extends BlockLiquid{ public float LiquidHieght; public BlockRushingWater(Material m_1) { super(m_1); LiquidHieght = .1F; setBlockBounds(0, 0, 0, 1, LiquidHieght, 1); } public void spreadOverArea(int par1, int par2, int par3, IBlockAccess iba, World world) { int a1 = par1; int a2 = par1; int a3 = par1; Block blockA = iba.getBlock(a1 - 1, a2, a3); Block blockB = iba.getBlock(a1 + 1, a2, a3); Block blockC = iba.getBlock(a1, a2, a3 - 1); Block blockD = iba.getBlock(a1, a2, a3 + 1); int i = world.getBlockMetadata( par1, par2, par3); if(this.LiquidHieght > .05) { if(blockA == Blocks.air) { world.setBlock(a1 - 1, a2, a3, Block.getBlockById(Block.getIdFromBlock(this) - 1), i, 2); world.scheduleBlockUpdate(par1, par2, par3, Block.getBlockById(Block.getIdFromBlock(this) - 1), tickRate(world)); this.LiquidHieght = LiquidHieght/ 2; } if(blockB == Blocks.air) { world.setBlock(a1 + 1, a2, a3, Block.getBlockById(Block.getIdFromBlock(this) - 1), i, 2); world.scheduleBlockUpdate(par1, par2, par3, Block.getBlockById(Block.getIdFromBlock(this) - 1), tickRate(world)); this.LiquidHieght = LiquidHieght/ 2; } if(blockC == Blocks.air) { world.setBlock(a1, a2, a3 + 1, Block.getBlockById(Block.getIdFromBlock(this) - 1), i, 2); world.scheduleBlockUpdate(par1, par2, par3, Block.getBlockById(Block.getIdFromBlock(this) - 1), tickRate(world)); this.LiquidHieght = LiquidHieght/ 2; } if(blockD == Blocks.air) { world.setBlock(a1, a2, a3 - 1, Block.getBlockById(Block.getIdFromBlock(this) - 1), i, 2); world.scheduleBlockUpdate(par1, par2, par3, Block.getBlockById(Block.getIdFromBlock(this) - 1), tickRate(world)); this.LiquidHieght = LiquidHieght/ 2; } } } public void MakeHieghtAmount() { this.setBlockBounds(0, 0, 0, 1, LiquidHieght, 1); } public void accumulate() { } } Quote Link to comment Share on other sites More sharing options...
TheGreyGhost Posted July 26, 2014 Share Posted July 26, 2014 Hi I'm not sure I understand your code. What are you expecting to call spreadOverArea? Forge has something similar to this already. Look at BlockFluidFinite (and in the minecraftforge\fluids package in general). I don't know how to use it properly myself, never tried, but it's intended for exactly this sort of thing. A google will probably show up a tutorial or at least a few GitHubs where people have used it before. -TGG Quote Link to comment Share on other sites More sharing options...
larsgerrits Posted July 26, 2014 Share Posted July 26, 2014 WTF Does this code mean: Block.getBlockById(Block.getIdFromBlock(this) You are basicly getting a block from a id which you get from a block. You could've just used this instead of that chain of code.... Quote Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support. 1.12 -> 1.13 primer by williewillus. 1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support. http://www.howoldisminecraft1710.today/ Link to comment Share on other sites More sharing options...
Jershy Posted July 26, 2014 Author Share Posted July 26, 2014 because it would give me an error message if i did not Quote Link to comment Share on other sites More sharing options...
jabelar Posted July 27, 2014 Share Posted July 27, 2014 Anyway, in addition to the specific questions about your code, I think you should consider using the Fluids that are now implemented in Minecraft Forge. There is a whole bunch of functionality there that might be useful to your need. See this tutorial: http://www.minecraftforge.net/wiki/Create_a_Fluid Quote Check out my tutorials here: http://jabelarminecraft.blogspot.com/ Link to comment Share on other sites More sharing options...
Recommended Posts
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.