diff --git a/build.gradle b/build.gradle index f0a5f15e..69ec93d1 100644 --- a/build.gradle +++ b/build.gradle @@ -75,4 +75,9 @@ processResources } } -sourceSets { main { output.resourcesDir = output.classesDir } } +apply plugin: 'idea' +idea { + module { + inheritOutputDirs = true + } +} \ No newline at end of file diff --git a/build.properties b/build.properties index b496bb63..518b70bc 100644 --- a/build.properties +++ b/build.properties @@ -1,6 +1,6 @@ minecraft_version=1.7.10 mod_version=1.0.2-RC2 -forge_version=10.13.4.1492-1.7.10 +forge_version=10.13.4.1558-1.7.10 CCLIB_version=1.1.3.140 NEI_version=1.0.3.74 ccc_version=1.0.4.29 diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 0087cd3b..e8c6bf7b 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index a9bbffb5..9e9de423 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-1.12-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-2.7-bin.zip diff --git a/gradlew b/gradlew index 91a7e269..32decf30 100644 --- a/gradlew +++ b/gradlew @@ -42,11 +42,6 @@ case "`uname`" in ;; esac -# For Cygwin, ensure paths are in UNIX format before anything is touched. -if $cygwin ; then - [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"` -fi - # Attempt to set APP_HOME # Resolve links: $0 may be a link PRG="$0" @@ -114,6 +109,7 @@ fi if $cygwin ; then APP_HOME=`cygpath --path --mixed "$APP_HOME"` CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + JAVACMD=`cygpath --unix "$JAVACMD"` # We build the pattern for arguments to be converted via cygpath ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` @@ -161,4 +157,4 @@ function splitJvmOpts() { eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" -exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" +exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" \ No newline at end of file diff --git a/src/main/java/com/brandon3055/draconicevolution/client/gui/GUIParticleGenerator.java b/src/main/java/com/brandon3055/draconicevolution/client/gui/GUIParticleGenerator.java index 5744a210..e984e758 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/gui/GUIParticleGenerator.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/gui/GUIParticleGenerator.java @@ -80,7 +80,7 @@ public class GUIParticleGenerator extends GuiScreen { syncWithServer(); } - String[] InfoText = {"" + "The Particle Generator is a decorative device that allows you to create your own custom particle effects. " + "It is fairly easy you use this device you simply adjust the fields (variables) in the interface to change how the generated particles look and behave. " + "This block is a work in progress and new features and particles are likely to be added in future versions. " + "The following is a list of all of the fields in the interface and what they do.", "The first thing to note is that most fields have a random modifier which will add a random number between 0 and whatever max (or min) value you give it to the field. " + "-The first 3 fields (Red, Green & Blue) control the colour of the particle. Most people should be familiar with this colour system if not google RGB colours. Note: the max value for each colour can not go higher then 255 so the colour field limits the random modifier e.g. if the colour field is set to 255 and the random modifier is set to 20 the result will always be 255", "-The next 3 fields (Motion X, Y & Z) control the direction and speed of the particle " + "-The \"Life\" field sets how long (in ticks) before the particle despawns. " + "-The \"Size\" field sets the size of the particle. " + "-The next 3 fields (Spawn X, Y & Z) Sets the spawn location of the particle (relative to the location of the particle generator)", "-The \"Delay\" field sets the delay (in ticks) between each particle spawn e.g. 1=20/s, 20=1/s, 100=1/5s " + "-The \"Fade\" field sets how long (in ticks) it takes the partile to fade out of existance. Note: This adds to the life of the particle " + "-The \"Gravity\" field sets how the particle is affected by gravity. " + "-\"Block Collision\" Toggles weather or not the particle will collide with blocks " + "-\"Particle Selected\" Switches between the different particles available.", EnumChatFormatting.DARK_RED + " Redstone Control" + EnumChatFormatting.BLACK + "\nBy default a redstone signal is required for the generator to run." + "\n\nHowever if you shift right click the generator with an empty hand it will switch to inverted mode." + "\nThe redstone mode is indicated by the 8 cubes at the corners of the block."}; + String[] InfoText = {"" + "The Particle Generator is a decorative device that allows you to create your own custom particle effects. " + "It is fairly easy you use this device you simply adjust the fields (variables) in the interface to change how the generated particles look and behave. " + "This block is a work in progress and new features and particles are likely to be added in future versions. " + "The following is a list of all of the fields in the interface and what they do.", "The first thing to note is that most fields have a random modifier which will add a random number between 0 and whatever max (or min) value you give it to the field. " + "-The first 3 fields (Red, Green & Blue) control the colour of the particle. Most people should be familiar with this colour system if not google RGB colours. Note: the max value for each colour can not go higher then 255 so the colour field limits the random modifier e.g. if the colour field is set to 255 and the random modifier is set to 20 the result will always be 255", "-The next 3 fields (Motion X, Y & Z) control the direction and speed of the particle " + "-The \"Life\" field sets how long (in ticks) before the particle despawns. " + "-The \"Size\" field sets the size of the particle. " + "-The next 3 fields (Spawn X, Y & Z) Sets the spawn location of the particle (relative to the location of the particle generator)", "-The \"Delay\" field sets the delay (in ticks) between each particle spawn e.g. 1=20/s, 20=1/s, 100=1/5s " + "-The \"Fade\" field sets how long (in ticks) it takes the partile to fade out of existance. Note: This adds to the life of the particle " + "-The \"Gravity\" field sets how the particle is affected by gravity. " + "-\"Block Collision\" Toggles weather or not the particle will collide with blocks " + "-\"Particle Selected\" Switches between the different particles available.", EnumChatFormatting.DARK_RED + " Redstone Control" + EnumChatFormatting.BLACK + "\nBy default a redstone signal is required for the generator to run." + "\n\nHowever if you shift right click the generator with an empty hand it will switch to inverted mode." + "\nThe redstone mode is indicated by the 8 cubes at the corners of the block.", EnumChatFormatting.DARK_RED + " Computer Control" + EnumChatFormatting.BLACK + "\nThe Generator can be controlled via a computer" + "\nIt exposes a relatively straight forward API:" + "\n\n setGeneratorProperty(property, value)\n getGeneratorState()\n resetGeneratorState()" + "\n\nGenerator state is obtained as a whole from getGeneratorState, whereas properties are modified one at a time using setGeneratorProperty. Property names are strings and mostly correspond to button labels in the GUI."}; //@formatter:off @Override @@ -395,7 +395,7 @@ public class GUIParticleGenerator extends GuiScreen { packetValue = (short) page; break; case 56://Info Next Page - if (infoPage < 4) infoPage++; + if (infoPage < 5) infoPage++; else initGui(); break; case 57://Info Previous Page diff --git a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileParticleGenerator.java b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileParticleGenerator.java index 28a535b1..be6a0d6b 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileParticleGenerator.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileParticleGenerator.java @@ -5,6 +5,8 @@ import com.brandon3055.draconicevolution.client.render.particle.Particles; import com.brandon3055.draconicevolution.common.blocks.multiblock.MultiblockHelper.TileLocation; import com.brandon3055.draconicevolution.client.handler.ParticleHandler; import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.TileEnergyStorageCore; +import com.brandon3055.draconicevolution.integration.computers.IDEPeripheral; + import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.nbt.NBTTagCompound; @@ -14,9 +16,11 @@ import net.minecraft.network.play.server.S35PacketUpdateTileEntity; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.AxisAlignedBB; +import java.util.HashMap; +import java.util.Map; import java.util.Random; -public class TileParticleGenerator extends TileEntity { +public class TileParticleGenerator extends TileEntity implements IDEPeripheral { public boolean particles_enabled = true; public int red = 0; @@ -46,6 +50,7 @@ public class TileParticleGenerator extends TileEntity { public int spawn_rate = 1; public boolean collide = false; public int selected_particle = 1; + public int selected_max = 3; public float gravity = 0F; public boolean active = true; public boolean signal = false; @@ -288,4 +293,253 @@ public class TileParticleGenerator extends TileEntity { public double getMaxRenderDistanceSquared() { return 655360.0D; } + + public static double limit(double value, double min, double max) { + return Math.max(min, Math.min(value, max)); + } + + public static int limit(int value, int min, int max) { + return Math.max(min, Math.min(value, max)); + } + + @Override + public String getName() { + return "particle_generator"; + } + + @Override + public String[] getMethodNames() { + return new String[] { + "setGeneratorProperty", + "getGeneratorState", + "resetGeneratorState" + }; + } + + @Override + public Object[] callMethod(String method, Object... args) { + if (method.startsWith("setGeneratorProperty")) { + if (args.length != 2) return new Object[] { false }; + else if (!(args[0] instanceof String)) return new Object[] { false }; + + /* Particles */ + if (args[0].equals("particles_enabled") && args[1] instanceof Boolean) { + particles_enabled = (Boolean) args[1]; + } + else if (args[0].equals("red") && args[1] instanceof Double) { + red = limit(((Double) args[1]).intValue(), 0, 255); + } + else if (args[0].equals("green") && args[1] instanceof Double) { + green = limit(((Double) args[1]).intValue(), 0, 255); + } + else if (args[0].equals("blue") && args[1] instanceof Double) { + blue = limit(((Double) args[1]).intValue(), 0, 255); + } + else if (args[0].equals("random_red") && args[1] instanceof Double) { + random_red = limit(((Double) args[1]).intValue(), 0, 255); + } + else if (args[0].equals("random_green") && args[1] instanceof Double) { + random_green = limit(((Double) args[1]).intValue(), 0, 255); + } + else if (args[0].equals("random_blue") && args[1] instanceof Double) { + random_blue = limit(((Double) args[1]).intValue(), 0, 255); + } + else if (args[0].equals("motion_x") && args[1] instanceof Double) { + motion_x = (float) limit((Double) args[1], -5F, 5F); + } + else if (args[0].equals("motion_y") && args[1] instanceof Double) { + motion_y = (float) limit((Double) args[1], -5F, 5F); + } + else if (args[0].equals("motion_z") && args[1] instanceof Double) { + motion_z = (float) limit((Double) args[1], -5F, 5F); + } + else if (args[0].equals("random_motion_x") && args[1] instanceof Double) { + random_motion_x = (float) limit((Double) args[1], -5F, 5F); + } + else if (args[0].equals("random_motion_y") && args[1] instanceof Double) { + random_motion_y = (float) limit((Double) args[1], -5F, 5F); + } + else if (args[0].equals("random_motion_z") && args[1] instanceof Double) { + random_motion_z = (float) limit((Double) args[1], -5F, 5F); + } + else if (args[0].equals("scale") && args[1] instanceof Double) { + scale = (float) limit((Double) args[1], 0.01F, 50F); + } + else if (args[0].equals("random_scale") && args[1] instanceof Double) { + random_scale = (float) limit((Double) args[1], 0.01F, 50F); + } + else if (args[0].equals("life") && args[1] instanceof Double) { + life = limit(((Double) args[1]).intValue(), 0, 1000); + } + else if (args[0].equals("random_life") && args[1] instanceof Double) { + random_life = limit(((Double) args[1]).intValue(), 0, 1000); + } + else if (args[0].equals("spawn_x") && args[1] instanceof Double) { + spawn_x = (float) limit((Double) args[1], -50F, 50F); + } + else if (args[0].equals("spawn_y") && args[1] instanceof Double) { + spawn_y = (float) limit((Double) args[1], -50F, 50F); + } + else if (args[0].equals("spawn_z") && args[1] instanceof Double) { + spawn_z = (float) limit((Double) args[1], -50F, 50F); + } + else if (args[0].equals("random_spawn_x") && args[1] instanceof Double) { + random_spawn_x = (float) limit((Double) args[1], -50F, 50F); + } + else if (args[0].equals("random_spawn_y") && args[1] instanceof Double) { + random_spawn_y = (float) limit((Double) args[1], -50F, 50F); + } + else if (args[0].equals("random_spawn_z") && args[1] instanceof Double) { + random_spawn_z = (float) limit((Double) args[1], -50F, 50F); + } + else if (args[0].equals("fade") && args[1] instanceof Double) { + fade = limit(((Double) args[1]).intValue(), 0, 100); + } + else if (args[0].equals("spawn_rate") && args[1] instanceof Double) { + spawn_rate = limit(((Double) args[1]).intValue(), 1, 200); + } + else if (args[0].equals("collide") && args[1] instanceof Double) { + collide = (Boolean) args[1]; + } + else if (args[0].equals("selected_particle") && args[1] instanceof Double) { + selected_particle = limit(((Double) args[1]).intValue(), 1, selected_max); + } + else if (args[0].equals("gravity") && args[1] instanceof Double) { + gravity = (float) limit((Double) args[1], -5F, 5F); + } + /* Beam */ + else if (args[0].equals("beam_enabled") && args[1] instanceof Boolean) { + beam_enabled = (Boolean) args[1]; + } + else if (args[0].equals("render_core") && args[1] instanceof Boolean) { + render_core = (Boolean) args[1]; + } + else if (args[0].equals("beam_red") && args[1] instanceof Double) { + beam_red = limit(((Double) args[1]).intValue(), 0, 255); + } + else if (args[0].equals("beam_green") && args[1] instanceof Double) { + beam_green = limit(((Double) args[1]).intValue(), 0, 255); + } + else if (args[0].equals("beam_blue") && args[1] instanceof Double) { + beam_blue = limit(((Double) args[1]).intValue(), 0, 255); + } + else if (args[0].equals("beam_scale") && args[1] instanceof Double) { + beam_scale = (float) limit((Double) args[1], -0F, 5F); + } + else if (args[0].equals("beam_pitch") && args[1] instanceof Double) { + beam_pitch = (float) limit((Double) args[1], -180F, 180F); + } + else if (args[0].equals("beam_yaw") && args[1] instanceof Double) { + beam_yaw = (float) limit((Double) args[1], -180F, 180F); + } + else if (args[0].equals("beam_length") && args[1] instanceof Double) { + beam_length = (float) limit((Double) args[1], -0F, 320F); + } + else if (args[0].equals("beam_rotation") && args[1] instanceof Double) { + beam_rotation = (float) limit((Double) args[1], -1F, 1F); + } + else { + return new Object[] { false }; + } + + worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); + return new Object[] { true }; + } + else if (method.startsWith("getGeneratorState")) { + Map map = new HashMap(); + + /* Particles */ + map.put("particles_enabled", particles_enabled); + map.put("red", red); + map.put("green", green); + map.put("blue", blue); + map.put("random_red", random_red); + map.put("random_green", random_green); + map.put("random_blue", random_blue); + map.put("motion_x", motion_x); + map.put("motion_y", motion_y); + map.put("motion_z", motion_z); + map.put("random_motion_x", random_motion_x); + map.put("random_motion_y", random_motion_y); + map.put("random_motion_z", random_motion_z); + map.put("scale", scale); + map.put("random_scale", random_scale); + map.put("life", life); + map.put("random_life", random_life); + map.put("spawn_x", spawn_x); + map.put("spawn_y", spawn_y); + map.put("spawn_z", spawn_z); + map.put("random_spawn_x", random_spawn_x); + map.put("random_spawn_y", random_spawn_y); + map.put("random_spawn_z", random_spawn_z); + map.put("fade", fade); + map.put("spawn_rate", spawn_rate); + map.put("collide", collide); + map.put("selected_particle", selected_particle); + map.put("gravity", gravity); + + /* Beam */ + map.put("beam_enabled", beam_enabled); + map.put("render_core", render_core); + map.put("beam_red", beam_red); + map.put("beam_green", beam_green); + map.put("beam_blue", beam_blue); + map.put("beam_scale", beam_scale); + map.put("beam_pitch", beam_pitch); + map.put("beam_yaw", beam_yaw); + map.put("beam_length", beam_length); + map.put("beam_rotation", beam_rotation); + + return new Object[]{ map }; + } + else if (method.startsWith("resetGeneratorState")) { + particles_enabled = true; + red = 0; + green = 0; + blue = 0; + random_red = 0; + random_green = 0; + random_blue = 0; + motion_x = 0.0F; + motion_y = 0.0F; + motion_z = 0.0F; + random_motion_x = 0.0F; + random_motion_y = 0.0F; + random_motion_z = 0.0F; + scale = 1F; + random_scale = 0F; + life = 100; + random_life = 0; + spawn_x = 0; + spawn_y = 0; + spawn_z = 0; + random_spawn_x = 0; + random_spawn_y = 0; + random_spawn_z = 0; + page = 1; + fade = 0; + spawn_rate = 1; + collide = false; + selected_particle = 1; + gravity = 0F; + + //beam + beam_enabled = false; + render_core = false; + + beam_red = 0; + beam_green = 0; + beam_blue = 0; + beam_scale = 1F; + beam_pitch = 0F; + beam_yaw = 0F; + beam_length = 0F; + beam_rotation = 0F; + + worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); + return new Object[] { true }; + } + + return new Object[] {0}; + } }