ForgePatch/patches/minecraft/net/minecraft/src/RailLogic.java.patch

90 lines
2.6 KiB
Diff

--- ../src_base/minecraft/net/minecraft/src/RailLogic.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/RailLogic.java 0000-00-00 00:00:00.000000000 -0000
@@ -3,7 +3,7 @@
import java.util.ArrayList;
import java.util.List;
-class RailLogic
+public class RailLogic
{
/** Reference to the World object. */
private World worldObj;
@@ -18,6 +18,7 @@
private List connectedTracks;
final BlockRail rail;
+ private final boolean canMakeSlopes;
public RailLogic(BlockRail par1BlockRail, World par2World, int par3, int par4, int par5)
{
@@ -28,18 +29,12 @@
this.trackY = par4;
this.trackZ = par5;
int var6 = par2World.getBlockId(par3, par4, par5);
- int var7 = par2World.getBlockMetadata(par3, par4, par5);
-
- if (BlockRail.isPoweredBlockRail((BlockRail)Block.blocksList[var6]))
- {
- this.isPoweredRail = true;
- var7 &= -9;
- }
- else
- {
- this.isPoweredRail = false;
- }
-
+
+ BlockRail target = (BlockRail)Block.blocksList[var6];
+ int var7 = target.getBasicRailMetadata(par2World, null, par3, par4, par5);
+ isPoweredRail = !target.isFlexibleRail(par2World, par3, par4, par5);
+ canMakeSlopes = target.canMakeSlopes(par2World, par3, par4, par5);
+
this.setConnections(var7);
}
@@ -258,7 +253,7 @@
}
}
- if (var6 == 0)
+ if (var6 == 0 && canMakeSlopes)
{
if (BlockRail.isRailBlockAt(this.worldObj, this.trackX, this.trackY + 1, this.trackZ - 1))
{
@@ -271,7 +266,7 @@
}
}
- if (var6 == 1)
+ if (var6 == 1 && canMakeSlopes)
{
if (BlockRail.isRailBlockAt(this.worldObj, this.trackX + 1, this.trackY + 1, this.trackZ))
{
@@ -422,7 +417,7 @@
}
}
- if (var7 == 0)
+ if (var7 == 0 && canMakeSlopes)
{
if (BlockRail.isRailBlockAt(this.worldObj, this.trackX, this.trackY + 1, this.trackZ - 1))
{
@@ -435,7 +430,7 @@
}
}
- if (var7 == 1)
+ if (var7 == 1 && canMakeSlopes)
{
if (BlockRail.isRailBlockAt(this.worldObj, this.trackX + 1, this.trackY + 1, this.trackZ))
{
@@ -485,7 +480,7 @@
/**
* get number of adjacent tracks
*/
- static int getNAdjacentTracks(RailLogic par0RailLogic)
+ public static int getNAdjacentTracks(RailLogic par0RailLogic)
{
return par0RailLogic.getAdjacentTracks();
}