Skip to content

Commit 3b23b81

Browse files
committed
absolute coordinates option
1 parent 8ab33f0 commit 3b23b81

File tree

14 files changed

+46
-25
lines changed

14 files changed

+46
-25
lines changed

110/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ plugins {
2020
id "net.minecraftforge.gradle.forge" version "2.0.2"
2121
}
2222
*/
23-
version = "0.92"
23+
version = "0.94"
2424
group= "mobi.omegacentauri.raspberryjammod" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
2525
archivesBaseName = "RaspberryJamMod"
2626

111/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ plugins {
2020
id "net.minecraftforge.gradle.forge" version "2.0.2"
2121
}
2222
*/
23-
version = "0.92"
23+
version = "0.94"
2424
group= "mobi.omegacentauri.raspberryjammod" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
2525
archivesBaseName = "RaspberryJamMod"
2626

112/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ plugins {
2020
id "net.minecraftforge.gradle.forge" version "2.0.2"
2121
}
2222
*/
23-
version = "0.92"
23+
version = "0.94"
2424
group= "mobi.omegacentauri.raspberryjammod" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
2525
archivesBaseName = "RaspberryJamMod"
2626

112/fast.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ for x in src/main/java/mobi/omegacentauri/raspberryjammod/*.java ; do
66
sed -i -f fix.sed $x
77
done
88
rm build/libs/Raspberr*.jar 2> /dev/null
9-
sh gradlew build
9+
sh gradlew --offline build
1010
# --offline build
1111
rm build/libs/Raspberry*ources.jar 2> /dev/null
1212
mv build/libs/Raspberr* build/libs/RaspberryJamMod.jar 2> /dev/null
@@ -17,7 +17,11 @@ if [ "$1" != "noinstall" ]
1717
then
1818
mkdir $APPDATA/.minecraft/mods
1919
mkdir $APPDATA/.minecraft/mods/1.12
20+
mkdir $APPDATA/.minecraft/mods/1.12.1
21+
mkdir $APPDATA/.minecraft/mods/1.12.2
2022
cp build/libs/RaspberryJamMod.jar $APPDATA/.minecraft/mods/1.12/
23+
cp build/libs/RaspberryJamMod.jar $APPDATA/.minecraft/mods/1.12.1/
24+
cp build/libs/RaspberryJamMod.jar $APPDATA/.minecraft/mods/1.12.2/
2125
else
2226
echo Skipping mod installation.
2327
fi

19/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ plugins {
2020
id "net.minecraftforge.gradle.forge" version "2.0.2"
2121
}
2222
*/
23-
version = "0.92"
23+
version = "0.94"
2424
group= "mobi.omegacentauri.raspberryjammod" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
2525
archivesBaseName = "RaspberryJamMod"
2626

19/src/main/java/mobi/omegacentauri/raspberryjammod/APIHandler.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -666,7 +666,7 @@ else if (cmd.equals(GETHEIGHT)) {
666666
}
667667
}
668668

669-
h -= serverWorlds[0].getSpawnPoint().getY();
669+
h -= Location.getOrigin(serverWorlds[0]).getY();
670670

671671
sendLine(h);
672672
}

19/src/main/java/mobi/omegacentauri/raspberryjammod/Location.java

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ public class Location extends BlockPos {
99
World world;
1010
static final int WORLD_SPACING = 2000;
1111
static final int WORLD_SPACING_HALF = WORLD_SPACING/2;
12+
static BlockPos zeroPoint = new BlockPos(0,0,0);
1213

1314
// Altitudes for world number i are >-WORLD_SPACING_HALF-WORLD_SPACING*i and
1415
// <= WORLD_SPACING_HALF-WORLD_SPACING*i, with altitude 0 being at -WORLD_SPACING*i.
@@ -53,25 +54,32 @@ static public double encodeAltitude(int worldIndex, double y) {
5354
super(x,y,z);
5455
this.world = world;
5556
}
57+
58+
public static BlockPos getOrigin(World w) {
59+
if (RaspberryJamMod.absoluteCoordinates)
60+
return zeroPoint;
61+
else
62+
return w.getSpawnPoint();
63+
}
5664

5765
static Location decodeLocation(World[] serverWorlds, int x, int y, int z) {
5866
World w = getWorldByEncodedAltitude(serverWorlds, y);
59-
BlockPos spawnPos = w.getSpawnPoint();
60-
return new Location(w, x+spawnPos.getX(), (int)decodeAltitude(y)+spawnPos.getY(), z+spawnPos.getZ());
67+
BlockPos originPos = getOrigin(w);
68+
return new Location(w, x+originPos.getX(), (int)decodeAltitude(y)+originPos.getY(), z+originPos.getZ());
6169
}
6270

6371
static Vec3w decodeVec3w(World[] serverWorlds, double x, double y, double z) {
6472
World w = getWorldByEncodedAltitude(serverWorlds, y);
65-
BlockPos spawnPos = w.getSpawnPoint();
66-
return new Vec3w(w, x+spawnPos.getX(), (int)decodeAltitude(y)+spawnPos.getY(), z+spawnPos.getZ());
73+
BlockPos originPos = getOrigin(w);
74+
return new Vec3w(w, x+originPos.getX(), (int)decodeAltitude(y)+originPos.getY(), z+originPos.getZ());
6775
}
6876

6977
public static Vec3d encodeVec3(World[] serverWorlds, World w, Vec3d pos) {
7078
for (int i = 0 ; i < serverWorlds.length ; i++) {
7179
if (serverWorlds[i] == w) {
72-
BlockPos spawnPos = w.getSpawnPoint();
73-
return new Vec3d(pos.xCoord-spawnPos.getX(), encodeAltitude(i, pos.yCoord-spawnPos.getY()),
74-
pos.zCoord-spawnPos.getZ());
80+
BlockPos originPos = getOrigin(w);
81+
return new Vec3d(pos.xCoord-originPos.getX(), encodeAltitude(i, pos.yCoord-originPos.getY()),
82+
pos.zCoord-originPos.getZ());
7583
}
7684
}
7785
return pos;
@@ -80,8 +88,8 @@ public static Vec3d encodeVec3(World[] serverWorlds, World w, Vec3d pos) {
8088
public static Vec3i encodeVec3i(World[] serverWorlds, World w, int x, int y, int z) {
8189
for (int i = 0 ; i < serverWorlds.length ; i++) {
8290
if (serverWorlds[i] == w) {
83-
BlockPos spawnPos = w.getSpawnPoint();
84-
return new Vec3i(x-spawnPos.getX(), encodeAltitude(i, y-spawnPos.getY()), z-spawnPos.getZ());
91+
BlockPos originPos = getOrigin(w);
92+
return new Vec3i(x-originPos.getX(), encodeAltitude(i, y-originPos.getY()), z-originPos.getZ());
8593
}
8694
}
8795
return new Vec3i(x,y,z);

19/src/main/java/mobi/omegacentauri/raspberryjammod/Permission.java

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package mobi.omegacentauri.raspberryjammod;
22

3+
import net.minecraft.util.math.BlockPos;
34
import java.util.ArrayList;
45
import java.util.List;
56

@@ -70,13 +71,15 @@ public void add(String s) {
7071
if (relative) {
7172
if (world == null) {
7273
for (World w : worlds) {
73-
add(w,x1+w.getSpawnPoint().getX(),z1+w.getSpawnPoint().getZ(),
74-
x2+w.getSpawnPoint().getX(),z2+w.getSpawnPoint().getZ(), permitted);
74+
BlockPos origin = Location.getOrigin(w);
75+
add(w,x1+origin.getX(),z1+origin.getZ(),
76+
x2+origin.getX(),z2+origin.getZ(), permitted);
7577
}
7678
}
7779
else {
78-
add(world,x1+world.getSpawnPoint().getX(),z1+world.getSpawnPoint().getZ(),
79-
x2+world.getSpawnPoint().getX(),z2+world.getSpawnPoint().getZ(),
80+
BlockPos origin = Location.getOrigin(world);
81+
add(world,x1+origin.getX(),z1+origin.getZ(),
82+
x2+origin.getX(),z2+origin.getZ(),
8083
permitted);
8184
}
8285
}

19/src/main/java/mobi/omegacentauri/raspberryjammod/RaspberryJamMod.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
public class RaspberryJamMod
5656
{
5757
public static final String MODID = "raspberryjammod";
58-
public static final String VERSION = "0.92";
58+
public static final String VERSION = "0.94";
5959
public static final String NAME = "Raspberry Jam Mod";
6060
private APIServer fullAPIServer = null;
6161
private PythonExternalCommand pythonExternalCommand = null;
@@ -83,6 +83,7 @@ public class RaspberryJamMod
8383
public static boolean noFallDamage = false;
8484
public static boolean noInWallDamage = false;
8585
public static boolean globalImmutable = false;
86+
public static boolean absoluteCoordinates = false;
8687
public static volatile boolean noNameTags = false;
8788
public static final int NOMINAL_VERSION = 1009000;
8889

@@ -136,6 +137,7 @@ public static void synchronizeConfig() {
136137
noFallDamage = configFile.getBoolean("Disable Fall Damage", Configuration.CATEGORY_GENERAL, false, "Disable fall damage");
137138
noInWallDamage = configFile.getBoolean("Disable Stuck-In-Wall Damage", Configuration.CATEGORY_GENERAL, false, "Disable stuck-in-wall damage");
138139
globalImmutable = configFile.getBoolean("Immutability Setting Is Global", Configuration.CATEGORY_GENERAL, false, "Immutability setting applies to all players");
140+
absoluteCoordinates = configFile.getBoolean("Absolute Coordinates", Configuration.CATEGORY_GENERAL, false, "Use absolute coordinates in scripts");
139141
// clientOnlyPortNumber = configFile.getInt("Port Number for Client-Only API", Configuration.CATEGORY_GENERAL, 0, 0, 65535, "Client-only API port number (normally 0)");
140142

141143
if (configFile.hasChanged())

194/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ plugins {
2020
id "net.minecraftforge.gradle.forge" version "2.0.2"
2121
}
2222
*/
23-
version = "0.92"
23+
version = "0.94"
2424
group= "mobi.omegacentauri.raspberryjammod" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
2525
archivesBaseName = "RaspberryJamMod"
2626

0 commit comments

Comments
 (0)