Skip to content

Commit

Permalink
chore: fix checkstyle issues
Browse files Browse the repository at this point in the history
  • Loading branch information
jdrueckert authored and keturn committed Oct 10, 2021
1 parent 4499272 commit 7dffedb
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 24 deletions.
2 changes: 0 additions & 2 deletions src/main/java/org/terasology/spawning/SpawnableComponent.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@

/**
* Component that enables an entity to be spawned by something.
*
* @author Rasmus 'Cervator' Praestholm <cervator@gmail.com>
*/
public class SpawnableComponent implements Component<SpawnableComponent> {

Expand Down
2 changes: 0 additions & 2 deletions src/main/java/org/terasology/spawning/SpawnerComponent.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
* Component that enables an entity to be a spawner of something.
* It forces any block it attaches to "active" so it'll maintain a BlockComponent for location purposes.
* However other entities can be valid spawners as well, such as creatures that have a LocationComponent.
*
* @author Rasmus 'Cervator' Praestholm <cervator@gmail.com>
*/
@ForceBlockActive
public class SpawnerComponent implements Component<SpawnerComponent> {
Expand Down
28 changes: 8 additions & 20 deletions src/main/java/org/terasology/spawning/SpawnerSystem.java
Original file line number Diff line number Diff line change
@@ -1,18 +1,5 @@
/*
* Copyright 2015 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 2021 The Terasology Foundation
// SPDX-License-Identifier: Apache-2.0
package org.terasology.spawning;

import com.google.common.collect.HashMultimap;
Expand Down Expand Up @@ -48,8 +35,6 @@

/**
* System that handles spawning of stuff
*
* @author Rasmus 'Cervator' Praestholm <cervator@gmail.com>
*/
@RegisterSystem(RegisterMode.AUTHORITY)
public class SpawnerSystem extends BaseComponentSystem implements UpdateSubscriberSystem {
Expand Down Expand Up @@ -154,7 +139,7 @@ public void onRemovedSpawner(BeforeRemoveComponent event, EntityRef spawner) {
* @param event the PeriodicActionTriggeredEvent from the scheduler to react to.
* @param spawner the spawner entity about to be processed.
*/
@ReceiveEvent(components = {SpawnerComponent.class})
@ReceiveEvent(components = SpawnerComponent.class)
public void onSpawn(PeriodicActionTriggeredEvent event, EntityRef spawner) {
logger.info("Spawner {} is ticking", spawner);
}
Expand Down Expand Up @@ -230,7 +215,9 @@ public void update(float delta) {
if (spawnerComp.rangedSpawning) {

// Add random range on the x and z planes, leave y (height) unchanged for now
spawnPos = new Vector3f(originPos.x + random.nextFloat() * spawnerComp.range, originPos.y, originPos.z + random.nextFloat() * spawnerComp.range);
spawnPos = new Vector3f(originPos.x + random.nextFloat() * spawnerComp.range,
originPos.y,
originPos.z + random.nextFloat() * spawnerComp.range);

// If a minimum distance is set make sure we're beyond it
if (spawnerComp.minDistance != 0) {
Expand Down Expand Up @@ -277,7 +264,8 @@ public void update(float delta) {
int anotherRandomIndex = random.nextInt(randomType.size());
Object[] randomPrefabs = randomType.toArray();
Prefab chosenPrefab = (Prefab) randomPrefabs[anotherRandomIndex];
logger.info("Picked index {} of types {} which is a {}, to spawn at {}", anotherRandomIndex, chosenSpawnerType, chosenPrefab, spawnPos);
logger.info("Picked index {} of types {} which is a {}, to spawn at {}",
anotherRandomIndex, chosenSpawnerType, chosenPrefab, spawnPos);

// Finally create the Spawnable. Assign parentage so we can tie Spawnables to their Spawner if needed
EntityRef newSpawnableRef = entityManager.create(chosenPrefab, spawnPos);
Expand Down

0 comments on commit 7dffedb

Please sign in to comment.