- BEASTpoint2
- Registered Member
-
Member for 12 years, 5 months, and 1 day
Last active Wed, Mar, 2 2016 19:13:11
- 0 Followers
- 295 Total Posts
- 19 Thanks
-
Aug 24, 2012BEASTpoint2 posted a message on 12w34a Snapshot Available for Testing!I found some bugs while making my shapshot overview video. here's the linkPosted in: News
-
Jan 5, 2012BEASTpoint2 posted a message on Minecon, Minecraft Updates & MoreThank you Jeb... You have added things people have wanted for... well... a long time!Posted in: News
Cant wait for the next release. -
Nov 14, 2011BEASTpoint2 posted a message on Minecraft RC2 is Out For Testingand another thing... Notch should make it possible to change the type of sound from the new kinds, to the original from 1.8.1... SPREAD THIS!Posted in: News
-
Nov 14, 2011BEASTpoint2 posted a message on Minecraft RC2 is Out For TestingPosted in: NewsQuote from FangVsLeon
Notch put up a poll and promised he'd heed to the results. Square won over circle.
I was just wondering... i liked the square sun and moon better. round just doesnt fit :smile.gif: -
Nov 14, 2011BEASTpoint2 posted a message on Minecraft RC2 is Out For Testingwhy isnt the sun round?Posted in: News
- To post a comment, please login.
1
Here would be the code, that is if you are wanting to use the ore for lapiz lazuli...
0
0
Glad I could help with the Ids. But for the sound, you need to put
in your block declaration.
0
Here is the code for the stationary block...
package net.minecraft.src;
import java.util.Random;
public class BlockAcidStationary extends BlockFluid
{
protected BlockAcidStationary(int par1, Material par2Material)
{
super(par1, par2Material);
setTickRandomly(false);
if (par2Material == Material.lava)
{
setTickRandomly(true);
}
}
public int colorMultiplier(IBlockAccess iblockacess, int i, int j, int k)
{
return (0x7FFF00);
}
public boolean getBlocksMovement(IBlockAccess par1IBlockAccess, int par2, int par3, int par4)
{
return blockMaterial != Material.lava;
}
/**
* Lets the block know when one of its neighbor changes. Doesn't know which neighbor changed (coordinates passed are
* their own) Args: x, y, z, neighbor blockID
*/
public void onNeighborBlockChange(World par1World, int par2, int par3, int par4, int par5)
{
super.onNeighborBlockChange(par1World, par2, par3, par4, par5);
if (par1World.getBlockId(par2, par3, par4) == blockID)
{
setNotStationary(par1World, par2, par3, par4);
}
}
/**
* Changes the block ID to that of an updating fluid.
*/
private void setNotStationary(World par1World, int par2, int par3, int par4)
{
par1World.editingBlocks = true;
par1World.markBlocksDirty(par2, par3, par4, par2, par3, par4);
par1World.scheduleBlockUpdate(par2, par3, par4, blockID - 1, tickRate());
par1World.editingBlocks = false;
}
/**
* Ticks the block if it's been scheduled
*/
public void updateTick(World par1World, int par2, int par3, int par4, Random par5Random)
{
if (blockMaterial == Material.lava)
{
int i = par5Random.nextInt(3);
for (int j = 0; j < i; j++)
{
par2 += par5Random.nextInt(3) - 1;
par3++;
par4 += par5Random.nextInt(3) - 1;
int l = par1World.getBlockId(par2, par3, par4);
if (l == 0)
{
if (isFlammable(par1World, par2 - 1, par3, par4) || isFlammable(par1World, par2 + 1, par3, par4) || isFlammable(par1World, par2, par3, par4 - 1) || isFlammable(par1World, par2, par3, par4 + 1) || isFlammable(par1World, par2, par3 - 1, par4) || isFlammable(par1World, par2, par3 + 1, par4))
{
par1World.setBlockWithNotify(par2, par3, par4, Block.fire.blockID);
return;
}
continue;
}
if (Block.blocksList[l].blockMaterial.blocksMovement())
{
return;
}
}
if (i == 0)
{
int k = par2;
int i1 = par4;
for (int j1 = 0; j1 < 3; j1++)
{
par2 = (k + par5Random.nextInt(3)) - 1;
par4 = (i1 + par5Random.nextInt(3)) - 1;
if (par1World.isAirBlock(par2, par3 + 1, par4) && isFlammable(par1World, par2, par3, par4))
{
par1World.setBlockWithNotify(par2, par3 + 1, par4, Block.fire.blockID);
}
}
}
}
}
/**
* Checks to see if the block is flammable.
*/
private boolean isFlammable(World par1World, int par2, int par3, int par4)
{
return par1World.getBlockMaterial(par2, par3, par4).getCanBurn();
}
}
[/code]
and here is the code for the flowing block.
[code]package net.minecraft.src; import java.util.Random; public class BlockAcidFlowing extends BlockFluid { /** * Number of horizontally adjacent liquid source blocks. Diagonal doesn't count. Only source blocks of the same * liquid as the block using the field are counted. */ int numAdjacentSources; boolean isOptimalFlowDirection[]; int flowCost[]; protected BlockAcidFlowing(int par1, Material par2Material) { super(par1, par2Material); numAdjacentSources = 0; isOptimalFlowDirection = new boolean[4]; flowCost = new int[4]; } public int colorMultiplier(IBlockAccess iblockacess, int i, int j, int k) { return (0x7FFF00); } /** * Updates the flow for the BlockFlowing object. */ private void updateFlow(World par1World, int par2, int par3, int par4) { par1World.markBlocksDirty(par2, par3, par4, par2, par3, par4); par1World.markBlockNeedsUpdate(par2, par3, par4); } public boolean getBlocksMovement(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) { return blockMaterial != Material.lava; } /** * Ticks the block if it's been scheduled */ public void updateTick(World par1World, int par2, int par3, int par4, Random par5Random) { int i = getFlowDecay(par1World, par2, par3, par4); byte byte0 = 1; if (blockMaterial == Material.lava && !par1World.worldProvider.isHellWorld) { byte0 = 2; } boolean flag = true; if (i > 0) { int j = -100; numAdjacentSources = 0; j = getSmallestFlowDecay(par1World, par2 - 1, par3, par4, j); j = getSmallestFlowDecay(par1World, par2 + 1, par3, par4, j); j = getSmallestFlowDecay(par1World, par2, par3, par4 - 1, j); j = getSmallestFlowDecay(par1World, par2, par3, par4 + 1, j); int k = j + byte0; if (k >= 8 || j < 0) { k = -1; } if (getFlowDecay(par1World, par2, par3 + 1, par4) >= 0) { int i1 = getFlowDecay(par1World, par2, par3 + 1, par4); if (i1 >= 8) { k = i1; } else { k = i1 + 8; } } if (numAdjacentSources >= 2 && blockMaterial == Material.water) { if (par1World.getBlockMaterial(par2, par3 - 1, par4).isSolid()) { k = 0; } else if (par1World.getBlockMaterial(par2, par3 - 1, par4) == blockMaterial && par1World.getBlockMetadata(par2, par3, par4) == 0) { k = 0; } } if (blockMaterial == Material.lava && i < 8 && k < 8 && k > i && par5Random.nextInt(4) != 0) { k = i; flag = false; } if (k != i) { i = k; if (i < 0) { par1World.setBlockWithNotify(par2, par3, par4, 0); } else { par1World.setBlockMetadataWithNotify(par2, par3, par4, i); par1World.scheduleBlockUpdate(par2, par3, par4, blockID, tickRate()); par1World.notifyBlocksOfNeighborChange(par2, par3, par4, blockID); } } else if (flag) { updateFlow(par1World, par2, par3, par4); } } else { updateFlow(par1World, par2, par3, par4); } if (liquidCanDisplaceBlock(par1World, par2, par3 - 1, par4)) { if (blockMaterial == Material.lava && par1World.getBlockMaterial(par2, par3 - 1, par4) == Material.water) { par1World.setBlockWithNotify(par2, par3 - 1, par4, Block.stone.blockID); triggerLavaMixEffects(par1World, par2, par3 - 1, par4); return; } if (i >= 8) { par1World.setBlockAndMetadataWithNotify(par2, par3 - 1, par4, blockID, i); } else { par1World.setBlockAndMetadataWithNotify(par2, par3 - 1, par4, blockID, i + 8); } } else if (i >= 0 && (i == 0 || blockBlocksFlow(par1World, par2, par3 - 1, par4))) { boolean aflag[] = getOptimalFlowDirections(par1World, par2, par3, par4); int l = i + byte0; if (i >= 8) { l = 1; } if (l >= 8) { return; } if (aflag[0]) { flowIntoBlock(par1World, par2 - 1, par3, par4, l); } if (aflag[1]) { flowIntoBlock(par1World, par2 + 1, par3, par4, l); } if (aflag[2]) { flowIntoBlock(par1World, par2, par3, par4 - 1, l); } if (aflag[3]) { flowIntoBlock(par1World, par2, par3, par4 + 1, l); } } } /** * flowIntoBlock(World world, int x, int y, int z, int newFlowDecay) - Flows into the block at the coordinates and * changes the block type to the liquid. */ private void flowIntoBlock(World par1World, int par2, int par3, int par4, int par5) { if (liquidCanDisplaceBlock(par1World, par2, par3, par4)) { int i = par1World.getBlockId(par2, par3, par4); if (i > 0) { if (blockMaterial == Material.lava) { triggerLavaMixEffects(par1World, par2, par3, par4); } else { Block.blocksList[i].dropBlockAsItem(par1World, par2, par3, par4, par1World.getBlockMetadata(par2, par3, par4), 0); } } par1World.setBlockAndMetadataWithNotify(par2, par3, par4, blockID, par5); } } /** * calculateFlowCost(World world, int x, int y, int z, int accumulatedCost, int previousDirectionOfFlow) - Used to * determine the path of least resistance, this method returns the lowest possible flow cost for the direction of * flow indicated. Each necessary horizontal flow adds to the flow cost. */ private int calculateFlowCost(World par1World, int par2, int par3, int par4, int par5, int par6) { int i = 1000; for (int j = 0; j < 4; j++) { if (j == 0 && par6 == 1 || j == 1 && par6 == 0 || j == 2 && par6 == 3 || j == 3 && par6 == 2) { continue; } int k = par2; int l = par3; int i1 = par4; if (j == 0) { k--; } if (j == 1) { k++; } if (j == 2) { i1--; } if (j == 3) { i1++; } if (blockBlocksFlow(par1World, k, l, i1) || par1World.getBlockMaterial(k, l, i1) == blockMaterial && par1World.getBlockMetadata(k, l, i1) == 0) { continue; } if (!blockBlocksFlow(par1World, k, l - 1, i1)) { return par5; } if (par5 >= 4) { continue; } int j1 = calculateFlowCost(par1World, k, l, i1, par5 + 1, j); if (j1 < i) { i = j1; } } return i; } /** * Returns a boolean array indicating which flow directions are optimal based on each direction's calculated flow * cost. Each array index corresponds to one of the four cardinal directions. A value of true indicates the * direction is optimal. */ private boolean[] getOptimalFlowDirections(World par1World, int par2, int par3, int par4) { for (int i = 0; i < 4; i++) { flowCost[i] = 1000; int k = par2; int j1 = par3; int k1 = par4; if (i == 0) { k--; } if (i == 1) { k++; } if (i == 2) { k1--; } if (i == 3) { k1++; } if (blockBlocksFlow(par1World, k, j1, k1) || par1World.getBlockMaterial(k, j1, k1) == blockMaterial && par1World.getBlockMetadata(k, j1, k1) == 0) { continue; } if (!blockBlocksFlow(par1World, k, j1 - 1, k1)) { flowCost[i] = 0; } else { flowCost[i] = calculateFlowCost(par1World, k, j1, k1, 1, i); } } int j = flowCost[0]; for (int l = 1; l < 4; l++) { if (flowCost[l] < j) { j = flowCost[l]; } } for (int i1 = 0; i1 < 4; i1++) { isOptimalFlowDirection[i1] = flowCost[i1] == j; } return isOptimalFlowDirection; } /** * Returns true if block at coords blocks fluids */ private boolean blockBlocksFlow(World par1World, int par2, int par3, int par4) { int i = par1World.getBlockId(par2, par3, par4); if (i == Block.doorWood.blockID || i == Block.doorSteel.blockID || i == Block.signPost.blockID || i == Block.ladder.blockID || i == Block.reed.blockID) { return true; } if (i == 0) { return false; } Material material = Block.blocksList[i].blockMaterial; if (material == Material.portal) { return true; } return material.blocksMovement(); } /** * getSmallestFlowDecay(World world, intx, int y, int z, int currentSmallestFlowDecay) - Looks up the flow decay at * the coordinates given and returns the smaller of this value or the provided currentSmallestFlowDecay. If one * value is valid and the other isn't, the valid value will be returned. Valid values are >= 0. Flow decay is the * amount that a liquid has dissipated. 0 indicates a source block. */ protected int getSmallestFlowDecay(World par1World, int par2, int par3, int par4, int par5) { int i = getFlowDecay(par1World, par2, par3, par4); if (i < 0) { return par5; } if (i == 0) { numAdjacentSources++; } if (i >= 8) { i = 0; } return par5 >= 0 && i >= par5 ? par5 : i; } /** * Returns true if the block at the coordinates can be displaced by the liquid. */ private boolean liquidCanDisplaceBlock(World par1World, int par2, int par3, int par4) { Material material = par1World.getBlockMaterial(par2, par3, par4); if (material == blockMaterial) { return false; } if (material == Material.lava) { return false; } else { return !blockBlocksFlow(par1World, par2, par3, par4); } } /** * Called whenever the block is added into the world. Args: world, x, y, z */ public void onBlockAdded(World par1World, int par2, int par3, int par4) { super.onBlockAdded(par1World, par2, par3, par4); if (par1World.getBlockId(par2, par3, par4) == blockID) { par1World.scheduleBlockUpdate(par2, par3, par4, blockID, tickRate()); } } }[/code]
I know for a fact that it has to do with these two methods.
Flowing
[code]private void updateFlow(World par1World, int par2, int par3, int par4) { int i = par1World.getBlockMetadata(par2, par3, par4); par1World.setBlockAndMetadata(par2, par3, par4, blockID + 1, i); par1World.markBlocksDirty(par2, par3, par4, par2, par3, par4); par1World.markBlockNeedsUpdate(par2, par3, par4); }[/code]
Still
[code]private void setNotStationary(World par1World, int par2, int par3, int par4) { int i = par1World.getBlockMetadata(par2, par3, par4); par1World.editingBlocks = true; par1World.setBlockAndMetadata(par2, par3, par4, blockID - 1, i); par1World.markBlocksDirty(par2, par3, par4, par2, par3, par4); par1World.scheduleBlockUpdate(par2, par3, par4, blockID - 1, tickRate()); par1World.editingBlocks = false; }[/code]
When I have the metadeta parts in those methods and it causes the game to crash when i destroy an adjacent block. I took it out and it worked fine, but now the liquid remains when i destroy the source block. I would appreciate ANY help you could provide me. Thanks.
1
Your Id has to be below 256 if you are just using ModLoader. If you use the forge API you can use Id up to some extreme number. That's only if you have a ton of block and items. Tip: You also need your ID to be above 124 and below 256... those are the only Ids available.
0
0
0
I would like to know how without a new API.Bump
0
0
Thanks, the block works fine now.
0
0
0
Maybe use the emeralds like so,
Boots = Emerald
Diamond = Diamond
...to make a bedrock core, use this in place if the gold in the original recipe to make the bedrock.
0
0