diff --git a/README.md b/README.md index ffec84cdf59..d6e6a82ff3b 100644 --- a/README.md +++ b/README.md @@ -22,6 +22,7 @@

Community | + Knowledge Base | Installation | Development | License @@ -69,6 +70,11 @@ We are present in nearly the complete round-up of social networks. Follow/friend

+## Knowledge Base + +Find documentation, instructions, and helpful references in our [Terasology Knowledge Base](http://terasology.org/Terasology/#/), formerly known as the Terasology Engine wiki. + + ## Installation diff --git a/docs-pre-merge/images/PopulatedVillage.jpg b/docs/images/PopulatedVillage.jpg similarity index 100% rename from docs-pre-merge/images/PopulatedVillage.jpg rename to docs/images/PopulatedVillage.jpg diff --git a/docs-pre-merge/images/discord.png b/docs/images/discord.png similarity index 100% rename from docs-pre-merge/images/discord.png rename to docs/images/discord.png diff --git a/docs-pre-merge/images/facebook.png b/docs/images/facebook.png similarity index 100% rename from docs-pre-merge/images/facebook.png rename to docs/images/facebook.png diff --git a/docs-pre-merge/images/forum.png b/docs/images/forum.png similarity index 100% rename from docs-pre-merge/images/forum.png rename to docs/images/forum.png diff --git a/docs-pre-merge/images/menuBackground.jpg b/docs/images/menuBackground.jpg similarity index 100% rename from docs-pre-merge/images/menuBackground.jpg rename to docs/images/menuBackground.jpg diff --git a/docs-pre-merge/images/patreon.jpg b/docs/images/patreon.jpg similarity index 100% rename from docs-pre-merge/images/patreon.jpg rename to docs/images/patreon.jpg diff --git a/docs-pre-merge/images/reddit.png b/docs/images/reddit.png similarity index 100% rename from docs-pre-merge/images/reddit.png rename to docs/images/reddit.png diff --git a/docs-pre-merge/images/terasology-logo.png b/docs/images/terasology-logo.png similarity index 100% rename from docs-pre-merge/images/terasology-logo.png rename to docs/images/terasology-logo.png diff --git a/docs-pre-merge/images/twitter.png b/docs/images/twitter.png similarity index 100% rename from docs-pre-merge/images/twitter.png rename to docs/images/twitter.png diff --git a/docs-pre-merge/images/youtube.png b/docs/images/youtube.png similarity index 100% rename from docs-pre-merge/images/youtube.png rename to docs/images/youtube.png diff --git a/engine-tests/src/test/java/org/terasology/engine/integrationenvironment/ExampleTest.java b/engine-tests/src/test/java/org/terasology/engine/integrationenvironment/ExampleTest.java index a7a47840901..adfae966a71 100644 --- a/engine-tests/src/test/java/org/terasology/engine/integrationenvironment/ExampleTest.java +++ b/engine-tests/src/test/java/org/terasology/engine/integrationenvironment/ExampleTest.java @@ -6,22 +6,25 @@ import org.joml.Vector3i; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.terasology.engine.context.Context; import org.terasology.engine.core.Time; import org.terasology.engine.entitySystem.entity.EntityManager; import org.terasology.engine.integrationenvironment.jupiter.IntegrationEnvironment; import org.terasology.engine.logic.players.LocalPlayer; -import org.terasology.engine.logic.players.event.ResetCameraEvent; import org.terasology.engine.network.ClientComponent; import org.terasology.engine.network.NetworkMode; import org.terasology.engine.registry.In; import org.terasology.engine.world.WorldProvider; import org.terasology.engine.world.block.BlockManager; +import org.terasology.unittest.stubs.DummyEvent; import java.io.IOException; @IntegrationEnvironment(networkMode = NetworkMode.LISTEN_SERVER) public class ExampleTest { + private static final Logger logger = LoggerFactory.getLogger(ExampleTest.class); @In private WorldProvider worldProvider; @@ -34,6 +37,13 @@ public class ExampleTest { @In private ModuleTestingHelper helper; + @Test + public void testClientCreation() { + logger.info("Starting test 'testClientCreation'"); + Assertions.assertDoesNotThrow(helper::createClient); + logger.info("Done with test 'testClientCreation'"); + } + @Test public void testClientConnection() throws IOException { int currentClients = Lists.newArrayList(entityManager.getEntitiesWith(ClientComponent.class)).size(); @@ -65,7 +75,7 @@ public void testSendEvent() throws IOException { Context clientContext = helper.createClient(); // send an event to a client's local player just for fun - clientContext.get(LocalPlayer.class).getClientEntity().send(new ResetCameraEvent()); + clientContext.get(LocalPlayer.class).getClientEntity().send(new DummyEvent()); } @Test diff --git a/engine/src/main/java/org/terasology/engine/config/SystemConfig.java b/engine/src/main/java/org/terasology/engine/config/SystemConfig.java index 9f0aafd1ab6..006d160a593 100644 --- a/engine/src/main/java/org/terasology/engine/config/SystemConfig.java +++ b/engine/src/main/java/org/terasology/engine/config/SystemConfig.java @@ -8,9 +8,14 @@ import org.terasology.engine.config.flexible.constraints.LocaleConstraint; import org.terasology.engine.config.flexible.constraints.NumberRangeConstraint; +import java.util.Arrays; import java.util.Locale; import java.util.Locale.Category; import java.util.Optional; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import java.util.stream.Collectors; +import java.util.stream.Stream; import static java.lang.Math.max; import static org.terasology.engine.config.flexible.SettingArgument.constraint; @@ -81,13 +86,34 @@ public class SystemConfig extends AutoConfig { public final Setting locale = setting( type(Locale.class), - defaultValue(Locale.getDefault(Category.DISPLAY)), + defaultValue(getAdjustedLocale()), name("${engine:menu#settings-language}"), - constraint(new LocaleConstraint(Locale.getAvailableLocales())) // TODO provide translate project's locales (Pirate lang don't works) + constraint(new LocaleConstraint( + // Locale.getAvailableLocales() + non-standard "pr" (pirate) tag + Stream.concat(Arrays.stream(Locale.getAvailableLocales()), Stream.of(Locale.forLanguageTag("pr"))) + .collect(Collectors.toSet()))) ); @Override public String getName() { return "${engine:menu#system-settings-title}"; } + + private static Locale getAdjustedLocale() { + Locale systemLocale = Locale.getDefault(Category.DISPLAY); + + // Matches unusual locales on Mac OS created from the user's language and location, e.g. en_UA + if (!Arrays.asList(Locale.getAvailableLocales()).contains(systemLocale)) { + final Pattern langRegionPattern = Pattern.compile("[a-z]{2}_[A-Z]{2}"); + + String input = systemLocale.toString(); + Matcher matcher = langRegionPattern.matcher(input); + + // If the locale is like that, convert it to just the language, e.g. en_UA -> en + if (matcher.find()) { + systemLocale = Locale.forLanguageTag(systemLocale.getLanguage()); + } + } + return systemLocale; + } } diff --git a/engine/src/main/java/org/terasology/engine/config/flexible/AutoConfigTypeHandler.java b/engine/src/main/java/org/terasology/engine/config/flexible/AutoConfigTypeHandler.java index 55ce4dee4d3..134081d2e84 100644 --- a/engine/src/main/java/org/terasology/engine/config/flexible/AutoConfigTypeHandler.java +++ b/engine/src/main/java/org/terasology/engine/config/flexible/AutoConfigTypeHandler.java @@ -89,7 +89,7 @@ public Optional deserialize(PersistedData data) { } return Optional.of(config); } catch (InstantiationException | InvocationTargetException | NoSuchMethodException | IllegalAccessException e) { - logger.error("Cannot create type [" + typeInfo + "] for deserialization", e); + logger.error("Cannot create type [{}] for deserialization", typeInfo, e); } return Optional.empty(); } diff --git a/engine/src/main/java/org/terasology/engine/config/flexible/internal/SettingImpl.java b/engine/src/main/java/org/terasology/engine/config/flexible/internal/SettingImpl.java index 69d94c0106b..aae34e01b8a 100644 --- a/engine/src/main/java/org/terasology/engine/config/flexible/internal/SettingImpl.java +++ b/engine/src/main/java/org/terasology/engine/config/flexible/internal/SettingImpl.java @@ -138,8 +138,8 @@ public boolean set(T newValue) { Preconditions.checkNotNull(newValue, "The value of a setting cannot be null."); if (override.get().isPresent()) { - LOGGER.warn("An attempt was made to overwrite the value specified in the System property." + - " This will give nothing while the System Property value is supplied"); + LOGGER.warn("An attempt was made to overwrite the value specified in the System property." + + " This will give nothing while the System Property value is supplied"); return false; } diff --git a/engine/src/main/java/org/terasology/engine/core/ComponentSystemManager.java b/engine/src/main/java/org/terasology/engine/core/ComponentSystemManager.java index 0ded16708cd..025ca2a2dc3 100644 --- a/engine/src/main/java/org/terasology/engine/core/ComponentSystemManager.java +++ b/engine/src/main/java/org/terasology/engine/core/ComponentSystemManager.java @@ -177,7 +177,7 @@ public void register(ComponentSystem object) { context.get(EntityManager.class).getEventSystem().registerEventHandler(object); if (initialised) { - logger.warn("System " + object.getClass().getName() + " registered post-init."); + logger.warn("System {} registered post-init.", object.getClass().getName()); initialiseSystem(object); } } diff --git a/engine/src/main/java/org/terasology/engine/core/module/SandboxFileManager.java b/engine/src/main/java/org/terasology/engine/core/module/SandboxFileManager.java index a8db9819174..5ca0bf8acd3 100644 --- a/engine/src/main/java/org/terasology/engine/core/module/SandboxFileManager.java +++ b/engine/src/main/java/org/terasology/engine/core/module/SandboxFileManager.java @@ -70,7 +70,7 @@ public void readFile(String filename, Consumer consumer) { // consumer to read the file, if it exists consumer.accept(moduleInputStream); } catch (IOException e) { - logger.error("Could not read the file: " + filename, e); + logger.error("Could not read the file: {}", filename, e); } return null; @@ -109,7 +109,7 @@ public void writeFile(String filename, Consumer consumer) { // consumer to write the file consumer.accept(moduleInputStream); } catch (IOException e) { - logger.error("Could not write the file: " + filename, e); + logger.error("Could not write the file: {}", filename, e); } return null; diff --git a/engine/src/main/java/org/terasology/engine/core/subsystem/common/MonitoringSubsystem.java b/engine/src/main/java/org/terasology/engine/core/subsystem/common/MonitoringSubsystem.java index 5b118a72f3d..c8be7ad5214 100644 --- a/engine/src/main/java/org/terasology/engine/core/subsystem/common/MonitoringSubsystem.java +++ b/engine/src/main/java/org/terasology/engine/core/subsystem/common/MonitoringSubsystem.java @@ -38,9 +38,8 @@ public void initialise(GameEngine engine, Context rootContext) { if (rootContext.get(SystemConfig.class).monitoringEnabled.get()) { advancedMonitor = new AdvancedMonitor(); advancedMonitor.setVisible(true); + initMicrometerMetrics(rootContext.get(Time.class)); } - - initMicrometerMetrics(rootContext.get(Time.class)); } /** diff --git a/engine/src/main/java/org/terasology/engine/logic/behavior/actions/conditions/ConditionAction.java b/engine/src/main/java/org/terasology/engine/logic/behavior/actions/conditions/ConditionAction.java index e97fc70ad98..06df94007fc 100644 --- a/engine/src/main/java/org/terasology/engine/logic/behavior/actions/conditions/ConditionAction.java +++ b/engine/src/main/java/org/terasology/engine/logic/behavior/actions/conditions/ConditionAction.java @@ -55,14 +55,12 @@ public BehaviorState modify(Actor actor, BehaviorState result) { } return BehaviorState.SUCCESS; } catch (ClassNotFoundException e) { - logger.error("Class not found. " + - "Does the Component specified exist?", e); + logger.error("Class not found. Does the Component specified exist?", e); } catch (NoSuchFieldException e) { - logger.error("Field not found. " + - "Does the field specified in 'values' (publicly) exist in the Component specified in 'componentPresent'?", e); + logger.error("Field not found. " + + "Does the field specified in 'values' (publicly) exist in the Component specified in 'componentPresent'?", e); } catch (IllegalAccessException e) { - logger.error("Illegal access. " + - "Do we have access to the Component in question?", e); + logger.error("Illegal access. Do we have access to the Component in question?", e); } return BehaviorState.FAILURE; } diff --git a/engine/src/main/java/org/terasology/engine/rendering/dag/AbstractNode.java b/engine/src/main/java/org/terasology/engine/rendering/dag/AbstractNode.java index 136b1cce891..7b5663f5c09 100644 --- a/engine/src/main/java/org/terasology/engine/rendering/dag/AbstractNode.java +++ b/engine/src/main/java/org/terasology/engine/rendering/dag/AbstractNode.java @@ -195,17 +195,17 @@ public boolean addOutputBufferPairConnection(int id, BufferPair bufferPair) { // set data for all connected connections if (!localBufferPairConnection.getConnectedConnections().isEmpty()) { - logger.debug("Propagating bufferPair data to all connected connections of " + localBufferPairConnection + ": "); + logger.debug("Propagating bufferPair data to all connected connections of {}: ", localBufferPairConnection); localBufferPairConnection.getConnectedConnections().forEach((k, v) -> { - logger.debug("setting data for: " + v.toString() + " ,"); + logger.debug("setting data for: {} ,", v); v.setData(bufferPair); }); logger.debug("data propagated.\n"); } if (localBufferPairConnection.getData() != null) { - logger.warn("Adding output buffer pair to slot id " + id - + " of " + this.nodeUri + "node overwrites data of existing connection: " + localBufferPairConnection.toString()); + logger.warn("Adding output buffer pair to slot id {} of {} node overwrites data of existing connection: {}", + id, this.nodeUri, localBufferPairConnection); } localBufferPairConnection.setData(bufferPair); success = true; @@ -232,17 +232,17 @@ public boolean addOutputBufferPairConnection(int id, BufferPairConnection from) // set data for all connected connections if (!localBufferPairConnection.getConnectedConnections().isEmpty()) { - logger.info("Propagating data from " + from.toString() + " to all connected connections of " + localBufferPairConnection + ": "); + logger.info("Propagating data from {} to all connected connections of {}: ", from.toString(), localBufferPairConnection); localBufferPairConnection.getConnectedConnections().forEach((k, v) -> { - logger.info("setting data for: " + v.toString() + " ,"); + logger.info("setting data for: {} ,", v); v.setData(from.getData()); }); logger.info("data propagated.\n"); } if (localBufferPairConnection.getData() != null) { - logger.warn("Adding output buffer pair connection " + from.toString() + "\n to slot id " + id - + " of " + this.nodeUri + "node overwrites data of existing connection: " + localBufferPairConnection.toString()); + logger.warn("Adding output buffer pair connection to slot id {} of {} node overwrites data of existing connection: {}", + id, this.nodeUri, localBufferPairConnection); } localBufferPairConnection.setData(from.getData()); @@ -303,16 +303,16 @@ protected boolean addOutputFboConnection(int id, FBO fboData) { FboConnection fboConnection = (FboConnection) outputConnections.get(connectionUri); if (fboConnection.getData() != null) { - logger.warn("Adding output fbo data to slot id " + id - + " of " + this.nodeUri + "node overwrites data of existing connection: " + fboConnection.toString()); + logger.warn("Adding output fbo data to slot id {} of {} node overwrites data of existing connection: {}", + id, this.nodeUri, fboConnection); } fboConnection.setData(fboData); // set data for all connected connections if (!fboConnection.getConnectedConnections().isEmpty()) { - logger.info("Propagating fbo data to all connected connections of " + fboConnection + ": "); + logger.info("Propagating fbo data to all connected connections of {}: ", fboConnection); fboConnection.getConnectedConnections().forEach((k, v) -> { - logger.info("setting data for: " + v.toString() + " ,"); + logger.info("setting data for: {} ,", v); v.setData(fboData); }); logger.info("data propagated.\n"); @@ -443,9 +443,7 @@ public int getNumberOfOutputConnections() { public DependencyConnection getInputConnection(String name) { DependencyConnection connection = inputConnections.get(name); if (connection == null) { - String errorMessage = String.format("Getting input connection named %s returned null." + - " No such input connection in %s", name, this.toString()); - logger.error(errorMessage); + logger.error("Getting input connection named {} returned null. No such input connection in {}", name, this); // throw new NullPointerException(errorMessage); } return connection; @@ -455,9 +453,7 @@ public DependencyConnection getInputConnection(String name) { public DependencyConnection getOutputConnection(String name) { DependencyConnection connection = outputConnections.get(name); if (connection == null) { - String errorMessage = String.format("Getting output connection named %s returned null." + - " No such output connection in %s", name, this.toString()); - logger.error(errorMessage); + logger.error("Getting output connection named {} returned null. No such output connection in {}.", name, this); // throw new NullPointerException(errorMessage); } return connection; @@ -513,7 +509,7 @@ protected FBO requiresFbo(FboConfig fboConfig, BaseFboManager fboManager) { if (!fboUsages.containsKey(fboName)) { fboUsages.put(fboName, fboManager); } else { - logger.warn("FBO " + fboName + " is already requested."); + logger.warn("FBO {} is already requested.", fboName); fbo = fboManager.get(fboName); this.addInputFboConnection(inputConnections.size() + 1, fbo); return fbo; diff --git a/engine/src/main/java/org/terasology/engine/rendering/dag/RenderGraph.java b/engine/src/main/java/org/terasology/engine/rendering/dag/RenderGraph.java index 79c84593464..8583fc992f1 100644 --- a/engine/src/main/java/org/terasology/engine/rendering/dag/RenderGraph.java +++ b/engine/src/main/java/org/terasology/engine/rendering/dag/RenderGraph.java @@ -52,8 +52,8 @@ public void addNode(Node node) { } if (akaNodeMap.containsKey(nodeAka)) { Node aNode = akaNodeMap.get(nodeAka); - logger.info("Node " + nodeUri + " also known as" + nodeAka + " already matches existing node with uri " - + aNode.getUri() + " - attempting replacing..."); + logger.info("Node {} also known as {} already matches existing node with uri {} - attempting replacing...", + nodeUri, nodeAka, aNode.getUri()); replaceNode(aNode, node); } else { nodeMap.put(nodeUri, node); @@ -149,7 +149,7 @@ private void connect(Node... nodeList) { if (!graph.hasEdgeConnecting(fromNode, toNode)) { graph.putEdge(fromNode, toNode); } else { - logger.warn("Trying to connect two already connected nodes, " + fromNode.getUri() + " and " + toNode.getUri()); + logger.warn("Trying to connect two already connected nodes, {} and {}", fromNode.getUri(), toNode.getUri()); } } @@ -169,7 +169,7 @@ public void disconnect(Node fromNode, Node toNode) { Preconditions.checkNotNull(toNode, "toNode cannot be null!"); if (!graph.hasEdgeConnecting(fromNode, toNode)) { - logger.warn("Trying to disconnect two nodes that aren't connected, " + fromNode.getUri() + " and " + toNode.getUri()); + logger.warn("Trying to disconnect two nodes that aren't connected, {} and {}", fromNode.getUri(), toNode.getUri()); } graph.removeEdge(fromNode, toNode); @@ -264,7 +264,7 @@ private void connectFbo(Node toNode, int inputFboId, DependencyConnection fromCo // TODO this will have to be caught by a try-catch or redone if we were going use gui to tamper with dag // Is not yet connected? if (!fromConnection.getConnectedConnections().isEmpty()) { - logger.warn("Warning, " + fromConnection + "connection is already read somewhere else."); + logger.warn("Warning, {} connection is already read somewhere else.", fromConnection); } // If adding new input goes smoothly // TODO These checks might be redundant @@ -275,8 +275,8 @@ private void connectFbo(Node toNode, int inputFboId, DependencyConnection fromCo } else { // if adding new input failed, it already existed - check for connections //TODO update - logger.info(toNode.getUri() + ".connectFbo(" + inputFboId + ", " + fromConnection.getName() + "):" + - " Connection already existed. Testing for its connections.."); + logger.info("{}.connectFbo({}, {}): Connection already existed. Testing for its connections..", + toNode.getUri(), inputFboId, fromConnection.getName()); DependencyConnection localConnection = toNode.getInputFboConnection(inputFboId); // DependencyConnection localConnectionConnectedTo = localConnection.getConnectedConnections(); // if our input is connected @@ -302,7 +302,7 @@ public void connectFbo(Node fromNode, int outputId, Node toNode, int inputId) { // if (!areConnected(fromNode, toNode)) { // connect(fromNode, toNode); // } - logger.debug("Connected " + fromNode.getOutputFboConnection(outputId) + " to " + toNode + "."); + logger.debug("Connected {} to {}.", fromNode.getOutputFboConnection(outputId), toNode); } public void reconnectFbo(Node fromNode, int outputId, Node toNode, int inputId) { @@ -328,7 +328,7 @@ public void reconnectFbo(Node fromNode, int outputId, Node toNode, int inputId) private void connectBufferPair(Node toNode, int inputConnectionId, DependencyConnection fromConnection) { // Is not yet connected? if (!fromConnection.getConnectedConnections().isEmpty()) { - logger.info("Warning, " + fromConnection + "connection is already read somewhere else."); + logger.info("Warning, {} connection is already read somewhere else.", fromConnection); } // If adding new input goes smoothly // TODO These checks might be redundant @@ -339,8 +339,8 @@ private void connectBufferPair(Node toNode, int inputConnectionId, DependencyCon } else { // if adding new input failed, it already existed - check for connections //TODO update - logger.info(toNode.getUri() + ".connectFbo(" + inputConnectionId + ", " + fromConnection.getName() + "):" + - " Connection already existed. Testing for its connections.."); + logger.info("{}.connectFbo({}, {}): Connection already existed. Testing for its connections..", + toNode.getUri(), inputConnectionId, fromConnection.getName()); DependencyConnection localConnection = toNode.getInputBufferPairConnection(inputConnectionId); // DependencyConnection localConnectionConnectedTo = localConnection.getConnectedConnections(); // if our input is connected @@ -401,7 +401,7 @@ public void connectBufferPair(Node fromNode, int outputId, Node toNode, int inpu // if (!areConnected(fromNode, toNode)) { // connect(fromNode, toNode); // } - logger.debug("Connected " + fromNode.getOutputBufferPairConnection(outputId) + " to " + toNode + "."); + logger.debug("Connected {} to {}.", fromNode.getOutputBufferPairConnection(outputId), toNode); } /** @@ -529,13 +529,13 @@ public void reconnectInputToOutput(String fromNodeUri, int outputId, Node toNode */ private void reconnectInputToOutput(Node toNode, int inputId, DependencyConnection fromConnection, ConnectionType connectionType, boolean disconnectPrevious) { - logger.debug("Attempting reconnection of " + toNode.getUri() + " to " + fromConnection.getParentNode() + "'s output."); + logger.debug("Attempting reconnection of {} to {}'s output.", toNode.getUri(), fromConnection.getParentNode()); Node fromNode; fromNode = findNode(fromConnection.getParentNode()); if (!fromConnection.getConnectedConnections().isEmpty()) { - logger.warn("WARNING: destination connection (" + fromConnection + ") is already connected to (" - + fromConnection.getConnectedConnections()); + logger.warn("WARNING: destination connection ({}) is already connected to ({})", + fromConnection, fromConnection.getConnectedConnections()); // TODO update the hashmap to string to be pretty // throw new RuntimeException("Could not reconnect, destination connection (" + fromConnection + ") is already connected to (" // + fromConnection.getConnectedConnections() + "). Remove connection first."); @@ -587,7 +587,7 @@ private void reconnectInputToOutput(Node toNode, int inputId, DependencyConnecti // either do this after everything is set up, or in renderGraph.addNode // and when calling these trough api, call resetDesiredStateChanges(); } else { - logger.info(toNode + "'s connection " + connectionToReconnect + " was not connected. Attempting new connection..."); + logger.info("{}'s connection {} was not connected. Attempting new connection...", toNode, connectionToReconnect); this.connectFbo(toNode, inputId, fromConnection); } } else { // TODO make it connectionToReconnect @@ -603,7 +603,7 @@ private void reconnectInputToOutput(Node toNode, int inputId, DependencyConnecti connectionName = "[unsupported connection type]"; } - logger.info("No such input connection named " + connectionName + ". Attempting new connection..."); + logger.info("No such input connection named {}. Attempting new connection...", connectionName); switch (connectionType) { case FBO: @@ -634,7 +634,7 @@ public void connectFbo(String fromNodeUri, int outputId, Node toNode, int inputI @Deprecated public void disconnectOutputFboConnection(Node node, int connectionId) { - logger.debug("Attempting disconnection of " + node + "'s output fbo number " + connectionId + ".."); + logger.debug("Attempting disconnection of {}'s output fbo number {}..", node, connectionId); if (node != null) { DependencyConnection outputConnection = node.getOutputFboConnection(connectionId); @@ -642,7 +642,7 @@ public void disconnectOutputFboConnection(Node node, int connectionId) { outputConnection.disconnect(); logger.debug("..disconnecting complete."); } else { - logger.warn("Could not find output Fbo connection number " + connectionId + "within " + node + "."); + logger.warn("Could not find output Fbo connection number {} within {}.", connectionId, node); } } else { throw new RuntimeException("Could not find node named " + node + " within renderGraph."); @@ -657,7 +657,7 @@ public void disconnectOutputFboConnection(String nodeUri, int connectionId) { } public void disconnectInputFbo(String nodeUri, int connectionId) { - logger.debug("Attempting disconnection of " + nodeUri + "'s input fbo number " + connectionId); + logger.debug("Attempting disconnection of {}'s input fbo number {}.", nodeUri, connectionId); Node node = findNode(new SimpleUri(nodeUri)); if (node != null) { ((AbstractNode) node).disconnectInputFbo(connectionId); @@ -726,7 +726,7 @@ public void reconnectAllConnectedInputsTo(DependencyConnection connectionToRepla } else if (newOutputConnection instanceof BufferPairConnection) { connectionType = ConnectionType.BUFFER_PAIR; } else { - logger.error("Unknown connection type: " + newOutputConnection + " .\n"); + logger.error("Unknown connection type: {} .\n", newOutputConnection); throw new RuntimeException("Unknown connection type: " + newOutputConnection + " .\n"); } diff --git a/engine/src/main/java/org/terasology/engine/rendering/opengl/AbstractFboManager.java b/engine/src/main/java/org/terasology/engine/rendering/opengl/AbstractFboManager.java index 55a624ad62d..73846de3419 100644 --- a/engine/src/main/java/org/terasology/engine/rendering/opengl/AbstractFboManager.java +++ b/engine/src/main/java/org/terasology/engine/rendering/opengl/AbstractFboManager.java @@ -44,9 +44,9 @@ protected FBO generateWithDimensions(FboConfig fboConfig, FBO.Dimensions dimensi // At this stage it's unclear what should be done in this circumstances as I (manu3d) do not know what // the effects of using an incomplete FrameBuffer are. Throw an exception? Live with visual artifacts? if (fbo.getStatus() == FBO.Status.INCOMPLETE) { - logger.error("FBO " + fboConfig.getName() + " is incomplete. Look earlier in the log for details."); + logger.error("FBO {} is incomplete. Look earlier in the log for details.", fboConfig.getName()); } else if (fbo.getStatus() == FBO.Status.UNEXPECTED) { - logger.error("FBO " + fboConfig.getName() + " has generated an unexpected status code. Look earlier in the log for details."); + logger.error("FBO {} has generated an unexpected status code. Look earlier in the log for details.", fboConfig.getName()); } fboLookup.put(fboConfig.getName(), fbo); fboConfigs.put(fboConfig.getName(), fboConfig); @@ -103,7 +103,7 @@ public FBO get(SimpleUri fboName) { FBO fbo = fboLookup.get(fboName); if (fbo == null) { - logger.warn("Failed to retrieve FBO '" + fboName + "'!"); + logger.warn("Failed to retrieve FBO '{}'!", fboName); } return fbo; @@ -122,7 +122,7 @@ public FboConfig getFboConfig(SimpleUri fboName) { FboConfig fboConfig = fboConfigs.get(fboName); if (fboConfig == null) { - logger.warn("Failed to retrieve FboConfig '" + fboName + "'!"); + logger.warn("Failed to retrieve FboConfig '{}'!", fboName); } return fboConfig; diff --git a/engine/src/main/java/org/terasology/engine/rendering/opengl/FBO.java b/engine/src/main/java/org/terasology/engine/rendering/opengl/FBO.java index 872142ed76d..a6452d0193c 100644 --- a/engine/src/main/java/org/terasology/engine/rendering/opengl/FBO.java +++ b/engine/src/main/java/org/terasology/engine/rendering/opengl/FBO.java @@ -472,36 +472,31 @@ private static void verifyCompleteness(SimpleUri urn, Type type, FBO fbo) { fbo.setStatus(Status.COMPLETE); break; case GL30.GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT: - logger.error("FrameBuffer: " + urn - + ", has caused a GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT exception"); + logger.error("FrameBuffer: {}, has caused a GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT exception", urn); fbo.setStatus(Status.INCOMPLETE); break; case GL30.GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT: - logger.error("FrameBuffer: " + urn - + ", has caused a GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT exception"); + logger.error("FrameBuffer: {}, has caused a GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT exception", urn); fbo.setStatus(Status.INCOMPLETE); break; case GL30.GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER: - logger.error("FrameBuffer: " + urn - + ", has caused a GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT exception"); + logger.error("FrameBuffer: {}, has caused a GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT exception", urn); fbo.setStatus(Status.INCOMPLETE); break; case GL30.GL_FRAMEBUFFER_UNSUPPORTED: - logger.error("FrameBuffer: " + urn - + ", has caused a GL_FRAMEBUFFER_UNSUPPORTED_EXT exception"); + logger.error("FrameBuffer: {}, has caused a GL_FRAMEBUFFER_UNSUPPORTED_EXT exception", urn); fbo.setStatus(Status.INCOMPLETE); break; case GL30.GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER: - logger.error("FrameBuffer: " + urn - + ", has caused a GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT exception"); + logger.error("FrameBuffer: {}, has caused a GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT exception", urn); /* * On some graphics cards, FBO.Type.NO_COLOR can cause a GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT. * Code using NO_COLOR FBOs should check for this and -not use- the FBO if its status is DISPOSED */ if (type == Type.NO_COLOR) { - logger.error("FrameBuffer: " + urn - + ", ...but the FBO.Type was NO_COLOR, ignoring this error and continuing without this FBO."); + logger.error("FrameBuffer: {}, ...but the FBO.Type was NO_COLOR, ignoring this error and continuing without this FBO.", + urn); fbo.dispose(); } else { fbo.setStatus(Status.INCOMPLETE); @@ -509,7 +504,7 @@ private static void verifyCompleteness(SimpleUri urn, Type type, FBO fbo) { break; default: - logger.error("FBO '" + urn + "' generated an unexpected reply from glCheckFramebufferStatusEXT: " + checkFB); + logger.error("FBO '{}' generated an unexpected reply from glCheckFramebufferStatusEXT: {}", urn, checkFB); fbo.setStatus(Status.UNEXPECTED); break; } diff --git a/engine/src/main/java/org/terasology/engine/rendering/opengl/GLSLShader.java b/engine/src/main/java/org/terasology/engine/rendering/opengl/GLSLShader.java index c29a538c519..c75a60454ae 100644 --- a/engine/src/main/java/org/terasology/engine/rendering/opengl/GLSLShader.java +++ b/engine/src/main/java/org/terasology/engine/rendering/opengl/GLSLShader.java @@ -248,10 +248,10 @@ private void updateAvailableFeatures() { // TODO: Have our own shader language and parse this stuff out properly if (shaderProgramBase.getFragmentProgram().contains(feature.toString())) { - logger.debug("Fragment shader feature '" + feature.toString() + "' is available..."); + logger.debug("Fragment shader feature '{}' is available...", feature); availableFeatures.add(feature); } else if (shaderProgramBase.getVertexProgram().contains(feature.toString())) { - logger.debug("Vertex shader feature '" + feature.toString() + "' is available..."); + logger.debug("Vertex shader feature '{}' is available...", feature); availableFeatures.add(feature); } } diff --git a/engine/src/main/java/org/terasology/engine/world/chunks/blockdata/ExtraBlockDataManager.java b/engine/src/main/java/org/terasology/engine/world/chunks/blockdata/ExtraBlockDataManager.java index 5fa73e93993..6668963d894 100644 --- a/engine/src/main/java/org/terasology/engine/world/chunks/blockdata/ExtraBlockDataManager.java +++ b/engine/src/main/java/org/terasology/engine/world/chunks/blockdata/ExtraBlockDataManager.java @@ -107,9 +107,9 @@ private Map>> getFieldsFromAnnotations(Context c if (registerAnnotation != null) { String errorType = validRegistrationMethod(method, registerAnnotation); if (errorType != null) { - logger.error("Unable to register extra block data: " + errorType + - " for {}.{}: should be \"public static boolean {}(Block block)\", and bitSize should be 4, 8 or 16.", - type.getName(), method.getName(), method.getName()); + logger.error("Unable to register extra block data: {} for {}.{}: should be \"public static" + + " boolean {}(Block block)\", and bitSize should be 4, 8 or 16.", + errorType, type.getName(), method.getName(), method.getName()); continue; } method.setAccessible(true); diff --git a/engine/src/main/java/org/terasology/engine/world/generator/internal/WorldGeneratorManager.java b/engine/src/main/java/org/terasology/engine/world/generator/internal/WorldGeneratorManager.java index f0413d8c131..832498c5a8e 100644 --- a/engine/src/main/java/org/terasology/engine/world/generator/internal/WorldGeneratorManager.java +++ b/engine/src/main/java/org/terasology/engine/world/generator/internal/WorldGeneratorManager.java @@ -64,8 +64,8 @@ public void refresh() { infos.add(new WorldGeneratorInfo(uri, annotation.displayName(), annotation.description())); logger.debug("{} added from {}", uri, generatorClass); } else { - logger.error("{} marked to be registered as a World Generator, " + - "but is not a subclass of WorldGenerator or lacks the correct constructor", generatorClass); + logger.error("{} marked to be registered as a World Generator, " + + "but is not a subclass of WorldGenerator or lacks the correct constructor", generatorClass); } } }