News:
Jan 13 2015: I finally got my tile entity stuff to work after struggling with it for a week. Yay
what this mostly means is that now I can finally start making this mod work the way it is supposed to
UPDATE: I have just recently actually began development on this
Current Version: 0.0.0.0.0.0.0.1 (i.e. nothing really works yet)
In lieu of that, I shall press on in development in case anyone still cares about this being made (I do!).
screenie showing...uhhh something or other
What is the first thing I and (hopefully) others thought when we saw minecarts and rails?
HECK YEAH ROLLERCOASTERS!!! Buuut as most of us mortals know, the majority of coasters we make turn out lame.
All that will change with this mod I am creating (I again, hope)
At the core of this mod lies the Omnirail. Able to be placed on any side of a block it is the mother of all rails that will allow infinetely more creative and interesting coasters or simple transportation rides.
If you don't like the textures please tell me. I made them pretty quickly and I'm not too good at graphic art and stuff.
It is crafted as follows:
This part may or may not be done...depends on how well I end up enjoying modding
There will be many more things added to this mod most notably will be many "macrorails" so to speak, such as loops, rolls, and dives.
I will look at all community suggestions for more "macrorails," but please include a description of your idea and a picture would definently be helpful so I can understand what your saying and make a 3d model from it.
Thanks in advance for your support
Oh yeah this mod is currently being developed by me(alexbenh) and krispycheez
Note:as this is my first mod and I'm also just now learning java it will likely take some time to create, but don't worry because krispycheez knows a lot more java then me.
me and a couple friends have been messing around with some coaster ideas and this is exactly the kind of mod we would love to use. Is this still being worked on?
lol, I haven't looked at this thread for awhile, but currently, no...sorry. I will hopefully start working on it when school starts because I will be taking a computer programming class that should help me with making this.
Hello, im a random dude. isemi know java, but im not that fluent. i understand how to program in it, i just forget what command does what. any ways, i was wondering if i coud help you program. you could email me the files, or make a git hub and add me to it. but i woud love to help. ive been scared to death of roller coasters untill three days ago at magic mountain, and when i got home i started looking at coasters in minecraft. Anways, i would love to help. so pm me or something, i would love to help. and if oyu dont need help, i had an idea:roller coaster carts. i use railcraft (voltz anyone?) and made the superman (its awesome) but linking carts is really hard, so what if we had a roller coaster cart? it would be like a bunch of carts in the crafting tabe, and it would be able to stop graity, and inn a normal cart if you go on thesse fancy rails you fall out. pm or email me, thanks
linkable carts has been something I thought about, but I have just started learning java so this mod may take awhile.
I have however thought of how to approach this which would be as follows:
1.create the omnirail block and allow it to be placed on any side of a block and rotate the texture and bounding box accordingly
2.change the rail logic so minecraft can figure out how to connect floor rails to wall rails and know how to use the turn texture correctly on the wall/roof rails
3.change the minecart logic so it knows how to run along these new rails
4.(optional but I would like this) change minecart physics to treat wall rails going up vertically to bring the cart down instead of treating them as flat rails
5.(this may be the hardest part but Im not sure) create a way to add the "macrorails" in
6.(another optional one) make the player model flip and rotate according to the cart's orientation
Edit: posted this question somewhere else and found an answer already
hopefully someone reads this in the near future, I am having issues with my mod right now. I wanted to be able to add some custom metadata values to my rail so instead of using the original BlockRailBase.class I copied it and renamed it to BlockOmniRailBase.class. Unfortuantely, now my game crashes shortly after a world load, or immediatly if I try to place my block. Do I need to register this new class or something?
my class, mostly the same as BlockRailBase.class but I dont think its the changes I made that causes it to crash...could it also need to be placed somewhere special since it is neither the base class for my mod or a block/item
public abstract class BlockOmniRailBase extends Block
{
protected final boolean field_150053_a;
private static final String __OBFID = "CL_00000195";
public static final boolean func_150049_b_(World p_150049_0_, int p_150049_1_, int p_150049_2_, int p_150049_3_)
{
return func_150051_a(p_150049_0_.getBlock(p_150049_1_, p_150049_2_, p_150049_3_));
}
public static final boolean func_150051_a(Block p_150051_0_)
{
return p_150051_0_ instanceof BlockOmniRailBase;
}
/**
* Returns true if the block is power related rail.
*/
public boolean isPowered()
{
return this.field_150053_a;
}
/**
* Returns a bounding box from the pool of bounding boxes (this means this box can change after the pool has been
* cleared to be reused)
*/
public AxisAlignedBB getCollisionBoundingBoxFromPool(World p_149668_1_, int p_149668_2_, int p_149668_3_, int p_149668_4_)
{
return null;
}
/**
* Is this block (a) opaque and (b) a full 1m cube? This determines whether or not to render the shared face of two
* adjacent blocks and also whether the player can attach torches, redstone wire, etc to this block.
*/
public boolean isOpaqueCube()
{
return false;
}
/**
* Ray traces through the blocks collision from start vector to end vector returning a ray trace hit. Args: world,
* x, y, z, startVec, endVec
*/
public MovingObjectPosition collisionRayTrace(World p_149731_1_, int p_149731_2_, int p_149731_3_, int p_149731_4_, Vec3 p_149731_5_, Vec3 p_149731_6_)
{
this.setBlockBoundsBasedOnState(p_149731_1_, p_149731_2_, p_149731_3_, p_149731_4_);
return super.collisionRayTrace(p_149731_1_, p_149731_2_, p_149731_3_, p_149731_4_, p_149731_5_, p_149731_6_);
}
/**
* Updates the blocks bounds based on its current state. Args: world, x, y, z
*/
public void setBlockBoundsBasedOnState(IBlockAccess p_149719_1_, int x, int y, int z)
{
int side = p_149719_1_.getBlockMetadata(x, y, z);
//System.out.println("Meta is:" + side);
if(side == 0 || side == 1 || (side >= 6 && side <=9)) {
//if(block is placed on face x,z (ground) facing up
this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.125F, 1.0F);
//System.out.println("UP");
}
//finish these
/*else if(side == DOWN) {
//if block is placed on face x,z facing down
this.setBlockBounds(0.0F, 1.0F - 0.125F, 0.0F, 1.0F, 1.0F, 1.0F);
//System.out.println("DOWN");
}
else if(side == SOUTH) {
//if block is placed on face x,y facing south
this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 0.125F);
//System.out.println("SOUTH");
}
else if(side == NORTH) {
//if block is placed on face x,y facing north
this.setBlockBounds(0.0F, 0.0F, 1.0F-0.125F, 1.0F, 1.0F, 1.0F);
//System.out.println("NORTH");
}
else if(side == WEST) {
//if block is placed on face y,z facing west
this.setBlockBounds(1.0F-0.125F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
//System.out.println("WEST");
}
else if(side == EAST) {
//if block is placed on face y,z facing east
this.setBlockBounds(0.0F, 0.0F, 0.0F, 0.125F, 1.0F, 1.0F);
//System.out.println("EAST");
}*/
}
/**
* If this block doesn't render as an ordinary block it will return False (examples: signs, buttons, stairs, etc)
*/
public boolean renderAsNormalBlock()
{
return false;
}
/**
* The type of render function that is called for this block
*/
public int getRenderType()
{
return renderType;
}
/**
* Returns the quantity of items to drop on block destruction.
*/
public int quantityDropped(Random p_149745_1_)
{
return 1;
}
/**
* Checks to see if its valid to put this block at the specified coordinates. Args: world, x, y, z
*/
//overrides to allow for wall and ceiling placement (works )
public boolean canPlaceBlockAt(World p_149742_1_, int p_149742_2_, int p_149742_3_, int p_149742_4_)
{
return p_149742_1_.isSideSolid(p_149742_2_ - 1, p_149742_3_, p_149742_4_, EAST ) ||
p_149742_1_.isSideSolid(p_149742_2_ + 1, p_149742_3_, p_149742_4_, WEST ) ||
p_149742_1_.isSideSolid(p_149742_2_, p_149742_3_, p_149742_4_ - 1, SOUTH) ||
p_149742_1_.isSideSolid(p_149742_2_, p_149742_3_, p_149742_4_ + 1, NORTH) ||
p_149742_1_.isSideSolid(p_149742_2_, p_149742_3_ - 1, p_149742_4_, UP ) ||
p_149742_1_.isSideSolid(p_149742_2_, p_149742_3_ + 1, p_149742_4_, DOWN );
}
public boolean canPlaceBlockOnSide(World p_149707_1_, int p_149707_2_, int p_149707_3_, int p_149707_4_, int p_149707_5_)
{
ForgeDirection dir = ForgeDirection.getOrientation(p_149707_5_);
if((dir == DOWN && p_149707_1_.isSideSolid(p_149707_2_, p_149707_3_ + 1, p_149707_4_, DOWN )) ||
(dir == UP && p_149707_1_.isSideSolid(p_149707_2_, p_149707_3_ - 1, p_149707_4_, UP )) ||
(dir == NORTH && p_149707_1_.isSideSolid(p_149707_2_, p_149707_3_, p_149707_4_ + 1, NORTH)) ||
(dir == SOUTH && p_149707_1_.isSideSolid(p_149707_2_, p_149707_3_, p_149707_4_ - 1, SOUTH)) ||
(dir == WEST && p_149707_1_.isSideSolid(p_149707_2_ + 1, p_149707_3_, p_149707_4_, WEST )) ||
(dir == EAST && p_149707_1_.isSideSolid(p_149707_2_ - 1, p_149707_3_, p_149707_4_, EAST ))) {
//currentSideOn = dir; //replaced with onBlockPlaced method
return true;
}
return false;
}
/**
* Called whenever the block is added into the world. Args: world, x, y, z
*/
public void onBlockAdded(World p_149726_1_, int p_149726_2_, int p_149726_3_, int p_149726_4_)
{
if (!p_149726_1_.isRemote)
{
this.func_150052_a(p_149726_1_, p_149726_2_, p_149726_3_, p_149726_4_, true);
//for metadata stuff...I think
public int damageDropped(int meta)
{
return meta;
}
/**
* 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 Block
*/
public void onNeighborBlockChange(World p_149695_1_, int p_149695_2_, int p_149695_3_, int p_149695_4_, Block p_149695_5_)
{
//do nothing for now
}
protected void func_150048_a(World p_150048_1_, int p_150048_2_, int p_150048_3_, int p_150048_4_, int p_150048_5_, int p_150048_6_, Block p_150048_7_) {}
protected void func_150052_a(World p_150052_1_, int p_150052_2_, int p_150052_3_, int p_150052_4_, boolean p_150052_5_)
{
if (!p_150052_1_.isRemote)
{
(new BlockOmniRailBase.Rail(p_150052_1_, p_150052_2_, p_150052_3_, p_150052_4_)).func_150655_a(p_150052_1_.isBlockIndirectlyGettingPowered(p_150052_2_, p_150052_3_, p_150052_4_), p_150052_5_);
}
}
/**
* Returns the mobility information of the block, 0 = free, 1 = can't push but can move over, 2 = total immobility
* and stop pistons
*/
public int getMobilityFlag()
{
return 0;
}
public void breakBlock(World p_149749_1_, int p_149749_2_, int p_149749_3_, int p_149749_4_, Block p_149749_5_, int p_149749_6_)
{
int i1 = p_149749_6_;
if (this.field_150053_a)
{
i1 = p_149749_6_ & 7;
}
/* ======================================== FORGE START =====================================*/
/**
* Return true if the rail can make corners.
* Used by placement logic.
* @param world The world.
* @param x The rail X coordinate.
* @param y The rail Y coordinate.
* @param z The rail Z coordinate.
* @return True if the rail can make corners.
*/
public boolean isFlexibleRail(IBlockAccess world, int y, int x, int z)
{
return !isPowered();
}
/**
* Returns true if the rail can make up and down slopes.
* Used by placement logic.
* @param world The world.
* @param x The rail X coordinate.
* @param y The rail Y coordinate.
* @param z The rail Z coordinate.
* @return True if the rail can make slopes.
*/
public boolean canMakeSlopes(IBlockAccess world, int x, int y, int z)
{
return true;
}
/**
* Return the rail's metadata (without the power bit if the rail uses one).
* Can be used to make the cart think the rail something other than it is,
* for example when making diamond junctions or switches.
* The cart parameter will often be null unless it it called from EntityMinecart.
*
* Valid rail metadata is defined as follows:
* 0x0: flat track going North-South
* 0x1: flat track going West-East
* 0x2: track ascending to the East
* 0x3: track ascending to the West
* 0x4: track ascending to the North
* 0x5: track ascending to the South
* 0x6: WestNorth corner (connecting East and South)
* 0x7: EastNorth corner (connecting West and South)
* 0x8: EastSouth corner (connecting West and North)
* 0x9: WestSouth corner (connecting East and North)
*
* @param world The world.
* @param cart The cart asking for the metadata, null if it is not called by EntityMinecart.
* @param y The rail X coordinate.
* @param x The rail Y coordinate.
* @param z The rail Z coordinate.
* @return The metadata.
*/
public int getBasicRailMetadata(IBlockAccess world, EntityMinecart cart, int x, int y, int z)
{
int meta = world.getBlockMetadata(x, y, z);
if(isPowered())
{
meta = meta & 7;
}
return meta;
}
/**
* Returns the max speed of the rail at the specified position.
* @param world The world.
* @param cart The cart on the rail, may be null.
* @param x The rail X coordinate.
* @param y The rail Y coordinate.
* @param z The rail Z coordinate.
* @return The max speed of the current rail.
*/
public float getRailMaxSpeed(World world, EntityMinecart cart, int y, int x, int z)
{
return 0.4f;
}
/**
* This function is called by any minecart that passes over this rail.
* It is called once per update tick that the minecart is on the rail.
* @param world The world.
* @param cart The cart on the rail.
* @param y The rail X coordinate.
* @param x The rail Y coordinate.
* @param z The rail Z coordinate.
*/
public void onMinecartPass(World world, EntityMinecart cart, int y, int x, int z)
{
}
/**
* Forge: Moved render type to a field and a setter.
* This allows for a mod to change the render type
* for vanilla rails, and any mod rails that extend
* this class.
*/
private int renderType = 9;
public void setRenderType(int value)
{
renderType = value;
}
/* ======================================== FORGE END =====================================*/
public class Rail
{
private World field_150660_b;
private int field_150661_c;
private int field_150658_d;
private int field_150659_e;
private final boolean field_150656_f;
private List field_150657_g = new ArrayList();
private static final String __OBFID = "CL_00000196";
private final boolean canMakeSlopes;
public Rail(World p_i45388_2_, int p_i45388_3_, int p_i45388_4_, int p_i45388_5_)
{
this.field_150660_b = p_i45388_2_;
this.field_150661_c = p_i45388_3_;
this.field_150658_d = p_i45388_4_;
this.field_150659_e = p_i45388_5_;
BlockOmniRailBase block = (BlockOmniRailBase)p_i45388_2_.getBlock(p_i45388_3_, p_i45388_4_, p_i45388_5_);
int l = block.getBasicRailMetadata(p_i45388_2_, null, p_i45388_3_, p_i45388_4_, p_i45388_5_);
this.field_150656_f = !block.isFlexibleRail(p_i45388_2_, p_i45388_3_, p_i45388_4_, p_i45388_5_);
canMakeSlopes = block.canMakeSlopes(p_i45388_2_, p_i45388_3_, p_i45388_4_, p_i45388_5_);
this.func_150648_a(l);
}
private boolean func_150652_b(int p_150652_1_, int p_150652_2_, int p_150652_3_)
{
for (int l = 0; l < this.field_150657_g.size(); ++l)
{
ChunkPosition chunkposition = (ChunkPosition)this.field_150657_g.get(l);
Jan 13 2015: I finally got my tile entity stuff to work after struggling with it for a week. Yay
what this mostly means is that now I can finally start making this mod work the way it is supposed to
UPDATE: I have just recently actually began development on this
Current Version: 0.0.0.0.0.0.0.1 (i.e. nothing really works yet)
In lieu of that, I shall press on in development in case anyone still cares about this being made (I do!).
screenie showing...uhhh something or other
What is the first thing I and (hopefully) others thought when we saw minecarts and rails?
HECK YEAH ROLLERCOASTERS!!! Buuut as most of us mortals know, the majority of coasters we make turn out lame.
All that will change with this mod I am creating (I again, hope)
At the core of this mod lies the Omnirail. Able to be placed on any side of a block it is the mother of all rails that will allow infinetely more creative and interesting coasters or simple transportation rides.
If you don't like the textures please tell me. I made them pretty quickly and I'm not too good at graphic art and stuff.
It is crafted as follows:
This part may or may not be done...depends on how well I end up enjoying modding
There will be many more things added to this mod most notably will be many "macrorails" so to speak, such as loops, rolls, and dives.
I will look at all community suggestions for more "macrorails," but please include a description of your idea and a picture would definently be helpful so I can understand what your saying and make a 3d model from it.
Thanks in advance for your support
Oh yeah this mod is currently being developed by me(alexbenh) and krispycheez
Note:as this is my first mod and I'm also just now learning java it will likely take some time to create, but don't worry because krispycheez knows a lot more java then me.
http://kck.st/PzXxKA 'Nuff Said
http://kck.st/PzXxKA 'Nuff Said
http://kck.st/PzXxKA 'Nuff Said
I have however thought of how to approach this which would be as follows:
1.create the omnirail block and allow it to be placed on any side of a block and rotate the texture and bounding box accordingly
2.change the rail logic so minecraft can figure out how to connect floor rails to wall rails and know how to use the turn texture correctly on the wall/roof rails
3.change the minecart logic so it knows how to run along these new rails
4.(optional but I would like this) change minecart physics to treat wall rails going up vertically to bring the cart down instead of treating them as flat rails
5.(this may be the hardest part but Im not sure) create a way to add the "macrorails" in
6.(another optional one) make the player model flip and rotate according to the cart's orientation
http://kck.st/PzXxKA 'Nuff Said
hopefully someone reads this in the near future, I am having issues with my mod right now. I wanted to be able to add some custom metadata values to my rail so instead of using the original BlockRailBase.class I copied it and renamed it to BlockOmniRailBase.class. Unfortuantely, now my game crashes shortly after a world load, or immediatly if I try to place my block. Do I need to register this new class or something?
my class, mostly the same as BlockRailBase.class but I dont think its the changes I made that causes it to crash...could it also need to be placed somewhere special since it is neither the base class for my mod or a block/item
import static net.minecraftforge.common.util.ForgeDirection.DOWN;
import static net.minecraftforge.common.util.ForgeDirection.EAST;
import static net.minecraftforge.common.util.ForgeDirection.NORTH;
import static net.minecraftforge.common.util.ForgeDirection.SOUTH;
import static net.minecraftforge.common.util.ForgeDirection.UP;
import static net.minecraftforge.common.util.ForgeDirection.WEST;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.item.EntityMinecart;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.Vec3;
import net.minecraft.world.ChunkPosition;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
public abstract class BlockOmniRailBase extends Block
{
protected final boolean field_150053_a;
private static final String __OBFID = "CL_00000195";
public static final boolean func_150049_b_(World p_150049_0_, int p_150049_1_, int p_150049_2_, int p_150049_3_)
{
return func_150051_a(p_150049_0_.getBlock(p_150049_1_, p_150049_2_, p_150049_3_));
}
public static final boolean func_150051_a(Block p_150051_0_)
{
return p_150051_0_ instanceof BlockOmniRailBase;
}
protected BlockOmniRailBase(boolean p_i45389_1_)
{
super(Material.circuits);
this.field_150053_a = p_i45389_1_;
this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.125F, 1.0F);
this.setCreativeTab(CreativeTabs.tabTransport);
}
/**
* Returns true if the block is power related rail.
*/
public boolean isPowered()
{
return this.field_150053_a;
}
/**
* Returns a bounding box from the pool of bounding boxes (this means this box can change after the pool has been
* cleared to be reused)
*/
public AxisAlignedBB getCollisionBoundingBoxFromPool(World p_149668_1_, int p_149668_2_, int p_149668_3_, int p_149668_4_)
{
return null;
}
/**
* Is this block (a) opaque and (b) a full 1m cube? This determines whether or not to render the shared face of two
* adjacent blocks and also whether the player can attach torches, redstone wire, etc to this block.
*/
public boolean isOpaqueCube()
{
return false;
}
/**
* Ray traces through the blocks collision from start vector to end vector returning a ray trace hit. Args: world,
* x, y, z, startVec, endVec
*/
public MovingObjectPosition collisionRayTrace(World p_149731_1_, int p_149731_2_, int p_149731_3_, int p_149731_4_, Vec3 p_149731_5_, Vec3 p_149731_6_)
{
this.setBlockBoundsBasedOnState(p_149731_1_, p_149731_2_, p_149731_3_, p_149731_4_);
return super.collisionRayTrace(p_149731_1_, p_149731_2_, p_149731_3_, p_149731_4_, p_149731_5_, p_149731_6_);
}
/**
* Updates the blocks bounds based on its current state. Args: world, x, y, z
*/
public void setBlockBoundsBasedOnState(IBlockAccess p_149719_1_, int x, int y, int z)
{
int side = p_149719_1_.getBlockMetadata(x, y, z);
//System.out.println("Meta is:" + side);
if(side == 0 || side == 1 || (side >= 6 && side <=9)) {
//if(block is placed on face x,z (ground) facing up
this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.125F, 1.0F);
//System.out.println("UP");
}
//finish these
/*else if(side == DOWN) {
//if block is placed on face x,z facing down
this.setBlockBounds(0.0F, 1.0F - 0.125F, 0.0F, 1.0F, 1.0F, 1.0F);
//System.out.println("DOWN");
}
else if(side == SOUTH) {
//if block is placed on face x,y facing south
this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 0.125F);
//System.out.println("SOUTH");
}
else if(side == NORTH) {
//if block is placed on face x,y facing north
this.setBlockBounds(0.0F, 0.0F, 1.0F-0.125F, 1.0F, 1.0F, 1.0F);
//System.out.println("NORTH");
}
else if(side == WEST) {
//if block is placed on face y,z facing west
this.setBlockBounds(1.0F-0.125F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
//System.out.println("WEST");
}
else if(side == EAST) {
//if block is placed on face y,z facing east
this.setBlockBounds(0.0F, 0.0F, 0.0F, 0.125F, 1.0F, 1.0F);
//System.out.println("EAST");
}*/
}
/**
* If this block doesn't render as an ordinary block it will return False (examples: signs, buttons, stairs, etc)
*/
public boolean renderAsNormalBlock()
{
return false;
}
/**
* The type of render function that is called for this block
*/
public int getRenderType()
{
return renderType;
}
/**
* Returns the quantity of items to drop on block destruction.
*/
public int quantityDropped(Random p_149745_1_)
{
return 1;
}
/**
* Checks to see if its valid to put this block at the specified coordinates. Args: world, x, y, z
*/
//overrides to allow for wall and ceiling placement (works )
public boolean canPlaceBlockAt(World p_149742_1_, int p_149742_2_, int p_149742_3_, int p_149742_4_)
{
return p_149742_1_.isSideSolid(p_149742_2_ - 1, p_149742_3_, p_149742_4_, EAST ) ||
p_149742_1_.isSideSolid(p_149742_2_ + 1, p_149742_3_, p_149742_4_, WEST ) ||
p_149742_1_.isSideSolid(p_149742_2_, p_149742_3_, p_149742_4_ - 1, SOUTH) ||
p_149742_1_.isSideSolid(p_149742_2_, p_149742_3_, p_149742_4_ + 1, NORTH) ||
p_149742_1_.isSideSolid(p_149742_2_, p_149742_3_ - 1, p_149742_4_, UP ) ||
p_149742_1_.isSideSolid(p_149742_2_, p_149742_3_ + 1, p_149742_4_, DOWN );
}
public boolean canPlaceBlockOnSide(World p_149707_1_, int p_149707_2_, int p_149707_3_, int p_149707_4_, int p_149707_5_)
{
ForgeDirection dir = ForgeDirection.getOrientation(p_149707_5_);
if((dir == DOWN && p_149707_1_.isSideSolid(p_149707_2_, p_149707_3_ + 1, p_149707_4_, DOWN )) ||
(dir == UP && p_149707_1_.isSideSolid(p_149707_2_, p_149707_3_ - 1, p_149707_4_, UP )) ||
(dir == NORTH && p_149707_1_.isSideSolid(p_149707_2_, p_149707_3_, p_149707_4_ + 1, NORTH)) ||
(dir == SOUTH && p_149707_1_.isSideSolid(p_149707_2_, p_149707_3_, p_149707_4_ - 1, SOUTH)) ||
(dir == WEST && p_149707_1_.isSideSolid(p_149707_2_ + 1, p_149707_3_, p_149707_4_, WEST )) ||
(dir == EAST && p_149707_1_.isSideSolid(p_149707_2_ - 1, p_149707_3_, p_149707_4_, EAST ))) {
//currentSideOn = dir; //replaced with onBlockPlaced method
return true;
}
return false;
}
/**
* Called whenever the block is added into the world. Args: world, x, y, z
*/
public void onBlockAdded(World p_149726_1_, int p_149726_2_, int p_149726_3_, int p_149726_4_)
{
if (!p_149726_1_.isRemote)
{
this.func_150052_a(p_149726_1_, p_149726_2_, p_149726_3_, p_149726_4_, true);
if (this.field_150053_a)
{
this.onNeighborBlockChange(p_149726_1_, p_149726_2_, p_149726_3_, p_149726_4_, this);
}
}
}
//for metadata stuff...I think
public int damageDropped(int meta)
{
return meta;
}
/**
* 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 Block
*/
public void onNeighborBlockChange(World p_149695_1_, int p_149695_2_, int p_149695_3_, int p_149695_4_, Block p_149695_5_)
{
//do nothing for now
}
protected void func_150048_a(World p_150048_1_, int p_150048_2_, int p_150048_3_, int p_150048_4_, int p_150048_5_, int p_150048_6_, Block p_150048_7_) {}
protected void func_150052_a(World p_150052_1_, int p_150052_2_, int p_150052_3_, int p_150052_4_, boolean p_150052_5_)
{
if (!p_150052_1_.isRemote)
{
(new BlockOmniRailBase.Rail(p_150052_1_, p_150052_2_, p_150052_3_, p_150052_4_)).func_150655_a(p_150052_1_.isBlockIndirectlyGettingPowered(p_150052_2_, p_150052_3_, p_150052_4_), p_150052_5_);
}
}
/**
* Returns the mobility information of the block, 0 = free, 1 = can't push but can move over, 2 = total immobility
* and stop pistons
*/
public int getMobilityFlag()
{
return 0;
}
public void breakBlock(World p_149749_1_, int p_149749_2_, int p_149749_3_, int p_149749_4_, Block p_149749_5_, int p_149749_6_)
{
int i1 = p_149749_6_;
if (this.field_150053_a)
{
i1 = p_149749_6_ & 7;
}
super.breakBlock(p_149749_1_, p_149749_2_, p_149749_3_, p_149749_4_, p_149749_5_, p_149749_6_);
if (i1 == 2 || i1 == 3 || i1 == 4 || i1 == 5)
{
p_149749_1_.notifyBlocksOfNeighborChange(p_149749_2_, p_149749_3_ + 1, p_149749_4_, p_149749_5_);
}
if (this.field_150053_a)
{
p_149749_1_.notifyBlocksOfNeighborChange(p_149749_2_, p_149749_3_, p_149749_4_, p_149749_5_);
p_149749_1_.notifyBlocksOfNeighborChange(p_149749_2_, p_149749_3_ - 1, p_149749_4_, p_149749_5_);
}
}
/* ======================================== FORGE START =====================================*/
/**
* Return true if the rail can make corners.
* Used by placement logic.
* @param world The world.
* @param x The rail X coordinate.
* @param y The rail Y coordinate.
* @param z The rail Z coordinate.
* @return True if the rail can make corners.
*/
public boolean isFlexibleRail(IBlockAccess world, int y, int x, int z)
{
return !isPowered();
}
/**
* Returns true if the rail can make up and down slopes.
* Used by placement logic.
* @param world The world.
* @param x The rail X coordinate.
* @param y The rail Y coordinate.
* @param z The rail Z coordinate.
* @return True if the rail can make slopes.
*/
public boolean canMakeSlopes(IBlockAccess world, int x, int y, int z)
{
return true;
}
/**
* Return the rail's metadata (without the power bit if the rail uses one).
* Can be used to make the cart think the rail something other than it is,
* for example when making diamond junctions or switches.
* The cart parameter will often be null unless it it called from EntityMinecart.
*
* Valid rail metadata is defined as follows:
* 0x0: flat track going North-South
* 0x1: flat track going West-East
* 0x2: track ascending to the East
* 0x3: track ascending to the West
* 0x4: track ascending to the North
* 0x5: track ascending to the South
* 0x6: WestNorth corner (connecting East and South)
* 0x7: EastNorth corner (connecting West and South)
* 0x8: EastSouth corner (connecting West and North)
* 0x9: WestSouth corner (connecting East and North)
*
* @param world The world.
* @param cart The cart asking for the metadata, null if it is not called by EntityMinecart.
* @param y The rail X coordinate.
* @param x The rail Y coordinate.
* @param z The rail Z coordinate.
* @return The metadata.
*/
public int getBasicRailMetadata(IBlockAccess world, EntityMinecart cart, int x, int y, int z)
{
int meta = world.getBlockMetadata(x, y, z);
if(isPowered())
{
meta = meta & 7;
}
return meta;
}
/**
* Returns the max speed of the rail at the specified position.
* @param world The world.
* @param cart The cart on the rail, may be null.
* @param x The rail X coordinate.
* @param y The rail Y coordinate.
* @param z The rail Z coordinate.
* @return The max speed of the current rail.
*/
public float getRailMaxSpeed(World world, EntityMinecart cart, int y, int x, int z)
{
return 0.4f;
}
/**
* This function is called by any minecart that passes over this rail.
* It is called once per update tick that the minecart is on the rail.
* @param world The world.
* @param cart The cart on the rail.
* @param y The rail X coordinate.
* @param x The rail Y coordinate.
* @param z The rail Z coordinate.
*/
public void onMinecartPass(World world, EntityMinecart cart, int y, int x, int z)
{
}
/**
* Forge: Moved render type to a field and a setter.
* This allows for a mod to change the render type
* for vanilla rails, and any mod rails that extend
* this class.
*/
private int renderType = 9;
public void setRenderType(int value)
{
renderType = value;
}
/* ======================================== FORGE END =====================================*/
public class Rail
{
private World field_150660_b;
private int field_150661_c;
private int field_150658_d;
private int field_150659_e;
private final boolean field_150656_f;
private List field_150657_g = new ArrayList();
private static final String __OBFID = "CL_00000196";
private final boolean canMakeSlopes;
public Rail(World p_i45388_2_, int p_i45388_3_, int p_i45388_4_, int p_i45388_5_)
{
this.field_150660_b = p_i45388_2_;
this.field_150661_c = p_i45388_3_;
this.field_150658_d = p_i45388_4_;
this.field_150659_e = p_i45388_5_;
BlockOmniRailBase block = (BlockOmniRailBase)p_i45388_2_.getBlock(p_i45388_3_, p_i45388_4_, p_i45388_5_);
int l = block.getBasicRailMetadata(p_i45388_2_, null, p_i45388_3_, p_i45388_4_, p_i45388_5_);
this.field_150656_f = !block.isFlexibleRail(p_i45388_2_, p_i45388_3_, p_i45388_4_, p_i45388_5_);
canMakeSlopes = block.canMakeSlopes(p_i45388_2_, p_i45388_3_, p_i45388_4_, p_i45388_5_);
this.func_150648_a(l);
}
private void func_150648_a(int p_150648_1_)
{
this.field_150657_g.clear();
if (p_150648_1_ == 0)
{
this.field_150657_g.add(new ChunkPosition(this.field_150661_c, this.field_150658_d, this.field_150659_e - 1));
this.field_150657_g.add(new ChunkPosition(this.field_150661_c, this.field_150658_d, this.field_150659_e + 1));
}
else if (p_150648_1_ == 1)
{
this.field_150657_g.add(new ChunkPosition(this.field_150661_c - 1, this.field_150658_d, this.field_150659_e));
this.field_150657_g.add(new ChunkPosition(this.field_150661_c + 1, this.field_150658_d, this.field_150659_e));
}
else if (p_150648_1_ == 2)
{
this.field_150657_g.add(new ChunkPosition(this.field_150661_c - 1, this.field_150658_d, this.field_150659_e));
this.field_150657_g.add(new ChunkPosition(this.field_150661_c + 1, this.field_150658_d + 1, this.field_150659_e));
}
else if (p_150648_1_ == 3)
{
this.field_150657_g.add(new ChunkPosition(this.field_150661_c - 1, this.field_150658_d + 1, this.field_150659_e));
this.field_150657_g.add(new ChunkPosition(this.field_150661_c + 1, this.field_150658_d, this.field_150659_e));
}
else if (p_150648_1_ == 4)
{
this.field_150657_g.add(new ChunkPosition(this.field_150661_c, this.field_150658_d + 1, this.field_150659_e - 1));
this.field_150657_g.add(new ChunkPosition(this.field_150661_c, this.field_150658_d, this.field_150659_e + 1));
}
else if (p_150648_1_ == 5)
{
this.field_150657_g.add(new ChunkPosition(this.field_150661_c, this.field_150658_d, this.field_150659_e - 1));
this.field_150657_g.add(new ChunkPosition(this.field_150661_c, this.field_150658_d + 1, this.field_150659_e + 1));
}
else if (p_150648_1_ == 6)
{
this.field_150657_g.add(new ChunkPosition(this.field_150661_c + 1, this.field_150658_d, this.field_150659_e));
this.field_150657_g.add(new ChunkPosition(this.field_150661_c, this.field_150658_d, this.field_150659_e + 1));
}
else if (p_150648_1_ == 7)
{
this.field_150657_g.add(new ChunkPosition(this.field_150661_c - 1, this.field_150658_d, this.field_150659_e));
this.field_150657_g.add(new ChunkPosition(this.field_150661_c, this.field_150658_d, this.field_150659_e + 1));
}
else if (p_150648_1_ == 8)
{
this.field_150657_g.add(new ChunkPosition(this.field_150661_c - 1, this.field_150658_d, this.field_150659_e));
this.field_150657_g.add(new ChunkPosition(this.field_150661_c, this.field_150658_d, this.field_150659_e - 1));
}
else if (p_150648_1_ == 9)
{
this.field_150657_g.add(new ChunkPosition(this.field_150661_c + 1, this.field_150658_d, this.field_150659_e));
this.field_150657_g.add(new ChunkPosition(this.field_150661_c, this.field_150658_d, this.field_150659_e - 1));
}
}
private void func_150651_b()
{
for (int i = 0; i < this.field_150657_g.size(); ++i)
{
BlockOmniRailBase.Rail rail = this.func_150654_a((ChunkPosition)this.field_150657_g.get(i));
if (rail != null && rail.func_150653_a(this))
{
this.field_150657_g.set(i, new ChunkPosition(rail.field_150661_c, rail.field_150658_d, rail.field_150659_e));
}
else
{
this.field_150657_g.remove(i--);
}
}
}
private boolean func_150646_a(int p_150646_1_, int p_150646_2_, int p_150646_3_)
{
return BlockOmniRailBase.func_150049_b_(this.field_150660_b, p_150646_1_, p_150646_2_, p_150646_3_) ? true : (BlockOmniRailBase.func_150049_b_(this.field_150660_b, p_150646_1_, p_150646_2_ + 1, p_150646_3_) ? true : BlockOmniRailBase.func_150049_b_(this.field_150660_b, p_150646_1_, p_150646_2_ - 1, p_150646_3_));
}
private BlockOmniRailBase.Rail func_150654_a(ChunkPosition p_150654_1_)
{
return BlockOmniRailBase.func_150049_b_(this.field_150660_b, p_150654_1_.chunkPosX, p_150654_1_.chunkPosY, p_150654_1_.chunkPosZ) ? BlockOmniRailBase.this.new Rail(this.field_150660_b, p_150654_1_.chunkPosX, p_150654_1_.chunkPosY, p_150654_1_.chunkPosZ) : (BlockOmniRailBase.func_150049_b_(this.field_150660_b, p_150654_1_.chunkPosX, p_150654_1_.chunkPosY + 1, p_150654_1_.chunkPosZ) ? BlockOmniRailBase.this.new Rail(this.field_150660_b, p_150654_1_.chunkPosX, p_150654_1_.chunkPosY + 1, p_150654_1_.chunkPosZ) : (BlockOmniRailBase.func_150049_b_(this.field_150660_b, p_150654_1_.chunkPosX, p_150654_1_.chunkPosY - 1, p_150654_1_.chunkPosZ) ? BlockOmniRailBase.this.new Rail(this.field_150660_b, p_150654_1_.chunkPosX, p_150654_1_.chunkPosY - 1, p_150654_1_.chunkPosZ) : null));
}
private boolean func_150653_a(BlockOmniRailBase.Rail p_150653_1_)
{
for (int i = 0; i < this.field_150657_g.size(); ++i)
{
ChunkPosition chunkposition = (ChunkPosition)this.field_150657_g.get(i);
if (chunkposition.chunkPosX == p_150653_1_.field_150661_c && chunkposition.chunkPosZ == p_150653_1_.field_150659_e)
{
return true;
}
}
return false;
}
private boolean func_150652_b(int p_150652_1_, int p_150652_2_, int p_150652_3_)
{
for (int l = 0; l < this.field_150657_g.size(); ++l)
{
ChunkPosition chunkposition = (ChunkPosition)this.field_150657_g.get(l);
if (chunkposition.chunkPosX == p_150652_1_ && chunkposition.chunkPosZ == p_150652_3_)
{
return true;
}
}
return false;
}
protected int func_150650_a()
{
int i = 0;
if (this.func_150646_a(this.field_150661_c, this.field_150658_d, this.field_150659_e - 1))
{
++i;
}
if (this.func_150646_a(this.field_150661_c, this.field_150658_d, this.field_150659_e + 1))
{
++i;
}
if (this.func_150646_a(this.field_150661_c - 1, this.field_150658_d, this.field_150659_e))
{
++i;
}
if (this.func_150646_a(this.field_150661_c + 1, this.field_150658_d, this.field_150659_e))
{
++i;
}
return i;
}
private boolean func_150649_b(BlockOmniRailBase.Rail p_150649_1_)
{
return this.func_150653_a(p_150649_1_) ? true : (this.field_150657_g.size() == 2 ? false : (this.field_150657_g.isEmpty() ? true : true));
}
private void func_150645_c(BlockOmniRailBase.Rail p_150645_1_)
{
this.field_150657_g.add(new ChunkPosition(p_150645_1_.field_150661_c, p_150645_1_.field_150658_d, p_150645_1_.field_150659_e));
boolean flag = this.func_150652_b(this.field_150661_c, this.field_150658_d, this.field_150659_e - 1);
boolean flag1 = this.func_150652_b(this.field_150661_c, this.field_150658_d, this.field_150659_e + 1);
boolean flag2 = this.func_150652_b(this.field_150661_c - 1, this.field_150658_d, this.field_150659_e);
boolean flag3 = this.func_150652_b(this.field_150661_c + 1, this.field_150658_d, this.field_150659_e);
byte b0 = -1;
if (flag || flag1)
{
b0 = 0;
}
if (flag2 || flag3)
{
b0 = 1;
}
if (!this.field_150656_f)
{
if (flag1 && flag3 && !flag && !flag2)
{
b0 = 6;
}
if (flag1 && flag2 && !flag && !flag3)
{
b0 = 7;
}
if (flag && flag2 && !flag1 && !flag3)
{
b0 = 8;
}
if (flag && flag3 && !flag1 && !flag2)
{
b0 = 9;
}
}
if (b0 == 0 && canMakeSlopes)
{
if (BlockOmniRailBase.func_150049_b_(this.field_150660_b, this.field_150661_c, this.field_150658_d + 1, this.field_150659_e - 1))
{
b0 = 4;
}
if (BlockOmniRailBase.func_150049_b_(this.field_150660_b, this.field_150661_c, this.field_150658_d + 1, this.field_150659_e + 1))
{
b0 = 5;
}
}
if (b0 == 1 && canMakeSlopes)
{
if (BlockOmniRailBase.func_150049_b_(this.field_150660_b, this.field_150661_c + 1, this.field_150658_d + 1, this.field_150659_e))
{
b0 = 2;
}
if (BlockOmniRailBase.func_150049_b_(this.field_150660_b, this.field_150661_c - 1, this.field_150658_d + 1, this.field_150659_e))
{
b0 = 3;
}
}
if (b0 < 0)
{
b0 = 0;
}
int i = b0;
if (this.field_150656_f)
{
i = this.field_150660_b.getBlockMetadata(this.field_150661_c, this.field_150658_d, this.field_150659_e) & 8 | b0;
}
this.field_150660_b.setBlockMetadataWithNotify(this.field_150661_c, this.field_150658_d, this.field_150659_e, i, 3);
}
private boolean func_150647_c(int p_150647_1_, int p_150647_2_, int p_150647_3_)
{
BlockOmniRailBase.Rail rail = this.func_150654_a(new ChunkPosition(p_150647_1_, p_150647_2_, p_150647_3_));
if (rail == null)
{
return false;
}
else
{
rail.func_150651_b();
return rail.func_150649_b(this);
}
}
public void func_150655_a(boolean p_150655_1_, boolean p_150655_2_)
{
boolean flag2 = this.func_150647_c(this.field_150661_c, this.field_150658_d, this.field_150659_e - 1);
boolean flag3 = this.func_150647_c(this.field_150661_c, this.field_150658_d, this.field_150659_e + 1);
boolean flag4 = this.func_150647_c(this.field_150661_c - 1, this.field_150658_d, this.field_150659_e);
boolean flag5 = this.func_150647_c(this.field_150661_c + 1, this.field_150658_d, this.field_150659_e);
byte b0 = -1;
if ((flag2 || flag3) && !flag4 && !flag5)
{
b0 = 0;
}
if ((flag4 || flag5) && !flag2 && !flag3)
{
b0 = 1;
}
if (!this.field_150656_f)
{
if (flag3 && flag5 && !flag2 && !flag4)
{
b0 = 6;
}
if (flag3 && flag4 && !flag2 && !flag5)
{
b0 = 7;
}
if (flag2 && flag4 && !flag3 && !flag5)
{
b0 = 8;
}
if (flag2 && flag5 && !flag3 && !flag4)
{
b0 = 9;
}
}
if (b0 == -1)
{
if (flag2 || flag3)
{
b0 = 0;
}
if (flag4 || flag5)
{
b0 = 1;
}
if (!this.field_150656_f)
{
if (p_150655_1_)
{
if (flag3 && flag5)
{
b0 = 6;
}
if (flag4 && flag3)
{
b0 = 7;
}
if (flag5 && flag2)
{
b0 = 9;
}
if (flag2 && flag4)
{
b0 = 8;
}
}
else
{
if (flag2 && flag4)
{
b0 = 8;
}
if (flag5 && flag2)
{
b0 = 9;
}
if (flag4 && flag3)
{
b0 = 7;
}
if (flag3 && flag5)
{
b0 = 6;
}
}
}
}
if (b0 == 0 && canMakeSlopes)
{
if (BlockOmniRailBase.func_150049_b_(this.field_150660_b, this.field_150661_c, this.field_150658_d + 1, this.field_150659_e - 1))
{
b0 = 4;
}
if (BlockOmniRailBase.func_150049_b_(this.field_150660_b, this.field_150661_c, this.field_150658_d + 1, this.field_150659_e + 1))
{
b0 = 5;
}
}
if (b0 == 1 && canMakeSlopes)
{
if (BlockOmniRailBase.func_150049_b_(this.field_150660_b, this.field_150661_c + 1, this.field_150658_d + 1, this.field_150659_e))
{
b0 = 2;
}
if (BlockOmniRailBase.func_150049_b_(this.field_150660_b, this.field_150661_c - 1, this.field_150658_d + 1, this.field_150659_e))
{
b0 = 3;
}
}
if (b0 < 0)
{
b0 = 0;
}
this.func_150648_a(b0);
int i = b0;
if (this.field_150656_f)
{
i = this.field_150660_b.getBlockMetadata(this.field_150661_c, this.field_150658_d, this.field_150659_e) & 8 | b0;
}
if (p_150655_2_ || this.field_150660_b.getBlockMetadata(this.field_150661_c, this.field_150658_d, this.field_150659_e) != i)
{
this.field_150660_b.setBlockMetadataWithNotify(this.field_150661_c, this.field_150658_d, this.field_150659_e, i, 3);
for (int j = 0; j < this.field_150657_g.size(); ++j)
{
BlockOmniRailBase.Rail rail = this.func_150654_a((ChunkPosition)this.field_150657_g.get(j));
if (rail != null)
{
rail.func_150651_b();
if (rail.func_150649_b(this))
{
rail.func_150645_c(this);
}
}
}
}
}
}
}
http://kck.st/PzXxKA 'Nuff Said