Skip to content

Commit

Permalink
Trivial code quality tweaks after big merge.
Browse files Browse the repository at this point in the history
  • Loading branch information
Cervator committed May 26, 2018
1 parent 97e00cb commit d0c852d
Show file tree
Hide file tree
Showing 39 changed files with 65 additions and 124 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2013 MovingBlocks
* 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.
Expand All @@ -13,7 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.terasology;

import org.jboss.shrinkwrap.api.ShrinkWrap;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2013 MovingBlocks
* 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.
Expand Down Expand Up @@ -72,8 +72,6 @@
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;

/**
*/
public class StorageManagerTest extends TerasologyTestingEnvironment {

public static final String PLAYER_ID = "someId";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2013 MovingBlocks
* 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.
Expand Down Expand Up @@ -28,7 +28,6 @@
import org.terasology.world.block.Block;
import org.terasology.world.block.BlockManager;
import org.terasology.world.block.BlockUri;
import org.terasology.world.block.family.BlockFamilyRegistry;
import org.terasology.world.block.family.SymmetricFamily;
import org.terasology.world.block.internal.BlockManagerImpl;
import org.terasology.world.block.loader.BlockFamilyDefinition;
Expand All @@ -41,7 +40,6 @@

import static org.junit.Assert.assertEquals;


public class ChunkTest extends TerasologyTestingEnvironment {

private Chunk chunk;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2013 MovingBlocks
* 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.
Expand All @@ -13,7 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.terasology.world;

import org.junit.Before;
Expand All @@ -29,7 +28,6 @@
import org.terasology.world.block.Block;
import org.terasology.world.block.BlockManager;
import org.terasology.world.block.BlockUri;
import org.terasology.world.block.family.BlockFamilyRegistry;
import org.terasology.world.block.family.SymmetricFamily;
import org.terasology.world.block.internal.BlockManagerImpl;
import org.terasology.world.block.loader.BlockFamilyDefinition;
Expand All @@ -46,8 +44,6 @@

import static org.junit.Assert.assertEquals;

/**
*/
public class ChunkViewTest extends TerasologyTestingEnvironment {

Block airBlock;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2013 MovingBlocks
* 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.
Expand All @@ -13,7 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.terasology.world;

import com.google.common.base.Objects;
Expand Down Expand Up @@ -66,8 +65,6 @@
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;

/**
*/
public class EntityAwareWorldProviderTest extends TerasologyTestingEnvironment {

private EntityAwareWorldProvider worldProvider;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2013 MovingBlocks
* 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.
Expand All @@ -13,7 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.terasology.world.generator;

import org.junit.Before;
Expand All @@ -30,7 +29,6 @@
import org.terasology.world.block.Block;
import org.terasology.world.block.BlockManager;
import org.terasology.world.block.BlockUri;
import org.terasology.world.block.family.BlockFamilyRegistry;
import org.terasology.world.block.family.SymmetricFamily;
import org.terasology.world.block.internal.BlockManagerImpl;
import org.terasology.world.block.loader.BlockFamilyDefinition;
Expand All @@ -44,8 +42,6 @@

import static org.junit.Assert.assertEquals;

/**
*/
public class InternalLightGeneratorTest extends TerasologyTestingEnvironment {

Block airBlock;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2014 MovingBlocks
* 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.
Expand Down Expand Up @@ -31,8 +31,6 @@
import org.terasology.world.block.Block;
import org.terasology.world.block.BlockManager;
import org.terasology.world.block.BlockUri;
import org.terasology.world.block.family.BlockFamily;
import org.terasology.world.block.family.BlockFamilyRegistry;
import org.terasology.world.block.family.SymmetricFamily;
import org.terasology.world.block.internal.BlockManagerImpl;
import org.terasology.world.block.loader.BlockFamilyDefinition;
Expand All @@ -56,8 +54,6 @@

import static org.junit.Assert.assertEquals;

/**
*/
public class BetweenChunkPropagationTest extends TerasologyTestingEnvironment {

private BlockManagerImpl blockManager;
Expand All @@ -74,7 +70,6 @@ public class BetweenChunkPropagationTest extends TerasologyTestingEnvironment {
private BatchPropagator sunlightPropagator;
private SunlightRegenBatchPropagator propagator;


@Before
@Override
public void setup() throws Exception {
Expand All @@ -90,7 +85,7 @@ public void setup() throws Exception {
solidData.getBaseSection().setDisplayName("Stone");
solidData.getBaseSection().setShape(assetManager.getAsset("engine:cube", BlockShape.class).get());
solidData.getBaseSection().setTranslucent(false);
solidData.setBlockFamily( SymmetricFamily.class);
solidData.setBlockFamily(SymmetricFamily.class);
assetManager.loadAsset(new ResourceUrn("engine:stone"), solidData, BlockFamilyDefinition.class);
solid = blockManager.getBlock(new BlockUri(new ResourceUrn("engine:stone")));

Expand All @@ -102,7 +97,6 @@ public void setup() throws Exception {
propagator = new SunlightRegenBatchPropagator(regenRules, regenWorldView, sunlightPropagator, lightWorldView);
}


@Test
public void testBetweenChunksSimple() {
Chunk topChunk = new ChunkImpl(new Vector3i(0, 1, 0), blockManager, biomeManager);
Expand Down Expand Up @@ -310,5 +304,4 @@ public void purgeWorld() {
// do nothing
}
}

}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2013 MovingBlocks
* 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.
Expand Down Expand Up @@ -27,7 +27,6 @@
import org.terasology.world.block.Block;
import org.terasology.world.block.BlockManager;
import org.terasology.world.block.BlockUri;
import org.terasology.world.block.family.BlockFamilyRegistry;
import org.terasology.world.block.family.SymmetricFamily;
import org.terasology.world.block.internal.BlockManagerImpl;
import org.terasology.world.block.loader.BlockFamilyDefinition;
Expand All @@ -39,8 +38,6 @@

import static org.junit.Assert.assertEquals;

/**
*/
public class BulkLightPropagationTest extends TerasologyTestingEnvironment {

private BlockManagerImpl blockManager;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2014 MovingBlocks
* 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.
Expand Down Expand Up @@ -27,7 +27,6 @@
import org.terasology.world.block.Block;
import org.terasology.world.block.BlockManager;
import org.terasology.world.block.BlockUri;
import org.terasology.world.block.family.BlockFamilyRegistry;
import org.terasology.world.block.family.SymmetricFamily;
import org.terasology.world.block.internal.BlockManagerImpl;
import org.terasology.world.block.loader.BlockFamilyDefinition;
Expand All @@ -42,8 +41,6 @@

import static org.junit.Assert.assertEquals;

/**
*/
public class BulkSunlightPropagationTest extends TerasologyTestingEnvironment {

private BlockManagerImpl blockManager;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2016 MovingBlocks
* 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.
Expand All @@ -13,7 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.terasology.engine;

import com.google.common.base.Preconditions;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2013 MovingBlocks
* 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.
Expand Down Expand Up @@ -176,7 +176,7 @@ private void unregisterPrefabFormats(ModuleAwareAssetTypeManager assetTypeManage

private static void loadFamilies(BlockFamilyRegistry registry, ModuleEnvironment environment) {
registry.clear();
for(Class<?> blockFamily : environment.getTypesAnnotatedWith(RegisterBlockFamily.class)) {
for (Class<?> blockFamily : environment.getTypesAnnotatedWith(RegisterBlockFamily.class)) {
if (!BlockFamily.class.isAssignableFrom(blockFamily)) {
logger.error("Cannot load {}, must be a subclass of BlockFamily", blockFamily.getSimpleName());
continue;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2017 MovingBlocks
* 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.
Expand Down Expand Up @@ -68,8 +68,6 @@

import java.util.Queue;

/**
*/
public class StateLoading implements GameState {

private static final Logger logger = LoggerFactory.getLogger(StateLoading.class);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2017 MovingBlocks
* 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.
Expand Down Expand Up @@ -35,7 +35,7 @@ public String getMessage() {
@Override
public boolean step() {
BlockManager blockManager = context.get(BlockManager.class);
for(BlockFamily blockFamily : blockManager.listRegisteredBlockFamilies()) {
for (BlockFamily blockFamily : blockManager.listRegisteredBlockFamilies()) {
InjectionHelper.inject(blockFamily, context);
}
return true;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2013 MovingBlocks
* 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.
Expand All @@ -20,7 +20,7 @@
import org.terasology.world.block.family.BlockFamily;

/**
* return the block family based on the registered string id
* Return the block family based on the registered string id.
*/
public class BlockFamilyTypeHandler extends StringRepresentationTypeHandler<BlockFamily> {

Expand Down
7 changes: 3 additions & 4 deletions engine/src/main/java/org/terasology/world/block/Block.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2013 MovingBlocks
* 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.
Expand Down Expand Up @@ -56,9 +56,8 @@ public final class Block {
// TODO: Use directional light(s) when rendering instead of this
private static final Map<BlockPart, Float> DIRECTION_LIT_LEVEL = Maps.newEnumMap(BlockPart.class);

/**
* Init. the LUTs.
*/

// Initialize the LUTs
static {
DIRECTION_LIT_LEVEL.put(BlockPart.TOP, 0.9f);
DIRECTION_LIT_LEVEL.put(BlockPart.BOTTOM, 0.9f);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2013 MovingBlocks
* 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.
Expand All @@ -21,7 +21,6 @@
import org.terasology.world.block.loader.SectionDefinitionData;
import org.terasology.world.block.shapes.BlockShape;


public interface BlockBuilderHelper {

Block constructSimpleBlock(BlockFamilyDefinition definition, BlockUri uri, BlockFamily blockFamily);
Expand All @@ -41,5 +40,4 @@ public interface BlockBuilderHelper {
Block constructTransformedBlock(BlockFamilyDefinition definition, BlockShape shape, String section, Rotation rotation, BlockUri uri, BlockFamily blockFamily);

Block constructCustomBlock(String defaultName, BlockShape shape, Rotation rotation, SectionDefinitionData section, BlockUri uri, BlockFamily blockFamily);

}
Loading

0 comments on commit d0c852d

Please sign in to comment.