├── .gitignore ├── LICENSE ├── README.md ├── block ├── build.gradle └── src │ └── main │ ├── java │ └── nova │ │ └── sample │ │ └── block │ │ ├── BlockStateful.java │ │ ├── BlockStateless.java │ │ └── NovaBlock.java │ └── resources │ └── assets │ └── novablock │ ├── lang │ └── en_US.lang │ ├── models │ └── grinder.tcn │ └── textures │ ├── blocks │ ├── block_steel.png │ └── grinder.png │ └── entities │ └── grinder_entity.png ├── build.gradle ├── entity ├── build.gradle └── src │ └── main │ └── java │ └── nova │ └── sample │ └── entity │ └── NovaEntity.java ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── gui ├── build.gradle └── src │ └── main │ ├── java │ └── nova │ │ └── sample │ │ └── gui │ │ ├── NovaGui.java │ │ └── block │ │ └── BlockSimpleTest.java │ └── resources │ └── assets │ └── novagui │ └── textures │ └── blocks │ └── block_steel.png ├── item ├── build.gradle └── src │ └── main │ ├── java │ └── nova │ │ └── sample │ │ └── item │ │ ├── ItemScrewdriver.java │ │ └── NovaItem.java │ └── resources │ └── assets │ └── novaitem │ ├── lang │ └── en_US.lang │ └── textures │ └── items │ └── screwdriver.png ├── settings.gradle └── worldgen ├── build.gradle └── src └── main ├── java └── nova │ └── sample │ └── worldgen │ ├── BlockSteelOre.java │ ├── ItemSteelIngot.java │ └── NovaWorldgen.java └── resources └── assets └── novaexampleworldgen └── textures ├── blocks └── ore_steel.png └── items └── ingot_steel.png /.gitignore: -------------------------------------------------------------------------------- 1 | # Ignore All 2 | /* 3 | 4 | # Except: 5 | !/LICENSE.* 6 | 7 | # Sources 8 | !/src 9 | !/block 10 | !/gui 11 | !/item 12 | !/entity 13 | !/worldgen 14 | !/old 15 | !/guidelines 16 | 17 | # github 18 | !/.gitignore 19 | !/README.md 20 | 21 | # gradle 22 | !/build.gradle 23 | !/settings.gradle 24 | !/gradle.properties 25 | !/gradlew* 26 | !/gradle 27 | .gradle/ 28 | build/ 29 | 30 | # unwanted IDEA files 31 | *.iml 32 | *.iws 33 | *.ipr 34 | 35 | # other unwanted folders 36 | /*/run 37 | 38 | # checkstyle 39 | !/checkstyle*.xml 40 | 41 | # Travis 42 | !/.travis.yml 43 | 44 | # unwanted os-generated files 45 | .DS_Store 46 | .DS_Store? 47 | ._* 48 | .Spotlight-V100 49 | .Trashes 50 | ehthumbs.db 51 | Thumbs.db 52 | *~ 53 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Nova Organization 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Nova-Test 2 | A test mod running NOVA API 3 | 4 | #### Running examples: 5 | To execute example use gradle or gradle wrapper like `gradle [example]:runClient`, so to start block example run `gradle block:runClient`. 6 | 7 | Note that doing `gradle runClient` will launch all of the examples!! 8 | 9 | NovaExample is published under MIT License. 10 | 11 | After [16b0293c7f6fab16439fd9c800cc8d5ea045bb5f](https://github.com/NOVAAPI/NovaExample/commit/16b0293c7f6fab16439fd9c800cc8d5ea045bb5f) NovaExample code was relicensed from LGPLv3 to the MIT License 12 | by an [agreement](http://web.archive.org/web/20150509065507/https://github.com/NOVAAPI/NovaExample/issues/8) of all code contributors. 13 | -------------------------------------------------------------------------------- /block/build.gradle: -------------------------------------------------------------------------------- 1 | version = "0.1.0-SNAPSHOT" 2 | group = "nova.sample.block" 3 | 4 | archivesBaseName = "NOVA-Example-Block" 5 | -------------------------------------------------------------------------------- /block/src/main/java/nova/sample/block/BlockStateful.java: -------------------------------------------------------------------------------- 1 | package nova.sample.block; 2 | 3 | import nova.core.block.Block; 4 | import nova.core.block.Stateful; 5 | import nova.core.component.Category; 6 | import nova.core.component.Component; 7 | import nova.core.component.Passthrough; 8 | import nova.core.component.misc.Collider; 9 | import nova.core.component.renderer.StaticRenderer; 10 | import nova.core.network.NetworkTarget; 11 | import nova.core.network.Packet; 12 | import nova.core.network.Syncable; 13 | import nova.core.network.Sync; 14 | import nova.core.render.model.MeshModel; 15 | import nova.core.render.model.Model; 16 | import nova.core.retention.Storable; 17 | import nova.core.retention.Store; 18 | import nova.core.util.math.RotationUtil; 19 | import org.apache.commons.math3.geometry.euclidean.threed.Rotation; 20 | 21 | /** 22 | * This is a test block that has state. 23 | * @author Calclavia 24 | */ 25 | public class BlockStateful extends Block implements Storable, Stateful, Syncable { 26 | 27 | /** 28 | * Angle to rotate around 29 | */ 30 | @Store 31 | @Sync 32 | private double angle = 0; 33 | 34 | public BlockStateful() { 35 | components.add(new Collider(this).isOpaqueCube(false)); 36 | components.add(new StaticRenderer().onRender(model -> { 37 | Model grinderModel = NovaBlock.grinderModel.getModel(); 38 | 39 | grinderModel 40 | .combineChildren("crank", "crank1", "crank2", "crank3") 41 | .matrix.rotate(new Rotation(RotationUtil.DEFAULT_ORDER, 0, 0, angle)); 42 | 43 | if (grinderModel instanceof MeshModel) 44 | ((MeshModel)grinderModel).bindAll(NovaBlock.grinderTexture); 45 | 46 | model.children.add(grinderModel); 47 | })); 48 | components.add(new Category("buildingBlocks")); 49 | //components.add(new TestComponent()); 50 | 51 | events.on(RightClickEvent.class).bind(this::onRightClick); 52 | } 53 | 54 | public boolean onRightClick(RightClickEvent evt) { 55 | if (NetworkTarget.Side.get().isServer()) { 56 | angle = (angle + Math.PI / 12) % (Math.PI * 2); 57 | NovaBlock.networkManager.sync(this); 58 | } 59 | //world().addEntity(NovaTest.movableSimpleTestFactory).transform().setPosition(evt.entity.position()); 60 | return true; 61 | } 62 | 63 | @Override 64 | public void read(Packet packet) { 65 | Syncable.super.read(packet); 66 | world().markStaticRender(position()); 67 | } 68 | 69 | public static interface TestInterface { 70 | public void test(); 71 | } 72 | 73 | @Passthrough("nova.sample.block.BlockStateful$TestInterface") 74 | public static class TestComponent extends Component implements TestInterface { 75 | 76 | @Override 77 | public void test() { 78 | System.out.println("I do nothing"); 79 | } 80 | 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /block/src/main/java/nova/sample/block/BlockStateless.java: -------------------------------------------------------------------------------- 1 | package nova.sample.block; 2 | 3 | import nova.core.block.Block; 4 | import nova.core.component.Category; 5 | import nova.core.component.misc.Collider; 6 | import nova.core.component.renderer.StaticRenderer; 7 | import nova.core.network.Packet; 8 | import nova.core.network.Syncable; 9 | import nova.core.render.pipeline.BlockRenderPipeline; 10 | 11 | /** 12 | * Literally, this is a test block. 13 | * @author Calclavia 14 | */ 15 | public class BlockStateless extends Block implements Syncable { 16 | 17 | public BlockStateless() { 18 | components.add(new StaticRenderer().onRender(new BlockRenderPipeline(this).withTexture(NovaBlock.steelTexture).build())); 19 | components.add(new Collider(this)); 20 | components.add(new Category("buildingBlocks")); 21 | 22 | events.on(RightClickEvent.class).bind(this::onRightClick); 23 | } 24 | 25 | public void onRightClick(RightClickEvent evt) { 26 | System.out.println("Sending Packet: 1234"); 27 | NovaBlock.networkManager.sync(this); 28 | } 29 | 30 | @Override 31 | public void read(Packet packet) { 32 | System.out.println("Received packet: " + packet.readInt()); 33 | } 34 | 35 | @Override 36 | public void write(Packet packet) { 37 | packet.writeInt(1234); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /block/src/main/java/nova/sample/block/NovaBlock.java: -------------------------------------------------------------------------------- 1 | package nova.sample.block; 2 | 3 | import nova.core.block.BlockFactory; 4 | import nova.core.block.BlockManager; 5 | import nova.core.item.ItemFactory; 6 | import nova.core.item.ItemManager; 7 | import nova.core.loader.Loadable; 8 | import nova.core.loader.Mod; 9 | import nova.core.network.NetworkManager; 10 | import nova.core.recipes.RecipeManager; 11 | import nova.core.recipes.crafting.ItemIngredient; 12 | import nova.core.recipes.crafting.ShapedCraftingRecipe; 13 | import nova.core.render.RenderManager; 14 | import nova.core.render.model.ModelProvider; 15 | import nova.core.render.model.TechneModelProvider; 16 | import nova.core.render.texture.BlockTexture; 17 | import nova.core.render.texture.EntityTexture; 18 | 19 | /** 20 | * A test Nova Mod 21 | * 22 | * @author Calclavia 23 | */ 24 | @Mod(id = NovaBlock.MOD_ID, name = "Nova Example Block", version = "0.0.1", novaVersion = "0.0.1") 25 | public class NovaBlock implements Loadable { 26 | 27 | public static final String MOD_ID = "novablock"; 28 | 29 | public static BlockFactory blockStateful; 30 | public static BlockFactory blockStateless; 31 | 32 | public static ItemFactory itemBlockStateful; 33 | public static ItemFactory itemBlockStateless; 34 | 35 | public static BlockTexture steelTexture; 36 | public static BlockTexture grinderTexture; 37 | 38 | public static EntityTexture grinderEntityTexture; 39 | 40 | public static ModelProvider grinderModel; 41 | 42 | public static NetworkManager networkManager; 43 | 44 | public final BlockManager blockManager; 45 | public final ItemManager itemManager; 46 | public final RenderManager renderManager; 47 | public final RecipeManager recipeManager; 48 | 49 | public NovaBlock(BlockManager blockManager, 50 | ItemManager itemManager, 51 | RenderManager renderManager, 52 | NetworkManager networkManager, 53 | RecipeManager recipeManager) { 54 | this.blockManager = blockManager; 55 | this.itemManager = itemManager; 56 | this.renderManager = renderManager; 57 | this.recipeManager = recipeManager; 58 | 59 | NovaBlock.networkManager = networkManager; 60 | } 61 | 62 | @Override 63 | public void preInit() { 64 | steelTexture = renderManager.registerTexture(new BlockTexture(MOD_ID, "block_steel")); 65 | grinderTexture = renderManager.registerTexture(new BlockTexture(MOD_ID, "grinder")); 66 | 67 | blockStateful = blockManager.register(MOD_ID + ":stateful", BlockStateful::new); 68 | blockStateless = blockManager.register(MOD_ID + ":simple", BlockStateless::new); 69 | 70 | itemBlockStateful = itemManager.getItemFromBlock(blockStateful); 71 | itemBlockStateless = itemManager.getItemFromBlock(blockStateless); 72 | 73 | grinderEntityTexture = renderManager.registerTexture(new EntityTexture(MOD_ID, "grinder_entity")); 74 | grinderModel = renderManager.registerModel(new TechneModelProvider(MOD_ID, "grinder")); 75 | 76 | // try to add a recipe 77 | //ItemIngredient stickIngredient = ItemIngredient.forItem("minecraft:stick"); //TODO: This should be obtained from some dictonary too 78 | ItemIngredient stickIngredient = ItemIngredient.forDictionary("stickWood"); 79 | ItemIngredient ingotIngredient = ItemIngredient.forDictionary("ingotIron"); 80 | 81 | recipeManager.addRecipe(new ShapedCraftingRecipe(itemBlockStateless.build(), "AAA-ABA-AAA", ingotIngredient, stickIngredient)); 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /block/src/main/resources/assets/novablock/lang/en_US.lang: -------------------------------------------------------------------------------- 1 | # NOVA Test Language File 2 | # @author Calclavia 3 | 4 | # Blocks 5 | block.stateful.name=Stateful Block 6 | block.simple.name=Stateless Block 7 | -------------------------------------------------------------------------------- /block/src/main/resources/assets/novablock/models/grinder.tcn: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NOVA-Team/NOVA-Example/dae350142bacb1e52680dc7b5af882a5b0e8d16a/block/src/main/resources/assets/novablock/models/grinder.tcn -------------------------------------------------------------------------------- /block/src/main/resources/assets/novablock/textures/blocks/block_steel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NOVA-Team/NOVA-Example/dae350142bacb1e52680dc7b5af882a5b0e8d16a/block/src/main/resources/assets/novablock/textures/blocks/block_steel.png -------------------------------------------------------------------------------- /block/src/main/resources/assets/novablock/textures/blocks/grinder.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NOVA-Team/NOVA-Example/dae350142bacb1e52680dc7b5af882a5b0e8d16a/block/src/main/resources/assets/novablock/textures/blocks/grinder.png -------------------------------------------------------------------------------- /block/src/main/resources/assets/novablock/textures/entities/grinder_entity.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NOVA-Team/NOVA-Example/dae350142bacb1e52680dc7b5af882a5b0e8d16a/block/src/main/resources/assets/novablock/textures/entities/grinder_entity.png -------------------------------------------------------------------------------- /build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id "java" 3 | id "nova.gradle" version "0.2.6" 4 | } 5 | 6 | subprojects { 7 | apply plugin: "java" 8 | apply plugin: "nova.gradle" 9 | 10 | repositories { 11 | mavenLocal() 12 | mavenCentral() 13 | maven { 14 | url 'http://maven.novaapi.net/' 15 | } 16 | } 17 | 18 | dependencies { 19 | compile nova(nova_version) 20 | } 21 | 22 | nova { 23 | wrappers { 24 | "17" { 25 | wrapper "nova.core:NOVA-Core-Wrapper-MC1.7:$nova_version" 26 | } 27 | "18" { 28 | wrapper "nova.core:NOVA-Core-Wrapper-MC1.8:$nova_version" 29 | } 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /entity/build.gradle: -------------------------------------------------------------------------------- 1 | version = "0.1.0-SNAPSHOT" 2 | group = "nova.sample.entity" 3 | 4 | archivesBaseName = "NOVA-Example-Entity" 5 | -------------------------------------------------------------------------------- /entity/src/main/java/nova/sample/entity/NovaEntity.java: -------------------------------------------------------------------------------- 1 | package nova.sample.entity; 2 | 3 | import nova.core.entity.EntityManager; 4 | import nova.core.loader.Loadable; 5 | import nova.core.loader.Mod; 6 | import nova.core.render.RenderManager; 7 | 8 | /** 9 | * Used to test NOVA entities. 10 | * 11 | * @author ExE Boss 12 | */ 13 | @Mod(id = NovaEntity.MOD_ID, name = "Nova Example Entity", version = "0.0.1", novaVersion = "0.0.1") 14 | public class NovaEntity implements Loadable { 15 | 16 | public static final String MOD_ID = "novaentity"; 17 | 18 | public final EntityManager entityManager; 19 | public final RenderManager renderManager; 20 | 21 | public NovaEntity(EntityManager entityManager, 22 | RenderManager renderManager) { 23 | this.entityManager = entityManager; 24 | this.renderManager = renderManager; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | version = 0.1.0-SNAPSHOT 2 | group = nova.sample 3 | 4 | nova_version = 0.1.0-SNAPSHOT 5 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NOVA-Team/NOVA-Example/dae350142bacb1e52680dc7b5af882a5b0e8d16a/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Sun Feb 01 14:56:16 GMT 2015 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.4-bin.zip 7 | -------------------------------------------------------------------------------- /gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ############################################################################## 4 | ## 5 | ## Gradle start up script for UN*X 6 | ## 7 | ############################################################################## 8 | 9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 10 | DEFAULT_JVM_OPTS="" 11 | 12 | APP_NAME="Gradle" 13 | APP_BASE_NAME=`basename "$0"` 14 | 15 | # Use the maximum available, or set MAX_FD != -1 to use that value. 16 | MAX_FD="maximum" 17 | 18 | warn ( ) { 19 | echo "$*" 20 | } 21 | 22 | die ( ) { 23 | echo 24 | echo "$*" 25 | echo 26 | exit 1 27 | } 28 | 29 | # OS specific support (must be 'true' or 'false'). 30 | cygwin=false 31 | msys=false 32 | darwin=false 33 | case "`uname`" in 34 | CYGWIN* ) 35 | cygwin=true 36 | ;; 37 | Darwin* ) 38 | darwin=true 39 | ;; 40 | MINGW* ) 41 | msys=true 42 | ;; 43 | esac 44 | 45 | # For Cygwin, ensure paths are in UNIX format before anything is touched. 46 | if $cygwin ; then 47 | [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"` 48 | fi 49 | 50 | # Attempt to set APP_HOME 51 | # Resolve links: $0 may be a link 52 | PRG="$0" 53 | # Need this for relative symlinks. 54 | while [ -h "$PRG" ] ; do 55 | ls=`ls -ld "$PRG"` 56 | link=`expr "$ls" : '.*-> \(.*\)$'` 57 | if expr "$link" : '/.*' > /dev/null; then 58 | PRG="$link" 59 | else 60 | PRG=`dirname "$PRG"`"/$link" 61 | fi 62 | done 63 | SAVED="`pwd`" 64 | cd "`dirname \"$PRG\"`/" >&- 65 | APP_HOME="`pwd -P`" 66 | cd "$SAVED" >&- 67 | 68 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 69 | 70 | # Determine the Java command to use to start the JVM. 71 | if [ -n "$JAVA_HOME" ] ; then 72 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 73 | # IBM's JDK on AIX uses strange locations for the executables 74 | JAVACMD="$JAVA_HOME/jre/sh/java" 75 | else 76 | JAVACMD="$JAVA_HOME/bin/java" 77 | fi 78 | if [ ! -x "$JAVACMD" ] ; then 79 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 80 | 81 | Please set the JAVA_HOME variable in your environment to match the 82 | location of your Java installation." 83 | fi 84 | else 85 | JAVACMD="java" 86 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 87 | 88 | Please set the JAVA_HOME variable in your environment to match the 89 | location of your Java installation." 90 | fi 91 | 92 | # Increase the maximum file descriptors if we can. 93 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then 94 | MAX_FD_LIMIT=`ulimit -H -n` 95 | if [ $? -eq 0 ] ; then 96 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 97 | MAX_FD="$MAX_FD_LIMIT" 98 | fi 99 | ulimit -n $MAX_FD 100 | if [ $? -ne 0 ] ; then 101 | warn "Could not set maximum file descriptor limit: $MAX_FD" 102 | fi 103 | else 104 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 105 | fi 106 | fi 107 | 108 | # For Darwin, add options to specify how the application appears in the dock 109 | if $darwin; then 110 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 111 | fi 112 | 113 | # For Cygwin, switch paths to Windows format before running java 114 | if $cygwin ; then 115 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 116 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 117 | 118 | # We build the pattern for arguments to be converted via cygpath 119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 120 | SEP="" 121 | for dir in $ROOTDIRSRAW ; do 122 | ROOTDIRS="$ROOTDIRS$SEP$dir" 123 | SEP="|" 124 | done 125 | OURCYGPATTERN="(^($ROOTDIRS))" 126 | # Add a user-defined pattern to the cygpath arguments 127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 129 | fi 130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 131 | i=0 132 | for arg in "$@" ; do 133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 135 | 136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 138 | else 139 | eval `echo args$i`="\"$arg\"" 140 | fi 141 | i=$((i+1)) 142 | done 143 | case $i in 144 | (0) set -- ;; 145 | (1) set -- "$args0" ;; 146 | (2) set -- "$args0" "$args1" ;; 147 | (3) set -- "$args0" "$args1" "$args2" ;; 148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 154 | esac 155 | fi 156 | 157 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules 158 | function splitJvmOpts() { 159 | JVM_OPTS=("$@") 160 | } 161 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS 162 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" 163 | 164 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" 165 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 12 | set DEFAULT_JVM_OPTS= 13 | 14 | set DIRNAME=%~dp0 15 | if "%DIRNAME%" == "" set DIRNAME=. 16 | set APP_BASE_NAME=%~n0 17 | set APP_HOME=%DIRNAME% 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windowz variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | if "%@eval[2+2]" == "4" goto 4NT_args 53 | 54 | :win9xME_args 55 | @rem Slurp the command line arguments. 56 | set CMD_LINE_ARGS= 57 | set _SKIP=2 58 | 59 | :win9xME_args_slurp 60 | if "x%~1" == "x" goto execute 61 | 62 | set CMD_LINE_ARGS=%* 63 | goto execute 64 | 65 | :4NT_args 66 | @rem Get arguments from the 4NT Shell from JP Software 67 | set CMD_LINE_ARGS=%$ 68 | 69 | :execute 70 | @rem Setup the command line 71 | 72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if "%ERRORLEVEL%"=="0" goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 85 | exit /b 1 86 | 87 | :mainEnd 88 | if "%OS%"=="Windows_NT" endlocal 89 | 90 | :omega 91 | -------------------------------------------------------------------------------- /gui/build.gradle: -------------------------------------------------------------------------------- 1 | version = "0.1.0-SNAPSHOT" 2 | group = "nova.sample.gui" 3 | 4 | archivesBaseName = "NOVA-Example-GUI" 5 | 6 | dependencies { 7 | compile group: "nova.gui", name: "NOVA-GUI", version: "0.0.1-SNAPSHOT", changing: true 8 | } -------------------------------------------------------------------------------- /gui/src/main/java/nova/sample/gui/NovaGui.java: -------------------------------------------------------------------------------- 1 | package nova.sample.gui; 2 | 3 | import nova.core.block.BlockFactory; 4 | import nova.core.block.BlockManager; 5 | import nova.gui.Background; 6 | import nova.gui.ComponentEvent.ActionEvent; 7 | import nova.gui.Gui; 8 | import nova.gui.GuiEvent.BindEvent; 9 | import nova.gui.GuiEvent.UnBindEvent; 10 | import nova.gui.component.Button; 11 | import nova.gui.component.Container; 12 | import nova.gui.component.Label; 13 | import nova.gui.component.inventory.Slot; 14 | import nova.gui.factory.GuiManager; 15 | import nova.gui.layout.Anchor; 16 | import nova.gui.layout.FlowLayout; 17 | import nova.core.item.ItemFactory; 18 | import nova.core.item.ItemManager; 19 | import nova.core.loader.Loadable; 20 | import nova.core.loader.Mod; 21 | import nova.core.network.NetworkManager; 22 | import nova.core.network.NetworkTarget.Side; 23 | import nova.core.recipes.RecipeManager; 24 | import nova.core.recipes.crafting.ItemIngredient; 25 | import nova.core.recipes.crafting.ShapedCraftingRecipe; 26 | import nova.core.render.Color; 27 | import nova.core.render.RenderManager; 28 | import nova.core.render.texture.BlockTexture; 29 | import nova.sample.gui.block.BlockSimpleTest; 30 | 31 | /** 32 | * A test Nova Mod 33 | * 34 | * @author Calclavia 35 | */ 36 | @Mod(id = NovaGui.MOD_ID, name = "Nova GUI example", version = "0.0.1", novaVersion = "0.0.1") 37 | public class NovaGui implements Loadable { 38 | 39 | public static final String MOD_ID = "novaexamplegui"; 40 | 41 | public static BlockFactory blockTest; 42 | public static ItemFactory itemBlockTest; 43 | 44 | public static BlockTexture steelTexture; 45 | public static GuiManager guiFactory; 46 | public static NetworkManager networkManager; 47 | 48 | public final BlockManager blockManager; 49 | public final ItemManager itemManager; 50 | public final RenderManager renderManager; 51 | public final RecipeManager recipeManager; 52 | 53 | public NovaGui(BlockManager blockManager, 54 | ItemManager itemManager, 55 | RenderManager renderManager, 56 | GuiManager guiFactory, 57 | RecipeManager recipeManager, 58 | NetworkManager networkManager) { 59 | this.blockManager = blockManager; 60 | this.itemManager = itemManager; 61 | this.renderManager = renderManager; 62 | this.recipeManager = recipeManager; 63 | 64 | NovaGui.networkManager = networkManager; 65 | 66 | NovaGui.guiFactory = guiFactory; 67 | } 68 | 69 | public static void initializeGUI() { 70 | guiFactory.register("testgui", () -> new Gui("testgui") 71 | .add(new Button("testbutton2", "I'm EAST") 72 | .setMaximumSize(Integer.MAX_VALUE, 120) 73 | 74 | .onEvent((event, component) -> { 75 | System.out.println("Test button pressed! " + Side.get()); 76 | }, ActionEvent.class, Side.BOTH), Anchor.EAST) 77 | 78 | .add(new Button("testbutton3", "I'm CENTER")) 79 | .add(new Container("test").setLayout(new FlowLayout()) 80 | .add(new Slot("main", 0)) 81 | .add(new Slot("main", 0)) 82 | .add(new Slot("main", 0)) 83 | .add(new Slot("main", 0)) 84 | , Anchor.SOUTH) 85 | 86 | .add(new Container("container").setLayout(new FlowLayout()) 87 | .add(new Button("testbutton5", "I'm the FIRST Button and need lots of space")) 88 | .add(new Label("testlabel1", "I'm some label hanging around").setBackground(new Background(Color.white))) 89 | .add(new Button("testbutton7", "I'm THIRD")) 90 | .add(new Button("testbutton8", "I'm FOURTH")) 91 | , Anchor.NORTH) 92 | 93 | .onGuiEvent((event) -> { 94 | event.gui.addInventory("main", ((BlockSimpleTest) event.block.get()).inventory); 95 | System.out.println("Test GUI initialized! " + event.player.getDisplayName() + " " + event.position); 96 | }, BindEvent.class) 97 | 98 | .onGuiEvent((event) -> { 99 | System.out.println("Test GUI closed!"); 100 | }, UnBindEvent.class) 101 | ); 102 | } 103 | 104 | @Override 105 | public void preInit() { 106 | blockTest = blockManager.register(MOD_ID + ":gui", BlockSimpleTest::new); 107 | 108 | itemBlockTest = itemManager.getItemFromBlock(blockTest); 109 | 110 | steelTexture = renderManager.registerTexture(new BlockTexture(MOD_ID, "block_steel")); 111 | 112 | // try to add a recipe 113 | //ItemIngredient stickIngredient = ItemIngredient.forItem("minecraft:stick"); //TODO: This should be obtained from some dictonary too 114 | ItemIngredient stickIngredient = ItemIngredient.forDictionary("stickWood"); 115 | ItemIngredient ingotIngredient = ItemIngredient.forDictionary("ingotIron"); 116 | recipeManager.addRecipe(new ShapedCraftingRecipe(itemBlockTest.build(), "AAA-ABA-AAA", ingotIngredient, stickIngredient)); 117 | 118 | initializeGUI(); 119 | } 120 | } 121 | -------------------------------------------------------------------------------- /gui/src/main/java/nova/sample/gui/block/BlockSimpleTest.java: -------------------------------------------------------------------------------- 1 | package nova.sample.gui.block; 2 | 3 | import nova.core.block.Block; 4 | import nova.core.component.Category; 5 | import nova.core.component.inventory.Inventory; 6 | import nova.core.component.inventory.InventorySimple; 7 | import nova.core.component.misc.Collider; 8 | import nova.core.network.Syncable; 9 | import nova.core.network.Packet; 10 | import nova.sample.gui.NovaGui; 11 | 12 | import nova.core.component.renderer.StaticRenderer; 13 | import nova.core.render.model.MeshModel; 14 | import nova.core.render.pipeline.BlockRenderPipeline; 15 | 16 | /** 17 | * Literally, this is a test block. 18 | * @author Calclavia 19 | */ 20 | public class BlockSimpleTest extends Block implements Syncable { 21 | 22 | public Inventory inventory = new InventorySimple(1); 23 | 24 | public BlockSimpleTest() { 25 | components.add(new StaticRenderer().onRender(new BlockRenderPipeline(this).withTexture(NovaGui.steelTexture).build())); 26 | components.add(new Collider(this)); 27 | components.add(new Category("buildingBlocks")); 28 | events.on(RightClickEvent.class).bind(this::onRightClick); 29 | } 30 | 31 | public void onRightClick(RightClickEvent evt) { 32 | NovaGui.initializeGUI(); 33 | NovaGui.guiFactory.showGui("testgui", evt.entity, position()); 34 | 35 | System.out.println("Sending Packet: 1234"); 36 | NovaGui.networkManager.sync(this); 37 | } 38 | 39 | @Override 40 | public void read(Packet packet) { 41 | System.out.println("Received packet: " + packet.readInt()); 42 | } 43 | 44 | @Override 45 | public void write(Packet packet) { 46 | packet.writeInt(1234); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /gui/src/main/resources/assets/novagui/textures/blocks/block_steel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NOVA-Team/NOVA-Example/dae350142bacb1e52680dc7b5af882a5b0e8d16a/gui/src/main/resources/assets/novagui/textures/blocks/block_steel.png -------------------------------------------------------------------------------- /item/build.gradle: -------------------------------------------------------------------------------- 1 | version = "0.1.0-SNAPSHOT" 2 | group = "nova.sample.item" 3 | 4 | archivesBaseName = "NOVA-Example-Item" 5 | -------------------------------------------------------------------------------- /item/src/main/java/nova/sample/item/ItemScrewdriver.java: -------------------------------------------------------------------------------- 1 | package nova.sample.item; 2 | 3 | import nova.core.component.Category; 4 | import nova.core.component.renderer.StaticRenderer; 5 | import nova.core.item.Item; 6 | import nova.core.render.pipeline.ItemRenderPipeline; 7 | 8 | /** 9 | * @author Calclavia 10 | */ 11 | public class ItemScrewdriver extends Item { 12 | 13 | public ItemScrewdriver() { 14 | components.add(new Category("tools")); 15 | components.add(new StaticRenderer().onRender(new ItemRenderPipeline(this).withTexture(NovaItem.screwTexture).build())); 16 | 17 | events.on(UseEvent.class).bind(event -> event.action = true); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /item/src/main/java/nova/sample/item/NovaItem.java: -------------------------------------------------------------------------------- 1 | package nova.sample.item; 2 | 3 | import nova.core.item.ItemFactory; 4 | import nova.core.item.ItemManager; 5 | import nova.core.loader.Loadable; 6 | import nova.core.loader.Mod; 7 | import nova.core.recipes.RecipeManager; 8 | import nova.core.recipes.crafting.ItemIngredient; 9 | import nova.core.recipes.crafting.ShapedCraftingRecipe; 10 | import nova.core.render.RenderManager; 11 | import nova.core.render.texture.ItemTexture; 12 | 13 | /** 14 | * Created by magik6k on 5/29/15. 15 | */ 16 | @Mod(id = NovaItem.MOD_ID, name = "Nova Example Item", version = "0.0.1", novaVersion = "0.0.1") 17 | public class NovaItem implements Loadable { 18 | public static final String MOD_ID = "novaitem"; 19 | 20 | public static ItemFactory itemScrewdriver; 21 | public static ItemTexture screwTexture; 22 | 23 | public final ItemManager itemManager; 24 | public final RenderManager renderManager; 25 | public final RecipeManager recipeManager; 26 | 27 | public NovaItem(ItemManager itemManager, 28 | RenderManager renderManager, 29 | RecipeManager recipeManager) { 30 | this.itemManager = itemManager; 31 | this.renderManager = renderManager; 32 | this.recipeManager = recipeManager; 33 | } 34 | 35 | @Override 36 | public void preInit() { 37 | screwTexture = renderManager.registerTexture(new ItemTexture(MOD_ID, "screwdriver")); 38 | itemScrewdriver = itemManager.register(MOD_ID + ":testscrewdriver", ItemScrewdriver::new); 39 | 40 | //ItemIngredient stickIngredient = ItemIngredient.forItem("minecraft:stick"); //TODO: This should be obtained from some dictonary too 41 | ItemIngredient stickIngredient = ItemIngredient.forDictionary("stickWood"); 42 | ItemIngredient ingotIngredient = ItemIngredient.forDictionary("ingotIron"); 43 | recipeManager.addRecipe(new ShapedCraftingRecipe(itemScrewdriver.build(), "A- B", true, ingotIngredient, stickIngredient)); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /item/src/main/resources/assets/novaitem/lang/en_US.lang: -------------------------------------------------------------------------------- 1 | # NOVA Test Language File 2 | # @author Calclavia 3 | 4 | # Items 5 | item.testscrewdriver.name=Screwdriver 6 | -------------------------------------------------------------------------------- /item/src/main/resources/assets/novaitem/textures/items/screwdriver.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NOVA-Team/NOVA-Example/dae350142bacb1e52680dc7b5af882a5b0e8d16a/item/src/main/resources/assets/novaitem/textures/items/screwdriver.png -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = 'NOVA-Example' 2 | 3 | include 'block' 4 | include 'entity' 5 | include 'gui' 6 | include 'item' 7 | include 'worldgen' 8 | -------------------------------------------------------------------------------- /worldgen/build.gradle: -------------------------------------------------------------------------------- 1 | version = "0.1.0-SNAPSHOT" 2 | group = "nova.sample.worldgen" 3 | 4 | archivesBaseName = "NOVA-Example-Worldgen" 5 | 6 | dependencies { 7 | compile group: "nova.worldgen", name: "NOVA-Worldgen", version: "0.0.1-SNAPSHOT", changing: true 8 | } -------------------------------------------------------------------------------- /worldgen/src/main/java/nova/sample/worldgen/BlockSteelOre.java: -------------------------------------------------------------------------------- 1 | package nova.sample.worldgen; 2 | 3 | import nova.core.block.Block; 4 | import nova.core.component.Category; 5 | import nova.core.component.misc.Collider; 6 | import nova.core.component.renderer.StaticRenderer; 7 | import nova.core.render.pipeline.BlockRenderPipeline; 8 | 9 | /** 10 | * 11 | * @author ExE Boss 12 | */ 13 | public class BlockSteelOre extends Block { 14 | 15 | public BlockSteelOre() { 16 | components.add(new StaticRenderer().onRender(new BlockRenderPipeline(this).withTexture(NovaWorldgen.steelOreTexture).build())); 17 | components.add(new Collider(this)); 18 | components.add(new Category("buildingBlocks")); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /worldgen/src/main/java/nova/sample/worldgen/ItemSteelIngot.java: -------------------------------------------------------------------------------- 1 | package nova.sample.worldgen; 2 | 3 | import nova.core.component.Category; 4 | import nova.core.component.renderer.StaticRenderer; 5 | import nova.core.item.Item; 6 | import nova.core.render.pipeline.ItemRenderPipeline; 7 | 8 | /** 9 | * 10 | * @author ExE Boss 11 | */ 12 | public class ItemSteelIngot extends Item { 13 | 14 | public ItemSteelIngot() { 15 | components.add(new Category("materials")); 16 | components.add(new StaticRenderer().onRender(new ItemRenderPipeline(this).withTexture(NovaWorldgen.steelIngotTexture).build())); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /worldgen/src/main/java/nova/sample/worldgen/NovaWorldgen.java: -------------------------------------------------------------------------------- 1 | package nova.sample.worldgen; 2 | 3 | import nova.core.block.BlockFactory; 4 | import nova.core.block.BlockManager; 5 | import nova.core.item.ItemFactory; 6 | import nova.core.item.ItemManager; 7 | import nova.core.loader.Loadable; 8 | import nova.core.loader.Mod; 9 | import nova.core.recipes.RecipeManager; 10 | import nova.core.render.RenderManager; 11 | import nova.core.render.texture.BlockTexture; 12 | import nova.core.render.texture.ItemTexture; 13 | import nova.core.util.EnumSelector; 14 | import nova.worldgen.WorldgenManager; 15 | import nova.worldgen.ore.Ore; 16 | import nova.worldgen.ore.OreHeight; 17 | 18 | @Mod(id = NovaWorldgen.MOD_ID, name = "Nova Worldgen Example", version = "0.0.1", novaVersion = "0.0.1") 19 | public class NovaWorldgen implements Loadable { 20 | public static final String MOD_ID = "novaexampleworldgen"; 21 | 22 | public static BlockFactory blockSteelOre; 23 | 24 | public static ItemFactory itemBlockSteelOre; 25 | public static ItemFactory itemSteelIngot; 26 | 27 | public static Ore oreSteel; 28 | 29 | public static BlockTexture steelOreTexture; 30 | public static ItemTexture steelIngotTexture; 31 | 32 | public final BlockManager blockManager; 33 | public final ItemManager itemManager; 34 | public final RenderManager renderManager; 35 | public final RecipeManager recipeManager; 36 | public final WorldgenManager worldgenManager; 37 | 38 | public NovaWorldgen(BlockManager blockManager, 39 | ItemManager itemManager, 40 | RenderManager renderManager, 41 | RecipeManager recipeManager, 42 | WorldgenManager worldgenManager) { 43 | this.blockManager = blockManager; 44 | this.itemManager = itemManager; 45 | this.renderManager = renderManager; 46 | this.recipeManager = recipeManager; 47 | this.worldgenManager = worldgenManager; 48 | } 49 | 50 | @Override 51 | public void preInit() { 52 | steelOreTexture = renderManager.registerTexture(new BlockTexture(MOD_ID, "ore_steel")); 53 | steelIngotTexture = renderManager.registerTexture(new ItemTexture(MOD_ID, "ingot_steel")); 54 | 55 | blockSteelOre = blockManager.register(MOD_ID + ":steel_ore", BlockSteelOre::new); 56 | itemSteelIngot = itemManager.register(MOD_ID + ":steel_ingot", ItemSteelIngot::new); 57 | 58 | itemBlockSteelOre = itemManager.getItemFromBlock(blockSteelOre); 59 | 60 | oreSteel = worldgenManager.register(new Ore(MOD_ID + ":steel_ore", blockSteelOre, 1, 1, 61 | EnumSelector.of(OreHeight.class).blockAll().apart(OreHeight.DEEP).lock())); 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /worldgen/src/main/resources/assets/novaexampleworldgen/textures/blocks/ore_steel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NOVA-Team/NOVA-Example/dae350142bacb1e52680dc7b5af882a5b0e8d16a/worldgen/src/main/resources/assets/novaexampleworldgen/textures/blocks/ore_steel.png -------------------------------------------------------------------------------- /worldgen/src/main/resources/assets/novaexampleworldgen/textures/items/ingot_steel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NOVA-Team/NOVA-Example/dae350142bacb1e52680dc7b5af882a5b0e8d16a/worldgen/src/main/resources/assets/novaexampleworldgen/textures/items/ingot_steel.png --------------------------------------------------------------------------------