diff --git a/src/main/java/org/terasology/biomesAPI/Biome.java b/src/main/java/org/terasology/biomesAPI/Biome.java index 912fb06..08f4aae 100644 --- a/src/main/java/org/terasology/biomesAPI/Biome.java +++ b/src/main/java/org/terasology/biomesAPI/Biome.java @@ -1,21 +1,8 @@ -/* - * Copyright 2018 MovingBlocks - * - * 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. - */ +// Copyright 2020 The Terasology Foundation +// SPDX-License-Identifier: Apache-2.0 package org.terasology.biomesAPI; -import org.terasology.naming.Name; +import org.terasology.gestalt.naming.Name; /** * Biomes can be assigned to different blocks during worldgen as well as on runtime, to provide additional metadata @@ -28,8 +15,8 @@ public interface Biome { /** - * @return An identifier that includes both the Module the biome originates from - * and a unique biome id (unique to that module). + * @return An identifier that includes both the Module the biome originates from and a unique biome id (unique to + * that module). */ Name getId(); @@ -41,9 +28,9 @@ public interface Biome { /** * Biome hashCode must be deterministic, non-zero, and unique for every biome. *
- * Please consider overriding this method to return constant values, hard-coded for each of the biomes.
- * No assumptions should however be made from any external module using biomes about their constant value,
- * i.e. modules should always retrieve biome hash using this function, and not hard-code any constant values.
+ * Please consider overriding this method to return constant values, hard-coded for each of the biomes. No
+ * assumptions should however be made from any external module using biomes about their constant value, i.e. modules
+ * should always retrieve biome hash using this function, and not hard-code any constant values.
*
* @return Hashcode of the biome
*/
diff --git a/src/main/java/org/terasology/biomesAPI/BiomeManager.java b/src/main/java/org/terasology/biomesAPI/BiomeManager.java
index 3417cfa..e5ba3e7 100644
--- a/src/main/java/org/terasology/biomesAPI/BiomeManager.java
+++ b/src/main/java/org/terasology/biomesAPI/BiomeManager.java
@@ -1,47 +1,33 @@
-/*
- * Copyright 2018 MovingBlocks
- *
- * 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.
- */
+// Copyright 2020 The Terasology Foundation
+// SPDX-License-Identifier: Apache-2.0
package org.terasology.biomesAPI;
import com.google.common.base.Preconditions;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.terasology.entitySystem.entity.EntityManager;
-import org.terasology.entitySystem.entity.EntityRef;
-import org.terasology.entitySystem.event.ReceiveEvent;
-import org.terasology.entitySystem.systems.BaseComponentSystem;
-import org.terasology.entitySystem.systems.RegisterSystem;
-import org.terasology.logic.location.LocationComponent;
-import org.terasology.logic.players.PlayerCharacterComponent;
-import org.terasology.logic.players.event.OnPlayerSpawnedEvent;
+import org.terasology.engine.entitySystem.entity.EntityManager;
+import org.terasology.engine.entitySystem.entity.EntityRef;
+import org.terasology.engine.entitySystem.event.ReceiveEvent;
+import org.terasology.engine.entitySystem.systems.BaseComponentSystem;
+import org.terasology.engine.entitySystem.systems.RegisterSystem;
+import org.terasology.engine.logic.location.LocationComponent;
+import org.terasology.engine.logic.players.PlayerCharacterComponent;
+import org.terasology.engine.logic.players.event.OnPlayerSpawnedEvent;
+import org.terasology.engine.physics.events.MovedEvent;
+import org.terasology.engine.registry.CoreRegistry;
+import org.terasology.engine.registry.In;
+import org.terasology.engine.registry.Share;
+import org.terasology.engine.rendering.nui.NUIManager;
+import org.terasology.engine.rendering.nui.layers.ingame.metrics.DebugMetricsSystem;
+import org.terasology.engine.world.WorldProvider;
+import org.terasology.engine.world.block.Block;
+import org.terasology.engine.world.chunks.CoreChunk;
+import org.terasology.engine.world.chunks.blockdata.ExtraBlockDataManager;
+import org.terasology.engine.world.chunks.blockdata.ExtraDataSystem;
+import org.terasology.engine.world.chunks.blockdata.RegisterExtraData;
import org.terasology.math.geom.Vector3f;
import org.terasology.math.geom.Vector3i;
-import org.terasology.physics.events.MovedEvent;
-import org.terasology.registry.CoreRegistry;
-import org.terasology.registry.In;
-import org.terasology.registry.Share;
-import org.terasology.world.WorldProvider;
-import org.terasology.world.block.Block;
-import org.terasology.world.chunks.CoreChunk;
-import org.terasology.world.chunks.blockdata.ExtraBlockDataManager;
-import org.terasology.world.chunks.blockdata.ExtraDataSystem;
-import org.terasology.world.chunks.blockdata.RegisterExtraData;
-import org.terasology.rendering.nui.NUIManager;
-import org.terasology.rendering.nui.layers.ingame.metrics.DebugMetricsSystem;
-
-import java.util.Collection;
+
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -52,26 +38,28 @@
@RegisterSystem
@ExtraDataSystem
public class BiomeManager extends BaseComponentSystem implements BiomeRegistry {
+ private static final Logger LOGGER = LoggerFactory.getLogger(BiomeManager.class);
+ private final Map
- * Biomes should be ideally registered through new {@link ComponentSystem}, in the method
- * {@link ComponentSystem#preBegin()}.
+ * Biomes should be ideally registered through new {@link ComponentSystem}, in the method {@link
+ * ComponentSystem#preBegin()}.
*
* @param biome Biome to register
*/
@@ -37,9 +24,9 @@ public interface BiomeRegistry {
* Sets specified biome at position in world.
*
* @param biome Biome to set
- * @param x x position of the block to set
- * @param y y position of the block to set
- * @param z z position of the block to set
+ * @param x x position of the block to set
+ * @param y y position of the block to set
+ * @param z z position of the block to set
*/
void setBiome(Biome biome, int x, int y, int z);
@@ -48,9 +35,9 @@ public interface BiomeRegistry {
*
* @param biome Biome to set
* @param chunk Chunk where to set the biome
- * @param relX x position of the block to set, relative to the chunk
- * @param relY y position of the block to set, relative to the chunk
- * @param relZ z position of the block to set, relative to the chunk
+ * @param relX x position of the block to set, relative to the chunk
+ * @param relY y position of the block to set, relative to the chunk
+ * @param relZ z position of the block to set, relative to the chunk
*/
void setBiome(Biome biome, CoreChunk chunk, int relX, int relY, int relZ);
@@ -58,7 +45,7 @@ public interface BiomeRegistry {
* Sets specified biome at position in world.
*
* @param biome Biome to set
- * @param pos Position of the block to set
+ * @param pos Position of the block to set
*/
void setBiome(Biome biome, Vector3i pos);
@@ -67,7 +54,7 @@ public interface BiomeRegistry {
*
* @param biome Biome to set
* @param chunk Chunk where to set the biome
- * @param pos Position of the block to set
+ * @param pos Position of the block to set
*/
void setBiome(Biome biome, CoreChunk chunk, Vector3i pos);
diff --git a/src/main/java/org/terasology/biomesAPI/BiomesMetricsMode.java b/src/main/java/org/terasology/biomesAPI/BiomesMetricsMode.java
index 084e15b..3ad423f 100644
--- a/src/main/java/org/terasology/biomesAPI/BiomesMetricsMode.java
+++ b/src/main/java/org/terasology/biomesAPI/BiomesMetricsMode.java
@@ -1,27 +1,14 @@
-/*
- * Copyright 2020 MovingBlocks
- *
- * 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.
- */
+// Copyright 2020 The Terasology Foundation
+// SPDX-License-Identifier: Apache-2.0
package org.terasology.biomesAPI;
-import org.terasology.rendering.nui.layers.ingame.metrics.MetricsMode;
+import org.terasology.engine.rendering.nui.layers.ingame.metrics.MetricsMode;
/**
* Display the name of the biome the player is currently located in in the debug overlay.
*
- * Current biome is set when OnBiomeChanged event is triggered
- * biomeName is polled whenever MetricsMode values are updated
+ * Current biome is set when OnBiomeChanged event is triggered biomeName is polled whenever MetricsMode values are
+ * updated
*/
class BiomesMetricsMode extends MetricsMode {
@@ -33,7 +20,7 @@ class BiomesMetricsMode extends MetricsMode {
@Override
public String getMetrics() {
- return getName()+"\n"+biomeName;
+ return getName() + "\n" + biomeName;
}
@Override
diff --git a/src/main/java/org/terasology/biomesAPI/OnBiomeChangedEvent.java b/src/main/java/org/terasology/biomesAPI/OnBiomeChangedEvent.java
index d4daff9..bece08c 100644
--- a/src/main/java/org/terasology/biomesAPI/OnBiomeChangedEvent.java
+++ b/src/main/java/org/terasology/biomesAPI/OnBiomeChangedEvent.java
@@ -1,29 +1,16 @@
-/*
- * Copyright 2018 MovingBlocks
- *
- * 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.
- */
+// Copyright 2020 The Terasology Foundation
+// SPDX-License-Identifier: Apache-2.0
package org.terasology.biomesAPI;
-import org.terasology.entitySystem.event.Event;
+import org.terasology.engine.entitySystem.event.Event;
/**
* This event is thrown to entities with {@link org.terasology.logic.players.PlayerCharacterComponent} whenever they
* change the biome they are in.
*/
public class OnBiomeChangedEvent implements Event {
- private Biome oldBiome;
- private Biome newBiome;
+ private final Biome oldBiome;
+ private final Biome newBiome;
public OnBiomeChangedEvent(Biome oldBiome, Biome newBiome) {
this.oldBiome = oldBiome;