diff --git a/build.gradle b/build.gradle index 292495d9..dd65245d 100644 --- a/build.gradle +++ b/build.gradle @@ -19,7 +19,6 @@ plugins { buildDir = "build-${mc_version}" apply plugin: 'net.minecraftforge.gradle.forge' -apply from: 'gradle/scripts/jsonGen.gradle' version = mc_version + "-" + mod_version group = "org.squiddev" @@ -98,35 +97,35 @@ repositories { } dependencies { - compile "dan200.computercraft:ComputerCraft:${project.cc_version}-${project.cc_build}" + implementation "dan200.computercraft:ComputerCraft:${project.cc_version}-${project.cc_build}" deobfCompile "mezz.jei:jei_${project.mc_version}:4.7.0.68" - provided "org.squiddev:CCTweaks:1.11.2-1.5.0-pr0:dev" // TODO: Upload initial 1.12 version - compile "cofh:RedstoneFlux:1.12-2.0.0.1:deobf" - provided "net.industrial-craft:industrialcraft-2:2.6.99-ex110:dev" - deobfProvided "buildcraft:buildcraft:7.99.14" - provided "net.darkhax.tesla:Tesla-1.12:1.0.61:deobf" + compileOnly "org.squiddev:CCTweaks:1.11.2-1.5.0-pr0:dev" // TODO: Upload initial 1.12 version + compileOnly "cofh:RedstoneFlux:1.12-2.0.0.1:deobf" + compileOnly "net.industrial-craft:industrialcraft-2:2.6.99-ex110:dev" + compileOnly "buildcraft:buildcraft:7.99.14" + compileOnly "net.darkhax.tesla:Tesla-1.12:1.0.61:deobf" // Tinker's + Dependencies - deobfProvided "slimeknights:TConstruct:1.12.2-2.9.0.56" - deobfProvided "slimeknights.mantle:Mantle:1.12-1.3.1.22" + compileOnly "slimeknights:TConstruct:1.12.2-2.9.0.56" + compileOnly "slimeknights.mantle:Mantle:1.12-1.3.1.22" // Storage drawers + Dependencies - deobfProvided "curseMods:Chameleon:${project.mc_version}-4.1.0" - deobfProvided "curseMods:StorageDrawers:${project.mc_version}-5.2.2" + compileOnly "curseMods:Chameleon:${project.mc_version}-4.1.0" + compileOnly "curseMods:StorageDrawers:${project.mc_version}-5.2.2" - provided "MCMultiPart2:MCMultiPart:2.2.2:deobf" - deobfProvided "refinedstorage:refinedstorage:1.5.8-1240" - deobfProvided "curseMods:forestry:${project.mc_version}-5.4.3.128" - deobfProvided "curseMods:appliedenergistics2:rv4-alpha-9" // Won't run on 1.12, but here for the future - deobfProvided "curseMods:Baubles:1.12-1.5.2" - deobfCompile "curseMods:blockcraftery:0.1.3" - provided("codechicken:ForgeMultipart:1.12-2.3.0.46:deobf") { exclude group: "codechicken" } - provided "codechicken:CodeChickenLib:1.12-3.1.5.330:deobf" + compileOnly "MCMultiPart2:MCMultiPart:2.2.2:deobf" + compileOnly "refinedstorage:refinedstorage:1.5.8-1240" + compileOnly "curseMods:forestry:${project.mc_version}-5.4.3.128" + compileOnly "curseMods:appliedenergistics2:rv4-alpha-9" // Won't run on 1.12, but here for the future + compileOnly "curseMods:Baubles:1.12-1.5.2" + compileOnly "curseMods:blockcraftery:0.1.3" + compileOnly("codechicken:ForgeMultipart:1.12-2.3.0.46:deobf") { exclude group: "codechicken" } + compileOnly "codechicken:CodeChickenLib:1.12-3.1.5.330:deobf" - provided('org.squiddev:ConfigGen:1.2.5') { exclude group: 'net.minecraftforge' } + compileOnly('org.squiddev:ConfigGen:1.2.5') { exclude group: 'net.minecraftforge' } - provided "com.google.errorprone:error_prone_annotations:2.0.21" + compileOnly "com.google.errorprone:error_prone_annotations:2.0.21" } processResources { diff --git a/gradle.properties b/gradle.properties index ab58c18e..80d7f093 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,6 +1,6 @@ mc_version=1.12 forge_version=14.21.1.2401 -mod_version=1.1.9 +mod_version=1.1.10 cc_version=1.80pr1 cc_build=build0 # For when one needs to decompile diff --git a/gradle/scripts/jsonGen.gradle b/gradle/scripts/jsonGen.gradle deleted file mode 100644 index 33d703e5..00000000 --- a/gradle/scripts/jsonGen.gradle +++ /dev/null @@ -1,91 +0,0 @@ -buildscript { - repositories { mavenCentral() } - dependencies { classpath "com.google.code.gson:gson:2.+" } -} - -import com.google.gson.Gson - -import java.util.regex.Matcher -import java.util.regex.Pattern - -class JsonData { - Map> templates = new HashMap<>(); - Map>> extended = new HashMap<>(); - Map> simple = new HashMap<>(); -} - -class JsonProvider extends DefaultTask { - @InputFiles - @SkipWhenEmpty - @Optional - def FileCollection sources - - @OutputDirectory - def File outputDir - - @TaskAction - public void run() { - sources.each { parse(it) }; - } - - public void parse(File file) { - println "Processing file"; - Gson gson = new Gson() - JsonData data = gson.fromJson(file.text, JsonData.class) - - File directory = file.parentFile - Map templates = data.templates.collectEntries { group, items -> - items.collectEntries { folder, path -> - new File(outputDir, folder).mkdirs() - [path, new File(directory, path).text] - } - } - - data.simple.each { group, elements -> - Map> store = data.extended[group]; - if (store == null) { - store = new HashMap>() - data.extended[group] = store - } - - elements.each { name, texture -> - store[name] = [texture: texture] - } - } - - data.extended.each { group, elements -> - Map results = data.templates[group] - elements.each { name, properties -> - properties.put("name", name) - results.each { folder, path -> - String contents = apply(templates[path], properties) - new File(new File(outputDir, folder), name + ".json").text = contents - } - } - } - } - - static Pattern pattern = Pattern.compile(/\$\{(.*)\}/); - - public static String apply(String template, Map replacements) { - StringBuffer output = new StringBuffer() - Matcher matcher = pattern.matcher(template) - while (matcher.find()) { - matcher.appendReplacement(output, replacements[matcher.group(1)]) - } - matcher.appendTail(output) - return output.toString() - } -} - -task jsonGenerator(type: JsonProvider) { - sources = sourceSets.main.resources.filter { it.name == "generate.json" } - outputDir = new File(project.buildDir, "resources/main/assets/plethora/models") -} - -processResources.dependsOn += jsonGenerator - -processResources { - exclude("assets/plethora/models/templates") - exclude("assets/plethora/models/generate.json") -} diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 30d399d8..99340b4a 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 877bc603..2c2bbe5f 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,5 @@ -#Tue Jun 14 10:16:55 BST 2016 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-2.14-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-4.4.1-bin.zip diff --git a/gradlew b/gradlew index 91a7e269..cccdd3d5 100755 --- a/gradlew +++ b/gradlew @@ -1,4 +1,4 @@ -#!/usr/bin/env bash +#!/usr/bin/env sh ############################################################################## ## @@ -6,20 +6,38 @@ ## ############################################################################## -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS="" +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null APP_NAME="Gradle" APP_BASE_NAME=`basename "$0"` +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS="" + # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD="maximum" -warn ( ) { +warn () { echo "$*" } -die ( ) { +die () { echo echo "$*" echo @@ -30,6 +48,7 @@ die ( ) { cygwin=false msys=false darwin=false +nonstop=false case "`uname`" in CYGWIN* ) cygwin=true @@ -40,31 +59,11 @@ case "`uname`" in MINGW* ) msys=true ;; + NONSTOP* ) + nonstop=true + ;; 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" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi -done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >&- -APP_HOME="`pwd -P`" -cd "$SAVED" >&- - CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar # Determine the Java command to use to start the JVM. @@ -90,7 +89,7 @@ location of your Java installation." fi # Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then +if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then MAX_FD_LIMIT=`ulimit -H -n` if [ $? -eq 0 ] ; then if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then @@ -114,6 +113,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` @@ -154,11 +154,19 @@ if $cygwin ; then esac fi -# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules -function splitJvmOpts() { - JVM_OPTS=("$@") +# Escape application args +save () { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " } -eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS -JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" +APP_ARGS=$(save "$@") + +# Collect all arguments for the java command, following the shell quoting and substitution rules +eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" + +# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong +if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then + cd "$(dirname "$0")" +fi -exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" +exec "$JAVACMD" "$@" diff --git a/gradlew.bat b/gradlew.bat index 8a0b282a..f9553162 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -8,14 +8,14 @@ @rem Set local scope for the variables with windows NT shell if "%OS%"=="Windows_NT" setlocal -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS= - set DIRNAME=%~dp0 if "%DIRNAME%" == "" set DIRNAME=. set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS= + @rem Find java.exe if defined JAVA_HOME goto findJavaFromJavaHome @@ -46,10 +46,9 @@ echo location of your Java installation. goto fail :init -@rem Get command-line arguments, handling Windowz variants +@rem Get command-line arguments, handling Windows variants if not "%OS%" == "Windows_NT" goto win9xME_args -if "%@eval[2+2]" == "4" goto 4NT_args :win9xME_args @rem Slurp the command line arguments. @@ -60,11 +59,6 @@ set _SKIP=2 if "x%~1" == "x" goto execute set CMD_LINE_ARGS=%* -goto execute - -:4NT_args -@rem Get arguments from the 4NT Shell from JP Software -set CMD_LINE_ARGS=%$ :execute @rem Setup the command line diff --git a/src/main/java/org/squiddev/plethora/api/neural/INeuralRegistry.java b/src/main/java/org/squiddev/plethora/api/neural/INeuralRegistry.java index 5b934ec9..639bd3f6 100644 --- a/src/main/java/org/squiddev/plethora/api/neural/INeuralRegistry.java +++ b/src/main/java/org/squiddev/plethora/api/neural/INeuralRegistry.java @@ -13,7 +13,7 @@ public interface INeuralRegistry { * Add an predicate which controls whether an entity can have * the neural interface attached to it. * - * @param predicate The predicate which will recieve an entity. If {@code false} is returned then the neural + * @param predicate The predicate which will receive an entity. If {@code false} is returned then the neural * interface will be blocked from connecting, otherwise the remaining predicates will be checked. */ void addEquipPredicate(@Nonnull Predicate predicate); diff --git a/src/main/java/org/squiddev/plethora/core/ModuleRegistry.java b/src/main/java/org/squiddev/plethora/core/ModuleRegistry.java index 53199397..8ede89c4 100644 --- a/src/main/java/org/squiddev/plethora/core/ModuleRegistry.java +++ b/src/main/java/org/squiddev/plethora/core/ModuleRegistry.java @@ -11,14 +11,11 @@ import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.IRecipe; import net.minecraft.util.ResourceLocation; -import net.minecraftforge.event.RegistryEvent; -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.registries.IForgeRegistry; import org.squiddev.plethora.api.Constants; -import org.squiddev.plethora.api.vehicle.IVehicleUpgradeHandler; import org.squiddev.plethora.api.module.IModuleHandler; import org.squiddev.plethora.api.module.IModuleRegistry; -import org.squiddev.plethora.gameplay.Plethora; +import org.squiddev.plethora.api.vehicle.IVehicleUpgradeHandler; import javax.annotation.Nonnull; import java.util.ArrayList; @@ -27,8 +24,8 @@ final class ModuleRegistry implements IModuleRegistry { public static final ModuleRegistry instance = new ModuleRegistry(); - private final List pocketUpgrades = new ArrayList(); - private final List turtleUpgrades = new ArrayList(); + private final List pocketUpgrades = new ArrayList<>(); + private final List turtleUpgrades = new ArrayList<>(); private ModuleRegistry() { } @@ -96,7 +93,7 @@ public IVehicleUpgradeHandler toVehicleUpgrade(@Nonnull IModuleHandler handler) return new VehicleUpgradeModule(handler); } - void addRecipes(IForgeRegistry registry) { + void addRecipes(IForgeRegistry registry) { for (ITurtleUpgrade upgrade : turtleUpgrades) { registry.register(new ImpostorRecipe( PlethoraCore.ID + ":turtle_upgrade", 2, 1, diff --git a/src/main/java/org/squiddev/plethora/core/PocketUpgradeModule.java b/src/main/java/org/squiddev/plethora/core/PocketUpgradeModule.java index e0fba061..223607d0 100644 --- a/src/main/java/org/squiddev/plethora/core/PocketUpgradeModule.java +++ b/src/main/java/org/squiddev/plethora/core/PocketUpgradeModule.java @@ -23,9 +23,9 @@ import org.squiddev.plethora.api.module.IModuleHandler; import org.squiddev.plethora.api.module.SingletonModuleContainer; import org.squiddev.plethora.api.reference.IReference; +import org.squiddev.plethora.core.capabilities.DefaultCostHandler; import org.squiddev.plethora.core.executor.ContextDelayedExecutor; import org.squiddev.plethora.core.executor.IExecutorFactory; -import org.squiddev.plethora.utils.DebugLogger; import javax.annotation.Nonnull; import javax.annotation.Nullable; @@ -75,13 +75,7 @@ public IPeripheral createPeripheral(@Nonnull final IPocketAccess pocket) { MethodRegistry registry = MethodRegistry.instance; final Entity entity = pocket.getEntity(); - ICostHandler cost; - if (entity != null) { - cost = registry.getCostHandler(entity, null); - } else { - DebugLogger.warn("Cannot find entity for pocket computer"); - return null; - } + ICostHandler cost = DefaultCostHandler.get(pocket); final PocketModuleAccess access = new PocketModuleAccess(pocket, handler); final IModuleContainer container = access.getContainer(); diff --git a/src/main/java/org/squiddev/plethora/core/TurtleUpgradeModule.java b/src/main/java/org/squiddev/plethora/core/TurtleUpgradeModule.java index 262c8e98..f3fd4759 100644 --- a/src/main/java/org/squiddev/plethora/core/TurtleUpgradeModule.java +++ b/src/main/java/org/squiddev/plethora/core/TurtleUpgradeModule.java @@ -3,11 +3,9 @@ import dan200.computercraft.api.lua.LuaException; import dan200.computercraft.api.peripheral.IPeripheral; import dan200.computercraft.api.turtle.*; -import dan200.computercraft.shared.turtle.blocks.ITurtleTile; import net.minecraft.client.renderer.block.model.IBakedModel; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; import net.minecraft.util.ITickable; import net.minecraft.util.ResourceLocation; @@ -21,9 +19,9 @@ import org.squiddev.plethora.api.module.SingletonModuleContainer; import org.squiddev.plethora.api.reference.IReference; import org.squiddev.plethora.api.reference.Reference; +import org.squiddev.plethora.core.capabilities.DefaultCostHandler; import org.squiddev.plethora.core.executor.ContextDelayedExecutor; import org.squiddev.plethora.core.executor.IExecutorFactory; -import org.squiddev.plethora.utils.DebugLogger; import javax.annotation.Nonnull; import javax.annotation.Nullable; @@ -84,14 +82,7 @@ public IPeripheral createPeripheral(@Nonnull final ITurtleAccess turtle, @Nonnul MethodRegistry registry = MethodRegistry.instance; - TileEntity te = turtle.getWorld().getTileEntity(turtle.getPosition()); - ICostHandler cost; - if (te != null && te instanceof ITurtleTile) { - cost = registry.getCostHandler(te, null); - } else { - DebugLogger.warn("Cannot find turtle where access says it should be"); - return null; - } + ICostHandler cost = DefaultCostHandler.get(turtle); final TurtleModuleAccess access = new TurtleModuleAccess(turtle, side, handler); BasicContextBuilder builder = new BasicContextBuilder(); diff --git a/src/main/java/org/squiddev/plethora/core/docdump/HTMLWriter.java b/src/main/java/org/squiddev/plethora/core/docdump/HTMLWriter.java index c4f24e3a..2243280c 100644 --- a/src/main/java/org/squiddev/plethora/core/docdump/HTMLWriter.java +++ b/src/main/java/org/squiddev/plethora/core/docdump/HTMLWriter.java @@ -29,6 +29,7 @@ public HTMLWriter(OutputStream stream) { this.writer = new PrintStream(stream); } + @Override public void writeHeader() throws IOException { InputStream header = getClass().getClassLoader().getResourceAsStream("assets/plethora/header.html"); if (header == null) { @@ -42,11 +43,13 @@ public void writeHeader() throws IOException { } } + @Override public void writeFooter() { writer.printf("
Generated on %s
\n", format.format(new Date())); writer.println(""); } + @Override public void write(Multimap, IMethod> methodLookup) { ListMultimap classLookup = MultimapBuilder.treeKeys().arrayListValues().build(); ListMultimap moduleLookup = MultimapBuilder.treeKeys().arrayListValues().build(); diff --git a/src/main/java/org/squiddev/plethora/core/executor/ContextDelayedExecutor.java b/src/main/java/org/squiddev/plethora/core/executor/ContextDelayedExecutor.java index 95c465de..a793fdaf 100644 --- a/src/main/java/org/squiddev/plethora/core/executor/ContextDelayedExecutor.java +++ b/src/main/java/org/squiddev/plethora/core/executor/ContextDelayedExecutor.java @@ -17,6 +17,7 @@ * An executor which uses {@link IComputerAccess} to queue events. */ public final class ContextDelayedExecutor extends AbstractDelayedExecutor implements IExecutorFactory { + @Override @Nonnull public IResultExecutor createExecutor(@Nullable final IComputerAccess access) { if (access == null) { diff --git a/src/main/java/org/squiddev/plethora/core/executor/DefaultExecutor.java b/src/main/java/org/squiddev/plethora/core/executor/DefaultExecutor.java index b1a76579..c12a7927 100644 --- a/src/main/java/org/squiddev/plethora/core/executor/DefaultExecutor.java +++ b/src/main/java/org/squiddev/plethora/core/executor/DefaultExecutor.java @@ -22,6 +22,7 @@ public final class DefaultExecutor implements IResultExecutor, IExecutorFactory private DefaultExecutor() { } + @Override @Nullable public Object[] execute(@Nonnull MethodResult result, @Nonnull ILuaContext context) throws LuaException, InterruptedException { if (result.isFinal()) { diff --git a/src/main/java/org/squiddev/plethora/gameplay/ConfigGameplay.java b/src/main/java/org/squiddev/plethora/gameplay/ConfigGameplay.java index 9428c624..d98b44b3 100644 --- a/src/main/java/org/squiddev/plethora/gameplay/ConfigGameplay.java +++ b/src/main/java/org/squiddev/plethora/gameplay/ConfigGameplay.java @@ -199,4 +199,16 @@ public static class Chat { @DefaultBoolean(true) public static boolean allowMobs; } + + /** + * Various options that don't belong to anything + */ + public static class Miscellaneous { + /** + * Fun rendering overlay for various objects. + * Basically I'm slightly vain. + */ + @DefaultBoolean(true) + public static boolean funRender; + } } diff --git a/src/main/java/org/squiddev/plethora/gameplay/client/RenderOverlay.java b/src/main/java/org/squiddev/plethora/gameplay/client/RenderOverlay.java index 7f7de5d2..c6f2d6a7 100644 --- a/src/main/java/org/squiddev/plethora/gameplay/client/RenderOverlay.java +++ b/src/main/java/org/squiddev/plethora/gameplay/client/RenderOverlay.java @@ -30,7 +30,7 @@ import net.minecraftforge.oredict.OreDictionary; import org.lwjgl.opengl.GL11; import org.squiddev.plethora.gameplay.Plethora; -import org.squiddev.plethora.gameplay.modules.ItemModule; +import org.squiddev.plethora.gameplay.modules.PlethoraModules; import org.squiddev.plethora.gameplay.registry.IClientModule; import org.squiddev.plethora.gameplay.registry.Module; import org.squiddev.plethora.gameplay.registry.Registry; @@ -144,7 +144,7 @@ private void renderOverlay(RenderWorldLastEvent event, ItemStack stack) { GlStateManager.translate(-renderManager.viewerPosX, -renderManager.viewerPosY, -renderManager.viewerPosZ); switch (stack.getItemDamage()) { - case ItemModule.SENSOR_ID: { + case PlethoraModules.SENSOR_ID: { // Gather all entities and render them Vec3d position = player.getPositionEyes(event.getPartialTicks()); List entities = world.getEntitiesWithinAABB(EntityLivingBase.class, new AxisAlignedBB( @@ -162,7 +162,7 @@ private void renderOverlay(RenderWorldLastEvent event, ItemStack stack) { } break; } - case ItemModule.SCANNER_ID: { + case PlethoraModules.SCANNER_ID: { // Try to find all ore blocks and render them BlockPos pos = player.getPosition(); final int x = pos.getX(), y = pos.getY(), z = pos.getZ(); @@ -180,7 +180,8 @@ private void renderOverlay(RenderWorldLastEvent event, ItemStack stack) { } break; } - case ItemModule.CHAT_ID: { + case PlethoraModules.CHAT_ID: + case PlethoraModules.CHAT_CREATIVE_ID: { for (ChatMessage message : chatMessages) { if (message.getWorld() == world.provider.getDimension()) { Vec3d pos = message.getPosition(); diff --git a/src/main/java/org/squiddev/plethora/gameplay/client/RenderSquidOverlay.java b/src/main/java/org/squiddev/plethora/gameplay/client/RenderSquidOverlay.java new file mode 100644 index 00000000..81252f35 --- /dev/null +++ b/src/main/java/org/squiddev/plethora/gameplay/client/RenderSquidOverlay.java @@ -0,0 +1,191 @@ +package org.squiddev.plethora.gameplay.client; + +import com.mojang.authlib.GameProfile; +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.BufferBuilder; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.client.renderer.entity.RenderPlayer; +import net.minecraft.client.renderer.entity.layers.LayerRenderer; +import net.minecraft.client.renderer.vertex.DefaultVertexFormats; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.util.math.Vec3d; +import net.minecraftforge.fml.common.Loader; +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; +import org.lwjgl.opengl.GL11; +import org.squiddev.cctweaks.CCTweaks; +import org.squiddev.plethora.gameplay.ConfigGameplay; +import org.squiddev.plethora.gameplay.registry.IClientModule; +import org.squiddev.plethora.gameplay.registry.Module; + +import javax.annotation.Nonnull; +import java.util.Map; +import java.util.UUID; + +public class RenderSquidOverlay extends Module implements IClientModule { + private static final UUID uuid = UUID.fromString("d3156e4b-c712-4fd3-87b0-b24b8ca94209"); + + @Override + @SideOnly(Side.CLIENT) + public void clientInit() { + if (Loader.isModLoaded(CCTweaks.ID)) return; + + Map skinMap = Minecraft.getMinecraft().getRenderManager().getSkinMap(); + RenderLayer layer = new RenderLayer(); + skinMap.get("default").addLayer(layer); + skinMap.get("slim").addLayer(layer); + } + + @SideOnly(Side.CLIENT) + private static final class RenderLayer implements LayerRenderer { + private static final int SEGMENTS = 5; + private static final int TENTACLES = 6; + private static final int BASE_ANGLE = 25; + + // Dimensions of the one tentacle + private static final float LENGTH = 0.3f; + private static final float WIDTH = 0.15f; + + private static final double EASING_TICKS = 5; + private static final double OFFSET_SPEED = 0.1; + private static final double OFFSET_VARIANCE = 7; + + private final double[] lastAngles = new double[TENTACLES * SEGMENTS]; + private final double[] offsets = new double[TENTACLES * SEGMENTS]; + + private double tick = 0; + + public RenderLayer() { + for (int i = 0; i < lastAngles.length; i++) { + lastAngles[i] = BASE_ANGLE; + offsets[i] = Math.random() * Math.PI * 2; + } + } + + @Override + @SideOnly(Side.CLIENT) + public void doRenderLayer(@Nonnull EntityPlayer player, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) { + GameProfile profile = player.getGameProfile(); + if (profile == null || !profile.getId().equals(uuid) || !ConfigGameplay.Miscellaneous.funRender) return; + + GlStateManager.disableLighting(); + GlStateManager.disableTexture2D(); + + GlStateManager.pushMatrix(); + if (player.isSneaking()) { + GlStateManager.translate(0F, 0.2F, 0F); + GlStateManager.rotate(90F / (float) Math.PI, 1.0F, 0.0F, 0.0F); + } + + GlStateManager.rotate(90, 1, 0, 0); + GlStateManager.translate(0, 0.1, -0.3); + + GlStateManager.color(0, 0, 0, 1); + + final double angle; + if (player.hurtTime > 0) { + double progress = (double) player.hurtTime / player.maxHurtTime; + angle = BASE_ANGLE - (progress * (BASE_ANGLE - OFFSET_VARIANCE)); + } else { + double velocity = new Vec3d(player.lastTickPosX, player.lastTickPosY, player.lastTickPosZ).distanceTo( + new Vec3d(player.posX, player.posY, player.posZ)); + + double adjusted = 1 - Math.exp(velocity * -2); + + angle = BASE_ANGLE - adjusted * BASE_ANGLE; + } + + +// DebugLogger.info(new Vec3d(player.lastTickPosX, player.lastTickPosY, player.lastTickPosZ).distanceTo( +// new Vec3d(player.posX, player.posY, player.posZ)) + " !"); + + tick = (tick + partialTicks) % (Math.PI * 2 / OFFSET_SPEED); + + for (int i = 0; i < TENTACLES; i++) { + GlStateManager.pushMatrix(); + + GlStateManager.rotate(360.0f / TENTACLES * i, 0, 1, 0); + GlStateManager.translate(0.1, 0, 0); + + Tessellator tessellator = Tessellator.getInstance(); + BufferBuilder renderer = tessellator.getBuffer(); + + for (int j = 0; j < SEGMENTS; j++) { + // Offset each tentacle by a random amount + double lastAngle = lastAngles[i * SEGMENTS + j]; + double thisAngle = angle + Math.sin(offsets[i * SEGMENTS + j] + tick * OFFSET_SPEED) * OFFSET_VARIANCE; + + // Angle each tentacle to get a "claw" effect. + thisAngle *= Math.cos(j * (Math.PI / (SEGMENTS - 1))); + + // Provide some basic easing on the angle + // Basically the middle segments have a high "delta" + if (Math.abs(lastAngle - thisAngle) > 1) { + thisAngle = lastAngle - (lastAngle - thisAngle) / EASING_TICKS; + } + + lastAngles[i * SEGMENTS + j] = thisAngle; + + GlStateManager.rotate((float) thisAngle, 0, 0, -1); + + renderer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION); + tentacle(renderer); + tessellator.draw(); + + GlStateManager.translate(0, LENGTH - WIDTH / 2, 0); + } + + GlStateManager.popMatrix(); + } + + GlStateManager.popMatrix(); + + GlStateManager.enableLighting(); + GlStateManager.enableTexture2D(); + } + + @Override + @SideOnly(Side.CLIENT) + public boolean shouldCombineTextures() { + return false; + } + + private static void tentacle(BufferBuilder renderer) { + renderer.pos(0, 0, -WIDTH / 2).endVertex(); + renderer.pos(0, 0, WIDTH / 2).endVertex(); + renderer.pos(0, LENGTH, WIDTH / 2).endVertex(); + renderer.pos(0, LENGTH, -WIDTH / 2).endVertex(); + + renderer.pos(0, 0, -WIDTH / 2).endVertex(); + renderer.pos(0, 0, WIDTH / 2).endVertex(); + renderer.pos(WIDTH, 0, WIDTH / 2).endVertex(); + renderer.pos(WIDTH, 0, -WIDTH / 2).endVertex(); + + renderer.pos(0, 0, -WIDTH / 2).endVertex(); + renderer.pos(0, LENGTH, -WIDTH / 2).endVertex(); + renderer.pos(WIDTH, LENGTH, -WIDTH / 2).endVertex(); + renderer.pos(WIDTH, 0, -WIDTH / 2).endVertex(); + + renderer.pos(WIDTH, 0, -WIDTH / 2).endVertex(); + renderer.pos(WIDTH, 0, WIDTH / 2).endVertex(); + renderer.pos(WIDTH, LENGTH, WIDTH / 2).endVertex(); + renderer.pos(WIDTH, LENGTH, -WIDTH / 2).endVertex(); + + renderer.pos(0, LENGTH, -WIDTH / 2).endVertex(); + renderer.pos(0, LENGTH, WIDTH / 2).endVertex(); + renderer.pos(WIDTH, LENGTH, WIDTH / 2).endVertex(); + renderer.pos(WIDTH, LENGTH, -WIDTH / 2).endVertex(); + + renderer.pos(0, 0, WIDTH / 2).endVertex(); + renderer.pos(0, LENGTH, WIDTH / 2).endVertex(); + renderer.pos(WIDTH, LENGTH, WIDTH / 2).endVertex(); + renderer.pos(WIDTH, 0, WIDTH / 2).endVertex(); + } + } + + @Override + @SideOnly(Side.CLIENT) + public void clientPreInit() { + } +} diff --git a/src/main/java/org/squiddev/plethora/gameplay/client/entity/RenderMinecartComputer.java b/src/main/java/org/squiddev/plethora/gameplay/client/entity/RenderMinecartComputer.java index 43f5efa6..583c1606 100644 --- a/src/main/java/org/squiddev/plethora/gameplay/client/entity/RenderMinecartComputer.java +++ b/src/main/java/org/squiddev/plethora/gameplay/client/entity/RenderMinecartComputer.java @@ -29,6 +29,7 @@ public RenderMinecartComputer(RenderManager renderManagerIn) { super(renderManagerIn); } + @Override public void doRender(@Nonnull EntityMinecartComputer entity, double x, double y, double z, float entityYaw, float partialTicks) { GlStateManager.pushMatrix(); bindEntityTexture(entity); diff --git a/src/main/java/org/squiddev/plethora/gameplay/client/gui/GuiKeyboard.java b/src/main/java/org/squiddev/plethora/gameplay/client/gui/GuiKeyboard.java index d931c2d2..9b52307b 100644 --- a/src/main/java/org/squiddev/plethora/gameplay/client/gui/GuiKeyboard.java +++ b/src/main/java/org/squiddev/plethora/gameplay/client/gui/GuiKeyboard.java @@ -1,7 +1,6 @@ package org.squiddev.plethora.gameplay.client.gui; import dan200.computercraft.client.gui.widgets.WidgetTerminal; -import dan200.computercraft.core.terminal.Terminal; import dan200.computercraft.shared.computer.core.IComputer; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; @@ -34,8 +33,7 @@ public void initGui() { mc.player.openContainer = container; - Terminal terminal = computer.getTerminal(); - terminalGui = new WidgetTerminal(0, 0, terminal.getWidth(), terminal.getHeight(), () -> computer, 2, 2, 2, 2); + terminalGui = new WidgetTerminal(0, 0, 1, 1, () -> computer, 2, 2, 2, 2); terminalGui.setAllowFocusLoss(false); Keyboard.enableRepeatEvents(true); } diff --git a/src/main/java/org/squiddev/plethora/gameplay/client/tile/RenderManipulator.java b/src/main/java/org/squiddev/plethora/gameplay/client/tile/RenderManipulator.java index 42e2caec..1fdd167c 100644 --- a/src/main/java/org/squiddev/plethora/gameplay/client/tile/RenderManipulator.java +++ b/src/main/java/org/squiddev/plethora/gameplay/client/tile/RenderManipulator.java @@ -4,6 +4,7 @@ import net.minecraft.client.renderer.block.model.IBakedModel; import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumFacing; import net.minecraft.util.math.AxisAlignedBB; import net.minecraftforge.client.ForgeHooksClient; import org.apache.commons.lang3.tuple.Pair; @@ -13,6 +14,7 @@ import org.squiddev.plethora.gameplay.client.RenderHelpers; import org.squiddev.plethora.gameplay.modules.ManipulatorType; import org.squiddev.plethora.gameplay.modules.TileManipulator; +import org.squiddev.plethora.utils.MatrixHelpers; import javax.vecmath.Matrix4f; @@ -21,7 +23,7 @@ public final class RenderManipulator extends TileEntitySpecialRenderer { @Override - public void render(TileManipulator tileManipulator, double x, double y, double z, float partialTicks, int destroyState, float alpha) { + public void render(TileManipulator manipulator, double x, double y, double z, float partialTicks, int destroyState, float alpha) { GlStateManager.pushMatrix(); GlStateManager.alphaFunc(GL11.GL_GREATER, 0.1f); @@ -29,27 +31,27 @@ public void render(TileManipulator tileManipulator, double x, double y, double z GlStateManager.enableBlend(); GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0); - GlStateManager.translate(x, y + OFFSET, z); + GlStateManager.translate(x, y, z); + ForgeHooksClient.multiplyCurrentGlMatrix(MatrixHelpers.matrixFor(manipulator.getFacing())); + GlStateManager.translate(0, OFFSET, 0); - ManipulatorType type = tileManipulator.getType(); - - float delta = (float) tileManipulator.incrementRotation(); + ManipulatorType type = manipulator.getType(); + float delta = (float) manipulator.incrementRotation(); int size = type.size(); + AxisAlignedBB[] boxes = type.boxesFor(EnumFacing.DOWN); for (int i = 0; i < size; i++) { - ItemStack stack = tileManipulator.getStack(i); + ItemStack stack = manipulator.getStack(i); if (stack != null && !stack.isEmpty()) { GlStateManager.pushMatrix(); - AxisAlignedBB box = type.boxes[i]; - + AxisAlignedBB box = boxes[i]; GlStateManager.translate( (box.minX + box.maxX) / 2.0f, type.scale, (box.minZ + box.maxZ) / 2.0f ); - IBakedModel model; IModuleHandler handler = stack.getCapability(Constants.MODULE_HANDLER_CAPABILITY, null); if (handler != null) { diff --git a/src/main/java/org/squiddev/plethora/gameplay/minecart/CommandAPI.java b/src/main/java/org/squiddev/plethora/gameplay/minecart/CommandAPI.java index 3a7e90f3..d9bd32d2 100644 --- a/src/main/java/org/squiddev/plethora/gameplay/minecart/CommandAPI.java +++ b/src/main/java/org/squiddev/plethora/gameplay/minecart/CommandAPI.java @@ -91,6 +91,7 @@ private Object getBlockInfo(World world, BlockPos pos) { return table; } + @Override public Object[] callMethod(@Nonnull ILuaContext context, int method, @Nonnull Object[] arguments) throws LuaException, InterruptedException { switch (method) { diff --git a/src/main/java/org/squiddev/plethora/gameplay/minecart/EntityMinecartComputer.java b/src/main/java/org/squiddev/plethora/gameplay/minecart/EntityMinecartComputer.java index 5b9bf0fc..f088d9be 100644 --- a/src/main/java/org/squiddev/plethora/gameplay/minecart/EntityMinecartComputer.java +++ b/src/main/java/org/squiddev/plethora/gameplay/minecart/EntityMinecartComputer.java @@ -153,6 +153,7 @@ public EntityMinecartComputer(EntityMinecartEmpty minecart, int id, String label this.romId = romId; } + @Override protected void entityInit() { super.entityInit(); dataManager.register(INSTANCE_SLOT, -1); @@ -426,6 +427,7 @@ public IBlockState getDisplayTile() { return blockState; } + @Override public void killMinecart(DamageSource source) { setDead(); diff --git a/src/main/java/org/squiddev/plethora/gameplay/modules/BlockManipulator.java b/src/main/java/org/squiddev/plethora/gameplay/modules/BlockManipulator.java index bf1eccbf..4583107c 100644 --- a/src/main/java/org/squiddev/plethora/gameplay/modules/BlockManipulator.java +++ b/src/main/java/org/squiddev/plethora/gameplay/modules/BlockManipulator.java @@ -6,10 +6,13 @@ import dan200.computercraft.api.lua.LuaException; import dan200.computercraft.api.peripheral.IPeripheral; import dan200.computercraft.api.peripheral.IPeripheralProvider; +import net.minecraft.block.BlockDirectional; +import net.minecraft.block.properties.PropertyDirection; import net.minecraft.block.properties.PropertyEnum; import net.minecraft.block.state.BlockStateContainer; import net.minecraft.block.state.IBlockState; import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.EntityLivingBase; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; @@ -44,6 +47,7 @@ import org.squiddev.plethora.gameplay.BlockBase; import org.squiddev.plethora.gameplay.client.tile.RenderManipulator; import org.squiddev.plethora.utils.Helpers; +import org.squiddev.plethora.utils.MatrixHelpers; import org.squiddev.plethora.utils.RenderHelper; import javax.annotation.Nonnull; @@ -57,21 +61,61 @@ public final class BlockManipulator extends BlockBase implements IPeripheralProvider { private static final PropertyEnum TYPE = PropertyEnum.create("type", ManipulatorType.class); + public static final PropertyDirection FACING = BlockDirectional.FACING; public static final double OFFSET = 10.0 / 16.0; public static final double PIX = 1 / 16.0; + public static final double BOX_EXPAND = 0.002; - private static final AxisAlignedBB BOX = new AxisAlignedBB(0, 0, 0, 1, (float) OFFSET, 1); + private static final AxisAlignedBB[] BOXES = new AxisAlignedBB[6]; + + static { + AxisAlignedBB box = new AxisAlignedBB(0, 0, 0, 1, (float) OFFSET, 1); + for (EnumFacing facing : EnumFacing.VALUES) { + BOXES[facing.ordinal()] = MatrixHelpers.transform(box, MatrixHelpers.matrixFor(facing)); + } + } public BlockManipulator() { super("manipulator", TileManipulator.class); setDefaultState(getBlockState().getBaseState().withProperty(TYPE, ManipulatorType.MARK_1)); } + @Nonnull @Override - @SuppressWarnings({"NullableProblems", "deprecation"}) + @Deprecated public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) { - return BOX; + return BOXES[state.getValue(FACING).ordinal()]; + } + + @Nullable + @Override + @Deprecated + public RayTraceResult collisionRayTrace(IBlockState blockState, @Nonnull World world, @Nonnull BlockPos pos, @Nonnull Vec3d start, @Nonnull Vec3d end) { + ManipulatorType type = blockState.getValue(TYPE); + EnumFacing facing = blockState.getValue(FACING); + + Vec3d startOff = start.subtract(pos.getX(), pos.getY(), pos.getZ()); + Vec3d endOff = end.subtract(pos.getX(), pos.getY(), pos.getZ()); + + // Compute the intersection with the main box + AxisAlignedBB primary = getBoundingBox(blockState, world, pos); + RayTraceResult result = primary.calculateIntercept(startOff, endOff); + double distance = result == null ? Double.POSITIVE_INFINITY : result.hitVec.squareDistanceTo(startOff); + + // Look for one of our inputs if possible. + for (AxisAlignedBB child : type.boxesFor(facing)) { + RayTraceResult hit = child.calculateIntercept(startOff, endOff); + if (hit != null) { + double newDistance = hit.hitVec.squareDistanceTo(startOff); + if (newDistance <= distance) { + result = hit; + distance = newDistance; + } + } + } + + return result == null ? null : new RayTraceResult(result.hitVec.addVector(pos.getX(), pos.getY(), pos.getZ()), result.sideHit, pos); } @Override @@ -84,30 +128,43 @@ public void getSubBlocks(CreativeTabs tab, NonNullList itemStacks) { @Override @SuppressWarnings("deprecation") public IBlockState getStateFromMeta(int meta) { - IBlockState state = super.getStateFromMeta(meta); - return state.withProperty(TYPE, VALUES[meta < 0 || meta >= VALUES.length ? 0 : meta]); + ManipulatorType type = VALUES[meta & 1]; + EnumFacing facing = (meta >> 1) <= 6 ? EnumFacing.VALUES[meta >> 1] : EnumFacing.DOWN; + + return super.getStateFromMeta(meta).withProperty(TYPE, type).withProperty(FACING, facing); } @Override public int getMetaFromState(IBlockState state) { - return state.getValue(TYPE).ordinal(); + return state.getValue(TYPE).ordinal() | state.getValue(FACING).ordinal() << 1; + } + + @Override + @Deprecated + public IBlockState getStateForPlacement(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) { + return getStateFromMeta(meta).withProperty(FACING, facing.getOpposite()); } @Nonnull @Override protected BlockStateContainer createBlockState() { - return new BlockStateContainer(this, TYPE); + return new BlockStateContainer(this, TYPE, FACING); } @Override public String getUnlocalizedName(int meta) { - return getUnlocalizedName() + "." + VALUES[meta < 0 || meta >= VALUES.length ? 0 : meta].getName(); + return getUnlocalizedName() + "." + VALUES[meta & 1].getName(); } @Nonnull @Override public TileEntity createNewTileEntity(@Nonnull World world, int meta) { - return new TileManipulator(VALUES[meta < 0 || meta >= VALUES.length ? 0 : meta]); + return new TileManipulator(VALUES[meta & 1]); + } + + @Override + public int damageDropped(IBlockState state) { + return state.getValue(TYPE).ordinal(); } @Override @@ -257,13 +314,12 @@ public void drawHighlight(DrawBlockHighlightEvent event) { IBlockState state = event.getPlayer().getEntityWorld().getBlockState(blockPos); if (state.getBlock() != this) return; + EnumFacing facing = state.getValue(FACING); + Vec3d hit = event.getTarget().hitVec.subtract(blockPos.getX(), blockPos.getY(), blockPos.getZ()); ManipulatorType type = state.getValue(TYPE); - for (AxisAlignedBB box : type.boxes) { - if (hit.y > OFFSET - PIX && - hit.x >= box.minX && hit.x <= box.maxX && - hit.z >= box.minZ && hit.z <= box.maxZ) { - + for (AxisAlignedBB box : type.boxesFor(facing)) { + if (box.grow(BOX_EXPAND, BOX_EXPAND, BOX_EXPAND).contains(hit)) { RenderHelper.renderBoundingBox(event.getPlayer(), box, event.getTarget().getBlockPos(), event.getPartialTicks()); event.setCanceled(true); break; diff --git a/src/main/java/org/squiddev/plethora/gameplay/modules/ChatListener.java b/src/main/java/org/squiddev/plethora/gameplay/modules/ChatListener.java index 0e2fab8a..462e20e0 100644 --- a/src/main/java/org/squiddev/plethora/gameplay/modules/ChatListener.java +++ b/src/main/java/org/squiddev/plethora/gameplay/modules/ChatListener.java @@ -37,11 +37,9 @@ public void onServerChat(ServerChatEvent event) { // Handle captures for (Listener listener : listeners) { - if (listener.owner != null && listener.owner == sender) { - if (listener.handleCapture(event.getMessage())) { - event.setCanceled(true); - return; - } + if (listener.handles(sender) && listener.handleCapture(sender, event.getMessage())) { + event.setCanceled(true); + return; } } @@ -61,6 +59,10 @@ public Listener(@Nonnull IModuleAccess access, @Nullable Entity owner) { this.owner = owner; } + public boolean handles(Entity sender) { + return owner != null && owner == sender; + } + public synchronized void addPattern(String pattern) { patterns.add(pattern); } @@ -73,10 +75,10 @@ public synchronized void clearPatterns() { patterns.clear(); } - private synchronized boolean handleCapture(String message) { + private synchronized boolean handleCapture(Entity sender, String message) { for (String pattern : patterns) { if (LuaPattern.matches(message, pattern)) { - access.queueEvent("chat_capture", message, pattern); + access.queueEvent("chat_capture", message, pattern, sender.getDisplayName().getUnformattedText(), sender.getPersistentID().toString()); return true; } } @@ -110,4 +112,15 @@ public Listener safeGet() throws LuaException { return this; } } + + public static class CreativeListener extends Listener { + public CreativeListener(@Nonnull IModuleAccess access) { + super(access, null); + } + + @Override + public boolean handles(Entity sender) { + return true; + } + } } diff --git a/src/main/java/org/squiddev/plethora/gameplay/modules/ChatVisualiser.java b/src/main/java/org/squiddev/plethora/gameplay/modules/ChatVisualiser.java index 81c657e8..ba8ddff3 100644 --- a/src/main/java/org/squiddev/plethora/gameplay/modules/ChatVisualiser.java +++ b/src/main/java/org/squiddev/plethora/gameplay/modules/ChatVisualiser.java @@ -39,7 +39,8 @@ public void onServerChat(ServerChatEvent event) { ChatMessage message = new ChatMessage(sender, event.getComponent()); for (EntityPlayerMP player : players.getPlayers()) { - if (Helpers.isHolding(player, Registry.itemModule, ItemModule.CHAT_ID)) { + if (Helpers.isHolding(player, Registry.itemModule, PlethoraModules.CHAT_ID) || + Helpers.isHolding(player, Registry.itemModule, PlethoraModules.CHAT_CREATIVE_ID)) { if (player != sender && player.getEntityWorld() == sender.getEntityWorld() && player.getDistanceToEntity(sender) <= distance) { Plethora.network.sendTo(message, player); } diff --git a/src/main/java/org/squiddev/plethora/gameplay/modules/ItemModule.java b/src/main/java/org/squiddev/plethora/gameplay/modules/ItemModule.java index a94355af..c31f176e 100644 --- a/src/main/java/org/squiddev/plethora/gameplay/modules/ItemModule.java +++ b/src/main/java/org/squiddev/plethora/gameplay/modules/ItemModule.java @@ -31,11 +31,11 @@ import org.squiddev.plethora.api.Constants; import org.squiddev.plethora.api.PlethoraAPI; import org.squiddev.plethora.api.method.IContextBuilder; -import org.squiddev.plethora.api.vehicle.IVehicleUpgradeHandler; import org.squiddev.plethora.api.module.AbstractModuleHandler; import org.squiddev.plethora.api.module.IModuleAccess; import org.squiddev.plethora.api.module.IModuleRegistry; import org.squiddev.plethora.api.reference.EntityReference; +import org.squiddev.plethora.api.vehicle.IVehicleUpgradeHandler; import org.squiddev.plethora.gameplay.ConfigGameplay; import org.squiddev.plethora.gameplay.ItemBase; import org.squiddev.plethora.gameplay.Plethora; @@ -54,51 +54,10 @@ import static org.squiddev.plethora.gameplay.ConfigGameplay.Kinetic.launchMax; import static org.squiddev.plethora.gameplay.ConfigGameplay.Laser.maximumPotency; import static org.squiddev.plethora.gameplay.ConfigGameplay.Laser.minimumPotency; +import static org.squiddev.plethora.gameplay.modules.PlethoraModules.*; import static org.squiddev.plethora.gameplay.registry.Packets.*; public final class ItemModule extends ItemBase { - public static final String INTROSPECTION = "introspection"; - public static final String LASER = "laser"; - public static final String SCANNER = "scanner"; - public static final String SENSOR = "sensor"; - public static final String KINETIC = "kinetic"; - public static final String CHAT = "chat"; - public static final String GLASSES = "glasses"; - - public static final int INTROSPECTION_ID = 0; - public static final int LASER_ID = 1; - public static final int SCANNER_ID = 2; - public static final int SENSOR_ID = 3; - public static final int KINETIC_ID = 4; - public static final int CHAT_ID = 5; - public static final int GLASSES_ID = 6; - - private static final int MODULES = 7; - - private static final int[] TURTLE_MODULES = new int[]{ - INTROSPECTION_ID, - LASER_ID, - SCANNER_ID, - SENSOR_ID, - }; - - private static final int[] POCKET_MODULES = new int[]{ - LASER_ID, - SCANNER_ID, - SENSOR_ID, - INTROSPECTION_ID, - KINETIC_ID, - CHAT_ID, - }; - - public static final int[] VEHICLE_MODULES = new int[]{ - LASER_ID, - SCANNER_ID, - SENSOR_ID, - INTROSPECTION_ID, - KINETIC_ID, - }; - private static final int MAX_TICKS = 72000; private static final int USE_TICKS = 30; @@ -115,27 +74,6 @@ public ItemModule() { setHasSubtypes(true); } - public static String getName(int id) { - switch (id) { - case INTROSPECTION_ID: - return INTROSPECTION; - case LASER_ID: - return LASER; - case SCANNER_ID: - return SCANNER; - case SENSOR_ID: - return SENSOR; - case KINETIC_ID: - return KINETIC; - case CHAT_ID: - return CHAT; - case GLASSES_ID: - return GLASSES; - default: - return "unknown"; - } - } - @Nonnull @Override public String getUnlocalizedName(ItemStack stack) { @@ -367,6 +305,10 @@ public void getAdditionalContext(@Nonnull IModuleAccess access, @Nonnull IContex builder.addContext(glasses); builder.addAttachable(glasses); } + } else if (stack.getItemDamage() == CHAT_CREATIVE_ID) { + ChatListener.Listener listener = new ChatListener.CreativeListener(access); + builder.addContext(listener); + builder.addAttachable(listener); } } diff --git a/src/main/java/org/squiddev/plethora/gameplay/modules/ManipulatorType.java b/src/main/java/org/squiddev/plethora/gameplay/modules/ManipulatorType.java index f37f4e26..91102a34 100644 --- a/src/main/java/org/squiddev/plethora/gameplay/modules/ManipulatorType.java +++ b/src/main/java/org/squiddev/plethora/gameplay/modules/ManipulatorType.java @@ -1,9 +1,12 @@ package org.squiddev.plethora.gameplay.modules; +import net.minecraft.util.EnumFacing; import net.minecraft.util.IStringSerializable; import net.minecraft.util.math.AxisAlignedBB; +import org.squiddev.plethora.utils.MatrixHelpers; import javax.annotation.Nonnull; +import javax.vecmath.Matrix4f; import static org.squiddev.plethora.gameplay.modules.BlockManipulator.OFFSET; import static org.squiddev.plethora.gameplay.modules.BlockManipulator.PIX; @@ -22,13 +25,15 @@ public enum ManipulatorType implements IStringSerializable { private final String name; - public final AxisAlignedBB[] boxes; + private final AxisAlignedBB[] boxes; + private final AxisAlignedBB[][] facingBoxes; public final float scale; ManipulatorType(float scale, AxisAlignedBB... boxes) { name = name().toLowerCase(); this.scale = scale; this.boxes = boxes; + this.facingBoxes = new AxisAlignedBB[6][]; } @Nonnull @@ -45,4 +50,15 @@ public String toString() { public int size() { return boxes.length; } + + public AxisAlignedBB[] boxesFor(EnumFacing facing) { + AxisAlignedBB[] cached = facingBoxes[facing.ordinal()]; + if (cached != null) return cached; + + Matrix4f m = MatrixHelpers.matrixFor(facing); + cached = new AxisAlignedBB[boxes.length]; + for (int i = 0; i < boxes.length; i++) cached[i] = MatrixHelpers.transform(boxes[i], m); + + return facingBoxes[facing.ordinal()] = cached; + } } diff --git a/src/main/java/org/squiddev/plethora/gameplay/modules/PlethoraModules.java b/src/main/java/org/squiddev/plethora/gameplay/modules/PlethoraModules.java index cb07d17a..e72b2638 100644 --- a/src/main/java/org/squiddev/plethora/gameplay/modules/PlethoraModules.java +++ b/src/main/java/org/squiddev/plethora/gameplay/modules/PlethoraModules.java @@ -7,19 +7,76 @@ * List of modules built in to plethora */ public class PlethoraModules { - public static final ResourceLocation INTROSPECTION = new ResourceLocation(Plethora.RESOURCE_DOMAIN, ItemModule.INTROSPECTION); - public static final ResourceLocation KINETIC = new ResourceLocation(Plethora.RESOURCE_DOMAIN, ItemModule.KINETIC); - public static final ResourceLocation LASER = new ResourceLocation(Plethora.RESOURCE_DOMAIN, ItemModule.LASER); - public static final ResourceLocation SCANNER = new ResourceLocation(Plethora.RESOURCE_DOMAIN, ItemModule.SCANNER); - public static final ResourceLocation SENSOR = new ResourceLocation(Plethora.RESOURCE_DOMAIN, ItemModule.SENSOR); - public static final ResourceLocation CHAT = new ResourceLocation(Plethora.RESOURCE_DOMAIN, ItemModule.CHAT); - public static final ResourceLocation GLASSES = new ResourceLocation(Plethora.RESOURCE_DOMAIN, ItemModule.GLASSES); - - public static final String INTROSPECTION_S = Plethora.RESOURCE_DOMAIN + ":" + ItemModule.INTROSPECTION; - public static final String KINETIC_S = Plethora.RESOURCE_DOMAIN + ":" + ItemModule.KINETIC; - public static final String LASER_S = Plethora.RESOURCE_DOMAIN + ":" + ItemModule.LASER; - public static final String SCANNER_S = Plethora.RESOURCE_DOMAIN + ":" + ItemModule.SCANNER; - public static final String SENSOR_S = Plethora.RESOURCE_DOMAIN + ":" + ItemModule.SENSOR; - public static final String CHAT_S = Plethora.RESOURCE_DOMAIN + ":" + ItemModule.CHAT; - public static final String GLASSES_S = Plethora.RESOURCE_DOMAIN + ":" + ItemModule.GLASSES; + public static final String INTROSPECTION = "introspection"; + public static final String LASER = "laser"; + public static final String SCANNER = "scanner"; + public static final String SENSOR = "sensor"; + public static final String KINETIC = "kinetic"; + public static final String CHAT = "chat"; + public static final String GLASSES = "glasses"; + public static final String CHAT_CREATIVE = "chat_creative"; + + public static final int INTROSPECTION_ID = 0; + public static final int LASER_ID = 1; + public static final int SCANNER_ID = 2; + public static final int SENSOR_ID = 3; + public static final int KINETIC_ID = 4; + public static final int CHAT_ID = 5; + public static final int GLASSES_ID = 6; + public static final int CHAT_CREATIVE_ID = 7; + + public static final int MODULES = 8; + + private static String[] NAMES = new String[]{ + INTROSPECTION, LASER, SCANNER, SENSOR, KINETIC, CHAT, GLASSES, CHAT_CREATIVE + }; + + public static final int[] TURTLE_MODULES = new int[]{ + INTROSPECTION_ID, + LASER_ID, + SCANNER_ID, + SENSOR_ID, + CHAT_CREATIVE_ID, + }; + + public static final int[] POCKET_MODULES = new int[]{ + LASER_ID, + SCANNER_ID, + SENSOR_ID, + INTROSPECTION_ID, + KINETIC_ID, + CHAT_ID, + CHAT_CREATIVE_ID, + }; + + public static final int[] VEHICLE_MODULES = new int[]{ + LASER_ID, + SCANNER_ID, + SENSOR_ID, + INTROSPECTION_ID, + KINETIC_ID, + CHAT_CREATIVE_ID, + }; + + public static final String INTROSPECTION_S = Plethora.RESOURCE_DOMAIN + ":" + INTROSPECTION; + public static final String KINETIC_S = Plethora.RESOURCE_DOMAIN + ":" + KINETIC; + public static final String LASER_S = Plethora.RESOURCE_DOMAIN + ":" + LASER; + public static final String SCANNER_S = Plethora.RESOURCE_DOMAIN + ":" + SCANNER; + public static final String SENSOR_S = Plethora.RESOURCE_DOMAIN + ":" + SENSOR; + public static final String CHAT_S = Plethora.RESOURCE_DOMAIN + ":" + CHAT; + public static final String GLASSES_S = Plethora.RESOURCE_DOMAIN + ":" + GLASSES; + public static final String CHAT_CREATIVE_S = Plethora.RESOURCE_DOMAIN + ":" + CHAT_CREATIVE; + + public static final ResourceLocation INTROSPECTION_M = new ResourceLocation(Plethora.RESOURCE_DOMAIN, INTROSPECTION); + public static final ResourceLocation KINETIC_M = new ResourceLocation(Plethora.RESOURCE_DOMAIN, KINETIC); + public static final ResourceLocation LASER_M = new ResourceLocation(Plethora.RESOURCE_DOMAIN, LASER); + public static final ResourceLocation SCANNER_M = new ResourceLocation(Plethora.RESOURCE_DOMAIN, SCANNER); + public static final ResourceLocation SENSOR_M = new ResourceLocation(Plethora.RESOURCE_DOMAIN, SENSOR); + public static final ResourceLocation CHAT_M = new ResourceLocation(Plethora.RESOURCE_DOMAIN, CHAT); + public static final ResourceLocation GLASSES_M = new ResourceLocation(Plethora.RESOURCE_DOMAIN, GLASSES); + public static final ResourceLocation CHAT_CREATIVE_M = new ResourceLocation(Plethora.RESOURCE_DOMAIN, CHAT_CREATIVE); + + public static String getName(int id) { + return id >= 0 && id < MODULES ? NAMES[id] : "unknown"; + } } diff --git a/src/main/java/org/squiddev/plethora/gameplay/modules/TileManipulator.java b/src/main/java/org/squiddev/plethora/gameplay/modules/TileManipulator.java index 5297f6a8..9985c233 100644 --- a/src/main/java/org/squiddev/plethora/gameplay/modules/TileManipulator.java +++ b/src/main/java/org/squiddev/plethora/gameplay/modules/TileManipulator.java @@ -17,14 +17,15 @@ import org.squiddev.plethora.core.executor.ContextDelayedExecutor; import org.squiddev.plethora.core.executor.IExecutorFactory; import org.squiddev.plethora.gameplay.TileBase; +import org.squiddev.plethora.gameplay.registry.Registry; import org.squiddev.plethora.utils.Helpers; import javax.annotation.Nonnull; import java.util.Arrays; import java.util.Map; +import static org.squiddev.plethora.gameplay.modules.BlockManipulator.BOX_EXPAND; import static org.squiddev.plethora.gameplay.modules.BlockManipulator.OFFSET; -import static org.squiddev.plethora.gameplay.modules.BlockManipulator.PIX; import static org.squiddev.plethora.gameplay.modules.ManipulatorType.VALUES; public final class TileManipulator extends TileBase implements ITickable { @@ -58,6 +59,13 @@ public ManipulatorType getType() { return type; } + public EnumFacing getFacing() { + IBlockState state = getWorld().getBlockState(getPos()); + return state.getBlock() == Registry.blockManipulator + ? state.getValue(BlockManipulator.FACING) + : EnumFacing.DOWN; + } + public ItemStack getStack(int slot) { return stacks[slot]; } @@ -120,7 +128,7 @@ protected void writeDescription(NBTTagCompound tag) { protected void readDescription(NBTTagCompound tag) { if (tag.hasKey("type") && type == null) { int meta = tag.getInteger("type"); - setType(VALUES[meta < 0 || meta >= VALUES.length ? 0 : meta]); + setType(VALUES[meta & 1]); } if (type == null) return; @@ -143,21 +151,18 @@ protected void readDescription(NBTTagCompound tag) { @Override public boolean onActivated(EntityPlayer player, EnumHand hand, EnumFacing side, Vec3d hit) { - if (side != EnumFacing.UP) return false; if (player.getEntityWorld().isRemote) return true; if (type == null) { int meta = getBlockMetadata(); - setType(VALUES[meta < 0 || meta >= VALUES.length ? 0 : meta]); + setType(VALUES[meta & 1]); } ItemStack heldStack = player.getHeldItem(hand); + AxisAlignedBB[] boxes = type.boxesFor(getFacing()); for (int i = 0; i < type.size(); i++) { - AxisAlignedBB box = type.boxes[i]; - if (hit.y > OFFSET - PIX && - hit.x >= box.minX && hit.x <= box.maxX && - hit.z >= box.minZ && hit.z <= box.maxZ) { - + AxisAlignedBB box = boxes[i]; + if (box.grow(BOX_EXPAND, BOX_EXPAND, BOX_EXPAND).contains(hit)) { final ItemStack stack = stacks[i]; if (heldStack.isEmpty() && !stack.isEmpty()) { if (!player.capabilities.isCreativeMode) { diff --git a/src/main/java/org/squiddev/plethora/gameplay/modules/glasses/BaseObject.java b/src/main/java/org/squiddev/plethora/gameplay/modules/glasses/BaseObject.java index eb205dd0..75c4d2c2 100644 --- a/src/main/java/org/squiddev/plethora/gameplay/modules/glasses/BaseObject.java +++ b/src/main/java/org/squiddev/plethora/gameplay/modules/glasses/BaseObject.java @@ -2,6 +2,7 @@ import dan200.computercraft.api.lua.LuaException; import io.netty.buffer.ByteBuf; +import net.minecraft.client.renderer.GlStateManager; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import org.squiddev.plethora.api.reference.IReference; @@ -108,4 +109,16 @@ public BaseObject safeGet() throws LuaException { return get(); } } + + /** + * Prepare to draw a flat object. + */ + @SideOnly(Side.CLIENT) + protected static void setupFlat() { + GlStateManager.enableBlend(); + GlStateManager.disableAlpha(); + GlStateManager.disableTexture2D(); + GlStateManager.disableLighting(); + GlStateManager.disableCull(); + } } diff --git a/src/main/java/org/squiddev/plethora/gameplay/modules/glasses/CanvasHandler.java b/src/main/java/org/squiddev/plethora/gameplay/modules/glasses/CanvasHandler.java index 6ce3dacc..88f8ebef 100644 --- a/src/main/java/org/squiddev/plethora/gameplay/modules/glasses/CanvasHandler.java +++ b/src/main/java/org/squiddev/plethora/gameplay/modules/glasses/CanvasHandler.java @@ -123,16 +123,11 @@ public void render2DOverlay(RenderGameOverlayEvent.Post event) { GlStateManager.pushMatrix(); - GlStateManager.enableBlend(); - GlStateManager.disableAlpha(); - GlStateManager.disableTexture2D(); - GlStateManager.disableLighting(); - // The hotbar renders at -90 (See GuiIngame#renderTooltip) GlStateManager.translate(0, 0, -100); ScaledResolution resolution = event.getResolution(); - GlStateManager.scale(resolution.getScaledWidth_double() / WIDTH, resolution.getScaledHeight_double() / HEIGHT, 0); + GlStateManager.scale(resolution.getScaledWidth_double() / WIDTH, resolution.getScaledHeight_double() / HEIGHT, 2); synchronized (canvas.objects) { for (BaseObject object : canvas.objects.valueCollection()) { @@ -142,6 +137,7 @@ public void render2DOverlay(RenderGameOverlayEvent.Post event) { GlStateManager.color(1.0f, 1.0f, 1.0f); GlStateManager.enableTexture2D(); + GlStateManager.enableCull(); GlStateManager.popMatrix(); } diff --git a/src/main/java/org/squiddev/plethora/gameplay/modules/glasses/CanvasServer.java b/src/main/java/org/squiddev/plethora/gameplay/modules/glasses/CanvasServer.java index b3e137ba..6423f971 100644 --- a/src/main/java/org/squiddev/plethora/gameplay/modules/glasses/CanvasServer.java +++ b/src/main/java/org/squiddev/plethora/gameplay/modules/glasses/CanvasServer.java @@ -28,11 +28,18 @@ public CanvasServer(int canvasId, @Nonnull IModuleAccess access, @Nonnull Entity this.canvasId = canvasId; this.access = access; this.player = player; + } + public void attach() { access.getData().setInteger("id", canvasId); access.markDataDirty(); } + public void detach() { + access.getData().removeTag("id"); + access.markDataDirty(); + } + public synchronized int newObjectId() { return lastId++; } @@ -49,6 +56,8 @@ public MessageCanvasRemove getRemoveMessage() { @Nullable public synchronized MessageCanvasUpdate getUpdateMessage() { + for (BaseObject added : added) added.resetDirty(); + ArrayList changed = null; for (BaseObject object : objects.valueCollection()) { if (object.isDirty()) { diff --git a/src/main/java/org/squiddev/plethora/gameplay/modules/glasses/GlassesInstance.java b/src/main/java/org/squiddev/plethora/gameplay/modules/glasses/GlassesInstance.java index ea77db94..a7bb28ab 100644 --- a/src/main/java/org/squiddev/plethora/gameplay/modules/glasses/GlassesInstance.java +++ b/src/main/java/org/squiddev/plethora/gameplay/modules/glasses/GlassesInstance.java @@ -24,12 +24,14 @@ public CanvasServer getCanvas() { @Override public void attach() { + canvas.attach(); CanvasHandler.addServer(canvas); } @Override public void detach() { CanvasHandler.removeServer(canvas); + canvas.detach(); } @Nonnull diff --git a/src/main/java/org/squiddev/plethora/gameplay/modules/glasses/methods/Methods2D.java b/src/main/java/org/squiddev/plethora/gameplay/modules/glasses/methods/Methods2D.java index 1b011d9f..d6400d04 100644 --- a/src/main/java/org/squiddev/plethora/gameplay/modules/glasses/methods/Methods2D.java +++ b/src/main/java/org/squiddev/plethora/gameplay/modules/glasses/methods/Methods2D.java @@ -1,12 +1,14 @@ package org.squiddev.plethora.gameplay.modules.glasses.methods; import dan200.computercraft.api.lua.LuaException; +import net.minecraft.item.Item; +import net.minecraft.util.ResourceLocation; import org.squiddev.plethora.api.method.BasicMethod; import org.squiddev.plethora.api.method.IUnbakedContext; import org.squiddev.plethora.api.method.MethodResult; import org.squiddev.plethora.gameplay.modules.glasses.objects.object2d.*; -import static dan200.computercraft.core.apis.ArgumentHelper.getInt; +import static dan200.computercraft.core.apis.ArgumentHelper.*; import static org.squiddev.plethora.api.method.ArgumentHelper.assertBetween; import static org.squiddev.plethora.api.method.ArgumentHelper.getFloat; @@ -104,4 +106,27 @@ public static MethodResult insertPoint(IUnbakedContext co object.addPoint(idx - 1, new Point2D(x, y)); return MethodResult.empty(); } + + @BasicMethod.Inject(value = Item2D.class, doc = "function(): string, number -- Get the item and damage value for this object.") + public static MethodResult getItem(IUnbakedContext context, Object[] args) throws LuaException { + Item2D object = context.safeBake().getTarget(); + + return MethodResult.result(object.getItem().getRegistryName().toString(), object.getDamage()); + } + + @BasicMethod.Inject(value = Item2D.class, doc = "function(item:string[, damage:number]) -- Set the item and damage value for this object.") + public static MethodResult setItem(IUnbakedContext context, Object[] args) throws LuaException { + Item2D object = context.safeBake().getTarget(); + + ResourceLocation name = new ResourceLocation(getString(args, 0)); + int damage = optInt(args, 1, 0); + + Item item = Item.REGISTRY.getObject(name); + if (item == null) throw new LuaException("Unknown item '" + name + "'"); + + object.setItem(item); + object.setDamage(damage); + + return MethodResult.empty(); + } } diff --git a/src/main/java/org/squiddev/plethora/gameplay/modules/glasses/methods/MethodsBasic.java b/src/main/java/org/squiddev/plethora/gameplay/modules/glasses/methods/MethodsBasic.java index 67d462df..fbd66f06 100644 --- a/src/main/java/org/squiddev/plethora/gameplay/modules/glasses/methods/MethodsBasic.java +++ b/src/main/java/org/squiddev/plethora/gameplay/modules/glasses/methods/MethodsBasic.java @@ -55,11 +55,12 @@ public static MethodResult setColour(IUnbakedContext context, Object break; } + default: case 4: { int r = getInt(args, 0) & 0xFF; int g = getInt(args, 1) & 0xFF; - int b = getInt(args, 3) & 0xFF; - int a = getInt(args, 4) & 0xFF; + int b = getInt(args, 2) & 0xFF; + int a = getInt(args, 3) & 0xFF; object.setColour((r << 24) | (g << 16) | (b << 8) | a); break; diff --git a/src/main/java/org/squiddev/plethora/gameplay/modules/glasses/methods/MethodsCanvas2D.java b/src/main/java/org/squiddev/plethora/gameplay/modules/glasses/methods/MethodsCanvas2D.java index 91a8a962..ff2056ac 100644 --- a/src/main/java/org/squiddev/plethora/gameplay/modules/glasses/methods/MethodsCanvas2D.java +++ b/src/main/java/org/squiddev/plethora/gameplay/modules/glasses/methods/MethodsCanvas2D.java @@ -1,6 +1,8 @@ package org.squiddev.plethora.gameplay.modules.glasses.methods; import dan200.computercraft.api.lua.LuaException; +import net.minecraft.item.Item; +import net.minecraft.util.ResourceLocation; import org.squiddev.plethora.api.method.BasicMethod; import org.squiddev.plethora.api.method.IContext; import org.squiddev.plethora.api.method.IUnbakedContext; @@ -156,6 +158,29 @@ public static MethodResult addLines(IUnbakedContext context, Objec return MethodResult.result(baked.makeChild(lines.reference(canvas)).getObject()); } + @BasicMethod.Inject(value = CanvasServer.class, doc = "function(position:table, id:string[, damage:number][, scale:number]):table -- Create a item icon.") + public static MethodResult addItem(IUnbakedContext context, Object[] args) throws LuaException { + IContext baked = context.safeBake(); + CanvasServer canvas = baked.getTarget(); + + Point2D position = getPoint2D(args, 0); + ResourceLocation name = new ResourceLocation(getString(args, 1)); + int damage = optInt(args, 2, 0); + float scale = optFloat(args, 3, 1); + + Item item = Item.REGISTRY.getObject(name); + if (item == null) throw new LuaException("Unknown item '" + name + "'"); + + Item2D model = new Item2D(canvas.newObjectId()); + model.setPosition(position); + model.setScale(scale); + model.setItem(item); + model.setDamage(damage); + + canvas.add(model); + return MethodResult.result(baked.makeChild(model.reference(canvas)).getObject()); + } + @BasicMethod.Inject(value = CanvasServer.class, doc = "function():number, number -- Get the size of this canvas.") public static MethodResult getSize(IUnbakedContext context, Object[] args) throws LuaException { context.safeBake(); diff --git a/src/main/java/org/squiddev/plethora/gameplay/modules/glasses/objects/ObjectRegistry.java b/src/main/java/org/squiddev/plethora/gameplay/modules/glasses/objects/ObjectRegistry.java index e7ade8ef..96ace510 100644 --- a/src/main/java/org/squiddev/plethora/gameplay/modules/glasses/objects/ObjectRegistry.java +++ b/src/main/java/org/squiddev/plethora/gameplay/modules/glasses/objects/ObjectRegistry.java @@ -12,6 +12,7 @@ public final class ObjectRegistry { public static final byte TRIANGLE_2D = 4; public static final byte POLYGON_2D = 5; public static final byte LINE_LOOP_2D = 6; + public static final byte ITEM_2D = 7; private ObjectRegistry() { } @@ -32,6 +33,8 @@ public static BaseObject create(int id, byte type) { return new Polygon(id); case LINE_LOOP_2D: return new LineLoop(id); + case ITEM_2D: + return new Item2D(id); default: throw new IllegalStateException("Unknown type " + type); } diff --git a/src/main/java/org/squiddev/plethora/gameplay/modules/glasses/objects/object2d/Dot.java b/src/main/java/org/squiddev/plethora/gameplay/modules/glasses/objects/object2d/Dot.java index cba142e3..9c46cfd8 100644 --- a/src/main/java/org/squiddev/plethora/gameplay/modules/glasses/objects/object2d/Dot.java +++ b/src/main/java/org/squiddev/plethora/gameplay/modules/glasses/objects/object2d/Dot.java @@ -64,6 +64,8 @@ public void readInitial(ByteBuf buf) { @Override public void draw2D() { + setupFlat(); + float x = position.x, y = position.y, delta = scale / 2; GL11.glBegin(GL11.GL_TRIANGLES); diff --git a/src/main/java/org/squiddev/plethora/gameplay/modules/glasses/objects/object2d/Item2D.java b/src/main/java/org/squiddev/plethora/gameplay/modules/glasses/objects/object2d/Item2D.java new file mode 100644 index 00000000..8dc3671f --- /dev/null +++ b/src/main/java/org/squiddev/plethora/gameplay/modules/glasses/objects/object2d/Item2D.java @@ -0,0 +1,123 @@ +package org.squiddev.plethora.gameplay.modules.glasses.objects.object2d; + +import io.netty.buffer.ByteBuf; +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.RenderHelper; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.ResourceLocation; +import net.minecraftforge.fml.common.network.ByteBufUtils; +import org.squiddev.plethora.gameplay.modules.glasses.BaseObject; +import org.squiddev.plethora.gameplay.modules.glasses.objects.ObjectRegistry; +import org.squiddev.plethora.gameplay.modules.glasses.objects.Scalable; + +import javax.annotation.Nonnull; + +public class Item2D extends BaseObject implements Scalable, Positionable2D { + private float scale; + private Point2D position = new Point2D(); + + private int damage; + private Item item; + + public Item2D(int id) { + super(id); + } + + + @Override + public float getScale() { + return scale; + } + + @Override + public void setScale(float scale) { + if (this.scale != scale) { + this.scale = scale; + setDirty(); + } + } + + @Override + public Point2D getPosition() { + return position; + } + + @Override + public void setPosition(Point2D position) { + if (!this.position.equals(position)) { + this.position = position; + setDirty(); + } + } + + public int getDamage() { + return damage; + } + + public void setDamage(int damage) { + if (this.damage != damage) { + this.damage = damage; + setDirty(); + } + } + + public Item getItem() { + return item; + } + + public void setItem(@Nonnull Item item) { + if (this.item != item) { + this.item = item; + setDirty(); + } + } + + @Override + public byte getType() { + return ObjectRegistry.ITEM_2D; + } + + @Override + public void writeInital(ByteBuf buf) { + position.write(buf); + buf.writeFloat(scale); + ByteBufUtils.writeUTF8String(buf, item.getRegistryName().toString()); + buf.writeInt(damage); + } + + @Override + public void readInitial(ByteBuf buf) { + position.read(buf); + scale = buf.readFloat(); + + ResourceLocation name = new ResourceLocation(ByteBufUtils.readUTF8String(buf)); + item = Item.REGISTRY.getObject(name); + + damage = buf.readInt(); + } + + @Override + public void draw2D() { + GlStateManager.pushMatrix(); + + GlStateManager.translate(position.x, position.y, 0); + GlStateManager.scale(scale, scale, 1); + + GlStateManager.color(1.0f, 1.0f, 1.0f, 1.0f); + GlStateManager.enableTexture2D(); + GlStateManager.enableRescaleNormal(); + GlStateManager.enableBlend(); + GlStateManager.enableAlpha(); + GlStateManager.enableCull(); + GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO); + RenderHelper.enableGUIStandardItemLighting(); + + ItemStack stack = new ItemStack(item, 1, damage); + Minecraft.getMinecraft().getRenderItem() + .renderItemAndEffectIntoGUI(Minecraft.getMinecraft().player, stack, 0, 0); + + GlStateManager.popMatrix(); + } +} diff --git a/src/main/java/org/squiddev/plethora/gameplay/modules/glasses/objects/object2d/Line.java b/src/main/java/org/squiddev/plethora/gameplay/modules/glasses/objects/object2d/Line.java index 8d14ac34..7dae1e9a 100644 --- a/src/main/java/org/squiddev/plethora/gameplay/modules/glasses/objects/object2d/Line.java +++ b/src/main/java/org/squiddev/plethora/gameplay/modules/glasses/objects/object2d/Line.java @@ -78,12 +78,15 @@ public void readInitial(ByteBuf buf) { @Override public void draw2D() { + setupFlat(); GL11.glLineWidth(thickness); + GL11.glBegin(GL11.GL_LINES); setupColour(); GL11.glVertex3f(start.x, start.y, 0); GL11.glVertex3f(end.x, end.y, 0); GL11.glEnd(); + GL11.glLineWidth(1); } } diff --git a/src/main/java/org/squiddev/plethora/gameplay/modules/glasses/objects/object2d/LineLoop.java b/src/main/java/org/squiddev/plethora/gameplay/modules/glasses/objects/object2d/LineLoop.java index 2366cc82..2299b2f6 100644 --- a/src/main/java/org/squiddev/plethora/gameplay/modules/glasses/objects/object2d/LineLoop.java +++ b/src/main/java/org/squiddev/plethora/gameplay/modules/glasses/objects/object2d/LineLoop.java @@ -48,6 +48,7 @@ public void readInitial(ByteBuf buf) { public void draw2D() { if (points.size() < 2) return; + setupFlat(); GL11.glLineWidth(scale); GL11.glBegin(GL11.GL_LINE_LOOP); diff --git a/src/main/java/org/squiddev/plethora/gameplay/modules/glasses/objects/object2d/Polygon.java b/src/main/java/org/squiddev/plethora/gameplay/modules/glasses/objects/object2d/Polygon.java index e0a457ca..c0bc147f 100644 --- a/src/main/java/org/squiddev/plethora/gameplay/modules/glasses/objects/object2d/Polygon.java +++ b/src/main/java/org/squiddev/plethora/gameplay/modules/glasses/objects/object2d/Polygon.java @@ -2,7 +2,6 @@ import com.google.common.base.Objects; import io.netty.buffer.ByteBuf; -import net.minecraft.client.renderer.GlStateManager; import org.lwjgl.opengl.GL11; import org.squiddev.plethora.gameplay.modules.glasses.objects.ColourableObject; @@ -90,7 +89,7 @@ public void readInitial(ByteBuf buf) { public void draw2D() { if (points.size() < 3) return; - GlStateManager.disableCull(); + setupFlat(); int size = points.size(); Point2D a = points.get(0); @@ -104,7 +103,5 @@ public void draw2D() { GL11.glVertex3f(c.x, c.y, 0); } GL11.glEnd(); - - GlStateManager.enableCull(); } } diff --git a/src/main/java/org/squiddev/plethora/gameplay/modules/glasses/objects/object2d/Rectangle.java b/src/main/java/org/squiddev/plethora/gameplay/modules/glasses/objects/object2d/Rectangle.java index 16c19c42..b56d18ef 100644 --- a/src/main/java/org/squiddev/plethora/gameplay/modules/glasses/objects/object2d/Rectangle.java +++ b/src/main/java/org/squiddev/plethora/gameplay/modules/glasses/objects/object2d/Rectangle.java @@ -68,6 +68,8 @@ public void readInitial(ByteBuf buf) { @Override public void draw2D() { + setupFlat(); + float x = position.x, y = position.y; GL11.glBegin(GL11.GL_TRIANGLES); setupColour(); diff --git a/src/main/java/org/squiddev/plethora/gameplay/modules/glasses/objects/object2d/Text.java b/src/main/java/org/squiddev/plethora/gameplay/modules/glasses/objects/object2d/Text.java index c2754622..1f8f7c4c 100644 --- a/src/main/java/org/squiddev/plethora/gameplay/modules/glasses/objects/object2d/Text.java +++ b/src/main/java/org/squiddev/plethora/gameplay/modules/glasses/objects/object2d/Text.java @@ -104,7 +104,5 @@ public void draw2D() { // We use 0xRRGGBBAA, but the font renderer expects 0xAARRGGBB, so we rotate the bits fontrenderer.drawString(text, 0, 0, Integer.rotateRight(colour, 8)); GlStateManager.popMatrix(); - - GlStateManager.disableTexture2D(); } } diff --git a/src/main/java/org/squiddev/plethora/gameplay/modules/methods/MethodsChat.java b/src/main/java/org/squiddev/plethora/gameplay/modules/methods/MethodsChat.java index 1e0fc285..7f678960 100644 --- a/src/main/java/org/squiddev/plethora/gameplay/modules/methods/MethodsChat.java +++ b/src/main/java/org/squiddev/plethora/gameplay/modules/methods/MethodsChat.java @@ -91,7 +91,7 @@ public static MethodResult tell(@Nonnull final IUnbakedContext }); } - private static void validateMessage(String message) throws LuaException { + public static void validateMessage(String message) throws LuaException { if (ConfigGameplay.Chat.maxLength > 0 && message.length() > ConfigGameplay.Chat.maxLength) { throw new LuaException(String.format("Message is too long (was %d, maximum is %d)", message.length(), ConfigGameplay.Chat.maxLength)); } diff --git a/src/main/java/org/squiddev/plethora/gameplay/modules/methods/MethodsChatCreative.java b/src/main/java/org/squiddev/plethora/gameplay/modules/methods/MethodsChatCreative.java new file mode 100644 index 00000000..d1360d7b --- /dev/null +++ b/src/main/java/org/squiddev/plethora/gameplay/modules/methods/MethodsChatCreative.java @@ -0,0 +1,89 @@ +package org.squiddev.plethora.gameplay.modules.methods; + +import dan200.computercraft.api.lua.LuaException; +import net.minecraft.server.MinecraftServer; +import net.minecraft.util.text.ITextComponent; +import net.minecraftforge.common.ForgeHooks; +import net.minecraftforge.fml.common.FMLCommonHandler; +import org.squiddev.plethora.api.IWorldLocation; +import org.squiddev.plethora.api.method.IContext; +import org.squiddev.plethora.api.method.IUnbakedContext; +import org.squiddev.plethora.api.method.MethodResult; +import org.squiddev.plethora.api.module.IModuleContainer; +import org.squiddev.plethora.api.module.ModuleContainerMethod; +import org.squiddev.plethora.api.module.SubtargetedModuleObjectMethod; +import org.squiddev.plethora.gameplay.modules.PlethoraModules; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; +import java.util.concurrent.Callable; + +import static dan200.computercraft.core.apis.ArgumentHelper.getString; +import static org.squiddev.plethora.gameplay.modules.ChatListener.Listener; +import static org.squiddev.plethora.gameplay.modules.methods.MethodsChat.validateMessage; + +public final class MethodsChatCreative { + @ModuleContainerMethod.Inject( + value = PlethoraModules.CHAT_CREATIVE_S, + doc = "function(message:string) -- Send a message to everyone" + ) + @Nonnull + public static MethodResult say(@Nonnull final IUnbakedContext unbaked, @Nonnull Object[] args) throws LuaException { + final String message = getString(args, 0); + validateMessage(message); + + return MethodResult.nextTick(new Callable() { + @Override + public MethodResult call() throws Exception { + IContext context = unbaked.bake(); + + // Create the chat event and post to chat + ITextComponent formatted = ForgeHooks.newChatWithLinks(message); + + // Attempt to extract the server from the current world. + MinecraftServer server = null; + if (context.hasContext(IWorldLocation.class)) { + server = context.getContext(IWorldLocation.class).getWorld().getMinecraftServer(); + } + + // If that failed then just get the global server. + if (server == null) server = FMLCommonHandler.instance().getMinecraftServerInstance(); + + server.getPlayerList().sendMessage(formatted, false); + return MethodResult.empty(); + } + }); + } + + @SubtargetedModuleObjectMethod.Inject( + module = PlethoraModules.CHAT_CREATIVE_S, target = Listener.class, worldThread = false, + doc = "function(pattern:string) -- Capture all chat messages matching a Lua pattern, preventing them from being said." + ) + @Nullable + public static Object[] capture(Listener listener, @Nonnull IContext context, @Nonnull Object[] args) throws LuaException { + String pattern = getString(args, 0); + listener.addPattern(pattern); + return null; + } + + @SubtargetedModuleObjectMethod.Inject( + module = PlethoraModules.CHAT_CREATIVE_S, target = Listener.class, worldThread = false, + doc = "function(pattern:string):boolean -- Remove a capture added by capture(pattern)." + ) + @Nonnull + public static Object[] uncapture(Listener listener, @Nonnull IContext context, @Nonnull Object[] args) throws LuaException { + String pattern = getString(args, 0); + boolean removed = listener.removePattern(pattern); + return new Object[]{removed}; + } + + @SubtargetedModuleObjectMethod.Inject( + module = PlethoraModules.CHAT_S, target = Listener.class, worldThread = false, + doc = "function() -- Remove all listeners added by capture()." + ) + @Nullable + public static Object[] clearCaptures(Listener listener, @Nonnull final IContext unbaked, @Nonnull Object[] args) throws LuaException { + listener.clearPatterns(); + return null; + } +} diff --git a/src/main/java/org/squiddev/plethora/gameplay/neural/ContainerNeuralInterface.java b/src/main/java/org/squiddev/plethora/gameplay/neural/ContainerNeuralInterface.java index f8e83329..a4b7bdac 100644 --- a/src/main/java/org/squiddev/plethora/gameplay/neural/ContainerNeuralInterface.java +++ b/src/main/java/org/squiddev/plethora/gameplay/neural/ContainerNeuralInterface.java @@ -112,6 +112,7 @@ public ItemStack transferStackInSlot(EntityPlayer player, int slotIdx) { * * @see net.minecraftforge.items.ItemStackHandler#insertItem(int, ItemStack, boolean) */ + @Override protected boolean mergeItemStack(ItemStack stack, int startIndex, int endIndex, boolean reverseDirection) { boolean flag = false; int i = reverseDirection ? endIndex - 1 : startIndex; diff --git a/src/main/java/org/squiddev/plethora/gameplay/redstone/TileRedstoneIntegrator.java b/src/main/java/org/squiddev/plethora/gameplay/redstone/TileRedstoneIntegrator.java index 4ef630f0..4d3a5c87 100644 --- a/src/main/java/org/squiddev/plethora/gameplay/redstone/TileRedstoneIntegrator.java +++ b/src/main/java/org/squiddev/plethora/gameplay/redstone/TileRedstoneIntegrator.java @@ -110,6 +110,7 @@ public void onLoad() { enqueueOutputTick(); } + @Override public void onNeighbourChange() { updateInput(); } diff --git a/src/main/java/org/squiddev/plethora/gameplay/registry/Registry.java b/src/main/java/org/squiddev/plethora/gameplay/registry/Registry.java index 6929344d..d8872f3b 100644 --- a/src/main/java/org/squiddev/plethora/gameplay/registry/Registry.java +++ b/src/main/java/org/squiddev/plethora/gameplay/registry/Registry.java @@ -4,6 +4,7 @@ import net.minecraftforge.fml.relauncher.SideOnly; import org.squiddev.plethora.gameplay.client.RenderInterfaceLiving; import org.squiddev.plethora.gameplay.client.RenderOverlay; +import org.squiddev.plethora.gameplay.client.RenderSquidOverlay; import org.squiddev.plethora.gameplay.keyboard.ItemKeyboard; import org.squiddev.plethora.gameplay.minecart.EntityMinecartComputer; import org.squiddev.plethora.gameplay.modules.BlockManipulator; @@ -69,6 +70,8 @@ public static void setup() { addModule(itemKeyboard = new ItemKeyboard()); addModule(blockRedstoneIntegrator = new BlockRedstoneIntegrator()); + + addModule(new RenderSquidOverlay()); } public static void preInit() { diff --git a/src/main/java/org/squiddev/plethora/integration/baubles/MethodIntrospectionBaublesInventory.java b/src/main/java/org/squiddev/plethora/integration/baubles/MethodIntrospectionBaublesInventory.java index a374f1c3..61aba698 100644 --- a/src/main/java/org/squiddev/plethora/integration/baubles/MethodIntrospectionBaublesInventory.java +++ b/src/main/java/org/squiddev/plethora/integration/baubles/MethodIntrospectionBaublesInventory.java @@ -24,7 +24,7 @@ public class MethodIntrospectionBaublesInventory extends SubtargetedModuleObjectMethod { public MethodIntrospectionBaublesInventory() { super( - "getBaubles", Collections.singleton(PlethoraModules.INTROSPECTION), EntityPlayer.class, true, + "getBaubles", Collections.singleton(PlethoraModules.INTROSPECTION_M), EntityPlayer.class, true, "function():table -- Get this player's baubles inventory" ); } diff --git a/src/main/java/org/squiddev/plethora/integration/computercraft/IntegrationComputerCraft.java b/src/main/java/org/squiddev/plethora/integration/computercraft/IntegrationComputerCraft.java index 0a4be5eb..17d8ecce 100644 --- a/src/main/java/org/squiddev/plethora/integration/computercraft/IntegrationComputerCraft.java +++ b/src/main/java/org/squiddev/plethora/integration/computercraft/IntegrationComputerCraft.java @@ -51,9 +51,10 @@ public void onModelBakeEvent(ModelBakeEvent event) { } private static final class PeripheralCapabilityProvider implements ICapabilityProvider { - private boolean checked = false; + private boolean checkedPeripheral = false; private IPeripheralHandler peripheral; - private IVehicleUpgradeHandler minecart; + private boolean checkedVehicle = false; + private IVehicleUpgradeHandler vehicle; private final ItemStack stack; private PeripheralCapabilityProvider(ItemStack stack) { @@ -63,7 +64,7 @@ private PeripheralCapabilityProvider(ItemStack stack) { @Override public boolean hasCapability(@Nonnull Capability capability, EnumFacing enumFacing) { if (capability == Constants.PERIPHERAL_HANDLER_CAPABILITY) return getHandler() != null; - if (capability == Constants.VEHICLE_UPGRADE_HANDLER_CAPABILITY) return getMinecart() != null; + if (capability == Constants.VEHICLE_UPGRADE_HANDLER_CAPABILITY) return getVehicle() != null; return false; } @@ -71,15 +72,15 @@ public boolean hasCapability(@Nonnull Capability capability, EnumFacing enumF @SuppressWarnings("unchecked") public T getCapability(@Nonnull Capability capability, EnumFacing enumFacing) { if (capability == Constants.PERIPHERAL_HANDLER_CAPABILITY) return (T) getHandler(); - if (capability == Constants.VEHICLE_UPGRADE_HANDLER_CAPABILITY) return (T) getMinecart(); + if (capability == Constants.VEHICLE_UPGRADE_HANDLER_CAPABILITY) return (T) getVehicle(); return null; } private IPeripheralHandler getHandler() { - if (checked) { + if (checkedPeripheral) { return peripheral; } else { - checked = true; + checkedPeripheral = true; if (stack.getItem() instanceof ItemPeripheralBase) { ItemPeripheralBase item = (ItemPeripheralBase) stack.getItem(); @@ -99,21 +100,21 @@ private IPeripheralHandler getHandler() { } } - private IVehicleUpgradeHandler getMinecart() { - if (checked) { - return minecart; + private IVehicleUpgradeHandler getVehicle() { + if (checkedVehicle) { + return vehicle; } else { - checked = true; + checkedVehicle = true; if (stack.getItem() instanceof ItemPeripheralBase) { ItemPeripheralBase item = (ItemPeripheralBase) stack.getItem(); switch (item.getPeripheralType(stack)) { case WirelessModem: - return minecart = new WirelessModemPeripheralBase.VehicleUpgradeHandler(false, stack); + return vehicle = new WirelessModemPeripheralBase.VehicleUpgradeHandler(false, stack); case AdvancedModem: - return minecart = new WirelessModemPeripheralBase.VehicleUpgradeHandler(true, stack); + return vehicle = new WirelessModemPeripheralBase.VehicleUpgradeHandler(true, stack); case Speaker: - return minecart = new SpeakerPeripheralBase.VehicleUpgradeHandler(stack); + return vehicle = new SpeakerPeripheralBase.VehicleUpgradeHandler(stack); default: return null; } diff --git a/src/main/java/org/squiddev/plethora/integration/computercraft/SpeakerPeripheralBase.java b/src/main/java/org/squiddev/plethora/integration/computercraft/SpeakerPeripheralBase.java index d71d6910..08b9b2c0 100644 --- a/src/main/java/org/squiddev/plethora/integration/computercraft/SpeakerPeripheralBase.java +++ b/src/main/java/org/squiddev/plethora/integration/computercraft/SpeakerPeripheralBase.java @@ -5,7 +5,6 @@ import net.minecraft.client.renderer.block.model.IBakedModel; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.item.EntityMinecart; import net.minecraft.item.ItemStack; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3d; diff --git a/src/main/java/org/squiddev/plethora/integration/ic2/MetaItemCrop.java b/src/main/java/org/squiddev/plethora/integration/ic2/MetaItemCrop.java index fe4bdaab..f75b4bcb 100644 --- a/src/main/java/org/squiddev/plethora/integration/ic2/MetaItemCrop.java +++ b/src/main/java/org/squiddev/plethora/integration/ic2/MetaItemCrop.java @@ -74,7 +74,7 @@ public static Map getMeta(CropCard card, int level) { for (int i = 0; i < attributes.length; i++) { list.put(i + 1, attributes[i]); } - out.put("attributes", attributes); + out.put("attributes", list); } return out; diff --git a/src/main/java/org/squiddev/plethora/integration/jei/UseInRecipeWrapper.java b/src/main/java/org/squiddev/plethora/integration/jei/UseInRecipeWrapper.java index 9614a0f1..c8ad73a9 100644 --- a/src/main/java/org/squiddev/plethora/integration/jei/UseInRecipeWrapper.java +++ b/src/main/java/org/squiddev/plethora/integration/jei/UseInRecipeWrapper.java @@ -1,6 +1,7 @@ package org.squiddev.plethora.integration.jei; +import dan200.computercraft.ComputerCraft; import mezz.jei.api.IGuiHelper; import mezz.jei.api.gui.IDrawable; import mezz.jei.api.ingredients.IIngredients; @@ -8,21 +9,40 @@ import mezz.jei.util.Translator; import net.minecraft.client.Minecraft; import net.minecraft.item.ItemStack; +import org.squiddev.plethora.api.Constants; +import org.squiddev.plethora.utils.Helpers; import javax.annotation.Nonnull; import java.awt.*; +import java.util.ArrayList; +import java.util.List; public abstract class UseInRecipeWrapper implements IRecipeWrapper { + protected static String MINECART_COMPUTER = "entity.plethora.plethora:minecartComputer.name"; + protected final ItemStack stack; private final IDrawable slotDrawable; - private final ItemStack[] usable; + private final List usable = new ArrayList(); private final String id; public UseInRecipeWrapper(@Nonnull ItemStack stack, String id, @Nonnull ItemStack[] useIn, @Nonnull IGuiHelper helper) { this.stack = stack; this.slotDrawable = helper.getSlotDrawable(); - this.usable = useIn; this.id = id; + + for (ItemStack use : useIn) usable.add(use.getDisplayName()); + + if (stack.hasCapability(Constants.VEHICLE_UPGRADE_HANDLER_CAPABILITY, null)) { + usable.add(Helpers.translateToLocal(MINECART_COMPUTER)); + } + + if (ComputerCraft.getPocketUpgrade(stack) != null) { + usable.add(new ItemStack(ComputerCraft.Items.pocketComputer).getDisplayName()); + } + + if (ComputerCraft.getTurtleUpgrade(stack) != null) { + usable.add(new ItemStack(ComputerCraft.Blocks.turtle).getDisplayName()); + } } @Override @@ -48,8 +68,7 @@ public void drawInfo(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHe ); yPos += minecraft.fontRenderer.FONT_HEIGHT; - for (ItemStack stack : usable) { - String name = stack.getDisplayName(); + for (String name : usable) { minecraft.fontRenderer.drawString(" - " + name, xPos, yPos, color); yPos += minecraft.fontRenderer.FONT_HEIGHT; } diff --git a/src/main/java/org/squiddev/plethora/integration/vanilla/IntegrationVanilla.java b/src/main/java/org/squiddev/plethora/integration/vanilla/IntegrationVanilla.java index f3d21a58..28f10916 100644 --- a/src/main/java/org/squiddev/plethora/integration/vanilla/IntegrationVanilla.java +++ b/src/main/java/org/squiddev/plethora/integration/vanilla/IntegrationVanilla.java @@ -18,9 +18,9 @@ import net.minecraftforge.event.entity.living.LivingEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import org.squiddev.plethora.api.PlethoraAPI; -import org.squiddev.plethora.api.vehicle.VehicleModuleHandler; import org.squiddev.plethora.api.module.BasicModuleHandler; import org.squiddev.plethora.api.module.IModuleRegistry; +import org.squiddev.plethora.api.vehicle.VehicleModuleHandler; import org.squiddev.plethora.core.PlethoraCore; import org.squiddev.plethora.core.modules.BasicModuleHandlerTransform; import org.squiddev.plethora.core.modules.VehicleModuleHandlerTransform; diff --git a/src/main/java/org/squiddev/plethora/utils/MatrixHelpers.java b/src/main/java/org/squiddev/plethora/utils/MatrixHelpers.java new file mode 100644 index 00000000..550f41da --- /dev/null +++ b/src/main/java/org/squiddev/plethora/utils/MatrixHelpers.java @@ -0,0 +1,90 @@ +package org.squiddev.plethora.utils; + +import net.minecraft.util.EnumFacing; +import net.minecraft.util.math.AxisAlignedBB; + +import javax.vecmath.Matrix4f; +import javax.vecmath.Vector3f; + +public final class MatrixHelpers { + private MatrixHelpers() { + } + + public static final Matrix4f IDENTITY; + + public static final Matrix4f[] FACINGS; + + static { + IDENTITY = new Matrix4f(); + + FACINGS = new Matrix4f[EnumFacing.VALUES.length]; + for (EnumFacing facing : EnumFacing.VALUES) { + int x, y; + switch (facing) { + default: + case DOWN: + x = 0; + y = 0; + break; + case UP: + x = 180; + y = 0; + break; + case EAST: + x = 90; + y = 270; + break; + case WEST: + x = 90; + y = 90; + break; + case NORTH: + x = 90; + y = 180; + break; + case SOUTH: + x = 90; + y = 0; + break; + } + + Matrix4f result = new Matrix4f(), temp = new Matrix4f(); + result.setIdentity(); + + temp.setIdentity(); + temp.setTranslation(new Vector3f(0.5f, 0.5f, 0.5f)); + result.mul(temp); + + temp.setIdentity(); + temp.rotY(-y / 180.0f * (float) Math.PI); + result.mul(temp); + + temp.setIdentity(); + temp.rotX(-x / 180.0f * (float) Math.PI); + result.mul(temp); + + temp.setIdentity(); + temp.setTranslation(new Vector3f(-0.5f, -0.5f, -0.5f)); + result.mul(temp); + + FACINGS[facing.ordinal()] = result; + } + } + + public static Matrix4f matrixFor(EnumFacing facing) { + int index = facing.ordinal(); + return index < FACINGS.length ? FACINGS[index] : IDENTITY; + } + + public static AxisAlignedBB transform(AxisAlignedBB box, Matrix4f matrix) { + return new AxisAlignedBB( + (float) (matrix.m00 * box.minX + matrix.m01 * box.minY + matrix.m02 * box.minZ + matrix.m03), + (float) (matrix.m10 * box.minX + matrix.m11 * box.minY + matrix.m12 * box.minZ + matrix.m13), + (float) (matrix.m20 * box.minX + matrix.m21 * box.minY + matrix.m22 * box.minZ + matrix.m23), + + (float) (matrix.m00 * box.maxX + matrix.m01 * box.maxY + matrix.m02 * box.maxZ + matrix.m03), + (float) (matrix.m10 * box.maxX + matrix.m11 * box.maxY + matrix.m12 * box.maxZ + matrix.m13), + (float) (matrix.m20 * box.maxX + matrix.m21 * box.maxY + matrix.m22 * box.maxZ + matrix.m23) + ); + } +} diff --git a/src/main/java/org/squiddev/plethora/utils/PlayerHelpers.java b/src/main/java/org/squiddev/plethora/utils/PlayerHelpers.java index d6321ba1..f589a8b5 100644 --- a/src/main/java/org/squiddev/plethora/utils/PlayerHelpers.java +++ b/src/main/java/org/squiddev/plethora/utils/PlayerHelpers.java @@ -63,11 +63,11 @@ public static RayTraceResult findHit(EntityLivingBase entity, double range) { List entityList = entity.getEntityWorld().getEntitiesInAABBexcluding( entity, - entity.getEntityBoundingBox().expand( + entity.getEntityBoundingBox().expand( look.x * range, look.y * range, look.z * range - ).grow(1, 1, 1), collidablePredicate); + ).grow(1, 1, 1), collidablePredicate); Entity closestEntity = null; Vec3d closestVec = null; diff --git a/src/main/resources/assets/plethora/blockstates/manipulator.json b/src/main/resources/assets/plethora/blockstates/manipulator.json index 06a56dd6..e35ec6ee 100644 --- a/src/main/resources/assets/plethora/blockstates/manipulator.json +++ b/src/main/resources/assets/plethora/blockstates/manipulator.json @@ -1,10 +1,58 @@ { "variants": { - "type=mark_1": { + "facing=down,type=mark_1": { "model": "plethora:manipulator.mark_1" }, - "type=mark_2": { + "facing=down,type=mark_2": { "model": "plethora:manipulator.mark_2" + }, + "facing=up,type=mark_1": { + "model": "plethora:manipulator.mark_1", + "x": 180 + }, + "facing=up,type=mark_2": { + "model": "plethora:manipulator.mark_2", + "x": 180 + }, + "facing=east,type=mark_1": { + "model": "plethora:manipulator.mark_1", + "x": 90, + "y": 270 + }, + "facing=east,type=mark_2": { + "model": "plethora:manipulator.mark_2", + "x": 90, + "y": 270 + }, + "facing=west,type=mark_1": { + "model": "plethora:manipulator.mark_1", + "x": 90, + "y": 90 + }, + "facing=west,type=mark_2": { + "model": "plethora:manipulator.mark_2", + "x": 90, + "y": 90 + }, + "facing=north,type=mark_1": { + "model": "plethora:manipulator.mark_1", + "x": 90, + "y": 180 + }, + "facing=north,type=mark_2": { + "model": "plethora:manipulator.mark_2", + "x": 90, + "y": 180 + }, + "facing=south,type=mark_1": { + "model": "plethora:manipulator.mark_1", + "x": 90, + "y": 0 + }, + "facing=south,type=mark_2": { + "model": "plethora:manipulator.mark_2", + "x": 90, + "y": 0 } } } diff --git a/src/main/resources/assets/plethora/lang/en_us.lang b/src/main/resources/assets/plethora/lang/en_us.lang index 8c1d7e66..237a6f8b 100644 --- a/src/main/resources/assets/plethora/lang/en_us.lang +++ b/src/main/resources/assets/plethora/lang/en_us.lang @@ -1,5 +1,5 @@ # Modules -item.plethora.module.module_introspection.name=Introspection Module +item.plethora.module.module_introspection.name=Introspection module item.plethora.module.module_introspection.adjective=Introspective item.plethora.module.module_introspection.desc=Wraps your inventory as a peripheral. Shift+Use to bind to player. @@ -9,17 +9,17 @@ item.plethora.module.module_laser.desc=It fires lasers. 'nough said death.attack.laser=%1$s was vapourised by %2$s death.attack.laser.item=%1$s was vapourised by %2$s using %3$s -entity.Plethora.laser.name=Laser +entity.plethora.plethora:laser.name=A Frickin' laser -item.plethora.module.module_scanner.name=Block Scanner +item.plethora.module.module_scanner.name=Block scanner item.plethora.module.module_scanner.adjective=Scanner item.plethora.module.module_scanner.desc=Allows scanning blocks in the vicinity -item.plethora.module.module_sensor.name=Entity Sensor +item.plethora.module.module_sensor.name=Entity sensor item.plethora.module.module_sensor.adjective=Entity Sensor item.plethora.module.module_sensor.desc=Detects nearby entities, gathering data about them -item.plethora.module.module_kinetic.name=Kinetic Augment +item.plethora.module.module_kinetic.name=Kinetic augment item.plethora.module.module_kinetic.adjective=Kinetic item.plethora.module.module_kinetic.desc=Allows controlling your body via the neural interface @@ -27,7 +27,11 @@ item.plethora.module.module_chat.name=Chat recorder item.plethora.module.module_chat.adjective=Listening item.plethora.module.module_chat.desc=Allows listening and intercepting chat events -item.plethora.module.module_glasses.name=Overlay Glasses +item.plethora.module.module_chat_creative.name=Creative chat recorder +item.plethora.module.module_chat_creative.adjective=Snooping +item.plethora.module.module_chat_creative.desc=Allows listening and intercepting to all chat events + +item.plethora.module.module_glasses.name=Overlay glasses item.plethora.module.module_glasses.desc=Renders an overlay over the world. item.plethora.module.module_unknown.name=Unknown module @@ -51,10 +55,10 @@ item.plethora.keyboard.broken=Broken binding to %s item.plethora.keyboard.close=Keyboard open. Press ESC to close. # Neural interface/connector -item.plethora.neuralConnector.name=Neural Connector +item.plethora.neuralConnector.name=Neural connector item.plethora.neuralConnector.desc=Used to connect to Neural Interfaces -item.plethora.neuralInterface.name=Neural Interface +item.plethora.neuralInterface.name=Neural interface item.plethora.neuralInterface.desc=Goes in your helmet slot. Connect with the neural connector. gui.plethora.neuralInterface.peripherals=View peripherals @@ -70,13 +74,13 @@ adjective.plethora.daylight_detector=Photosensitive adjective.plethora.note_block=Acoustic # Minecart -entity.plethora.plethora:minecartComputer.name=Minecart Computer +entity.plethora.plethora:minecartComputer.name=Minecart computer # Creative tab itemGroup.plethora=Plethora # Core config -gui.config.plethora.costsystem=Cost System +gui.config.plethora.costsystem=Cost system gui.config.plethora.costsystem.initial=Initial level gui.config.plethora.costsystem.regen=Regen gui.config.plethora.costsystem.limit=Limit @@ -90,7 +94,7 @@ gui.config.plethora.blacklist.blacklistModulesMinecart=Blacklisted minecart modu gui.config.plethora.blacklist.blacklistModulesTile=Blacklisted tile modules gui.config.plethora.blacklist.blacklistProviders=Blacklisted providers gui.config.plethora.blacklist.blacklistTileEntities=Blacklisted TileEntities -gui.config.plethora.basecosts=Base Method Cost +gui.config.plethora.basecosts=Base method cost gui.config.plethora.testing=Testing gui.config.plethora.testing.bytecodeVerify=Verify bytecode gui.config.plethora.testing.debug=Debug @@ -104,11 +108,11 @@ gui.config.plethora.laser.maximumPotency=Maximum potency gui.config.plethora.laser.cost=Cost gui.config.plethora.laser.damage=Damage -gui.config.plethora.kinetic=Kinetic Augment +gui.config.plethora.kinetic=Kinetic augment gui.config.plethora.kinetic.launchMax=Maximum launch factor gui.config.plethora.kinetic.launchCost=Launch cost gui.config.plethora.kinetic.launchYScale=Launch Y scale -gui.config.plethora.kinetic.launchElytraScale=Launch Elytra scale +gui.config.plethora.kinetic.launchElytraScale=Launch elytra scale gui.config.plethora.kinetic.launchFallReset=Launch fall-distance reset gui.config.plethora.kinetic.launchFloatReset=Launch floating reset gui.config.plethora.kinetic.walkRange=Maximum walk range @@ -120,10 +124,10 @@ gui.config.plethora.kinetic.shootCost=Arrow shoot cost gui.config.plethora.kinetic.propelMax=Maximum minecart propulsion gui.config.plethora.kinetic.propelCost=Minecart propulsion cost -gui.config.plethora.scanner=Block Scanner +gui.config.plethora.scanner=Block scanner gui.config.plethora.scanner.radius=Scan radius -gui.config.plethora.sensor=Entity Sensor +gui.config.plethora.sensor=Entity sensor gui.config.plethora.sensor.radius=Sense radius gui.config.plethora.chat=Chat recorder @@ -131,6 +135,9 @@ gui.config.plethora.chat.maxLength=Maximum length gui.config.plethora.chat.allowFormatting=Allow format codes gui.config.plethora.chat.allowMobs=Allow mobs in chat +gui.config.plethora.miscellaneous=Miscellaneous +gui.config.plethora.miscellaneous.funRender=Fun rendering + # JEI Integration gui.jei.plethora.modules=Modules gui.jei.plethora.modules.usable=Usable as a module in: diff --git a/src/main/resources/assets/plethora/models/templates/block.json b/src/main/resources/assets/plethora/models/block/redstone_integrator.json similarity index 52% rename from src/main/resources/assets/plethora/models/templates/block.json rename to src/main/resources/assets/plethora/models/block/redstone_integrator.json index 0b7f5ddd..878f47d2 100644 --- a/src/main/resources/assets/plethora/models/templates/block.json +++ b/src/main/resources/assets/plethora/models/block/redstone_integrator.json @@ -1,6 +1,6 @@ { "parent": "block/cube_all", "textures": { - "all": "${texture}" + "all": "plethora:blocks/redstone_integrator" } } diff --git a/src/main/resources/assets/plethora/models/generate.json b/src/main/resources/assets/plethora/models/generate.json deleted file mode 100644 index 3c1789fe..00000000 --- a/src/main/resources/assets/plethora/models/generate.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "templates": { - "item": { "item": "templates/item.json" }, - "itemblock": { "item": "templates/itemblock.json" }, - "block": { "block": "templates/block.json" }, - "both": { - "item": "templates/itemblock.json", - "block": "templates/block.json" - } - }, - "simple": { - "item": { - "module_introspection": "plethora:items/module_introspection", - "module_scanner": "plethora:items/module_scanner", - "module_sensor": "plethora:items/module_sensor", - "module_kinetic": "plethora:items/module_kinetic", - "module_chat": "plethora:items/module_chat", - "module_glasses": "plethora:items/module_glasses", - "module": "plethora:items/module_unknown", - "neural_connector": "plethora:items/neural_connector", - "neural_interface": "plethora:items/neural_interface", - "keyboard": "plethora:items/keyboard" - }, - "both": { - "redstone_integrator": "plethora:blocks/redstone_integrator" - }, - "itemblock": { - "manipulator.mark_1": "manipulator.mark_1", - "manipulator.mark_2": "manipulator.mark_2" - } - } -} diff --git a/src/main/resources/assets/plethora/models/templates/item.json b/src/main/resources/assets/plethora/models/item/keyboard.json similarity index 57% rename from src/main/resources/assets/plethora/models/templates/item.json rename to src/main/resources/assets/plethora/models/item/keyboard.json index 9937f54a..956b9cd9 100644 --- a/src/main/resources/assets/plethora/models/templates/item.json +++ b/src/main/resources/assets/plethora/models/item/keyboard.json @@ -1,6 +1,6 @@ { "parent": "item/generated", "textures": { - "layer0": "${texture}" + "layer0": "plethora:items/keyboard" } } diff --git a/src/main/resources/assets/plethora/models/templates/itemblock.json b/src/main/resources/assets/plethora/models/item/manipulator.mark_1.json similarity index 75% rename from src/main/resources/assets/plethora/models/templates/itemblock.json rename to src/main/resources/assets/plethora/models/item/manipulator.mark_1.json index 96a4a699..94ae5306 100644 --- a/src/main/resources/assets/plethora/models/templates/itemblock.json +++ b/src/main/resources/assets/plethora/models/item/manipulator.mark_1.json @@ -1,5 +1,5 @@ { - "parent": "plethora:block/${name}", + "parent": "plethora:block/manipulator.mark_1", "display": { "thirdperson": { "rotation": [ 10, -45, 170 ], diff --git a/src/main/resources/assets/plethora/models/item/manipulator.mark_2.json b/src/main/resources/assets/plethora/models/item/manipulator.mark_2.json new file mode 100644 index 00000000..7ee7327c --- /dev/null +++ b/src/main/resources/assets/plethora/models/item/manipulator.mark_2.json @@ -0,0 +1,22 @@ +{ + "parent": "plethora:block/manipulator.mark_2", + "display": { + "thirdperson": { + "rotation": [ + 10, + -45, + 170 + ], + "translation": [ + 0, + 1.5, + -2.75 + ], + "scale": [ + 0.375, + 0.375, + 0.375 + ] + } + } +} diff --git a/src/main/resources/assets/plethora/models/item/module.json b/src/main/resources/assets/plethora/models/item/module.json new file mode 100644 index 00000000..6bd817e8 --- /dev/null +++ b/src/main/resources/assets/plethora/models/item/module.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "plethora:items/module_unknown" + } +} diff --git a/src/main/resources/assets/plethora/models/item/module_chat.json b/src/main/resources/assets/plethora/models/item/module_chat.json new file mode 100644 index 00000000..4b323fec --- /dev/null +++ b/src/main/resources/assets/plethora/models/item/module_chat.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "plethora:items/module_chat" + } +} diff --git a/src/main/resources/assets/plethora/models/item/module_chat_creative.json b/src/main/resources/assets/plethora/models/item/module_chat_creative.json new file mode 100644 index 00000000..fd6bcd28 --- /dev/null +++ b/src/main/resources/assets/plethora/models/item/module_chat_creative.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "plethora:items/module_chat_creative" + } +} diff --git a/src/main/resources/assets/plethora/models/item/module_glasses.json b/src/main/resources/assets/plethora/models/item/module_glasses.json new file mode 100644 index 00000000..eb475101 --- /dev/null +++ b/src/main/resources/assets/plethora/models/item/module_glasses.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "plethora:items/module_glasses" + } +} diff --git a/src/main/resources/assets/plethora/models/item/module_introspection.json b/src/main/resources/assets/plethora/models/item/module_introspection.json new file mode 100644 index 00000000..8f1fa1a9 --- /dev/null +++ b/src/main/resources/assets/plethora/models/item/module_introspection.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "plethora:items/module_introspection" + } +} diff --git a/src/main/resources/assets/plethora/models/item/module_kinetic.json b/src/main/resources/assets/plethora/models/item/module_kinetic.json new file mode 100644 index 00000000..c1cc0805 --- /dev/null +++ b/src/main/resources/assets/plethora/models/item/module_kinetic.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "plethora:items/module_kinetic" + } +} diff --git a/src/main/resources/assets/plethora/models/item/module_laser.json b/src/main/resources/assets/plethora/models/item/module_laser.json index d47092c5..b8a9b00c 100644 --- a/src/main/resources/assets/plethora/models/item/module_laser.json +++ b/src/main/resources/assets/plethora/models/item/module_laser.json @@ -5,24 +5,72 @@ }, "display": { "thirdperson_righthand": { - "rotation": [ -80, 260, -40 ], - "translation": [ -2, 2, -2 ], - "scale": [ 0.7, 0.7, 0.7 ] + "rotation": [ + -80, + 260, + -40 + ], + "translation": [ + -2, + 2, + -2 + ], + "scale": [ + 0.7, + 0.7, + 0.7 + ] }, "thirdperson_lefthand": { - "rotation": [ -80, -280, 40 ], - "translation": [ -2, 2, -2 ], - "scale": [ 0.7, 0.7, 0.7 ] + "rotation": [ + -80, + -280, + 40 + ], + "translation": [ + -2, + 2, + -2 + ], + "scale": [ + 0.7, + 0.7, + 0.7 + ] }, "firstperson_righthand": { - "rotation": [ 0, -90, 25 ], - "translation": [ 1.13, 3.2, 1.13], - "scale": [ 0.68, 0.68, 0.68 ] + "rotation": [ + 0, + -90, + 25 + ], + "translation": [ + 1.13, + 3.2, + 1.13 + ], + "scale": [ + 0.68, + 0.68, + 0.68 + ] }, "firstperson_lefthand": { - "rotation": [ 0, 90, -25 ], - "translation": [ 1.13, 3.2, 1.13], - "scale": [ 0.68, 0.68, 0.68 ] + "rotation": [ + 0, + 90, + -25 + ], + "translation": [ + 1.13, + 3.2, + 1.13 + ], + "scale": [ + 0.68, + 0.68, + 0.68 + ] } } } diff --git a/src/main/resources/assets/plethora/models/item/module_scanner.json b/src/main/resources/assets/plethora/models/item/module_scanner.json new file mode 100644 index 00000000..e6e9f4be --- /dev/null +++ b/src/main/resources/assets/plethora/models/item/module_scanner.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "plethora:items/module_scanner" + } +} diff --git a/src/main/resources/assets/plethora/models/item/module_sensor.json b/src/main/resources/assets/plethora/models/item/module_sensor.json new file mode 100644 index 00000000..2048959a --- /dev/null +++ b/src/main/resources/assets/plethora/models/item/module_sensor.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "plethora:items/module_sensor" + } +} diff --git a/src/main/resources/assets/plethora/models/item/neural_connector.json b/src/main/resources/assets/plethora/models/item/neural_connector.json new file mode 100644 index 00000000..63955edd --- /dev/null +++ b/src/main/resources/assets/plethora/models/item/neural_connector.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "plethora:items/neural_connector" + } +} diff --git a/src/main/resources/assets/plethora/models/item/neural_interface.json b/src/main/resources/assets/plethora/models/item/neural_interface.json new file mode 100644 index 00000000..e9b2137d --- /dev/null +++ b/src/main/resources/assets/plethora/models/item/neural_interface.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "plethora:items/neural_interface" + } +} diff --git a/src/main/resources/assets/plethora/models/item/redstone_integrator.json b/src/main/resources/assets/plethora/models/item/redstone_integrator.json new file mode 100644 index 00000000..7f6f9718 --- /dev/null +++ b/src/main/resources/assets/plethora/models/item/redstone_integrator.json @@ -0,0 +1,10 @@ +{ + "parent": "plethora:block/redstone_integrator", + "display": { + "thirdperson": { + "rotation": [ 10, -45, 170 ], + "translation": [ 0, 1.5, -2.75 ], + "scale": [ 0.375, 0.375, 0.375 ] + } + } +} diff --git a/src/main/resources/assets/plethora/textures/items/module_chat_creative.png b/src/main/resources/assets/plethora/textures/items/module_chat_creative.png new file mode 100644 index 00000000..aa80f7ad Binary files /dev/null and b/src/main/resources/assets/plethora/textures/items/module_chat_creative.png differ