Skip to content

Update to Scala 2.12 #3

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,28 +1,30 @@
plugins {
id "scala"
id "nova.gradle" version "0.2.5"
id "nova.gradle" version "0.2.6"
id "maven-publish"
id "com.jfrog.artifactory" version "3.1.1"
}

ext.scala_version = "2.12.3"

build.dependsOn scaladoc

apply from: "https://raw.githubusercontent.com/NOVA-Team/NOVA-Gradle/master/shared-scripts/java.gradle"


dependencies {
compile "org.scala-lang:scala-library:2.11.7"
compile "nova.core:NOVA-Core:$novaVersion"
testCompile "nova.core:NOVA-Core:$novaVersion:wrappertests"
compile "org.scala-lang:scala-library:2.12.3"
compile "nova.core:NOVA-Core:$nova_version"
testCompile "nova.core:NOVA-Core:$nova_version:wrappertests"
}

nova {
wrappers {
"17" {
wrapper "nova.core:NOVA-Core-Wrapper-MC1.7:$novaVersion"
wrapper "nova.core:NOVA-Core-Wrapper-MC1.7:$nova_version"
}

"18" {
wrapper "nova.core:NOVA-Core-Wrapper-MC1.8:$novaVersion"
wrapper "nova.core:NOVA-Core-Wrapper-MC1.8:$nova_version"
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
version = 0.0.1-SNAPSHOT
group = nova.scala
novaVersion = 0.1.0-SNAPSHOT
nova_version = 0.1.0-SNAPSHOT

packaging = jar
info.inceptionYear = 2015
Expand Down
28 changes: 10 additions & 18 deletions src/main/scala/nova/scala/modcontent/ContentLoader.scala
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,12 @@

package nova.scala.modcontent

import java.util.function.{Function => JFunction}

import nova.core.block.{Block, BlockFactory}
import nova.core.entity.{Entity, EntityFactory}
import nova.core.item.{Item, ItemFactory}
import nova.core.loader.Loadable
import nova.core.render.model.ModelProvider
import nova.core.render.texture.{BlockTexture, EntityTexture, ItemTexture}
import nova.internal.core.Game
import nova.scala.wrapper.FunctionalWrapper._

/**
* Automatic mffs.content registration for all Blocks, Items, Entities and Textures.
Expand All @@ -38,12 +34,12 @@ import nova.scala.wrapper.FunctionalWrapper._
*
* @author Calclavia
*/
trait ContentLoader extends Loadable {
trait ContentLoader {
self =>

def id: String

override def preInit() = {
def preInit() = {
//Automated handler for registering blocks & items vars
for (field <- self.getClass.getDeclaredFields) {
//Set it so we can access the field
Expand All @@ -59,12 +55,11 @@ trait ContentLoader extends Loadable {
if (itemWrapper.wrapped.newInstance().isInstanceOf[AutoItemTexture]) {
val texture = Game.render.registerTexture(new ItemTexture(id, itemWrapper.getID))
field.set(self, Game.items.register(
texture.getClass.getName,
supplier(() => {
texture.getClass.getName, () => {
val wrapped = itemWrapper.wrapped.newInstance()
wrapped.asInstanceOf[AutoItemTexture].texture = texture
wrapped
})
}
))
}
else {
Expand All @@ -74,12 +69,11 @@ trait ContentLoader extends Loadable {
if (itemConstructor.wrapped.apply().isInstanceOf[AutoItemTexture]) {
val texture = Game.render.registerTexture(new ItemTexture(id, itemConstructor.wrapped.getID))
field.set(self, Game.items.register(
texture.getClass.getName,
supplier(() => {
texture.getClass.getName, () => {
val wrapped = itemConstructor.wrapped.apply()
wrapped.asInstanceOf[AutoItemTexture].texture = texture
wrapped
})
}
))
}
else {
Expand All @@ -91,12 +85,11 @@ trait ContentLoader extends Loadable {
val texture = Game.render.registerTexture(new BlockTexture(id, blockWrapper.getID))
Game.render.registerTexture(new BlockTexture(id, blockWrapper.getID))
field.set(self, Game.blocks.register(
texture.getClass.getName,
supplier(() => {
texture.getClass.getName, () => {
val wrapped = blockWrapper.wrapped.newInstance()
wrapped.asInstanceOf[AutoBlockTexture].texture = texture
wrapped
})
}
))
}
else {
Expand All @@ -107,12 +100,11 @@ trait ContentLoader extends Loadable {
val texture = Game.render.registerTexture(new BlockTexture(id, blockConstructor.getID))
Game.render.registerTexture(new BlockTexture(id, blockConstructor.getID))
field.set(self, Game.blocks.register(
texture.getClass.getName,
supplier(() => {
texture.getClass.getName, () => {
val wrapped = blockConstructor.wrapped.apply()
wrapped.asInstanceOf[AutoBlockTexture].texture = texture
wrapped
})
}
))
}
else {
Expand Down
217 changes: 0 additions & 217 deletions src/main/scala/nova/scala/wrapper/FunctionalWrapper.scala

This file was deleted.