Skip to content

Commit

Permalink
0.0.1 release
Browse files Browse the repository at this point in the history
  • Loading branch information
LotuxPunk committed Apr 20, 2020
1 parent b2f1bc0 commit cd6e5a6
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 22 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ apply plugin: 'maven-publish'

version = "${minecraft_version}-${mod_version}"
group = 'com.vandendaelen.handles' // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = "${project.jar_name}_${minecraft_version}-${mod_version}"
archivesBaseName = "${project.jar_name}"

sourceCompatibility = targetCompatibility = compileJava.sourceCompatibility = compileJava.targetCompatibility = '1.8' // Need this here so eclipse task generates correctly.

Expand Down
6 changes: 3 additions & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
# This is required to provide enough memory for the Minecraft decompilation process.
org.gradle.jvmargs=-Xmx3G
org.gradle.daemon=false
jar_name=Handles
jar_name=handles
minecraft_version=1.14.4
mod_version = "0.0.1"
mod_version = 0.0.1

# Deps
jei_version=6.0.0.10
cct_version=1.86.2
tm_tag=1.1.1
tm_tag=1.0
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.Direction;
import net.minecraft.util.math.BlockPos;
import net.tardis.mod.controls.RefuelerControl;
import net.tardis.mod.dimensions.TDimensions;
import net.tardis.mod.tileentities.ConsoleTile;

Expand Down Expand Up @@ -47,18 +48,35 @@ public Object[] getTardisDestination() throws NotATardisException{
return new Object[]{pos.getX(), pos.getY(), pos.getZ()};
}

public Object[] setTardisDestination(int x, int y, int z) throws NotATardisException{
public Object[] setTardisDestination(double x, double y, double z) throws NotATardisException{
ConsoleTile tardis = getTardis();
tardis.setDestination(tardis.getDestinationDimension(), new BlockPos(x, y, z));
if (!tardis.isInFlight())
tardis.setDestination(tardis.getDestinationDimension(), new BlockPos(x, y, z));
return null;
}

public Object[] setTardisDimensionDestination(int id) throws NotATardisException {
public Object[] setTardisDimensionDestination(double id) throws NotATardisException {
ConsoleTile tardis = getTardis();
tardis.setDestination(DimensionHelper.getDimension(id), tardis.getDestination());
if (!tardis.isInFlight())
tardis.setDestination(DimensionHelper.getDimension((int)id), tardis.getDestination());
return null;
}

public Object[] startTardisFlight() throws NotATardisException {
ConsoleTile tardis = getTardis();
if (!tardis.isInFlight())
tardis.takeoff();
return null;
}

public Object[] setTardisRefuelMode(boolean status) throws NotATardisException {
ConsoleTile tardis = getTardis();
tardis.getControl(RefuelerControl.class).setRefuling(status);
return null;
}



public Object[] getDimensions(){
return DimensionHelper.getPrettyDimensionList().toArray();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,23 +1,24 @@
package com.vandendaelen.handles.helpers;

import net.minecraft.world.dimension.DimensionType;
import net.minecraft.world.server.ServerWorld;
import net.minecraftforge.fml.server.ServerLifecycleHooks;
import net.minecraftforge.common.DimensionManager;
import net.tardis.mod.helper.Helper;

import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.stream.Collectors;

public class DimensionHelper {
public static DimensionType getDimension(int id){
ArrayList<ServerWorld> worlds = new ArrayList<>();
ServerLifecycleHooks.getCurrentServer().getWorlds().iterator().forEachRemaining(worlds::add);
return worlds.get(id).getDimension().getType();
return getTardisableDimensionList().get(id);
}

public static ArrayList<String> getPrettyDimensionList(){
ArrayList<ServerWorld> worlds = new ArrayList<>();
ServerLifecycleHooks.getCurrentServer().getWorlds().iterator().forEachRemaining(worlds::add);
return (ArrayList<String>) worlds.stream().map(w -> MessageFormat.format("{0} - {1}", worlds.indexOf(w), w.getDimension().getType().getRegistryName().getNamespace())).collect(Collectors.toList());
ArrayList<DimensionType> dimensions = getTardisableDimensionList();
return (ArrayList<String>) dimensions.stream().map(dim -> MessageFormat.format("{0} - {1}", dimensions.indexOf(dim), dim.getRegistryName().toString())).collect(Collectors.toList());
}

public static ArrayList<DimensionType> getTardisableDimensionList(){
return (ArrayList<DimensionType>) DimensionManager.getRegistry().stream().filter(Helper::canTravelToDimension).collect(Collectors.toList());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ public String[] getMethodNames() {
"getDestination",
"setDestination",
"setDimension",
"getDimensions"
"getDimensions",
"startFlight",
"setRefuel"
};
}

Expand All @@ -46,11 +48,15 @@ public Object[] callMethod(@Nonnull IComputerAccess iComputerAccess, @Nonnull IL
case 1://getDestination
return tile.getTardisDestination();
case 2://setDestination
return tile.setTardisDestination((int)objects[0], (int)objects[1], (int)objects[2]);
case 3:
return tile.setTardisDimensionDestination((int)objects[0]);
case 4:
return tile.setTardisDestination((double)objects[0], (double)objects[1], (double)objects[2]);
case 3://setDimension
return tile.setTardisDimensionDestination((double)objects[0]);
case 4://getDimensions
return tile.getDimensions();
case 5://startFlight
return tile.startTardisFlight();
case 6://setRefuel
return tile.setTardisRefuelMode((boolean)objects[0]);
default:
return null;
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/META-INF/mods.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ displayURL="https://github.com/LotuxPunk/Handles" #optional
# A file name (in the root of the mod JAR) containing a logo for display
logoFile="handles.png" #optional
# A text field displayed in the mod UI
credits="The New TARDIS Mod team" #optional
credits="The New TARDIS Mod team, TheVale (Tardis Interface model & texture)" #optional
# A text field displayed in the mod UI
authors="LotuxPunk" #optional
# The description text for the mod (multi line!) (#mandatory)
Expand Down

0 comments on commit cd6e5a6

Please sign in to comment.