Skip to content

Commit

Permalink
absolute coordinates option
Browse files Browse the repository at this point in the history
  • Loading branch information
arpruss committed May 6, 2018
1 parent 8ab33f0 commit 3b23b81
Show file tree
Hide file tree
Showing 14 changed files with 46 additions and 25 deletions.
2 changes: 1 addition & 1 deletion 110/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ plugins {
id "net.minecraftforge.gradle.forge" version "2.0.2"
}
*/
version = "0.92"
version = "0.94"
group= "mobi.omegacentauri.raspberryjammod" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = "RaspberryJamMod"

Expand Down
2 changes: 1 addition & 1 deletion 111/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ plugins {
id "net.minecraftforge.gradle.forge" version "2.0.2"
}
*/
version = "0.92"
version = "0.94"
group= "mobi.omegacentauri.raspberryjammod" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = "RaspberryJamMod"

Expand Down
2 changes: 1 addition & 1 deletion 112/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ plugins {
id "net.minecraftforge.gradle.forge" version "2.0.2"
}
*/
version = "0.92"
version = "0.94"
group= "mobi.omegacentauri.raspberryjammod" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = "RaspberryJamMod"

Expand Down
6 changes: 5 additions & 1 deletion 112/fast.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ for x in src/main/java/mobi/omegacentauri/raspberryjammod/*.java ; do
sed -i -f fix.sed $x
done
rm build/libs/Raspberr*.jar 2> /dev/null
sh gradlew build
sh gradlew --offline build
# --offline build
rm build/libs/Raspberry*ources.jar 2> /dev/null
mv build/libs/Raspberr* build/libs/RaspberryJamMod.jar 2> /dev/null
Expand All @@ -17,7 +17,11 @@ if [ "$1" != "noinstall" ]
then
mkdir $APPDATA/.minecraft/mods
mkdir $APPDATA/.minecraft/mods/1.12
mkdir $APPDATA/.minecraft/mods/1.12.1
mkdir $APPDATA/.minecraft/mods/1.12.2
cp build/libs/RaspberryJamMod.jar $APPDATA/.minecraft/mods/1.12/
cp build/libs/RaspberryJamMod.jar $APPDATA/.minecraft/mods/1.12.1/
cp build/libs/RaspberryJamMod.jar $APPDATA/.minecraft/mods/1.12.2/
else
echo Skipping mod installation.
fi
2 changes: 1 addition & 1 deletion 19/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ plugins {
id "net.minecraftforge.gradle.forge" version "2.0.2"
}
*/
version = "0.92"
version = "0.94"
group= "mobi.omegacentauri.raspberryjammod" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = "RaspberryJamMod"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -666,7 +666,7 @@ else if (cmd.equals(GETHEIGHT)) {
}
}

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

sendLine(h);
}
Expand Down
26 changes: 17 additions & 9 deletions 19/src/main/java/mobi/omegacentauri/raspberryjammod/Location.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ public class Location extends BlockPos {
World world;
static final int WORLD_SPACING = 2000;
static final int WORLD_SPACING_HALF = WORLD_SPACING/2;
static BlockPos zeroPoint = new BlockPos(0,0,0);

// Altitudes for world number i are >-WORLD_SPACING_HALF-WORLD_SPACING*i and
// <= WORLD_SPACING_HALF-WORLD_SPACING*i, with altitude 0 being at -WORLD_SPACING*i.
Expand Down Expand Up @@ -53,25 +54,32 @@ static public double encodeAltitude(int worldIndex, double y) {
super(x,y,z);
this.world = world;
}

public static BlockPos getOrigin(World w) {
if (RaspberryJamMod.absoluteCoordinates)
return zeroPoint;
else
return w.getSpawnPoint();
}

static Location decodeLocation(World[] serverWorlds, int x, int y, int z) {
World w = getWorldByEncodedAltitude(serverWorlds, y);
BlockPos spawnPos = w.getSpawnPoint();
return new Location(w, x+spawnPos.getX(), (int)decodeAltitude(y)+spawnPos.getY(), z+spawnPos.getZ());
BlockPos originPos = getOrigin(w);
return new Location(w, x+originPos.getX(), (int)decodeAltitude(y)+originPos.getY(), z+originPos.getZ());
}

static Vec3w decodeVec3w(World[] serverWorlds, double x, double y, double z) {
World w = getWorldByEncodedAltitude(serverWorlds, y);
BlockPos spawnPos = w.getSpawnPoint();
return new Vec3w(w, x+spawnPos.getX(), (int)decodeAltitude(y)+spawnPos.getY(), z+spawnPos.getZ());
BlockPos originPos = getOrigin(w);
return new Vec3w(w, x+originPos.getX(), (int)decodeAltitude(y)+originPos.getY(), z+originPos.getZ());
}

public static Vec3d encodeVec3(World[] serverWorlds, World w, Vec3d pos) {
for (int i = 0 ; i < serverWorlds.length ; i++) {
if (serverWorlds[i] == w) {
BlockPos spawnPos = w.getSpawnPoint();
return new Vec3d(pos.xCoord-spawnPos.getX(), encodeAltitude(i, pos.yCoord-spawnPos.getY()),
pos.zCoord-spawnPos.getZ());
BlockPos originPos = getOrigin(w);
return new Vec3d(pos.xCoord-originPos.getX(), encodeAltitude(i, pos.yCoord-originPos.getY()),
pos.zCoord-originPos.getZ());
}
}
return pos;
Expand All @@ -80,8 +88,8 @@ public static Vec3d encodeVec3(World[] serverWorlds, World w, Vec3d pos) {
public static Vec3i encodeVec3i(World[] serverWorlds, World w, int x, int y, int z) {
for (int i = 0 ; i < serverWorlds.length ; i++) {
if (serverWorlds[i] == w) {
BlockPos spawnPos = w.getSpawnPoint();
return new Vec3i(x-spawnPos.getX(), encodeAltitude(i, y-spawnPos.getY()), z-spawnPos.getZ());
BlockPos originPos = getOrigin(w);
return new Vec3i(x-originPos.getX(), encodeAltitude(i, y-originPos.getY()), z-originPos.getZ());
}
}
return new Vec3i(x,y,z);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package mobi.omegacentauri.raspberryjammod;

import net.minecraft.util.math.BlockPos;
import java.util.ArrayList;
import java.util.List;

Expand Down Expand Up @@ -70,13 +71,15 @@ public void add(String s) {
if (relative) {
if (world == null) {
for (World w : worlds) {
add(w,x1+w.getSpawnPoint().getX(),z1+w.getSpawnPoint().getZ(),
x2+w.getSpawnPoint().getX(),z2+w.getSpawnPoint().getZ(), permitted);
BlockPos origin = Location.getOrigin(w);
add(w,x1+origin.getX(),z1+origin.getZ(),
x2+origin.getX(),z2+origin.getZ(), permitted);
}
}
else {
add(world,x1+world.getSpawnPoint().getX(),z1+world.getSpawnPoint().getZ(),
x2+world.getSpawnPoint().getX(),z2+world.getSpawnPoint().getZ(),
BlockPos origin = Location.getOrigin(world);
add(world,x1+origin.getX(),z1+origin.getZ(),
x2+origin.getX(),z2+origin.getZ(),
permitted);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
public class RaspberryJamMod
{
public static final String MODID = "raspberryjammod";
public static final String VERSION = "0.92";
public static final String VERSION = "0.94";
public static final String NAME = "Raspberry Jam Mod";
private APIServer fullAPIServer = null;
private PythonExternalCommand pythonExternalCommand = null;
Expand Down Expand Up @@ -83,6 +83,7 @@ public class RaspberryJamMod
public static boolean noFallDamage = false;
public static boolean noInWallDamage = false;
public static boolean globalImmutable = false;
public static boolean absoluteCoordinates = false;
public static volatile boolean noNameTags = false;
public static final int NOMINAL_VERSION = 1009000;

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

if (configFile.hasChanged())
Expand Down
2 changes: 1 addition & 1 deletion 194/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ plugins {
id "net.minecraftforge.gradle.forge" version "2.0.2"
}
*/
version = "0.92"
version = "0.94"
group= "mobi.omegacentauri.raspberryjammod" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = "RaspberryJamMod"

Expand Down
8 changes: 6 additions & 2 deletions RaspberryJamMod.iss
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!

#define MyAppName "RaspberryJamMod"
#define MyAppVersion "0.92"
#define MyAppVersion "0.93"
#define MyAppPublisher "Omega Centauri Software"
#define MyAppURL "http://github.com/arpruss/raspberryjammod"

Expand Down Expand Up @@ -66,6 +66,8 @@ Source: "110\build\libs\RaspberryJamMod.jar"; DestDir: "{userappdata}\.minecraft
Source: "111\build\libs\RaspberryJamMod.jar"; DestDir: "{userappdata}\.minecraft\mods\1.11\"
Source: "111\build\libs\RaspberryJamMod.jar"; DestDir: "{userappdata}\.minecraft\mods\1.11.2\"
Source: "112\build\libs\RaspberryJamMod.jar"; DestDir: "{userappdata}\.minecraft\mods\1.12\"
Source: "112\build\libs\RaspberryJamMod.jar"; DestDir: "{userappdata}\.minecraft\mods\1.12.1\"
Source: "112\build\libs\RaspberryJamMod.jar"; DestDir: "{userappdata}\.minecraft\mods\1.12.2\"
Source: "py27\*"; Excludes: "py27\Lib\site-packages\pip\*"; DestDir: "{userappdata}\.minecraft\python27"; Flags: createallsubdirs recursesubdirs ignoreversion; Components: Python\Python27\Interpreter
Source: "py3\*"; Excludes: "py3\Lib\site-packages\pip\*"; DestDir: "{userappdata}\.minecraft\python3"; Flags: createallsubdirs recursesubdirs ignoreversion; Components: Python\Python3\Interpreter
Source: "config27\raspberryjammod.cfg"; DestDir: "{userappdata}\.minecraft\config"; Flags: confirmoverwrite; Components: Python\Python27\Interpreter\Config
Expand Down Expand Up @@ -94,9 +96,11 @@ Type: files; Name: "{userappdata}\.minecraft\mods\1.10.2\RaspberryJamMod*.jar";
Type: files; Name: "{userappdata}\.minecraft\mods\1.11\RaspberryJamMod*.jar"; Components: Mod
Type: files; Name: "{userappdata}\.minecraft\mods\1.11.2\RaspberryJamMod*.jar"; Components: Mod
Type: files; Name: "{userappdata}\.minecraft\mods\1.12\RaspberryJamMod*.jar"; Components: Mod
Type: files; Name: "{userappdata}\.minecraft\mods\1.12.1\RaspberryJamMod*.jar"; Components: Mod
Type: files; Name: "{userappdata}\.minecraft\mods\1.12.2\RaspberryJamMod*.jar"; Components: Mod

[Messages]
WelcomeLabel2=MAKE SURE YOU HAVE FORGE FOR MINECRAFT (versions 1.8-1.12 supported) ALREADY INSTALLED. Otherwise, this won't work.
WelcomeLabel2=MAKE SURE YOU HAVE FORGE FOR MINECRAFT (versions 1.8-1.12.2 supported) ALREADY INSTALLED. Otherwise, this won't work.
ConfirmUninstall=Are you sure you want to completely remove %1 and all of its components? (Note that the scripts in the mcpipy folder of your Minecraft folder should NOT get deleted, however, in case you made changes.)
[Icons]
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ buildscript {

apply plugin: 'forge'

version = "0.92"
version = "0.94"
group= "mobi.omegacentauri.raspberryjammod" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = "RaspberryJamMod"

Expand Down
Binary file modified mods.zip
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
public class RaspberryJamMod
{
public static final String MODID = "raspberryjammod";
public static final String VERSION = "0.92";
public static final String VERSION = "0.94";
public static final String NAME = "Raspberry Jam Mod";
private APIServer fullAPIServer = null;
private PythonExternalCommand pythonExternalCommand = null;
Expand Down

0 comments on commit 3b23b81

Please sign in to comment.