Skip to content

Commit

Permalink
fix: fix errors with latest gestalt 7.x version
Browse files Browse the repository at this point in the history
  • Loading branch information
BenjaminAmos committed Oct 9, 2021
1 parent 7a737d7 commit 23f598e
Show file tree
Hide file tree
Showing 21 changed files with 186 additions and 21 deletions.
14 changes: 7 additions & 7 deletions engine/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ buildscript {
// HACK: Needed for NUI and gestalt entity-component reflections
classpath group: 'org.terasology.nui', name: 'nui', version: '3.1.0-SNAPSHOT'
classpath group: 'javax.servlet', name: 'javax.servlet-api', version: '3.0.1'
classpath group: 'org.terasology.gestalt', name: 'gestalt-entity-system', version: '7.0.6-SNAPSHOT'
classpath group: 'org.terasology.gestalt', name: 'gestalt-entity-system', version: '7.2.0-SNAPSHOT'
}
}

Expand All @@ -42,10 +42,10 @@ dependencies {
api "com.badlogicgames.gdx:gdx-box2d:$gdxVersion"
api "com.badlogicgames.gdx:gdx-controllers:$gdxVersion"

api(group: 'org.terasology.gestalt', name: 'gestalt-asset-core', version: '7.0.6-SNAPSHOT')
api(group: 'org.terasology.gestalt', name: 'gestalt-entity-system', version: '7.0.6-SNAPSHOT')
api(group: 'org.terasology.gestalt', name: 'gestalt-module', version: '7.0.6-SNAPSHOT')
api(group: 'org.terasology.gestalt', name: 'gestalt-util', version: '7.0.6-SNAPSHOT')
api(group: 'org.terasology.gestalt', name: 'gestalt-asset-core', version: '7.2.0-SNAPSHOT')
api(group: 'org.terasology.gestalt', name: 'gestalt-entity-system', version: '7.2.0-SNAPSHOT')
api(group: 'org.terasology.gestalt', name: 'gestalt-module', version: '7.2.0-SNAPSHOT')
api(group: 'org.terasology.gestalt', name: 'gestalt-util', version: '7.2.0-SNAPSHOT')

api group: 'org.terasology.nui', name: 'nui', version: nuiVersion
api group: 'org.terasology.nui', name: 'nui-libgdx', version: nuiVersion
Expand Down Expand Up @@ -82,7 +82,7 @@ task cacheReflections {
configurations."${sourceSets.main.runtimeClasspathConfigurationName}"

outputs.upToDateWhen {classes.state.upToDate}
outputs.file("$buildDir/classes/reflections.cache")
outputs.file("$buildDir/resources/main/org/destinationsol/reflections.cache")
dependsOn classes

doLast {
Expand All @@ -91,7 +91,7 @@ task cacheReflections {
.addUrls(inputs.files.collect { it.toURI().toURL() })
.filterInputsBy({ it.startsWith("org.destinationsol") || it.startsWith("org.terasology.nui") })
.setScanners(new TypeAnnotationsScanner(), new SubTypesScanner()))
reflections.save("$buildDir/classes/reflections.cache")
reflections.save("$buildDir/resources/main/org/destinationsol/reflections.cache")
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public float getMass() {
}

@Override
public void copy(BodyLinked other) {
public void copyFrom(BodyLinked other) {
this.mass = other.getMass();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public void setDurability(float durability) {
}

@Override
public void copy(Durability other) {
public void copyFrom(Durability other) {
this.durability = other.durability;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
*/
package org.destinationsol.game.console.adapter;

import org.terasology.gestalt.module.sandbox.API;

@API
public interface ParameterAdapter<T> {
T parse(String raw);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,11 @@
import org.destinationsol.SolApplication;
import org.destinationsol.game.console.commands.PositionCommandHandler;
import org.destinationsol.game.ship.hulls.HullConfig;
import org.terasology.gestalt.module.sandbox.API;

import java.util.Map;

@API
public class ParameterAdapterManager {
private final Map<Class<?>, ParameterAdapter> adapters = Maps.newHashMap();

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/*
* Copyright 2021 The Terasology Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@API package org.destinationsol.game.console.annotations;

import org.terasology.gestalt.module.sandbox.API;
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/*
* Copyright 2021 The Terasology Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@API package org.destinationsol.game.console.suggesters;

import org.terasology.gestalt.module.sandbox.API;
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,12 @@
import org.destinationsol.game.SolObject;
import org.destinationsol.game.drawables.DrawableLevel;
import org.destinationsol.game.drawables.RectSprite;
import org.terasology.gestalt.module.sandbox.API;

/**
* AnimatedRectSprites are a specialised variant of RectSprites that can play a single animation, based off a sprite-sheet texture
*/
@API
public class AnimatedRectSprite extends RectSprite {
private Animation<TextureAtlas.AtlasRegion> spriteAnimation;
private float animationTime;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public final class Health implements Component<Health> {
public float currentHealth = 30;

@Override
public void copy(Health other) {
public void copyFrom(Health other) {
this.maxHealth = other.maxHealth;
this.currentHealth = other.currentHealth;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public class Angle implements Component<Angle> {
private float angle;

@Override
public void copy(Angle other) {
public void copyFrom(Angle other) {
this.angle = other.angle;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public class Position implements Component<Position> {
public Vector2 position = new Vector2();

@Override
public void copy(Position other) {
public void copyFrom(Position other) {
position = other.position.cpy();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public class Velocity implements Component<Velocity> {
public Vector2 velocity = new Vector2();

@Override
public void copy(Velocity other) {
public void copyFrom(Velocity other) {
velocity = other.velocity.cpy();
}
}
40 changes: 37 additions & 3 deletions engine/src/main/java/org/destinationsol/modules/ModuleManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,34 @@ public class ModuleManager {
"com.badlogic.gdx.graphics.g2d",
// The hull config exposes a box2d body instance
"com.badlogic.gdx.physics",
"com.badlogic.gdx.physics.box2d"
"com.badlogic.gdx.physics.box2d",
// NUI doesn't use gestalt's @API annotations anymore, so they are replicated here
"org.terasology.input",
"org.terasology.input.device",
"org.terasology.input.device.nulldevices",
"org.terasology.nui",
"org.terasology.nui.asset",
"org.terasology.nui.asset.font",
"org.terasology.nui.canvas",
"org.terasology.nui.databinding",
"org.terasology.nui.events",
"org.terasology.nui.itemRendering",
"org.terasology.nui.layouts",
"org.terasology.nui.layouts.miglayout",
"org.terasology.nui.layouts.relative",
"org.terasology.nui.properties",
"org.terasology.nui.reflection",
"org.terasology.nui.skin",
"org.terasology.nui.translate",
"org.terasology.nui.util",
"org.terasology.nui.widgets",
"org.terasology.nui.widgets.treeView",
"org.terasology.nui.widgets.types",
"org.terasology.nui.widgets.types.builtin",
"org.terasology.nui.widgets.types.builtin.object",
"org.terasology.nui.widgets.types.builtin.util",
"org.terasology.nui.widgets.types.math",
"org.terasology.reflection.metadata"
};
protected static final Class<?>[] CLASS_WHITELIST = new Class<?>[]{
InvocationTargetException.class,
Expand Down Expand Up @@ -162,7 +189,14 @@ public class ModuleManager {
org.terasology.gestalt.entitysystem.entity.EntityManager.class,
org.terasology.gestalt.entitysystem.event.EventResult.class,
org.terasology.gestalt.entitysystem.event.ReceiveEvent.class,
org.terasology.gestalt.entitysystem.prefab.GeneratedFromRecipeComponent.class
org.terasology.gestalt.entitysystem.prefab.Prefab.class,
org.terasology.gestalt.entitysystem.prefab.GeneratedFromRecipeComponent.class,
/* NUI classes */
org.terasology.input.device.InputDevice.class,
org.terasology.input.device.KeyboardDevice.class,
org.terasology.input.device.MouseDevice.class,
org.terasology.reflection.MappedContainer.class,
org.terasology.reflection.TypeInfo.class
};

protected static ModuleEnvironment environment;
Expand Down Expand Up @@ -229,7 +263,7 @@ public void loadEnvironment(Set<Module> modules) {
scanner.scan(reflections);
Policy.setPolicy(new ModuleSecurityPolicy());
System.setSecurityManager(new ModuleSecurityManager());
environment = new ModuleEnvironment(modules,permissionFactory);
environment = new ModuleEnvironment(modules, permissionFactory);
}

public ModuleEnvironment getEnvironment() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public final class Renderable implements Component<Renderable> {
public boolean isInvisible;

@Override
public void copy(Renderable other) {
public void copyFrom(Renderable other) {
ArrayList<RenderableElement> newElements = new ArrayList<>();
for (int index = 0; index < other.elements.size(); index++) {
RenderableElement data = new RenderableElement();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public class Size implements Component<Size> {
public float size;

@Override
public void copy(Size other) {
public void copyFrom(Size other) {
this.size = other.size;
}
}
18 changes: 18 additions & 0 deletions engine/src/main/java/org/destinationsol/ui/nui/package-info.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/*
* Copyright 2021 The Terasology Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@API package org.destinationsol.ui.nui;

import org.terasology.gestalt.module.sandbox.API;
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/*
* Copyright 2021 The Terasology Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@API package org.destinationsol.ui.nui.screens;

import org.terasology.gestalt.module.sandbox.API;
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/*
* Copyright 2021 The Terasology Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@API package org.destinationsol.ui.nui.widgets;

import org.terasology.gestalt.module.sandbox.API;
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/*
* Copyright 2021 The Terasology Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@API package org.destinationsol.world.generators;

import org.terasology.gestalt.module.sandbox.API;
18 changes: 18 additions & 0 deletions engine/src/main/java/org/destinationsol/world/package-info.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/*
* Copyright 2021 The Terasology Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@API package org.destinationsol.world;

import org.terasology.gestalt.module.sandbox.API;
4 changes: 1 addition & 3 deletions templates/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -183,9 +183,7 @@ task createSkeleton() {

task cacheReflections {
description = 'Caches reflection output to make regular startup faster. May go stale and need cleanup at times.'
inputs.files sourceSets.main.output.classesDirs,
// getClassesDir from all sourceSets (for any jvm (seems) language)
configurations."${sourceSets.main.runtimeClasspathConfigurationName}"
inputs.files sourceSets.main.output.classesDirs

outputs.upToDateWhen {classes.state.upToDate}
outputs.file("$buildDir/classes/reflections.cache")
Expand Down

0 comments on commit 23f598e

Please sign in to comment.