MORE EXPERIMENTAL FIXES
- Updated the setup batch file for windows. - Added a setup bash file for Linux distros with apt support. - Experimental overhaul to rail item, should hopefully fix some bugs related to worldguard.
This commit is contained in:
parent
c206d9040b
commit
fd3e3b76d3
3 changed files with 335 additions and 267 deletions
240
setup.bat
240
setup.bat
|
@ -1,126 +1,114 @@
|
|||
:restart
|
||||
@echo off
|
||||
@ECHO ##########################################################################
|
||||
@ECHO.
|
||||
@ECHO Gradle startup script for Windows
|
||||
@ECHO This is to prepare the source for use with an IDE.
|
||||
@ECHO Optionally you may compile the .jar as well.
|
||||
@ECHO.
|
||||
@ECHO ##########################################################################
|
||||
|
||||
@ECHO Choose an IDE:
|
||||
@ECHO [1] Eclipse
|
||||
@ECHO [2] Idea (Intelij)
|
||||
@ECHO [3] Build the source.
|
||||
@echo off
|
||||
@ECHO.
|
||||
@ECHO.
|
||||
:tryagain
|
||||
set /p variable=""
|
||||
IF "%variable%"=="1" (goto eclipse)
|
||||
IF "%variable%"=="eclipse" (goto eclipse)
|
||||
IF "%variable%"=="Eclipse" (goto eclipse)
|
||||
|
||||
IF "%variable%"=="2" (goto intelij)
|
||||
IF "%variable%"=="Intelij" (goto intelij)
|
||||
IF "%variable%"=="intelij" (goto intelij)
|
||||
IF "%variable%"=="idea" (goto intelij)
|
||||
IF "%variable%"=="Idea" (goto intelij)
|
||||
|
||||
IF "%variable%"=="3" (goto build)
|
||||
|
||||
pause
|
||||
@ECHO Incorrect option, try again.
|
||||
goto tryagain
|
||||
|
||||
|
||||
|
||||
:eclipse
|
||||
@echo on
|
||||
start call gradlew setupDecompWorkspace --refresh-dependencies
|
||||
@echo off
|
||||
@ECHO.
|
||||
@ECHO.
|
||||
@ ECHO After the other window finishes, close it and
|
||||
pause
|
||||
@echo on
|
||||
start call gradlew eclipse
|
||||
@echo off
|
||||
@ECHO.
|
||||
@ECHO.
|
||||
@ ECHO After the other window finishes, close it and
|
||||
pause
|
||||
|
||||
@ECHO ##########################################################################
|
||||
@ECHO.
|
||||
@ECHO Mod is ready to be opened in Eclipse.
|
||||
@ECHO You may open the project via gradle or directory import.
|
||||
@ECHO NOTICE: if you get an error asking you to select a deobfuscateor, you can find this in:
|
||||
@ECHO %USERPROFILE%/.gradle/caches/minecraft/net/minecraftforge/forge/FORGEVERSION/unpacked/conf
|
||||
@ECHO.
|
||||
@ECHO You may now exit this window.
|
||||
@ECHO.
|
||||
@ECHO ##########################################################################
|
||||
|
||||
pause
|
||||
|
||||
goto quit
|
||||
|
||||
|
||||
:intelij
|
||||
@echo on
|
||||
start call gradlew setupDecompWorkspace --refresh-dependencies
|
||||
@echo off
|
||||
@ECHO.
|
||||
@ECHO.
|
||||
@ ECHO After the other window finishes, close it and
|
||||
pause
|
||||
@echo on
|
||||
start call gradlew idea
|
||||
@echo off
|
||||
@ECHO.
|
||||
@ECHO.
|
||||
@ ECHO After the other window finishes, close it and
|
||||
pause
|
||||
|
||||
@ECHO ##########################################################################
|
||||
@ECHO.
|
||||
@ECHO Mod is ready to be opened in Intelij/Idea.
|
||||
@ECHO You may open the project via gradle import or via: Traincraft-5.ipr
|
||||
@ECHO NOTICE: if you get an error asking you to select a deobfuscateor, you can find this in:
|
||||
@ECHO %USERPROFILE%/.gradle/caches/minecraft/net/minecraftforge/forge/FORGEVERSION/unpacked/conf
|
||||
@ECHO.
|
||||
@ECHO You may now exit this window.
|
||||
@ECHO.
|
||||
@ECHO ##########################################################################
|
||||
|
||||
pause
|
||||
|
||||
goto quit
|
||||
|
||||
|
||||
:build
|
||||
@echo on
|
||||
start call gradlew build
|
||||
@echo off
|
||||
@ECHO.
|
||||
@ECHO.
|
||||
@ ECHO After the other window finishes, close it and
|
||||
pause
|
||||
|
||||
@ECHO ##########################################################################
|
||||
@ECHO.
|
||||
@ECHO To find the compiled jar file look in /build/lib
|
||||
@ECHO.
|
||||
@ECHO You may now exit this window, or continue to go back to the main menu.
|
||||
@ECHO.
|
||||
@ECHO ##########################################################################
|
||||
|
||||
pause
|
||||
|
||||
goto restart
|
||||
|
||||
|
||||
:quit
|
||||
|
||||
exit
|
||||
:restart
|
||||
@echo off
|
||||
@ECHO ##########################################################################
|
||||
@ECHO.
|
||||
@ECHO Gradle startup script for Windows
|
||||
@ECHO This is to prepare the source for use with an IDE.
|
||||
@ECHO Optionally you may compile the .jar as well.
|
||||
@ECHO Be sure to install JDK 8 for your OS: https://www.oracle.com/technetwork/pt/java/javase/downloads/jdk8-downloads-2133151.html
|
||||
@ECHO Also be sure to set it as your JAVA_HOME: https://docs.oracle.com/cd/E19182-01/820-7851/inst_cli_jdk_javahome_t/
|
||||
@ECHO.
|
||||
@ECHO ##########################################################################
|
||||
|
||||
@ECHO Choose an IDE:
|
||||
@ECHO [1] Eclipse - (Usually does not work)
|
||||
@ECHO [2] Idea (Intelij) - (Does work)
|
||||
@ECHO [3] Build the source.
|
||||
@echo off
|
||||
@ECHO.
|
||||
@ECHO.
|
||||
:tryagain
|
||||
set /p variable=""
|
||||
IF "%variable%"=="1" (goto eclipse)
|
||||
IF "%variable%"=="eclipse" (goto eclipse)
|
||||
IF "%variable%"=="Eclipse" (goto eclipse)
|
||||
|
||||
IF "%variable%"=="2" (goto intelij)
|
||||
IF "%variable%"=="Intelij" (goto intelij)
|
||||
IF "%variable%"=="intelij" (goto intelij)
|
||||
IF "%variable%"=="idea" (goto intelij)
|
||||
IF "%variable%"=="Idea" (goto intelij)
|
||||
|
||||
IF "%variable%"=="3" (goto build)
|
||||
|
||||
pause
|
||||
@ECHO Incorrect option, try again.
|
||||
goto tryagain
|
||||
|
||||
|
||||
|
||||
:eclipse
|
||||
@echo on
|
||||
start call gradlew setupDecompWorkspace --refresh-dependencies eclipse
|
||||
@echo off
|
||||
@ECHO.
|
||||
@ECHO.
|
||||
@ ECHO After the other window finishes, close it and
|
||||
pause
|
||||
|
||||
@ECHO ##########################################################################
|
||||
@ECHO.
|
||||
@ECHO Mod is ready to be opened in Eclipse.
|
||||
@ECHO You may open the project via gradle or directory import.
|
||||
@ECHO NOTICE: if you get an error asking you to select a deobfuscateor, you can find this in:
|
||||
@ECHO %USERPROFILE%/.gradle/caches/minecraft/net/minecraftforge/forge/FORGEVERSION/unpacked/conf
|
||||
@ECHO.
|
||||
@ECHO You may now exit this window.
|
||||
@ECHO.
|
||||
@ECHO ##########################################################################
|
||||
|
||||
pause
|
||||
|
||||
goto quit
|
||||
|
||||
|
||||
:intelij
|
||||
@echo on
|
||||
start call gradlew setupDecompWorkspace --refresh-dependencies idea
|
||||
@echo off
|
||||
@ECHO.
|
||||
@ECHO.
|
||||
@ ECHO After the other window finishes, close it and
|
||||
pause
|
||||
|
||||
@ECHO ##########################################################################
|
||||
@ECHO.
|
||||
@ECHO Mod is ready to be opened in Intelij/Idea.
|
||||
@ECHO You may open the project via gradle import or via: Traincraft-5.ipr
|
||||
@ECHO NOTICE: if you get an error asking you to select a deobfuscateor, you can find this in:
|
||||
@ECHO %USERPROFILE%/.gradle/caches/minecraft/net/minecraftforge/forge/FORGEVERSION/unpacked/conf
|
||||
@ECHO.
|
||||
@ECHO You may now exit this window.
|
||||
@ECHO.
|
||||
@ECHO ##########################################################################
|
||||
|
||||
pause
|
||||
|
||||
goto quit
|
||||
|
||||
|
||||
:build
|
||||
@echo on
|
||||
start call gradlew setupDecompWorkspace --refresh-dependencies build
|
||||
@echo off
|
||||
@ECHO.
|
||||
@ECHO.
|
||||
@ ECHO After the other window finishes, close it and
|
||||
pause
|
||||
|
||||
@ECHO ##########################################################################
|
||||
@ECHO.
|
||||
@ECHO To find the compiled jar file look in /build/lib
|
||||
@ECHO.
|
||||
@ECHO You may now exit this window, or continue to go back to the main menu.
|
||||
@ECHO.
|
||||
@ECHO ##########################################################################
|
||||
|
||||
pause
|
||||
|
||||
goto restart
|
||||
|
||||
|
||||
:quit
|
||||
|
||||
exit
|
||||
|
|
79
setup.sh
Normal file
79
setup.sh
Normal file
|
@ -0,0 +1,79 @@
|
|||
JAVA_VER=$(javac -version 2>&1 | sed -n ';s/.* version "\(.*\)\.\(.*\)\..*"/\1\2/p;')
|
||||
|
||||
echo "JDK version found was:"
|
||||
echo "$JAVA_VER"
|
||||
|
||||
|
||||
if [ "$JAVA_VER" -ge 19 ]
|
||||
then
|
||||
echo "This version is incompatible, 1.9 and later break stuff."
|
||||
ins_j8;;
|
||||
elif [ -z "$JAVA_VER" ]
|
||||
then
|
||||
ins_j8;;
|
||||
elif [ ! "$JAVA_VER" -ge 18 ]
|
||||
then
|
||||
echo "your java version is too old and doesn't support the methods we need."
|
||||
insj8;;
|
||||
fi
|
||||
|
||||
|
||||
|
||||
|
||||
JAVA_VER=$(javac -version 2>&1 | sed -n ';s/.* version "\(.*\)\.\(.*\)\..*"/\1\2/p;')
|
||||
if [ "$JAVA_VER" -ge 18 ]
|
||||
then
|
||||
printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' -
|
||||
|
||||
echo "Choose an option:"
|
||||
echo "1: Setup workspace for eclipse (partial setup)."
|
||||
echo "2: Setup workspace for Intelij IDEA."
|
||||
echo "3: Compile a jar of the mod."
|
||||
|
||||
read -p "" choice
|
||||
case "$choice" in
|
||||
1 )
|
||||
echo "Setting up workspace for Eclipse"
|
||||
./gradlewLinux setupDecompWorkspace --refresh-dependencies eclipse
|
||||
|
||||
;;
|
||||
2 )
|
||||
echo "Setting up workspace for Intelij"
|
||||
./gradlewLinux setupDecompWorkspace --refresh-dependencies idea
|
||||
|
||||
;;
|
||||
3 )
|
||||
echo "Attempting to build jar file"
|
||||
./gradlewLinux setupDecompWorkspace --refresh-dependencies build
|
||||
|
||||
;;
|
||||
|
||||
|
||||
* ) echo "invalid answer";;
|
||||
esac
|
||||
|
||||
|
||||
fi
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
ins_j8() {
|
||||
read -p "Install Oracle Java Development Kit (JDK) 1.8 (y/n)?" choice
|
||||
case "$choice" in
|
||||
y|Y )
|
||||
echo "Installing Oracle JDK 18."
|
||||
sudo add-apt-repository ppa:webupd8team/java
|
||||
sudo apt-get update
|
||||
sudo apt-get install oracle-java8-installer
|
||||
;;
|
||||
n|N )
|
||||
echo "Exiting"
|
||||
[[ "$0" = "$BASH_SOURCE" ]] && exit 1 || return 1;;
|
||||
* ) echo "invalid answer";;
|
||||
esac
|
||||
|
||||
|
||||
}
|
|
@ -17,6 +17,7 @@ import train.common.library.ItemIDs;
|
|||
import train.common.tile.TileTCRail;
|
||||
import train.common.tile.TileTCRailGag;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.List;
|
||||
|
||||
public class ItemTCRail extends ItemPart {
|
||||
|
@ -135,8 +136,13 @@ public class ItemTCRail extends ItemPart {
|
|||
this.type = t;
|
||||
}
|
||||
|
||||
private boolean canPlaceTrack(World world, int x, int y, int z) {
|
||||
private boolean canPlaceTrack(EntityPlayer player, World world, int x, int y, int z) {
|
||||
Block l1 = world.getBlock(x, y - 1, z);
|
||||
System.out.println(x + ":" +z);
|
||||
|
||||
if(player !=null && !player.canPlayerEdit(x, y - 1, z, 0, player.getCurrentEquippedItem())){
|
||||
return false;
|
||||
}
|
||||
|
||||
return canBeReplaced(world, x, y, z) && (World.doesBlockHaveSolidTopSurface(world ,x, y - 1, z) || l1 == BlockIDs.bridgePillar.block);
|
||||
}
|
||||
|
@ -166,29 +172,24 @@ public class ItemTCRail extends ItemPart {
|
|||
* @param type
|
||||
* @return
|
||||
*/
|
||||
private boolean putDownTurn(World world, boolean putDownEnterTrack, int x, int y, int z, int[] posX, int[] posZ,
|
||||
int l, boolean putDownExitTrack, int exitFacing, int posExitX, int posExitZ, double r, double cx, double cy,
|
||||
double cz, String type, Item idDrop) {
|
||||
private boolean putDownTurn(@Nullable EntityPlayer player, World world, boolean putDownEnterTrack, int x, int y, int z, int[] posX, int[] posZ,
|
||||
int l, boolean putDownExitTrack, int exitFacing, int posExitX, int posExitZ, double r, double cx, double cy,
|
||||
double cz, String type, Item idDrop) {
|
||||
TileTCRailGag[] tileGag = new TileTCRailGag[posX.length - 1];
|
||||
|
||||
/** check if first straight rail can be placed */
|
||||
if (putDownEnterTrack && !canPlaceTrack(world, x, y + 1, z)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/** Check first turn block */
|
||||
if (!canPlaceTrack(world, posX[0], y + 1, posZ[0])) {
|
||||
if (putDownEnterTrack && !canPlaceTrack(player, world, x, y + 1, z)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/** check if Gag rails can be placed */
|
||||
for (int gag = 1; gag < posX.length; gag++) {
|
||||
if (!canPlaceTrack(world, posX[gag], y + 1, posZ[gag])) {
|
||||
for (int gag = 0; gag < posX.length; gag++) {
|
||||
if (!canPlaceTrack(player, world, posX[gag], y + 1, posZ[gag])) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
/** Check last block */
|
||||
if (putDownExitTrack && !canPlaceTrack(world, posExitX, y + 1, posExitZ)) {
|
||||
if (putDownExitTrack && !canPlaceTrack(player, world, posExitX, y + 1, posExitZ)) {
|
||||
return false;
|
||||
}
|
||||
if (putDownEnterTrack) {
|
||||
|
@ -354,7 +355,7 @@ public class ItemTCRail extends ItemPart {
|
|||
if (l == 2) {
|
||||
int[] xArray = { x, x, x + 1, x + 1, x + 2 };
|
||||
int[] zArray = { z, z - 1, z - 1, z - 2, z - 2 };
|
||||
if (!putDownTurn(world, false, x, y, z, xArray, zArray, l, false, 1, x + 3, z - 3, 2.5, x + 3,
|
||||
if (!putDownTurn(player, world, false, x, y, z, xArray, zArray, l, false, 1, x + 3, z - 3, 2.5, x + 3,
|
||||
y + 1, z + 1, TrackTypes.MEDIUM_RIGHT_TURN.getLabel(), ItemIDs.tcRailMediumTurn.item))
|
||||
return false;
|
||||
|
||||
|
@ -362,21 +363,21 @@ public class ItemTCRail extends ItemPart {
|
|||
if (l == 0) {
|
||||
int[] xArray = { x, x, x - 1, x - 1, x - 2 };
|
||||
int[] zArray = { z, z + 1, z + 1, z + 2, z + 2 };
|
||||
if (!putDownTurn(world, false, x, y, z, xArray, zArray, l, false, 1, x - 3, z + 3, 2.5, x - 2,
|
||||
if (!putDownTurn(player, world, false, x, y, z, xArray, zArray, l, false, 1, x - 3, z + 3, 2.5, x - 2,
|
||||
y + 1, z, TrackTypes.MEDIUM_RIGHT_TURN.getLabel(), ItemIDs.tcRailMediumTurn.item))
|
||||
return false;
|
||||
}
|
||||
if (l == 1) {
|
||||
int[] xArray = { x, x - 1, x - 1, x - 2, x - 2 };
|
||||
int[] zArray = { z, z, z - 1, z - 1, z - 2 };
|
||||
if (!putDownTurn(world, false, x, y, z, xArray, zArray, l, false, 2, x - 3, z - 3, 2.5, x + 1,
|
||||
if (!putDownTurn(player, world, false, x, y, z, xArray, zArray, l, false, 2, x - 3, z - 3, 2.5, x + 1,
|
||||
y + 1, z - 2, TrackTypes.MEDIUM_RIGHT_TURN.getLabel(), ItemIDs.tcRailMediumTurn.item))
|
||||
return false;
|
||||
}
|
||||
if (l == 3) {
|
||||
int[] xArray = { x, x + 1, x + 1, x + 2, x + 2 };
|
||||
int[] zArray = { z, z, z + 1, z + 1, z + 2 };
|
||||
if (!putDownTurn(world, false, x, y, z, xArray, zArray, l, false, 0, x + 3, z + 3, 2.5, x, y + 1,
|
||||
if (!putDownTurn(player, world, false, x, y, z, xArray, zArray, l, false, 0, x + 3, z + 3, 2.5, x, y + 1,
|
||||
z + 3, TrackTypes.MEDIUM_RIGHT_TURN.getLabel(), ItemIDs.tcRailMediumTurn.item))
|
||||
return false;
|
||||
}
|
||||
|
@ -391,7 +392,7 @@ public class ItemTCRail extends ItemPart {
|
|||
if (l == 1) {
|
||||
int[] xArray = { x, x - 1, x - 1, x - 2, x - 2 };
|
||||
int[] zArray = { z, z, z + 1, z + 1, z + 2 };
|
||||
if (!putDownTurn(world, false, x, y, z, xArray, zArray, l, false, 0, x - 3, z + 3, 2.5, x + 1,
|
||||
if (!putDownTurn(player, world, false, x, y, z, xArray, zArray, l, false, 0, x - 3, z + 3, 2.5, x + 1,
|
||||
y + 1, z + 3, TrackTypes.MEDIUM_LEFT_TURN.getLabel(), ItemIDs.tcRailMediumTurn.item))
|
||||
return false;
|
||||
|
||||
|
@ -399,21 +400,21 @@ public class ItemTCRail extends ItemPart {
|
|||
if (l == 3) {
|
||||
int[] xArray = { x, x + 1, x + 1, x + 2, x + 2 };
|
||||
int[] zArray = { z, z, z - 1, z - 1, z - 2 };
|
||||
if (!putDownTurn(world, false, x, y, z, xArray, zArray, l, false, 2, x + 3, z - 3, 2.5, x, y + 1,
|
||||
if (!putDownTurn(player, world, false, x, y, z, xArray, zArray, l, false, 2, x + 3, z - 3, 2.5, x, y + 1,
|
||||
z - 2, TrackTypes.MEDIUM_LEFT_TURN.getLabel(), ItemIDs.tcRailMediumTurn.item))
|
||||
return false;
|
||||
}
|
||||
if (l == 0) {
|
||||
int[] xArray = { x, x, x + 1, x + 1, x + 2 };
|
||||
int[] zArray = { z, z + 1, z + 1, z + 2, z + 2 };
|
||||
if (!putDownTurn(world, false, x, y, z, xArray, zArray, l, false, 3, x + 3, z + 3, 2.5, x + 3,
|
||||
if (!putDownTurn(player, world, false, x, y, z, xArray, zArray, l, false, 3, x + 3, z + 3, 2.5, x + 3,
|
||||
y + 1, z, TrackTypes.MEDIUM_LEFT_TURN.getLabel(), ItemIDs.tcRailMediumTurn.item))
|
||||
return false;
|
||||
}
|
||||
if (l == 2) {
|
||||
int[] xArray = { x, x, x - 1, x - 1, x - 2 };
|
||||
int[] zArray = { z, z - 1, z - 1, z - 2, z - 2 };
|
||||
if (!putDownTurn(world, false, x, y, z, xArray, zArray, l, false, 1, x - 3, z - 3, 2.5, x - 2,
|
||||
if (!putDownTurn(player, world, false, x, y, z, xArray, zArray, l, false, 1, x - 3, z - 3, 2.5, x - 2,
|
||||
y + 1, z + 1, TrackTypes.MEDIUM_LEFT_TURN.getLabel(), ItemIDs.tcRailMediumTurn.item))
|
||||
return false;
|
||||
}
|
||||
|
@ -426,13 +427,13 @@ public class ItemTCRail extends ItemPart {
|
|||
if (tempType == TrackTypes.MEDIUM_RIGHT_SWITCH) {
|
||||
if (l == 2) {
|
||||
/** Check if straight exit can be put down */
|
||||
if (!canPlaceTrack(world, x, y + 1, z - 3) || !canPlaceTrack(world, x, y + 1, z - 2) || !canPlaceTrack(world, x, y + 1, z - 1)) {
|
||||
if (!canPlaceTrack(player, world, x, y + 1, z - 3) || !canPlaceTrack(player, world, x, y + 1, z - 2) || !canPlaceTrack(player, world, x, y + 1, z - 1)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
int[] xArray = { x + 1, x + 1, x + 2 };
|
||||
int[] zArray = { z - 2, z - 3, z - 3 };
|
||||
if (!putDownTurn(world, true, x, y, z, xArray, zArray, l, true, 1, x + 3, z - 3, 2.5, x + 3, y + 1,
|
||||
if (!putDownTurn(player, world, true, x, y, z, xArray, zArray, l, true, 1, x + 3, z - 3, 2.5, x + 3, y + 1,
|
||||
z, TrackTypes.MEDIUM_RIGHT_TURN.getLabel(), ItemIDs.tcRailMediumSwitch.item))
|
||||
return false;
|
||||
TileTCRail tcRailTurn = (TileTCRail) world.getTileEntity(x + 1, y + 1, z - 2);
|
||||
|
@ -452,13 +453,13 @@ public class ItemTCRail extends ItemPart {
|
|||
}
|
||||
if (l == 0) {
|
||||
/** Check if straight exit can be put down */
|
||||
if (!canPlaceTrack(world, x, y + 1, z + 3) || !canPlaceTrack(world, x, y + 1, z + 2) || !canPlaceTrack(world, x, y + 1, z + 1)) {
|
||||
if (!canPlaceTrack(player, world, x, y + 1, z + 3) || !canPlaceTrack(player, world, x, y + 1, z + 2) || !canPlaceTrack(player, world, x, y + 1, z + 1)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
int[] xArray = { x - 1, x - 1, x - 2 };
|
||||
int[] zArray = { z + 2, z + 3, z + 3 };
|
||||
if (!putDownTurn(world, true, x, y, z, xArray, zArray, l, true, 1, x - 3, z + 3, 2.5, x - 2, y + 1,
|
||||
if (!putDownTurn(player, world, true, x, y, z, xArray, zArray, l, true, 1, x - 3, z + 3, 2.5, x - 2, y + 1,
|
||||
z + 1, TrackTypes.MEDIUM_RIGHT_TURN.getLabel(), ItemIDs.tcRailMediumSwitch.item))
|
||||
return false;
|
||||
TileTCRail tcRailTurn = (TileTCRail) world.getTileEntity(x - 1, y + 1, z + 2);
|
||||
|
@ -478,13 +479,13 @@ public class ItemTCRail extends ItemPart {
|
|||
}
|
||||
if (l == 1) {
|
||||
/** Check if straight exit can be put down */
|
||||
if (!canPlaceTrack(world, x - 3, y + 1, z) || !canPlaceTrack(world, x - 2, y + 1, z) || !canPlaceTrack(world, x - 1, y + 1, z)) {
|
||||
if (!canPlaceTrack(player, world, x - 3, y + 1, z) || !canPlaceTrack(player, world, x - 2, y + 1, z) || !canPlaceTrack(player, world, x - 1, y + 1, z)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
int[] xArray = { x - 2, x - 3, x - 3 };
|
||||
int[] zArray = { z - 1, z - 1, z - 2 };
|
||||
if (!putDownTurn(world, true, x, y, z, xArray, zArray, l, true, 2, x - 3, z - 3, 2.5, x, y + 1,
|
||||
if (!putDownTurn(player, world, true, x, y, z, xArray, zArray, l, true, 2, x - 3, z - 3, 2.5, x, y + 1,
|
||||
z - 2, TrackTypes.MEDIUM_RIGHT_TURN.getLabel(), ItemIDs.tcRailMediumSwitch.item))
|
||||
return false;
|
||||
TileTCRail tcRailTurn = (TileTCRail) world.getTileEntity(x - 2, y + 1, z - 1);
|
||||
|
@ -504,13 +505,13 @@ public class ItemTCRail extends ItemPart {
|
|||
}
|
||||
if (l == 3) {
|
||||
/** Check if straight exit can be put down */
|
||||
if (!canPlaceTrack(world, x + 3, y + 1, z) || !canPlaceTrack(world, x + 2, y + 1, z) || !canPlaceTrack(world, x + 1, y + 1, z)) {
|
||||
if (!canPlaceTrack(player, world, x + 3, y + 1, z) || !canPlaceTrack(player, world, x + 2, y + 1, z) || !canPlaceTrack(player, world, x + 1, y + 1, z)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
int[] xArray = { x + 2, x + 3, x + 3 };
|
||||
int[] zArray = { z + 1, z + 1, z + 2 };
|
||||
if (!putDownTurn(world, true, x, y, z, xArray, zArray, l, true, 0, x + 3, z + 3, 2.5, x + 1, y + 1,
|
||||
if (!putDownTurn(player, world, true, x, y, z, xArray, zArray, l, true, 0, x + 3, z + 3, 2.5, x + 1, y + 1,
|
||||
z + 3, TrackTypes.MEDIUM_RIGHT_TURN.getLabel(), ItemIDs.tcRailMediumSwitch.item))
|
||||
return false;
|
||||
TileTCRail tcRailTurn = (TileTCRail) world.getTileEntity(x + 2, y + 1, z + 1);
|
||||
|
@ -537,13 +538,13 @@ public class ItemTCRail extends ItemPart {
|
|||
if (tempType == TrackTypes.MEDIUM_LEFT_SWITCH) {
|
||||
if (l == 2) {
|
||||
/** Check if straight exit can be put down */
|
||||
if (!canPlaceTrack(world, x, y + 1, z - 3) || !canPlaceTrack(world, x, y + 1, z - 2) || !canPlaceTrack(world, x, y + 1, z - 1)) {
|
||||
if (!canPlaceTrack(player, world, x, y + 1, z - 3) || !canPlaceTrack(player, world, x, y + 1, z - 2) || !canPlaceTrack(player, world, x, y + 1, z - 1)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
int[] xArray = { x - 1, x - 1, x - 2 };
|
||||
int[] zArray = { z - 2, z - 3, z - 3 };
|
||||
if (!putDownTurn(world, true, x, y, z, xArray, zArray, l, true, 1, x - 3, z - 3, 2.5, x - 2, y + 1,
|
||||
if (!putDownTurn(player, world, true, x, y, z, xArray, zArray, l, true, 1, x - 3, z - 3, 2.5, x - 2, y + 1,
|
||||
z, TrackTypes.MEDIUM_LEFT_TURN.getLabel(), ItemIDs.tcRailMediumSwitch.item))
|
||||
return false;
|
||||
TileTCRail tcRailTurn = (TileTCRail) world.getTileEntity(x - 1, y + 1, z - 2);
|
||||
|
@ -564,12 +565,12 @@ public class ItemTCRail extends ItemPart {
|
|||
}
|
||||
if (l == 0) {
|
||||
/** Check if straight exit can be put down */
|
||||
if (!canPlaceTrack(world, x, y + 1, z + 3) || !canPlaceTrack(world, x, y + 1, z + 2) || !canPlaceTrack(world, x, y + 1, z + 1)) {
|
||||
if (!canPlaceTrack(player, world, x, y + 1, z + 3) || !canPlaceTrack(player, world, x, y + 1, z + 2) || !canPlaceTrack(player, world, x, y + 1, z + 1)) {
|
||||
return false;
|
||||
}
|
||||
int[] xArray = { x + 1, x + 1, x + 2 };
|
||||
int[] zArray = { z + 2, z + 3, z + 3 };
|
||||
if (!putDownTurn(world, true, x, y, z, xArray, zArray, l, true, 3, x + 3, z + 3, 2.5, x + 3, y + 1,
|
||||
if (!putDownTurn(player, world, true, x, y, z, xArray, zArray, l, true, 3, x + 3, z + 3, 2.5, x + 3, y + 1,
|
||||
z + 1, TrackTypes.MEDIUM_LEFT_TURN.getLabel(), ItemIDs.tcRailMediumSwitch.item))
|
||||
return false;
|
||||
TileTCRail tcRailTurn = (TileTCRail) world.getTileEntity(x + 1, y + 1, z + 2);
|
||||
|
@ -589,12 +590,12 @@ public class ItemTCRail extends ItemPart {
|
|||
}
|
||||
if (l == 1) {
|
||||
/** Check if straight exit can be put down */
|
||||
if (!canPlaceTrack(world, x - 3, y + 1, z) || !canPlaceTrack(world, x - 2, y + 1, z) || !canPlaceTrack(world, x - 1, y + 1, z)) {
|
||||
if (!canPlaceTrack(player, world, x - 3, y + 1, z) || !canPlaceTrack(player, world, x - 2, y + 1, z) || !canPlaceTrack(player, world, x - 1, y + 1, z)) {
|
||||
return false;
|
||||
}
|
||||
int[] xArray = { x - 2, x - 3, x - 3 };
|
||||
int[] zArray = { z + 1, z + 1, z + 2 };
|
||||
if (!putDownTurn(world, true, x, y, z, xArray, zArray, l, true, 0, x - 3, z + 3, 2.5, x, y + 1,
|
||||
if (!putDownTurn(player, world, true, x, y, z, xArray, zArray, l, true, 0, x - 3, z + 3, 2.5, x, y + 1,
|
||||
z + 3, TrackTypes.MEDIUM_LEFT_TURN.getLabel(), ItemIDs.tcRailMediumSwitch.item))
|
||||
return false;
|
||||
|
||||
|
@ -615,12 +616,12 @@ public class ItemTCRail extends ItemPart {
|
|||
}
|
||||
if (l == 3) {
|
||||
/** Check if straight exit can be put down */
|
||||
if (!canPlaceTrack(world, x + 3, y + 1, z) || !canPlaceTrack(world, x + 2, y + 1, z) || !canPlaceTrack(world, x + 1, y + 1, z)) {
|
||||
if (!canPlaceTrack(player, world, x + 3, y + 1, z) || !canPlaceTrack(player, world, x + 2, y + 1, z) || !canPlaceTrack(player, world, x + 1, y + 1, z)) {
|
||||
return false;
|
||||
}
|
||||
int[] xArray = { x + 2, x + 3, x + 3 };
|
||||
int[] zArray = { z - 1, z - 1, z - 2 };
|
||||
if (!putDownTurn(world, true, x, y, z, xArray, zArray, l, true, 2, x + 3, z - 3, 2.5, x + 1, y + 1,
|
||||
if (!putDownTurn(player, world, true, x, y, z, xArray, zArray, l, true, 2, x + 3, z - 3, 2.5, x + 1, y + 1,
|
||||
z - 2, TrackTypes.MEDIUM_LEFT_TURN.getLabel(), ItemIDs.tcRailMediumSwitch.item))
|
||||
return false;
|
||||
TileTCRail tcRailTurn = (TileTCRail) world.getTileEntity(x + 2, y + 1, z - 1);
|
||||
|
@ -646,12 +647,12 @@ public class ItemTCRail extends ItemPart {
|
|||
if (tempType == TrackTypes.LARGE_RIGHT_SWITCH) {
|
||||
if (l == 2) {
|
||||
/** Check if straight exit can be put down */
|
||||
if (!canPlaceTrack(world, x, y + 1, z - 5) || !canPlaceTrack(world, x, y + 1, z - 4) || !canPlaceTrack(world, x, y + 1, z - 3) || !canPlaceTrack(world, x, y + 1, z - 2) || !canPlaceTrack(world, x, y + 1, z - 1)) {
|
||||
if (!canPlaceTrack(player, world, x, y + 1, z - 5) || !canPlaceTrack(player, world, x, y + 1, z - 4) || !canPlaceTrack(player, world, x, y + 1, z - 3) || !canPlaceTrack(player, world, x, y + 1, z - 2) || !canPlaceTrack(player, world, x, y + 1, z - 1)) {
|
||||
return false;
|
||||
}
|
||||
int[] xArray = { x + 1, x + 1, x + 2, x + 1, x + 2, x + 3, x + 4, x + 3, x + 2 };
|
||||
int[] zArray = { z - 2, z - 3, z - 3, z - 4, z - 4, z - 4, z - 5, z - 5, z - 5 };
|
||||
if (!putDownTurn(world, true, x, y, z, xArray, zArray, l, true, 1, x + 5, z - 5, 4.5, x + 5, y + 1,
|
||||
if (!putDownTurn(player, world, true, x, y, z, xArray, zArray, l, true, 1, x + 5, z - 5, 4.5, x + 5, y + 1,
|
||||
z, TrackTypes.LARGE_RIGHT_TURN.getLabel(), ItemIDs.tcRailLargeSwitch.item))
|
||||
return false;
|
||||
TileTCRail tcRailTurn = (TileTCRail) world.getTileEntity(x + 1, y + 1, z - 2);
|
||||
|
@ -676,13 +677,13 @@ public class ItemTCRail extends ItemPart {
|
|||
}
|
||||
if (l == 0) {
|
||||
/** Check if straight exit can be put down */
|
||||
if (!canPlaceTrack(world, x, y + 1, z + 5) || !canPlaceTrack(world, x, y + 1, z + 4) || !canPlaceTrack(world, x, y + 1, z + 3) || !canPlaceTrack(world, x, y + 1, z + 2) || !canPlaceTrack(world, x, y + 1, z + 1)) {
|
||||
if (!canPlaceTrack(player, world, x, y + 1, z + 5) || !canPlaceTrack(player, world, x, y + 1, z + 4) || !canPlaceTrack(player, world, x, y + 1, z + 3) || !canPlaceTrack(player, world, x, y + 1, z + 2) || !canPlaceTrack(player, world, x, y + 1, z + 1)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
int[] xArray = { x - 1, x - 1, x - 2, x - 1, x - 2, x - 3, x - 2, x - 3, x - 4 };
|
||||
int[] zArray = { z + 2, z + 3, z + 3, z + 4, z + 4, z + 4, z + 5, z + 5, z + 5 };
|
||||
if (!putDownTurn(world, true, x, y, z, xArray, zArray, l, true, 1, x - 5, z + 5, 4.5, x - 4, y + 1,
|
||||
if (!putDownTurn(player, world, true, x, y, z, xArray, zArray, l, true, 1, x - 5, z + 5, 4.5, x - 4, y + 1,
|
||||
z + 1, TrackTypes.LARGE_RIGHT_TURN.getLabel(), ItemIDs.tcRailLargeSwitch.item))
|
||||
return false;
|
||||
TileTCRail tcRailTurn = (TileTCRail) world.getTileEntity(x - 1, y + 1, z + 2);
|
||||
|
@ -708,12 +709,12 @@ public class ItemTCRail extends ItemPart {
|
|||
}
|
||||
if (l == 1) {
|
||||
/** Check if straight exit can be put down */
|
||||
if (!canPlaceTrack(world, x - 5, y + 1, z) || !canPlaceTrack(world, x - 4, y + 1, z) || !canPlaceTrack(world, x - 3, y + 1, z) || !canPlaceTrack(world, x - 2, y + 1, z) || !canPlaceTrack(world, x - 1, y + 1, z)) {
|
||||
if (!canPlaceTrack(player, world, x - 5, y + 1, z) || !canPlaceTrack(player, world, x - 4, y + 1, z) || !canPlaceTrack(player, world, x - 3, y + 1, z) || !canPlaceTrack(player, world, x - 2, y + 1, z) || !canPlaceTrack(player, world, x - 1, y + 1, z)) {
|
||||
return false;
|
||||
}
|
||||
int[] xArray = { x - 2, x - 3, x - 3, x - 4, x - 4, x - 4, x - 5, x - 5, x - 5 };
|
||||
int[] zArray = { z - 1, z - 1, z - 2, z - 1, z - 2, z - 3, z - 2, z - 3, z - 4 };
|
||||
if (!putDownTurn(world, true, x, y, z, xArray, zArray, l, true, 2, x - 5, z - 5, 4.5, x, y + 1,
|
||||
if (!putDownTurn(player, world, true, x, y, z, xArray, zArray, l, true, 2, x - 5, z - 5, 4.5, x, y + 1,
|
||||
z - 4, TrackTypes.LARGE_RIGHT_TURN.getLabel(), ItemIDs.tcRailLargeSwitch.item))
|
||||
return false;
|
||||
TileTCRail tcRailTurn = (TileTCRail) world.getTileEntity(x - 2, y + 1, z - 1);
|
||||
|
@ -739,12 +740,12 @@ public class ItemTCRail extends ItemPart {
|
|||
}
|
||||
if (l == 3) {
|
||||
/** Check if straight exit can be put down */
|
||||
if (!canPlaceTrack(world, x + 5, y + 1, z) || !canPlaceTrack(world, x + 4, y + 1, z) || !canPlaceTrack(world, x + 3, y + 1, z) || !canPlaceTrack(world, x + 2, y + 1, z) || !canPlaceTrack(world, x + 1, y + 1, z)) {
|
||||
if (!canPlaceTrack(player, world, x + 5, y + 1, z) || !canPlaceTrack(player, world, x + 4, y + 1, z) || !canPlaceTrack(player, world, x + 3, y + 1, z) || !canPlaceTrack(player, world, x + 2, y + 1, z) || !canPlaceTrack(player, world, x + 1, y + 1, z)) {
|
||||
return false;
|
||||
}
|
||||
int[] xArray = { x + 2, x + 3, x + 3, x + 4, x + 4, x + 4, x + 5, x + 5, x + 5 };
|
||||
int[] zArray = { z + 1, z + 1, z + 2, z + 1, z + 2, z + 3, z + 2, z + 3, z + 4 };
|
||||
if (!putDownTurn(world, true, x, y, z, xArray, zArray, l, true, 0, x + 5, z + 5, 4.5, x + 1, y + 1,
|
||||
if (!putDownTurn(player, world, true, x, y, z, xArray, zArray, l, true, 0, x + 5, z + 5, 4.5, x + 1, y + 1,
|
||||
z + 5, TrackTypes.LARGE_RIGHT_TURN.getLabel(), ItemIDs.tcRailLargeSwitch.item))
|
||||
return false;
|
||||
|
||||
|
@ -779,12 +780,12 @@ public class ItemTCRail extends ItemPart {
|
|||
if (tempType == TrackTypes.LARGE_LEFT_SWITCH) {
|
||||
if (l == 2) {
|
||||
/** Check if straight exit can be put down */
|
||||
if (!canPlaceTrack(world, x, y + 1, z - 5) || !canPlaceTrack(world, x, y + 1, z - 4) || !canPlaceTrack(world, x, y + 1, z - 3) || !canPlaceTrack(world, x, y + 1, z - 2) || !canPlaceTrack(world, x, y + 1, z - 1)) {
|
||||
if (!canPlaceTrack(player, world, x, y + 1, z - 5) || !canPlaceTrack(player, world, x, y + 1, z - 4) || !canPlaceTrack(player, world, x, y + 1, z - 3) || !canPlaceTrack(player, world, x, y + 1, z - 2) || !canPlaceTrack(player, world, x, y + 1, z - 1)) {
|
||||
return false;
|
||||
}
|
||||
int[] xArray = { x - 1, x - 1, x - 2, x - 1, x - 2, x - 3, x - 4, x - 3, x - 2 };
|
||||
int[] zArray = { z - 2, z - 3, z - 3, z - 4, z - 4, z - 4, z - 5, z - 5, z - 5 };
|
||||
if (!putDownTurn(world, true, x, y, z, xArray, zArray, l, true, 1, x - 5, z - 5, 4.5, x - 4, y + 1,
|
||||
if (!putDownTurn(player, world, true, x, y, z, xArray, zArray, l, true, 1, x - 5, z - 5, 4.5, x - 4, y + 1,
|
||||
z, TrackTypes.LARGE_LEFT_TURN.getLabel(), ItemIDs.tcRailLargeSwitch.item))
|
||||
return false;
|
||||
TileTCRail tcRailTurn = (TileTCRail) world.getTileEntity(x - 1, y + 1, z - 2);
|
||||
|
@ -810,12 +811,12 @@ public class ItemTCRail extends ItemPart {
|
|||
}
|
||||
if (l == 0) {
|
||||
/** Check if straight exit can be put down */
|
||||
if (!canPlaceTrack(world, x, y + 1, z + 5) || !canPlaceTrack(world, x, y + 1, z + 4) || !canPlaceTrack(world, x, y + 1, z + 3) || !canPlaceTrack(world, x, y + 1, z + 2) || !canPlaceTrack(world, x, y + 1, z + 1)) {
|
||||
if (!canPlaceTrack(player, world, x, y + 1, z + 5) || !canPlaceTrack(player, world, x, y + 1, z + 4) || !canPlaceTrack(player, world, x, y + 1, z + 3) || !canPlaceTrack(player, world, x, y + 1, z + 2) || !canPlaceTrack(player, world, x, y + 1, z + 1)) {
|
||||
return false;
|
||||
}
|
||||
int[] xArray = { x + 1, x + 1, x + 2, x + 1, x + 2, x + 3, x + 2, x + 3, x + 4 };
|
||||
int[] zArray = { z + 2, z + 3, z + 3, z + 4, z + 4, z + 4, z + 5, z + 5, z + 5 };
|
||||
if (!putDownTurn(world, true, x, y, z, xArray, zArray, l, true, 1, x + 5, z + 5, 4.5, x + 5, y + 1,
|
||||
if (!putDownTurn(player, world, true, x, y, z, xArray, zArray, l, true, 1, x + 5, z + 5, 4.5, x + 5, y + 1,
|
||||
z + 1, TrackTypes.LARGE_LEFT_TURN.getLabel(), ItemIDs.tcRailLargeSwitch.item))
|
||||
return false;
|
||||
|
||||
|
@ -842,12 +843,12 @@ public class ItemTCRail extends ItemPart {
|
|||
}
|
||||
if (l == 1) {
|
||||
/** Check if straight exit can be put down */
|
||||
if (!canPlaceTrack(world, x - 5, y + 1, z) || !canPlaceTrack(world, x - 4, y + 1, z) || !canPlaceTrack(world, x - 3, y + 1, z) || !canPlaceTrack(world, x - 2, y + 1, z) || !canPlaceTrack(world, x - 1, y + 1, z)) {
|
||||
if (!canPlaceTrack(player, world, x - 5, y + 1, z) || !canPlaceTrack(player, world, x - 4, y + 1, z) || !canPlaceTrack(player, world, x - 3, y + 1, z) || !canPlaceTrack(player, world, x - 2, y + 1, z) || !canPlaceTrack(player, world, x - 1, y + 1, z)) {
|
||||
return false;
|
||||
}
|
||||
int[] xArray = { x - 2, x - 3, x - 3, x - 4, x - 4, x - 4, x - 5, x - 5, x - 5 };
|
||||
int[] zArray = { z + 1, z + 1, z + 2, z + 1, z + 2, z + 3, z + 2, z + 3, z + 4 };
|
||||
if (!putDownTurn(world, true, x, y, z, xArray, zArray, l, true, 2, x - 5, z + 5, 4.5, x, y + 1,
|
||||
if (!putDownTurn(player, world, true, x, y, z, xArray, zArray, l, true, 2, x - 5, z + 5, 4.5, x, y + 1,
|
||||
z + 5, TrackTypes.LARGE_LEFT_TURN.getLabel(), ItemIDs.tcRailLargeSwitch.item))
|
||||
return false;
|
||||
|
||||
|
@ -874,12 +875,12 @@ public class ItemTCRail extends ItemPart {
|
|||
}
|
||||
if (l == 3) {
|
||||
/** Check if straight exit can be put down */
|
||||
if (!canPlaceTrack(world, x + 5, y + 1, z) || !canPlaceTrack(world, x + 4, y + 1, z) || !canPlaceTrack(world, x + 3, y + 1, z) || !canPlaceTrack(world, x + 2, y + 1, z) || !canPlaceTrack(world, x + 1, y + 1, z)) {
|
||||
if (!canPlaceTrack(player, world, x + 5, y + 1, z) || !canPlaceTrack(player, world, x + 4, y + 1, z) || !canPlaceTrack(player, world, x + 3, y + 1, z) || !canPlaceTrack(player, world, x + 2, y + 1, z) || !canPlaceTrack(player, world, x + 1, y + 1, z)) {
|
||||
return false;
|
||||
}
|
||||
int[] xArray = { x + 2, x + 3, x + 3, x + 4, x + 4, x + 4, x + 5, x + 5, x + 5 };
|
||||
int[] zArray = { z - 1, z - 1, z - 2, z - 1, z - 2, z - 3, z - 2, z - 3, z - 4 };
|
||||
if (!putDownTurn(world, true, x, y, z, xArray, zArray, l, true, 0, x + 5, z - 5, 4.5, x + 1, y + 1,
|
||||
if (!putDownTurn(player, world, true, x, y, z, xArray, zArray, l, true, 0, x + 5, z - 5, 4.5, x + 1, y + 1,
|
||||
z - 4, TrackTypes.LARGE_LEFT_TURN.getLabel(), ItemIDs.tcRailLargeSwitch.item))
|
||||
return false;
|
||||
|
||||
|
@ -913,20 +914,20 @@ public class ItemTCRail extends ItemPart {
|
|||
|
||||
if (tempType == TrackTypes.MEDIUM_RIGHT_PARALLEL_SWITCH) {
|
||||
if (l == 2) {
|
||||
if (!parallelRightSwitchNorth(world, x, y, z, l, tempType))
|
||||
if (!parallelRightSwitchNorth(player, world, x, y, z, l, tempType))
|
||||
return false;
|
||||
|
||||
}
|
||||
if (l == 0) {
|
||||
if (!parallelRightSwitchSouth(world, x, y, z, l, tempType))
|
||||
if (!parallelRightSwitchSouth(player, world, x, y, z, l, tempType))
|
||||
return false;
|
||||
}
|
||||
if (l == 1) {
|
||||
if (!parallelRightSwitchWest(world, x, y, z, l, tempType))
|
||||
if (!parallelRightSwitchWest(player, world, x, y, z, l, tempType))
|
||||
return false;
|
||||
}
|
||||
if (l == 3) {
|
||||
if (!parallelRightSwitchEast(world, x, y, z, l, tempType))
|
||||
if (!parallelRightSwitchEast(player, world, x, y, z, l, tempType))
|
||||
return false;
|
||||
}
|
||||
if (player ==null || !player.capabilities.isCreativeMode) {
|
||||
|
@ -936,19 +937,19 @@ public class ItemTCRail extends ItemPart {
|
|||
}
|
||||
if (tempType == TrackTypes.MEDIUM_LEFT_PARALLEL_SWITCH) {
|
||||
if (l == 2) {
|
||||
if (!parallelLeftSwitchNorth(world, x, y, z, l, tempType))
|
||||
if (!parallelLeftSwitchNorth(player, world, x, y, z, l, tempType))
|
||||
return false;
|
||||
}
|
||||
if (l == 0) {
|
||||
if (!parallelLeftSwitchSouth(world, x, y, z, l, tempType))
|
||||
if (!parallelLeftSwitchSouth(player, world, x, y, z, l, tempType))
|
||||
return false;
|
||||
}
|
||||
if (l == 1) {
|
||||
if (!parallelLeftSwitchWest(world, x, y, z, l, tempType))
|
||||
if (!parallelLeftSwitchWest(player, world, x, y, z, l, tempType))
|
||||
return false;
|
||||
}
|
||||
if (l == 3) {
|
||||
if (!parallelLeftSwitchEast(world, x, y, z, l, tempType))
|
||||
if (!parallelLeftSwitchEast(player, world, x, y, z, l, tempType))
|
||||
return false;
|
||||
}
|
||||
if (player ==null || !player.capabilities.isCreativeMode) {
|
||||
|
@ -961,28 +962,28 @@ public class ItemTCRail extends ItemPart {
|
|||
if (l == 2) {
|
||||
int[] xArray = { x, x, x + 1, x + 1, x + 2, x, x + 1, x + 2, x + 3, x + 4, x + 3, x + 2 };
|
||||
int[] zArray = { z, z - 1, z - 1, z - 2, z - 2, z - 2, z - 3, z - 3, z - 3, z - 4, z - 4, z - 4 };
|
||||
if (!putDownTurn(world, false, x, y, z, xArray, zArray, l, false, 1, x + 5, z - 5, 4.5, x + 5,
|
||||
if (!putDownTurn(player, world, false, x, y, z, xArray, zArray, l, false, 1, x + 5, z - 5, 4.5, x + 5,
|
||||
y + 1, z + 1, TrackTypes.LARGE_RIGHT_TURN.getLabel(), ItemIDs.tcRailLargeTurn.item))
|
||||
return false;
|
||||
}
|
||||
if (l == 0) {
|
||||
int[] xArray = { x, x, x, x - 1, x - 1, x - 2, x - 1, x - 2, x - 3, x - 2, x - 3, x - 4 };
|
||||
int[] zArray = { z, z + 1, z + 2, z + 1, z + 2, z + 2, z + 3, z + 3, z + 3, z + 4, z + 4, z + 4 };
|
||||
if (!putDownTurn(world, false, x, y, z, xArray, zArray, l, false, 1, x - 5, z + 5, 4.5, x - 4,
|
||||
if (!putDownTurn(player, world, false, x, y, z, xArray, zArray, l, false, 1, x - 5, z + 5, 4.5, x - 4,
|
||||
y + 1, z, TrackTypes.LARGE_RIGHT_TURN.getLabel(), ItemIDs.tcRailLargeTurn.item))
|
||||
return false;
|
||||
}
|
||||
if (l == 1) {
|
||||
int[] xArray = { x, x - 1, x - 1, x - 2, x - 2, x - 2, x - 3, x - 3, x - 3, x - 4, x - 4, x - 4 };
|
||||
int[] zArray = { z, z, z - 1, z, z - 1, z - 2, z - 1, z - 2, z - 3, z - 2, z - 3, z - 4 };
|
||||
if (!putDownTurn(world, false, x, y, z, xArray, zArray, l, false, 2, x - 5, z - 5, 4.5, x + 1,
|
||||
if (!putDownTurn(player, world, false, x, y, z, xArray, zArray, l, false, 2, x - 5, z - 5, 4.5, x + 1,
|
||||
y + 1, z - 4, TrackTypes.LARGE_RIGHT_TURN.getLabel(), ItemIDs.tcRailLargeTurn.item))
|
||||
return false;
|
||||
}
|
||||
if (l == 3) {
|
||||
int[] xArray = { x, x + 1, x + 2, x + 1, x + 2, x + 2, x + 3, x + 3, x + 3, x + 4, x + 4, x + 4 };
|
||||
int[] zArray = { z, z, z, z + 1, z + 1, z + 2, z + 1, z + 2, z + 3, z + 2, z + 3, z + 4 };
|
||||
if (!putDownTurn(world, false, x, y, z, xArray, zArray, l, false, 0, x + 5, z + 5, 4.5, x, y + 1,
|
||||
if (!putDownTurn(player, world, false, x, y, z, xArray, zArray, l, false, 0, x + 5, z + 5, 4.5, x, y + 1,
|
||||
z + 5, TrackTypes.LARGE_RIGHT_TURN.getLabel(), ItemIDs.tcRailLargeTurn.item))
|
||||
return false;
|
||||
}
|
||||
|
@ -996,28 +997,28 @@ public class ItemTCRail extends ItemPart {
|
|||
if (l == 2) {
|
||||
int[] xArray = { x, x, x - 1, x - 1, x - 2, x, x - 1, x - 2, x - 3, x - 4, x - 3, x - 2 };
|
||||
int[] zArray = { z, z - 1, z - 1, z - 2, z - 2, z - 2, z - 3, z - 3, z - 3, z - 4, z - 4, z - 4 };
|
||||
if (!putDownTurn(world, false, x, y, z, xArray, zArray, l, false, 1, x - 5, z - 5, 4.5, x - 4,
|
||||
if (!putDownTurn(player, world, false, x, y, z, xArray, zArray, l, false, 1, x - 5, z - 5, 4.5, x - 4,
|
||||
y + 1, z + 1, TrackTypes.LARGE_LEFT_TURN.getLabel(), ItemIDs.tcRailLargeTurn.item))
|
||||
return false;
|
||||
}
|
||||
if (l == 0) {
|
||||
int[] xArray = { x, x, x, x + 1, x + 1, x + 2, x + 1, x + 2, x + 3, x + 2, x + 3, x + 4 };
|
||||
int[] zArray = { z, z + 1, z + 2, z + 1, z + 2, z + 2, z + 3, z + 3, z + 3, z + 4, z + 4, z + 4 };
|
||||
if (!putDownTurn(world, false, x, y, z, xArray, zArray, l, false, 1, x + 5, z + 5, 4.5, x + 5,
|
||||
if (!putDownTurn(player, world, false, x, y, z, xArray, zArray, l, false, 1, x + 5, z + 5, 4.5, x + 5,
|
||||
y + 1, z, TrackTypes.LARGE_LEFT_TURN.getLabel(), ItemIDs.tcRailLargeTurn.item))
|
||||
return false;
|
||||
}
|
||||
if (l == 1) {
|
||||
int[] xArray = { x, x - 1, x - 1, x - 2, x - 2, x - 2, x - 3, x - 3, x - 3, x - 4, x - 4, x - 4 };
|
||||
int[] zArray = { z, z, z + 1, z, z + 1, z + 2, z + 1, z + 2, z + 3, z + 2, z + 3, z + 4 };
|
||||
if (!putDownTurn(world, false, x, y, z, xArray, zArray, l, false, 2, x - 5, z + 5, 4.5, x + 1,
|
||||
if (!putDownTurn(player, world, false, x, y, z, xArray, zArray, l, false, 2, x - 5, z + 5, 4.5, x + 1,
|
||||
y + 1, z + 5, TrackTypes.LARGE_LEFT_TURN.getLabel(), ItemIDs.tcRailLargeTurn.item))
|
||||
return false;
|
||||
}
|
||||
if (l == 3) {
|
||||
int[] xArray = { x, x + 1, x + 2, x + 1, x + 2, x + 2, x + 3, x + 3, x + 3, x + 4, x + 4, x + 4 };
|
||||
int[] zArray = { z, z, z, z - 1, z - 1, z - 2, z - 1, z - 2, z - 3, z - 2, z - 3, z - 4 };
|
||||
if (!putDownTurn(world, false, x, y, z, xArray, zArray, l, false, 0, x + 5, z - 5, 4.5, x, y + 1,
|
||||
if (!putDownTurn(player, world, false, x, y, z, xArray, zArray, l, false, 0, x + 5, z - 5, 4.5, x, y + 1,
|
||||
z - 4, TrackTypes.LARGE_LEFT_TURN.getLabel(), ItemIDs.tcRailLargeTurn.item))
|
||||
return false;
|
||||
}
|
||||
|
@ -1031,7 +1032,7 @@ public class ItemTCRail extends ItemPart {
|
|||
if (l == 2) {
|
||||
int[] xArray = { x, x, x, x + 1, x, x + 1, x, x + 1, x + 1, x + 2, x + 2, x + 2, x + 3, x + 3, x + 4, x + 4, x + 5, x + 5, x + 5, x + 6, x + 6, x + 7, x + 7, x + 8, x + 9 };
|
||||
int[] zArray = { z, z - 1, z - 2, z - 2, z - 3, z - 3, z - 4, z - 4, z - 5, z - 4, z - 5, z - 6, z - 6, z - 7, z - 7, z - 8, z - 7, z - 8, z - 9, z - 8, z - 9, z - 8, z - 9, z - 9, z - 9 };
|
||||
if (!putDownTurn(world, false, x, y, z, xArray, zArray, l, false, 1, x + 10, z - 10, 9.5, x + 10,
|
||||
if (!putDownTurn(player, world, false, x, y, z, xArray, zArray, l, false, 1, x + 10, z - 10, 9.5, x + 10,
|
||||
y + 1, z + 1, TrackTypes.VERY_LARGE_RIGHT_TURN.getLabel(),
|
||||
ItemIDs.tcRailVeryLargeTurn.item))
|
||||
return false;
|
||||
|
@ -1041,14 +1042,14 @@ public class ItemTCRail extends ItemPart {
|
|||
x - 3, x - 3, x - 4, x - 5, x - 4, x - 5, x - 5, x - 6, x - 6, x - 7, x - 7, x - 8, x - 9 };
|
||||
int[] zArray = { z, z + 1, z + 2, z + 2, z + 3, z + 3, z + 4, z + 4, z + 4, z + 5, z + 5, z + 6,
|
||||
z + 6, z + 7, z + 7, z + 7, z + 8, z + 8, z + 9, z + 8, z + 9, z + 8, z + 9, z + 9, z + 9 };
|
||||
if (!putDownTurn(world, false, x, y, z, xArray, zArray, l, false, 1, x - 10, z + 10, 9.5, x - 9,
|
||||
if (!putDownTurn(player, world, false, x, y, z, xArray, zArray, l, false, 1, x - 10, z + 10, 9.5, x - 9,
|
||||
y + 1, z, TrackTypes.VERY_LARGE_RIGHT_TURN.getLabel(), ItemIDs.tcRailVeryLargeTurn.item))
|
||||
return false;
|
||||
}
|
||||
if (l == 1) {
|
||||
int[] xArray = { x, x - 1, x - 2, x - 2, x - 3, x - 3, x - 4, x - 4, x - 4, x - 5, x - 5, x - 6, x - 6, x - 7, x - 7, x - 8, x - 7, x - 8, x - 9, x - 8, x - 9, x - 8, x - 9, x - 9, x - 9 };
|
||||
int[] zArray = { z, z, z, z - 1, z, z - 1, z, z - 1, z - 2, z - 1, z - 2, z - 2, z - 3, z - 3, z - 4, z - 4, z - 5, z - 5, z - 5, z - 6, z - 6, z - 7, z - 7, z - 8, z - 9 };
|
||||
if (!putDownTurn(world, false, x, y, z, xArray, zArray, l, false, 2, x - 10, z - 10, 9.5, x + 1,
|
||||
if (!putDownTurn(player, world, false, x, y, z, xArray, zArray, l, false, 2, x - 10, z - 10, 9.5, x + 1,
|
||||
y + 1, z - 9, TrackTypes.VERY_LARGE_RIGHT_TURN.getLabel(),
|
||||
ItemIDs.tcRailVeryLargeTurn.item))
|
||||
return false;
|
||||
|
@ -1056,7 +1057,7 @@ public class ItemTCRail extends ItemPart {
|
|||
if (l == 3) {
|
||||
int[] xArray = { x, x + 1, x + 2, x + 2, x + 3, x + 3, x + 4, x + 4, x + 4, x + 5, x + 5, x + 6, x + 6, x + 7, x + 7, x + 8, x + 7, x + 8, x + 9, x + 8, x + 9, x + 8, x + 9, x + 9, x + 9 };
|
||||
int[] zArray = { z, z, z, z + 1, z, z + 1, z, z + 1, z + 2, z + 1, z + 2, z + 2, z + 3, z + 3, z + 4, z + 4, z + 5, z + 5, z + 5, z + 6, z + 6, z + 7, z + 7, z + 8, z + 9 };
|
||||
if (!putDownTurn(world, false, x, y, z, xArray, zArray, l, false, 0, x + 10, z + 10, 9.5, x, y + 1,
|
||||
if (!putDownTurn(player, world, false, x, y, z, xArray, zArray, l, false, 0, x + 10, z + 10, 9.5, x, y + 1,
|
||||
z + 10, TrackTypes.VERY_LARGE_RIGHT_TURN.getLabel(), ItemIDs.tcRailVeryLargeTurn.item))
|
||||
return false;
|
||||
}
|
||||
|
@ -1070,7 +1071,7 @@ public class ItemTCRail extends ItemPart {
|
|||
if (l == 2) {
|
||||
int[] xArray = { x, x, x, x - 1, x, x - 1, x, x - 1, x - 2, x - 1, x - 2, x - 2, x - 3, x - 3, x - 4, x - 5, x - 4, x - 5, x - 5, x - 6, x - 6, x - 7, x - 7, x - 8, x - 9 };
|
||||
int[] zArray = { z, z - 1, z - 2, z - 2, z - 3, z - 3, z - 4, z - 4, z - 4, z - 5, z - 5, z - 6, z - 6, z - 7, z - 7, z - 7, z - 8, z - 8, z - 9, z - 8, z - 9, z - 8, z - 9, z - 9, z - 9 };
|
||||
if (!putDownTurn(world, false, x, y, z, xArray, zArray, l, false, 1, x - 10, z - 10, 9.5, x - 9,
|
||||
if (!putDownTurn(player, world, false, x, y, z, xArray, zArray, l, false, 1, x - 10, z - 10, 9.5, x - 9,
|
||||
y + 1, z + 1, TrackTypes.VERY_LARGE_LEFT_TURN.getLabel(), ItemIDs.tcRailVeryLargeTurn.item))
|
||||
return false;
|
||||
}
|
||||
|
@ -1079,14 +1080,14 @@ public class ItemTCRail extends ItemPart {
|
|||
x + 3, x + 3, x + 4, x + 4, x + 5, x + 5, x + 5, x + 6, x + 6, x + 7, x + 7, x + 8, x + 9 };
|
||||
int[] zArray = { z, z + 1, z + 2, z + 2, z + 3, z + 3, z + 4, z + 4, z + 4, z + 5, z + 5, z + 6,
|
||||
z + 6, z + 7, z + 7, z + 8, z + 7, z + 8, z + 9, z + 8, z + 9, z + 8, z + 9, z + 9, z + 9 };
|
||||
if (!putDownTurn(world, false, x, y, z, xArray, zArray, l, false, 1, x + 10, z + 10, 9.5, x + 10,
|
||||
if (!putDownTurn(player, world, false, x, y, z, xArray, zArray, l, false, 1, x + 10, z + 10, 9.5, x + 10,
|
||||
y + 1, z, TrackTypes.VERY_LARGE_LEFT_TURN.getLabel(), ItemIDs.tcRailVeryLargeTurn.item))
|
||||
return false;
|
||||
}
|
||||
if (l == 1) {
|
||||
int[] xArray = { x, x - 1, x - 2, x - 2, x - 3, x - 3, x - 4, x - 4, x - 4, x - 5, x - 5, x - 6, x - 6, x - 7, x - 7, x - 8, x - 7, x - 8, x - 9, x - 8, x - 9, x - 8, x - 9, x - 9, x - 9 };
|
||||
int[] zArray = { z, z, z, z + 1, z, z + 1, z, z + 1, z + 2, z + 1, z + 2, z + 2, z + 3, z + 3, z + 4, z + 4, z + 5, z + 5, z + 5, z + 6, z + 6, z + 7, z + 7, z + 8, z + 9 };
|
||||
if (!putDownTurn(world, false, x, y, z, xArray, zArray, l, false, 2, x - 10, z + 10, 9.5, x + 1,
|
||||
if (!putDownTurn(player, world, false, x, y, z, xArray, zArray, l, false, 2, x - 10, z + 10, 9.5, x + 1,
|
||||
y + 1, z + 10, TrackTypes.VERY_LARGE_LEFT_TURN.getLabel(),
|
||||
ItemIDs.tcRailVeryLargeTurn.item))
|
||||
return false;
|
||||
|
@ -1094,7 +1095,7 @@ public class ItemTCRail extends ItemPart {
|
|||
if (l == 3) {
|
||||
int[] xArray = { x, x + 1, x + 2, x + 2, x + 3, x + 3, x + 4, x + 4, x + 4, x + 5, x + 5, x + 6, x + 6, x + 7, x + 7, x + 8, x + 7, x + 8, x + 9, x + 8, x + 9, x + 8, x + 9, x + 9, x + 9 };
|
||||
int[] zArray = { z, z, z, z - 1, z, z - 1, z, z - 1, z - 2, z - 1, z - 2, z - 2, z - 3, z - 3, z - 4, z - 4, z - 5, z - 5, z - 5, z - 6, z - 6, z - 7, z - 7, z - 8, z - 9 };
|
||||
if (!putDownTurn(world, false, x, y, z, xArray, zArray, l, false, 0, x + 10, z - 10, 9.5, x, y + 1,
|
||||
if (!putDownTurn(player, world, false, x, y, z, xArray, zArray, l, false, 0, x + 10, z - 10, 9.5, x, y + 1,
|
||||
z - 9, TrackTypes.VERY_LARGE_LEFT_TURN.getLabel(), ItemIDs.tcRailVeryLargeTurn.item))
|
||||
return false;
|
||||
}
|
||||
|
@ -1108,7 +1109,7 @@ public class ItemTCRail extends ItemPart {
|
|||
|| type == TrackTypes.LARGE_SLOPE_BALLAST || type == TrackTypes.VERY_LARGE_SLOPE_WOOD
|
||||
|| type == TrackTypes.VERY_LARGE_SLOPE_GRAVEL || type == TrackTypes.VERY_LARGE_SLOPE_BALLAST
|
||||
) {
|
||||
if (!canPlaceTrack(world, x, y + 1, z)) {
|
||||
if (!canPlaceTrack(player, world, x, y + 1, z)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1141,22 +1142,22 @@ public class ItemTCRail extends ItemPart {
|
|||
|
||||
for (int i = 1; i <= gagEnd; i++) {
|
||||
if (l == 2) {
|
||||
if (!canPlaceTrack(world, x, y + 1, z - i)) {
|
||||
if (!canPlaceTrack(player, world, x, y + 1, z - i)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (l == 0) {
|
||||
if (!canPlaceTrack(world, x, y + 1, z + i)) {
|
||||
if (!canPlaceTrack(player, world, x, y + 1, z + i)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (l == 1) {
|
||||
if (!canPlaceTrack(world, x - i, y + 1, z)) {
|
||||
if (!canPlaceTrack(player, world, x - i, y + 1, z)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (l == 3) {
|
||||
if (!canPlaceTrack(world, x + i, y + 1, z)) {
|
||||
if (!canPlaceTrack(player, world, x + i, y + 1, z)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -1209,7 +1210,7 @@ public class ItemTCRail extends ItemPart {
|
|||
}
|
||||
if (type == TrackTypes.MEDIUM_STRAIGHT || type == TrackTypes.LONG_STRAIGHT) {
|
||||
/** check if first rail can be placed */
|
||||
if (!canPlaceTrack(world, x, y + 1, z)) {
|
||||
if (!canPlaceTrack(player, world, x, y + 1, z)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1218,12 +1219,12 @@ public class ItemTCRail extends ItemPart {
|
|||
tileGag = new TileTCRailGag[4];
|
||||
}
|
||||
if (l == 2) {
|
||||
if (!canPlaceTrack(world, x, y + 1, z - 1) || !canPlaceTrack(world, x, y + 1, z - 2)) {
|
||||
if (!canPlaceTrack(player, world, x, y + 1, z - 1) || !canPlaceTrack(player, world, x, y + 1, z - 2)) {
|
||||
return false;
|
||||
}
|
||||
if (type == TrackTypes.LONG_STRAIGHT) {
|
||||
if (!canPlaceTrack(world, x, y + 1, z - 3) || !canPlaceTrack(world, x, y + 1, z - 4)
|
||||
|| !canPlaceTrack(world, x, y + 1, z - 5)) {
|
||||
if (!canPlaceTrack(player, world, x, y + 1, z - 3) || !canPlaceTrack(player, world, x, y + 1, z - 4)
|
||||
|| !canPlaceTrack(player, world, x, y + 1, z - 5)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -1262,12 +1263,12 @@ public class ItemTCRail extends ItemPart {
|
|||
|
||||
}
|
||||
if (l == 0) {
|
||||
if (!canPlaceTrack(world, x, y + 1, z + 1) || !canPlaceTrack(world, x, y + 1, z + 2)) {
|
||||
if (!canPlaceTrack(player, world, x, y + 1, z + 1) || !canPlaceTrack(player, world, x, y + 1, z + 2)) {
|
||||
return false;
|
||||
}
|
||||
if (type == TrackTypes.LONG_STRAIGHT) {
|
||||
if (!canPlaceTrack(world, x, y + 1, z + 3) || !canPlaceTrack(world, x, y + 1, z + 4)
|
||||
|| !canPlaceTrack(world, x, y + 1, z + 5)) {
|
||||
if (!canPlaceTrack(player, world, x, y + 1, z + 3) || !canPlaceTrack(player, world, x, y + 1, z + 4)
|
||||
|| !canPlaceTrack(player, world, x, y + 1, z + 5)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -1304,12 +1305,12 @@ public class ItemTCRail extends ItemPart {
|
|||
}
|
||||
}
|
||||
if (l == 1) {
|
||||
if (!canPlaceTrack(world, x - 1, y + 1, z) || !canPlaceTrack(world, x - 2, y + 1, z)) {
|
||||
if (!canPlaceTrack(player, world, x - 1, y + 1, z) || !canPlaceTrack(player, world, x - 2, y + 1, z)) {
|
||||
return false;
|
||||
}
|
||||
if (type == TrackTypes.LONG_STRAIGHT) {
|
||||
if (!canPlaceTrack(world, x - 3, y + 1, z) || !canPlaceTrack(world, x - 4, y + 1, z)
|
||||
|| !canPlaceTrack(world, x - 5, y + 1, z)) {
|
||||
if (!canPlaceTrack(player, world, x - 3, y + 1, z) || !canPlaceTrack(player, world, x - 4, y + 1, z)
|
||||
|| !canPlaceTrack(player, world, x - 5, y + 1, z)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -1345,12 +1346,12 @@ public class ItemTCRail extends ItemPart {
|
|||
}
|
||||
}
|
||||
if (l == 3) {
|
||||
if (!canPlaceTrack(world, x + 1, y + 1, z) || !canPlaceTrack(world, x + 2, y + 1, z)) {
|
||||
if (!canPlaceTrack(player, world, x + 1, y + 1, z) || !canPlaceTrack(player, world, x + 2, y + 1, z)) {
|
||||
return false;
|
||||
}
|
||||
if (type == TrackTypes.LONG_STRAIGHT) {
|
||||
if (!canPlaceTrack(world, x + 3, y + 1, z) || !canPlaceTrack(world, x + 5, y + 1, z)
|
||||
|| !canPlaceTrack(world, x + 5, y + 1, z)) {
|
||||
if (!canPlaceTrack(player, world, x + 3, y + 1, z) || !canPlaceTrack(player, world, x + 5, y + 1, z)
|
||||
|| !canPlaceTrack(player, world, x + 5, y + 1, z)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -1404,7 +1405,7 @@ public class ItemTCRail extends ItemPart {
|
|||
return true;
|
||||
}
|
||||
if (type == TrackTypes.SMALL_STRAIGHT || type == TrackTypes.SMALL_ROAD_CROSSING || type == TrackTypes.SMALL_ROAD_CROSSING_1 || type == TrackTypes.SMALL_ROAD_CROSSING_2) {
|
||||
if (!canPlaceTrack(world, x, y + 1, z)) {
|
||||
if (!canPlaceTrack(player, world, x, y + 1, z)) {
|
||||
return false;
|
||||
}
|
||||
placeTrack(world,x, y + 1, z, BlockIDs.tcRail.block, l);
|
||||
|
@ -1422,7 +1423,7 @@ public class ItemTCRail extends ItemPart {
|
|||
return true;
|
||||
}
|
||||
if (type == TrackTypes.TWO_WAYS_CROSSING) {
|
||||
if (!canPlaceTrack(world, x, y + 1, z)) {
|
||||
if (!canPlaceTrack(player, world, x, y + 1, z)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1453,15 +1454,15 @@ public class ItemTCRail extends ItemPart {
|
|||
sideFacing=2;
|
||||
}
|
||||
|
||||
if (!canPlaceTrack(world, x + xDisplace, y + 1, z + zDisplace)
|
||||
|| !canPlaceTrack(world, x + (xDisplace * 2), y + 1, z + (zDisplace * 2))) {
|
||||
if (!canPlaceTrack(player, world, x + xDisplace, y + 1, z + zDisplace)
|
||||
|| !canPlaceTrack(player, world, x + (xDisplace * 2), y + 1, z + (zDisplace * 2))) {
|
||||
return false;
|
||||
}
|
||||
if (!canPlaceTrack(world, x + (xDisplace * 2) + (xSideDisplace), y + 1,
|
||||
if (!canPlaceTrack(player, world, x + (xDisplace * 2) + (xSideDisplace), y + 1,
|
||||
z + (zDisplace) + (zSideDisplace))) {
|
||||
return false;
|
||||
}
|
||||
if (!canPlaceTrack(world, x + (xDisplace * 2) - (xSideDisplace), y + 1,
|
||||
if (!canPlaceTrack(player, world, x + (xDisplace * 2) - (xSideDisplace), y + 1,
|
||||
z + (zDisplace) - (zSideDisplace))) {
|
||||
return false;
|
||||
}
|
||||
|
@ -1542,17 +1543,17 @@ public class ItemTCRail extends ItemPart {
|
|||
return false;
|
||||
}
|
||||
|
||||
private boolean parallelRightSwitchEast(World world, int x, int y, int z, int l, TrackTypes tempType) {
|
||||
private boolean parallelRightSwitchEast(EntityPlayer player, World world, int x, int y, int z, int l, TrackTypes tempType) {
|
||||
for (int check = 1; check < 10; check++) {
|
||||
if (!canPlaceTrack(world, x + check, y + 1, z))
|
||||
if (!canPlaceTrack(player, world, x + check, y + 1, z))
|
||||
return false;
|
||||
}
|
||||
if (!canPlaceTrack(world, x + 3, y + 1, z + 1) || !canPlaceTrack(world, x + 4, y + 1, z + 1) || !canPlaceTrack(world, x + 5, y + 1, z + 1) || !canPlaceTrack(world, x + 4, y + 1, z + 2) || !canPlaceTrack(world, x + 5, y + 1, z + 2) || !canPlaceTrack(world, x + 6, y + 1, z + 2) || !canPlaceTrack(world, x + 7, y + 1, z + 2) || !canPlaceTrack(world, x + 8, y + 1, z + 2) || !canPlaceTrack(world, x + 6, y + 1, z + 3) || !canPlaceTrack(world, x + 7, y + 1, z + 3) || !canPlaceTrack(world, x + 8, y + 1, z + 3) || !canPlaceTrack(world, x + 9, y + 1, z + 3) || !canPlaceTrack(world, x + 10, y + 1, z + 3) || !canPlaceTrack(world, x, y + 1, z)) {
|
||||
if (!canPlaceTrack(player, world, x + 3, y + 1, z + 1) || !canPlaceTrack(player, world, x + 4, y + 1, z + 1) || !canPlaceTrack(player, world, x + 5, y + 1, z + 1) || !canPlaceTrack(player, world, x + 4, y + 1, z + 2) || !canPlaceTrack(player, world, x + 5, y + 1, z + 2) || !canPlaceTrack(player, world, x + 6, y + 1, z + 2) || !canPlaceTrack(player, world, x + 7, y + 1, z + 2) || !canPlaceTrack(player, world, x + 8, y + 1, z + 2) || !canPlaceTrack(player, world, x + 6, y + 1, z + 3) || !canPlaceTrack(player, world, x + 7, y + 1, z + 3) || !canPlaceTrack(player, world, x + 8, y + 1, z + 3) || !canPlaceTrack(player, world, x + 9, y + 1, z + 3) || !canPlaceTrack(player, world, x + 10, y + 1, z + 3) || !canPlaceTrack(player, world, x, y + 1, z)) {
|
||||
return false;
|
||||
}
|
||||
int[] xArray = { x + 3, x + 2, x + 4, x + 5 };
|
||||
int[] zArray = { z + 1, z + 1, z + 1, z + 1 };
|
||||
if (!putDownTurn(world, true, x, y, z, xArray, zArray, l, true, 3, x + 10, z, 8.5, x + 0.5, y + 1, z + 9,
|
||||
if (!putDownTurn(player, world, true, x, y, z, xArray, zArray, l, true, 3, x + 10, z, 8.5, x + 0.5, y + 1, z + 9,
|
||||
TrackTypes.MEDIUM_RIGHT_TURN.getLabel(), ItemIDs.tcRailMediumParallelSwitch.item))
|
||||
return false;
|
||||
TileTCRail tcRailTurn = (TileTCRail) world.getTileEntity(x + 3, y + 1, z + 1);
|
||||
|
@ -1569,7 +1570,7 @@ public class ItemTCRail extends ItemPart {
|
|||
|
||||
int[] xArray2 = {x + 4, x + 5, x + 6, x + 7, x + 8, x + 6, x + 7, x + 8, x + 9};
|
||||
int[] zArray2 = {z + 2, z + 2, z + 2, z + 2, z + 2, z + 3, z + 3, z + 3, z + 3};
|
||||
if (!putDownTurn(world, false, x, y, z, xArray2, zArray2, 0, true, 3, x + 10, z + 3, 8.5, x + 10, y + 1, z - 5,
|
||||
if (!putDownTurn(player, world, false, x, y, z, xArray2, zArray2, 0, true, 3, x + 10, z + 3, 8.5, x + 10, y + 1, z - 5,
|
||||
TrackTypes.MEDIUM_LEFT_TURN.getLabel(), null))
|
||||
return false;
|
||||
TileTCRail tcRailTurn2 = (TileTCRail) world.getTileEntity(x + 4, y + 1, z + 2);
|
||||
|
@ -1593,17 +1594,17 @@ public class ItemTCRail extends ItemPart {
|
|||
return true;
|
||||
}
|
||||
|
||||
private boolean parallelRightSwitchWest(World world, int x, int y, int z, int l, TrackTypes tempType) {
|
||||
private boolean parallelRightSwitchWest(EntityPlayer player, World world, int x, int y, int z, int l, TrackTypes tempType) {
|
||||
for (int check = 1; check < 10; check++) {
|
||||
if (!canPlaceTrack(world, x - check, y + 1, z))
|
||||
if (!canPlaceTrack(player, world, x - check, y + 1, z))
|
||||
return false;
|
||||
}
|
||||
if (!canPlaceTrack(world, x - 3, y + 1, z - 1) || !canPlaceTrack(world, x - 4, y + 1, z - 1) || !canPlaceTrack(world, x - 5, y + 1, z - 1) || !canPlaceTrack(world, x - 4, y + 1, z - 2) || !canPlaceTrack(world, x - 5, y + 1, z - 2) || !canPlaceTrack(world, x - 6, y + 1, z - 2) || !canPlaceTrack(world, x - 7, y + 1, z - 2) || !canPlaceTrack(world, x - 8, y + 1, z - 2) || !canPlaceTrack(world, x - 6, y + 1, z - 3) || !canPlaceTrack(world, x - 7, y + 1, z - 3) || !canPlaceTrack(world, x - 8, y + 1, z - 3) || !canPlaceTrack(world, x - 9, y + 1, z - 3) || !canPlaceTrack(world, x - 10, y + 1, z - 3) || !canPlaceTrack(world, x, y + 1, z)) {
|
||||
if (!canPlaceTrack(player, world, x - 3, y + 1, z - 1) || !canPlaceTrack(player, world, x - 4, y + 1, z - 1) || !canPlaceTrack(player, world, x - 5, y + 1, z - 1) || !canPlaceTrack(player, world, x - 4, y + 1, z - 2) || !canPlaceTrack(player, world, x - 5, y + 1, z - 2) || !canPlaceTrack(player, world, x - 6, y + 1, z - 2) || !canPlaceTrack(player, world, x - 7, y + 1, z - 2) || !canPlaceTrack(player, world, x - 8, y + 1, z - 2) || !canPlaceTrack(player, world, x - 6, y + 1, z - 3) || !canPlaceTrack(player, world, x - 7, y + 1, z - 3) || !canPlaceTrack(player, world, x - 8, y + 1, z - 3) || !canPlaceTrack(player, world, x - 9, y + 1, z - 3) || !canPlaceTrack(player, world, x - 10, y + 1, z - 3) || !canPlaceTrack(player, world, x, y + 1, z)) {
|
||||
return false;
|
||||
}
|
||||
int[] xArray = { x - 3, x - 2, x - 4, x - 5 };
|
||||
int[] zArray = { z - 1, z - 1, z - 1, z - 1 };
|
||||
if (!putDownTurn(world, true, x, y, z, xArray, zArray, l, true, 1, x - 10, z, 8.5, x + 0.5, y + 1, z - 8,
|
||||
if (!putDownTurn(player, world, true, x, y, z, xArray, zArray, l, true, 1, x - 10, z, 8.5, x + 0.5, y + 1, z - 8,
|
||||
TrackTypes.MEDIUM_RIGHT_TURN.getLabel(), ItemIDs.tcRailMediumParallelSwitch.item))
|
||||
return false;
|
||||
TileTCRail tcRailTurn = (TileTCRail) world.getTileEntity(x - 3, y + 1, z - 1);
|
||||
|
@ -1620,7 +1621,7 @@ public class ItemTCRail extends ItemPart {
|
|||
|
||||
int[] xArray2 = {x - 4, x - 5, x - 6, x - 7, x - 8, x - 6, x - 7, x - 8, x - 9};
|
||||
int[] zArray2 = {z - 2, z - 2, z - 2, z - 2, z - 2, z - 3, z - 3, z - 3, z - 3};
|
||||
if (!putDownTurn(world, false, x, y, z, xArray2, zArray2, 2, true, 1, x - 10, z - 3, 8.5, x - 9, y + 1, z + 6,
|
||||
if (!putDownTurn(player, world, false, x, y, z, xArray2, zArray2, 2, true, 1, x - 10, z - 3, 8.5, x - 9, y + 1, z + 6,
|
||||
TrackTypes.MEDIUM_LEFT_TURN.getLabel(), null))
|
||||
return false;
|
||||
TileTCRail tcRailTurn2 = (TileTCRail) world.getTileEntity(x - 4, y + 1, z - 2);
|
||||
|
@ -1645,17 +1646,17 @@ public class ItemTCRail extends ItemPart {
|
|||
return true;
|
||||
}
|
||||
|
||||
private boolean parallelRightSwitchSouth(World world, int x, int y, int z, int l, TrackTypes tempType) {
|
||||
private boolean parallelRightSwitchSouth(EntityPlayer player, World world, int x, int y, int z, int l, TrackTypes tempType) {
|
||||
for (int check = 1; check < 10; check++) {
|
||||
if (!canPlaceTrack(world, x, y + 1, z + check))
|
||||
if (!canPlaceTrack(player, world, x, y + 1, z + check))
|
||||
return false;
|
||||
}
|
||||
if (!canPlaceTrack(world, x - 1, y + 1, z + 3) || !canPlaceTrack(world, x - 1, y + 1, z + 4) || !canPlaceTrack(world, x - 1, y + 1, z + 5) || !canPlaceTrack(world, x - 2, y + 1, z + 4) || !canPlaceTrack(world, x - 2, y + 1, z + 5) || !canPlaceTrack(world, x - 2, y + 1, z + 6) || !canPlaceTrack(world, x - 2, y + 1, z + 7) || !canPlaceTrack(world, x - 2, y + 1, z + 8) || !canPlaceTrack(world, x - 3, y + 1, z + 6) || !canPlaceTrack(world, x - 3, y + 1, z + 7) || !canPlaceTrack(world, x - 3, y + 1, z + 8) || !canPlaceTrack(world, x - 3, y + 1, z + 9) || !canPlaceTrack(world, x - 3, y + 1, z + 10) || !canPlaceTrack(world, x, y + 1, z)) {
|
||||
if (!canPlaceTrack(player, world, x - 1, y + 1, z + 3) || !canPlaceTrack(player, world, x - 1, y + 1, z + 4) || !canPlaceTrack(player, world, x - 1, y + 1, z + 5) || !canPlaceTrack(player, world, x - 2, y + 1, z + 4) || !canPlaceTrack(player, world, x - 2, y + 1, z + 5) || !canPlaceTrack(player, world, x - 2, y + 1, z + 6) || !canPlaceTrack(player, world, x - 2, y + 1, z + 7) || !canPlaceTrack(player, world, x - 2, y + 1, z + 8) || !canPlaceTrack(player, world, x - 3, y + 1, z + 6) || !canPlaceTrack(player, world, x - 3, y + 1, z + 7) || !canPlaceTrack(player, world, x - 3, y + 1, z + 8) || !canPlaceTrack(player, world, x - 3, y + 1, z + 9) || !canPlaceTrack(player, world, x - 3, y + 1, z + 10) || !canPlaceTrack(player, world, x, y + 1, z)) {
|
||||
return false;
|
||||
}
|
||||
int[] xArray = { x - 1, x - 1, x - 1, x - 1 };
|
||||
int[] zArray = { z + 3, z + 2, z + 4, z + 5 };
|
||||
if (!putDownTurn(world, true, x, y, z, xArray, zArray, l, true, 0, x, z + 10, 8.5, x - 8, y + 1, z + 0.5,
|
||||
if (!putDownTurn(player, world, true, x, y, z, xArray, zArray, l, true, 0, x, z + 10, 8.5, x - 8, y + 1, z + 0.5,
|
||||
TrackTypes.MEDIUM_RIGHT_TURN.getLabel(), ItemIDs.tcRailMediumParallelSwitch.item))
|
||||
return false;
|
||||
TileTCRail tcRailTurn = (TileTCRail) world.getTileEntity(x - 1, y + 1, z + 3);
|
||||
|
@ -1672,7 +1673,7 @@ public class ItemTCRail extends ItemPart {
|
|||
|
||||
int[] xArray2 = {x - 2, x - 2, x - 2, x - 2, x - 2, x - 3, x - 3, x - 3, x - 3};
|
||||
int[] zArray2 = {z + 4, z + 5, z + 6, z + 7, z + 8, z + 6, z + 7, z + 8, z + 9};
|
||||
if (!putDownTurn(world, false, x, y, z, xArray2, zArray2, 1, true, 0, x - 3, z + 10, 8.5, x + 6, y + 1, z + 10,
|
||||
if (!putDownTurn(player, world, false, x, y, z, xArray2, zArray2, 1, true, 0, x - 3, z + 10, 8.5, x + 6, y + 1, z + 10,
|
||||
TrackTypes.MEDIUM_LEFT_TURN.getLabel(), null))
|
||||
return false;
|
||||
TileTCRail tcRailTurn2 = (TileTCRail) world.getTileEntity(x - 2, y + 1, z + 4);
|
||||
|
@ -1696,17 +1697,17 @@ public class ItemTCRail extends ItemPart {
|
|||
return true;
|
||||
}
|
||||
|
||||
private boolean parallelRightSwitchNorth(World world, int x, int y, int z, int l, TrackTypes tempType) {
|
||||
private boolean parallelRightSwitchNorth(EntityPlayer player, World world, int x, int y, int z, int l, TrackTypes tempType) {
|
||||
for (int check = 1; check < 10; check++) {
|
||||
if (!canPlaceTrack(world, x, y + 1, z - check))
|
||||
if (!canPlaceTrack(player, world, x, y + 1, z - check))
|
||||
return false;
|
||||
}
|
||||
if (!canPlaceTrack(world, x + 1, y + 1, z - 3) || !canPlaceTrack(world, x + 1, y + 1, z - 4) || !canPlaceTrack(world, x + 1, y + 1, z - 5) || !canPlaceTrack(world, x + 2, y + 1, z - 4) || !canPlaceTrack(world, x + 2, y + 1, z - 5) || !canPlaceTrack(world, x + 2, y + 1, z - 6) || !canPlaceTrack(world, x + 2, y + 1, z - 7) || !canPlaceTrack(world, x + 2, y + 1, z - 8) || !canPlaceTrack(world, x + 3, y + 1, z - 6) || !canPlaceTrack(world, x + 3, y + 1, z - 7) || !canPlaceTrack(world, x + 3, y + 1, z - 8) || !canPlaceTrack(world, x + 3, y + 1, z - 9) || !canPlaceTrack(world, x + 3, y + 1, z - 10) || !canPlaceTrack(world, x, y + 1, z)) {
|
||||
if (!canPlaceTrack(player, world, x + 1, y + 1, z - 3) || !canPlaceTrack(player, world, x + 1, y + 1, z - 4) || !canPlaceTrack(player, world, x + 1, y + 1, z - 5) || !canPlaceTrack(player, world, x + 2, y + 1, z - 4) || !canPlaceTrack(player, world, x + 2, y + 1, z - 5) || !canPlaceTrack(player, world, x + 2, y + 1, z - 6) || !canPlaceTrack(player, world, x + 2, y + 1, z - 7) || !canPlaceTrack(player, world, x + 2, y + 1, z - 8) || !canPlaceTrack(player, world, x + 3, y + 1, z - 6) || !canPlaceTrack(player, world, x + 3, y + 1, z - 7) || !canPlaceTrack(player, world, x + 3, y + 1, z - 8) || !canPlaceTrack(player, world, x + 3, y + 1, z - 9) || !canPlaceTrack(player, world, x + 3, y + 1, z - 10) || !canPlaceTrack(player, world, x, y + 1, z)) {
|
||||
return false;
|
||||
}
|
||||
int[] xArray = { x + 1, x + 1, x + 1, x + 1 };
|
||||
int[] zArray = { z - 3, z - 2, z - 4, z - 5 };
|
||||
if (!putDownTurn(world, true, x, y, z, xArray, zArray, l, true, 2, x, z - 10, 8.5, x + 9, y + 1, z + 0.5,
|
||||
if (!putDownTurn(player, world, true, x, y, z, xArray, zArray, l, true, 2, x, z - 10, 8.5, x + 9, y + 1, z + 0.5,
|
||||
TrackTypes.MEDIUM_RIGHT_TURN.getLabel(), ItemIDs.tcRailMediumParallelSwitch.item))
|
||||
return false;
|
||||
TileTCRail tcRailTurn = (TileTCRail) world.getTileEntity(x + 1, y + 1, z - 3);
|
||||
|
@ -1723,7 +1724,7 @@ public class ItemTCRail extends ItemPart {
|
|||
|
||||
int[] xArray2 = {x + 2, x + 2, x + 2, x + 2, x + 2, x + 3, x + 3, x + 3, x + 3};
|
||||
int[] zArray2 = {z - 4, z - 5, z - 6, z - 7, z - 8, z - 6, z - 7, z - 8, z - 9};
|
||||
if (!putDownTurn(world, false, x, y, z, xArray2, zArray2, 3, true, 2, x + 3, z - 10, 8.5, x - 5, y + 1, z - 9,
|
||||
if (!putDownTurn(player, world, false, x, y, z, xArray2, zArray2, 3, true, 2, x + 3, z - 10, 8.5, x - 5, y + 1, z - 9,
|
||||
TrackTypes.MEDIUM_LEFT_TURN.getLabel(), null))
|
||||
return false;
|
||||
TileTCRail tcRailTurn2 = (TileTCRail) world.getTileEntity(x + 2, y + 1, z - 4);
|
||||
|
@ -1747,17 +1748,17 @@ public class ItemTCRail extends ItemPart {
|
|||
return true;
|
||||
}
|
||||
|
||||
private boolean parallelLeftSwitchNorth(World world, int x, int y, int z, int l, TrackTypes tempType) {
|
||||
private boolean parallelLeftSwitchNorth(EntityPlayer player, World world, int x, int y, int z, int l, TrackTypes tempType) {
|
||||
for (int check = 1; check < 10; check++) {
|
||||
if (!canPlaceTrack(world, x, y + 1, z - check))
|
||||
if (!canPlaceTrack(player, world, x, y + 1, z - check))
|
||||
return false;
|
||||
}
|
||||
if (!canPlaceTrack(world, x - 1, y + 1, z - 3) || !canPlaceTrack(world, x - 1, y + 1, z - 4) || !canPlaceTrack(world, x - 1, y + 1, z - 5) || !canPlaceTrack(world, x - 2, y + 1, z - 4) || !canPlaceTrack(world, x - 2, y + 1, z - 5) || !canPlaceTrack(world, x - 2, y + 1, z - 6) || !canPlaceTrack(world, x - 2, y + 1, z - 7) || !canPlaceTrack(world, x - 2, y + 1, z - 8) || !canPlaceTrack(world, x - 3, y + 1, z - 6) || !canPlaceTrack(world, x - 3, y + 1, z - 7) || !canPlaceTrack(world, x - 3, y + 1, z - 8) || !canPlaceTrack(world, x - 3, y + 1, z - 9) || !canPlaceTrack(world, x - 3, y + 1, z - 10) || !canPlaceTrack(world, x, y + 1, z)) {
|
||||
if (!canPlaceTrack(player, world, x - 1, y + 1, z - 3) || !canPlaceTrack(player, world, x - 1, y + 1, z - 4) || !canPlaceTrack(player, world, x - 1, y + 1, z - 5) || !canPlaceTrack(player, world, x - 2, y + 1, z - 4) || !canPlaceTrack(player, world, x - 2, y + 1, z - 5) || !canPlaceTrack(player, world, x - 2, y + 1, z - 6) || !canPlaceTrack(player, world, x - 2, y + 1, z - 7) || !canPlaceTrack(player, world, x - 2, y + 1, z - 8) || !canPlaceTrack(player, world, x - 3, y + 1, z - 6) || !canPlaceTrack(player, world, x - 3, y + 1, z - 7) || !canPlaceTrack(player, world, x - 3, y + 1, z - 8) || !canPlaceTrack(player, world, x - 3, y + 1, z - 9) || !canPlaceTrack(player, world, x - 3, y + 1, z - 10) || !canPlaceTrack(player, world, x, y + 1, z)) {
|
||||
return false;
|
||||
}
|
||||
int[] xArray = { x - 1, x - 1, x - 1, x - 1 };
|
||||
int[] zArray = { z - 3, z - 2, z - 4, z - 5 };
|
||||
if (!putDownTurn(world, true, x, y, z, xArray, zArray, l, true, 2, x, z - 10, 8.5, x - 8, y + 1, z + 0.5,
|
||||
if (!putDownTurn(player, world, true, x, y, z, xArray, zArray, l, true, 2, x, z - 10, 8.5, x - 8, y + 1, z + 0.5,
|
||||
TrackTypes.MEDIUM_LEFT_TURN.getLabel(), ItemIDs.tcRailMediumParallelSwitch.item))
|
||||
return false;
|
||||
TileTCRail tcRailTurn = (TileTCRail) world.getTileEntity(x - 1, y + 1, z - 3);
|
||||
|
@ -1774,7 +1775,7 @@ public class ItemTCRail extends ItemPart {
|
|||
|
||||
int[] xArray2 = {x - 2, x - 2, x - 2, x - 2, x - 2, x - 3, x - 3, x - 3, x - 3};
|
||||
int[] zArray2 = {z - 4, z - 5, z - 6, z - 7, z - 8, z - 6, z - 7, z - 8, z - 9};
|
||||
if (!putDownTurn(world, false, x, y, z, xArray2, zArray2, 1, true, 2, x - 3, z - 10, 8.5, x + 6, y + 1, z - 9,
|
||||
if (!putDownTurn(player, world, false, x, y, z, xArray2, zArray2, 1, true, 2, x - 3, z - 10, 8.5, x + 6, y + 1, z - 9,
|
||||
TrackTypes.MEDIUM_RIGHT_TURN.getLabel(), null))
|
||||
return false;
|
||||
TileTCRail tcRailTurn2 = (TileTCRail) world.getTileEntity(x - 2, y + 1, z - 4);
|
||||
|
@ -1798,17 +1799,17 @@ public class ItemTCRail extends ItemPart {
|
|||
return true;
|
||||
}
|
||||
|
||||
private boolean parallelLeftSwitchSouth(World world, int x, int y, int z, int l, TrackTypes tempType) {
|
||||
private boolean parallelLeftSwitchSouth(EntityPlayer player, World world, int x, int y, int z, int l, TrackTypes tempType) {
|
||||
for (int check = 1; check < 10; check++) {
|
||||
if (!canPlaceTrack(world, x, y + 1, z + check))
|
||||
if (!canPlaceTrack(player, world, x, y + 1, z + check))
|
||||
return false;
|
||||
}
|
||||
if (!canPlaceTrack(world, x + 1, y + 1, z + 3) || !canPlaceTrack(world, x + 1, y + 1, z + 4) || !canPlaceTrack(world, x + 1, y + 1, z + 5) || !canPlaceTrack(world, x + 2, y + 1, z + 4) || !canPlaceTrack(world, x + 2, y + 1, z + 5) || !canPlaceTrack(world, x + 2, y + 1, z + 6) || !canPlaceTrack(world, x + 2, y + 1, z + 7) || !canPlaceTrack(world, x + 2, y + 1, z + 8) || !canPlaceTrack(world, x + 3, y + 1, z + 6) || !canPlaceTrack(world, x + 3, y + 1, z + 7) || !canPlaceTrack(world, x + 3, y + 1, z + 8) || !canPlaceTrack(world, x + 3, y + 1, z + 9) || !canPlaceTrack(world, x + 3, y + 1, z + 10) || !canPlaceTrack(world, x, y + 1, z)) {
|
||||
if (!canPlaceTrack(player, world, x + 1, y + 1, z + 3) || !canPlaceTrack(player, world, x + 1, y + 1, z + 4) || !canPlaceTrack(player, world, x + 1, y + 1, z + 5) || !canPlaceTrack(player, world, x + 2, y + 1, z + 4) || !canPlaceTrack(player, world, x + 2, y + 1, z + 5) || !canPlaceTrack(player, world, x + 2, y + 1, z + 6) || !canPlaceTrack(player, world, x + 2, y + 1, z + 7) || !canPlaceTrack(player, world, x + 2, y + 1, z + 8) || !canPlaceTrack(player, world, x + 3, y + 1, z + 6) || !canPlaceTrack(player, world, x + 3, y + 1, z + 7) || !canPlaceTrack(player, world, x + 3, y + 1, z + 8) || !canPlaceTrack(player, world, x + 3, y + 1, z + 9) || !canPlaceTrack(player, world, x + 3, y + 1, z + 10) || !canPlaceTrack(player, world, x, y + 1, z)) {
|
||||
return false;
|
||||
}
|
||||
int[] xArray = { x + 1, x + 1, x + 1, x + 1 };
|
||||
int[] zArray = { z + 3, z + 2, z + 4, z + 5 };
|
||||
if (!putDownTurn(world, true, x, y, z, xArray, zArray, l, true, 0, x, z + 10, 8.5, x + 9, y + 1, z + 0.5,
|
||||
if (!putDownTurn(player, world, true, x, y, z, xArray, zArray, l, true, 0, x, z + 10, 8.5, x + 9, y + 1, z + 0.5,
|
||||
TrackTypes.MEDIUM_LEFT_TURN.getLabel(), ItemIDs.tcRailMediumParallelSwitch.item))
|
||||
return false;
|
||||
TileTCRail tcRailTurn = (TileTCRail) world.getTileEntity(x + 1, y + 1, z + 3);
|
||||
|
@ -1825,7 +1826,7 @@ public class ItemTCRail extends ItemPart {
|
|||
|
||||
int[] xArray2 = {x + 2, x + 2, x + 2, x + 2, x + 2, x + 3, x + 3, x + 3, x + 3};
|
||||
int[] zArray2 = {z + 4, z + 5, z + 6, z + 7, z + 8, z + 6, z + 7, z + 8, z + 9};
|
||||
if (!putDownTurn(world, false, x, y, z, xArray2, zArray2, 3, true, 0, x + 3, z + 10, 8.5, x - 5, y + 1, z + 10,
|
||||
if (!putDownTurn(player, world, false, x, y, z, xArray2, zArray2, 3, true, 0, x + 3, z + 10, 8.5, x - 5, y + 1, z + 10,
|
||||
TrackTypes.MEDIUM_RIGHT_TURN.getLabel(), null))
|
||||
return false;
|
||||
TileTCRail tcRailTurn2 = (TileTCRail) world.getTileEntity(x + 2, y + 1, z + 4);
|
||||
|
@ -1849,17 +1850,17 @@ public class ItemTCRail extends ItemPart {
|
|||
return true;
|
||||
}
|
||||
|
||||
private boolean parallelLeftSwitchEast(World world, int x, int y, int z, int l, TrackTypes tempType) {
|
||||
private boolean parallelLeftSwitchEast(EntityPlayer player, World world, int x, int y, int z, int l, TrackTypes tempType) {
|
||||
for (int check = 1; check < 10; check++) {
|
||||
if (!canPlaceTrack(world, x + check, y + 1, z))
|
||||
if (!canPlaceTrack(player, world, x + check, y + 1, z))
|
||||
return false;
|
||||
}
|
||||
if (!canPlaceTrack(world, x + 3, y + 1, z - 1) || !canPlaceTrack(world, x + 4, y + 1, z - 1) || !canPlaceTrack(world, x + 5, y + 1, z - 1) || !canPlaceTrack(world, x + 4, y + 1, z - 2) || !canPlaceTrack(world, x + 5, y + 1, z - 2) || !canPlaceTrack(world, x + 6, y + 1, z - 2) || !canPlaceTrack(world, x + 7, y + 1, z - 2) || !canPlaceTrack(world, x + 8, y + 1, z - 2) || !canPlaceTrack(world, x + 6, y + 1, z - 3) || !canPlaceTrack(world, x + 7, y + 1, z - 3) || !canPlaceTrack(world, x + 8, y + 1, z - 3) || !canPlaceTrack(world, x + 9, y + 1, z - 3) || !canPlaceTrack(world, x + 10, y + 1, z - 3) || !canPlaceTrack(world, x, y + 1, z)) {
|
||||
if (!canPlaceTrack(player, world, x + 3, y + 1, z - 1) || !canPlaceTrack(player, world, x + 4, y + 1, z - 1) || !canPlaceTrack(player, world, x + 5, y + 1, z - 1) || !canPlaceTrack(player, world, x + 4, y + 1, z - 2) || !canPlaceTrack(player, world, x + 5, y + 1, z - 2) || !canPlaceTrack(player, world, x + 6, y + 1, z - 2) || !canPlaceTrack(player, world, x + 7, y + 1, z - 2) || !canPlaceTrack(player, world, x + 8, y + 1, z - 2) || !canPlaceTrack(player, world, x + 6, y + 1, z - 3) || !canPlaceTrack(player, world, x + 7, y + 1, z - 3) || !canPlaceTrack(player, world, x + 8, y + 1, z - 3) || !canPlaceTrack(player, world, x + 9, y + 1, z - 3) || !canPlaceTrack(player, world, x + 10, y + 1, z - 3) || !canPlaceTrack(player, world, x, y + 1, z)) {
|
||||
return false;
|
||||
}
|
||||
int[] xArray = { x + 3, x + 2, x + 4, x + 5 };
|
||||
int[] zArray = { z - 1, z - 1, z - 1, z - 1 };
|
||||
if (!putDownTurn(world, true, x, y, z, xArray, zArray, l, true, 3, x + 10, z, 8.5, x + 0.5, y + 1, z - 8,
|
||||
if (!putDownTurn(player, world, true, x, y, z, xArray, zArray, l, true, 3, x + 10, z, 8.5, x + 0.5, y + 1, z - 8,
|
||||
TrackTypes.MEDIUM_LEFT_TURN.getLabel(), ItemIDs.tcRailMediumParallelSwitch.item))
|
||||
return false;
|
||||
TileTCRail tcRailTurn = (TileTCRail) world.getTileEntity(x + 3, y + 1, z - 1);
|
||||
|
@ -1876,7 +1877,7 @@ public class ItemTCRail extends ItemPart {
|
|||
|
||||
int[] xArray2 = {x + 4, x + 5, x + 6, x + 7, x + 8, x + 6, x + 7, x + 8, x + 9};
|
||||
int[] zArray2 = {z - 2, z - 2, z - 2, z - 2, z - 2, z - 3, z - 3, z - 3, z - 3};
|
||||
if (!putDownTurn(world, false, x, y, z, xArray2, zArray2, 2, true, 3, x + 10, z - 3, 8.5, x + 10, y + 1, z + 6,
|
||||
if (!putDownTurn(player, world, false, x, y, z, xArray2, zArray2, 2, true, 3, x + 10, z - 3, 8.5, x + 10, y + 1, z + 6,
|
||||
TrackTypes.MEDIUM_RIGHT_TURN.getLabel(), null))
|
||||
return false;
|
||||
TileTCRail tcRailTurn2 = (TileTCRail) world.getTileEntity(x + 4, y + 1, z - 2);
|
||||
|
@ -1901,17 +1902,17 @@ public class ItemTCRail extends ItemPart {
|
|||
return true;
|
||||
}
|
||||
|
||||
private boolean parallelLeftSwitchWest(World world, int x, int y, int z, int l, TrackTypes tempType) {
|
||||
private boolean parallelLeftSwitchWest(EntityPlayer player, World world, int x, int y, int z, int l, TrackTypes tempType) {
|
||||
for (int check = 1; check < 10; check++) {
|
||||
if (!canPlaceTrack(world, x - check, y + 1, z))
|
||||
if (!canPlaceTrack(player, world, x - check, y + 1, z))
|
||||
return false;
|
||||
}
|
||||
if (!canPlaceTrack(world, x - 3, y + 1, z + 1) || !canPlaceTrack(world, x - 4, y + 1, z + 1) || !canPlaceTrack(world, x - 5, y + 1, z + 1) || !canPlaceTrack(world, x - 4, y + 1, z + 2) || !canPlaceTrack(world, x - 5, y + 1, z + 2) || !canPlaceTrack(world, x - 6, y + 1, z + 2) || !canPlaceTrack(world, x - 7, y + 1, z + 2) || !canPlaceTrack(world, x - 8, y + 1, z + 2) || !canPlaceTrack(world, x - 6, y + 1, z + 3) || !canPlaceTrack(world, x - 7, y + 1, z + 3) || !canPlaceTrack(world, x - 8, y + 1, z + 3) || !canPlaceTrack(world, x - 9, y + 1, z + 3) || !canPlaceTrack(world, x - 10, y + 1, z + 3) || !canPlaceTrack(world, x, y + 1, z)) {
|
||||
if (!canPlaceTrack(player, world, x - 3, y + 1, z + 1) || !canPlaceTrack(player, world, x - 4, y + 1, z + 1) || !canPlaceTrack(player, world, x - 5, y + 1, z + 1) || !canPlaceTrack(player, world, x - 4, y + 1, z + 2) || !canPlaceTrack(player, world, x - 5, y + 1, z + 2) || !canPlaceTrack(player, world, x - 6, y + 1, z + 2) || !canPlaceTrack(player, world, x - 7, y + 1, z + 2) || !canPlaceTrack(player, world, x - 8, y + 1, z + 2) || !canPlaceTrack(player, world, x - 6, y + 1, z + 3) || !canPlaceTrack(player, world, x - 7, y + 1, z + 3) || !canPlaceTrack(player, world, x - 8, y + 1, z + 3) || !canPlaceTrack(player, world, x - 9, y + 1, z + 3) || !canPlaceTrack(player, world, x - 10, y + 1, z + 3) || !canPlaceTrack(player, world, x, y + 1, z)) {
|
||||
return false;
|
||||
}
|
||||
int[] xArray = { x - 3, x - 2, x - 4, x - 5 };
|
||||
int[] zArray = { z + 1, z + 1, z + 1, z + 1 };
|
||||
if (!putDownTurn(world, true, x, y, z, xArray, zArray, l, true, 1, x - 10, z, 8.5, x + 0.5, y + 1, z + 9,
|
||||
if (!putDownTurn(player, world, true, x, y, z, xArray, zArray, l, true, 1, x - 10, z, 8.5, x + 0.5, y + 1, z + 9,
|
||||
TrackTypes.MEDIUM_LEFT_TURN.getLabel(), ItemIDs.tcRailMediumParallelSwitch.item))
|
||||
return false;
|
||||
TileTCRail tcRailTurn = (TileTCRail) world.getTileEntity(x - 3, y + 1, z + 1);
|
||||
|
@ -1928,7 +1929,7 @@ public class ItemTCRail extends ItemPart {
|
|||
|
||||
int[] xArray2 = {x - 4, x - 5, x - 6, x - 7, x - 8, x - 6, x - 7, x - 8, x - 9};
|
||||
int[] zArray2 = {z + 2, z + 2, z + 2, z + 2, z + 2, z + 3, z + 3, z + 3, z + 3};
|
||||
if (!putDownTurn(world, false, x, y, z, xArray2, zArray2, 0, true, 1, x - 10, z + 3, 8.5, x - 9, y + 1, z - 5,
|
||||
if (!putDownTurn(player, world, false, x, y, z, xArray2, zArray2, 0, true, 1, x - 10, z + 3, 8.5, x - 9, y + 1, z - 5,
|
||||
TrackTypes.MEDIUM_RIGHT_TURN.getLabel(), null))
|
||||
return false;
|
||||
TileTCRail tcRailTurn2 = (TileTCRail) world.getTileEntity(x - 4, y + 1, z + 2);
|
||||
|
|
Loading…
Reference in a new issue