auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void setRemotePlayersHeldItemMountPointTranslations(@CommandParam("x") float x, @CommandParam("y") float y, @CommandParam("z") float z) { for (EntityRef remotePlayer : entityManager.getEntitiesWith(RemotePersonHeldItemMountPointComponent.class)) { RemotePersonHeldItemMountPointComponent remoteMountPointComponent = remotePlayer.getComponent(RemotePersonHeldItemMountPointComponent.class); START if (remoteMountPointComponent != null) { END remoteMountPointComponent.translate.set(x, y, z); } } } Very minor thing is that you *technically* don't need this check. The `entityManager.getEntitiesWith` ensures that they will have the component and thus you don't need to check if it is null.

Target:
public void setRemotePlayersHeldItemMountPointTranslations(@CommandParam("x") float x, @CommandParam("y") float y, @CommandParam("z") float z) { for (EntityRef remotePlayer : entityManager.getEntitiesWith(RemotePersonHeldItemMountPointComponent.class)) { RemotePersonHeldItemMountPointComponent remoteMountPointComponent = remotePlayer.getComponent(RemotePersonHeldItemMountPointComponent.class); remoteMountPointComponent.translate.set(x, y, z); } }
Source:
START void activateOwnedEntityAsClient(EntityRef usedOwnedEntity) { END if (!usedOwnedEntity.exists()) { return; } activateTargetOrOwnedEntity(usedOwnedEntity); } This is used in the ManualLabor module, causing a compile error

Target:
public void activateOwnedEntityAsClient(EntityRef usedOwnedEntity) { if (!usedOwnedEntity.exists()) { return; } activateTargetOrOwnedEntity(usedOwnedEntity); }
Source:
START HeadlessEnvironment(Name... modules) { END super(modules); } The removal here of `public` breaks the NameGenerator module - generally the `HeadlessEnvironment` is available for other things to use, an IDE might just not think it is in-use if you lack whatever module or facade in your workspace.

Target:
public HeadlessEnvironment(Name... modules) { super(modules); }
Source:
START private String getMouseButtonName() { END return button.getName(); } This and the other similar change in this class are also both API violations since access is being lessened. Again no apparent usages, but also no apparent need for the change :-)

Target:
public String getMouseButtonName() { return button.getName(); }
Source:
START private Vector3f getViewPosition(Vector3f out) { END ClientComponent clientComponent = getClientEntity().getComponent(ClientComponent.class); if (clientComponent == null) { return out; } LocationComponent location = clientComponent.camera.getComponent(LocationComponent.class); if (location == null) { return getPosition(); } return location.getWorldPosition(out); } Another access change API violation, same a little below. If not needed then lets not change it here :-)

Target:
public Vector3f getViewPosition(Vector3f out) { ClientComponent clientComponent = getClientEntity().getComponent(ClientComponent.class); if (clientComponent == null) { return out; } LocationComponent location = clientComponent.camera.getComponent(LocationComponent.class); if (location == null) { return getPosition(); } return location.getWorldPosition(out); }
Source:
public void enableWireframe() { boolean refreshTaskList = false; EnableFaceCulling faceCullingStateChange = new EnableFaceCulling(); START if (getDesiredStateChanges().contains(faceCullingStateChange)) { END removeDesiredStateChange(faceCullingStateChange); refreshTaskList = true; } if (!getDesiredStateChanges().contains(wireframeStateChange)) { addDesiredStateChange(wireframeStateChange); refreshTaskList = true; } if (refreshTaskList) { worldRenderer.requestTaskListRefresh(); } } Because EnableFaceCulling is added as a desired state in the constructor you can rely on the fact that when you enable wireframe it will be there. So, you don't need the IF statement to check for its presence. Also notice that in this case the IF statement would always evaluate to false, as you are creating a new EnableFaceCulling state change every time.

Target:
public void enableWireframe() { if (!getDesiredStateChanges().contains(wireframeStateChange)) { removeDesiredStateChange(faceCullingStateChange); addDesiredStateChange(wireframeStateChange); worldRenderer.requestTaskListRefresh(); } }
Source:
public Node removeNode(SimpleUri nodeUri) { Preconditions.checkNotNull(nodeUri, "nodeUri cannot be null!"); Node node = findNode(nodeUri); START if (!graph.nodes().contains(node)) { END throw new RuntimeException("Node removal failure: there is no '" + nodeUri + "' in the render graph!"); } if (graph.adjacentNodes(node).size() != 0) { throw new RuntimeException("Node removal failure: node '" + nodeUri + "' is still connected to other nodes in the render graph!"); } nodeMap.remove(nodeUri); return nodeMap.remove(nodeUri); } Let's remember to remove this check and check instead the result of findNode.

Target:
public Node removeNode(SimpleUri nodeUri) { Preconditions.checkNotNull(nodeUri, "nodeUri cannot be null!"); Node node = findNode(nodeUri); if (node == null) { throw new RuntimeException("Node removal failure: there is no '" + nodeUri + "' in the render graph!"); } if (graph.adjacentNodes(node).size() != 0) { throw new RuntimeException("Node removal failure: node '" + nodeUri + "' is still connected to other nodes in the render graph!"); } nodeMap.remove(nodeUri); return nodeMap.remove(nodeUri); }
Source:
public void onChunkLoaded(Vector3i chunkCoordinates) { if (renderableRegion.encompasses(chunkCoordinates)) { Chunk chunk = chunkProvider.getChunk(chunkCoordinates); START if (chunk == null) { END logger.warn("Warning: onChunkLoaded called for a null chunk!"); } else { chunksInProximityOfCamera.add(chunk); Collections.sort(chunksInProximityOfCamera, new ChunkFrontToBackComparator()); } } } Is this the most typical case? I would have thought most chunks aren't null and such I'd suggest flipping the if/else block.

Target:
public void onChunkLoaded(Vector3i chunkCoordinates) { if (renderableRegion.encompasses(chunkCoordinates)) { Chunk chunk = chunkProvider.getChunk(chunkCoordinates); if (chunk != null) { chunksInProximityOfCamera.add(chunk); Collections.sort(chunksInProximityOfCamera, new ChunkFrontToBackComparator()); } else { logger.warn("Warning: onChunkLoaded called for a null chunk!"); } } }
Source:
public String get() { SelectedInventorySlotComponent component = localPlayer.getCharacterEntity().getComponent(SelectedInventorySlotComponent.class); for (InventoryCell cell : findAll(InventoryCell.class)) { START if (cell.getTargetItem().getComponent(DisplayNameComponent.class) != null && cell.getTargetSlot() == component.slot) END return cell.getTargetItem().getComponent(DisplayNameComponent.class).name; } return ""; } Always always always brackets around ifs :D

Target:
public String get() { SelectedInventorySlotComponent component = localPlayer.getCharacterEntity().getComponent(SelectedInventorySlotComponent.class); for (InventoryCell cell : findAll(InventoryCell.class)) { if (cell.getTargetItem().getComponent(DisplayNameComponent.class) != null && cell.getTargetSlot() == component.slot) { return cell.getTargetItem().getComponent(DisplayNameComponent.class).name; } } return ""; }
Source:
public SetInputTextureFromFbo(int textureSlot, SimpleUri fboUri, FboTexturesTypes textureType, BaseFBOsManager fboManager, ResourceUrn materialUrn, String shaderParameterName) { this.textureSlot = textureSlot; this.textureType = textureType; this.fbo = fboManager.get(fboUri); this.materialUrn = materialUrn; this.shaderParameterName = shaderParameterName; this.material = getMaterial(materialUrn); propertyChange(null); // Cheeky way to initialise textureId START fboManager.subscribe(this); END } Shouldn't we subscribe to the POST_FBO_REGENERATION event here too?

Target:
public SetInputTextureFromFbo(int textureSlot, SimpleUri fboUri, FboTexturesTypes textureType, BaseFBOsManager fboManager, ResourceUrn materialUrn, String shaderParameterName) { this(textureSlot, fboManager.get(fboUri), textureType, fboManager, materialUrn, shaderParameterName); }
Source:
public void update() { if (screenGrabber.isTakingScreenshot()) { ScreenshotSize screenshotSize = renderingConfig.getScreenshotSize(); // TODO: Remove dependency on Display fullScale.setDimensions(screenshotSize.getWidth(Display.getWidth()), screenshotSize.getHeight(Display.getHeight())); regenerateFbos(); wasTakingScreenshotLastFrame = true; } else if (wasTakingScreenshotLastFrame) { updateFullScale(); regenerateFbos(); START wasTakingScreenshotLastFrame = false; END } } Hmmm. I'd prefer: ``` if (!isTakingScreenshot) <-- most frequent case if (wasTakingScreenshotLastFrame) <--- must be here unfortunately else // is taking a screenshot ```

Target:
public void update() { if (!screenGrabber.isTakingScreenshot()) { if (wasTakingScreenshotLastFrame) { updateFullScale(); regenerateFbos(); wasTakingScreenshotLastFrame = false; } } else { ScreenshotSize screenshotSize = renderingConfig.getScreenshotSize(); // TODO: Remove dependency on Display fullScale.setDimensions(screenshotSize.getWidth(Display.getWidth()), screenshotSize.getHeight(Display.getHeight())); regenerateFbos(); wasTakingScreenshotLastFrame = true; } }
Source:
public void update() { if (!screenGrabber.isTakingScreenshot()) { if (wasTakingScreenshotLastFrame) { ScreenshotSize screenshotSize = renderingConfig.getScreenshotSize(); // TODO: Remove dependency on Display fullScale.setDimensions(screenshotSize.getWidth(Display.getWidth()), screenshotSize.getHeight(Display.getHeight())); regenerateFbos(); START wasTakingScreenshotLastFrame = true; END } } else { updateFullScale(); regenerateFbos(); wasTakingScreenshotLastFrame = false; } } Shouldn't this line be swapped with the one in the ELSE block?

Target:
public void update() { if (!screenGrabber.isTakingScreenshot()) { if (wasTakingScreenshotLastFrame) { updateFullScale(); regenerateFbos(); wasTakingScreenshotLastFrame = false; } } else { ScreenshotSize screenshotSize = renderingConfig.getScreenshotSize(); // TODO: Remove dependency on Display fullScale.setDimensions(screenshotSize.getWidth(Display.getWidth()), screenshotSize.getHeight(Display.getHeight())); regenerateFbos(); wasTakingScreenshotLastFrame = true; } }
Source:
private void addOutputNodes(RenderGraph renderGraph) { Node outputToVRFrameBufferNode = new OutputToHMDNode(context); renderGraph.addNode(outputToVRFrameBufferNode, "outputToVRFrameBufferNode"); Node outputToScreenNode = new OutputToScreenNode(context); renderGraph.addNode(outputToScreenNode, "outputToScreenNode"); Node finalPostProcessingNode = renderGraph.findNode(new SimpleUri("engine:finalPostProcessingNode")); renderGraph.connect(finalPostProcessingNode, outputToVRFrameBufferNode); START renderGraph.connect(outputToVRFrameBufferNode, outputToScreenNode); END } According to the sketchboard.io graph the VR and Screen output nodes are in parallel, both being dependent on finalPostProcessingNode being processed before them.

Target:
private void addOutputNodes(RenderGraph renderGraph) { Node finalPostProcessingNode = renderGraph.findNode("engine:finalPostProcessingNode"); Node outputToVRFrameBufferNode = new OutputToHMDNode(context); renderGraph.addNode(outputToVRFrameBufferNode, "outputToVRFrameBufferNode"); renderGraph.connect(finalPostProcessingNode, outputToVRFrameBufferNode); Node outputToScreenNode = new OutputToScreenNode(context); renderGraph.addNode(outputToScreenNode, "outputToScreenNode"); renderGraph.connect(finalPostProcessingNode, outputToScreenNode); }
Source:
public void process() { PerformanceMonitor.startActivity("rendering/copyDepth"); // The way things are set-up right now, we can have FBOs that are not the same size as the display (if scale != 100%). // However, when drawing the final image to the screen, we always want the viewport to match the size of display, // and not that of some FBO. Hence, we are manually setting the viewport via glViewport over here. copyDepthMaterial.setFloat("zNear",activeCamera.getzNear(),true); START copyDepthMaterial.setFloat("zFar",activeCamera.getzFar(),true); END glViewport(0, 0, Display.getWidth(), Display.getHeight()); renderFullscreenQuad(); PerformanceMonitor.endActivity(); } I would have thought checkstyle would inform there should be spaces after the commas here. Did you configure it in your IntelliJ?

Target:
public void process() { PerformanceMonitor.startActivity("rendering/copyDepth"); renderFullscreenQuad(); PerformanceMonitor.endActivity(); }
Source:
public boolean equals(Object obj) { return (obj instanceof SetFboWriteMask) START && fbo == ((SetFboWriteMask) obj).fbo END && renderToColorBuffer == ((SetFboWriteMask) obj).renderToColorBuffer && renderToDepthBuffer == ((SetFboWriteMask) obj).renderToDepthBuffer && renderToLightBuffer == ((SetFboWriteMask) obj).renderToLightBuffer; } I'm wondering about this change. It closes the door to two FBOs having the same id GPU-side. Which is probably an unlikely if not impossible case within Terasology. But makes me wonder.

Target:
public boolean equals(Object obj) { return (obj instanceof SetFboWriteMask) && fbo.equals(((SetFboWriteMask) obj).fbo) && renderToColorBuffer == ((SetFboWriteMask) obj).renderToColorBuffer && renderToDepthBuffer == ((SetFboWriteMask) obj).renderToDepthBuffer && renderToLightBuffer == ((SetFboWriteMask) obj).renderToLightBuffer; }
Source:
public EntityRef create(String prefabName, Vector3f position) { if (prefabName != null && !prefabName.isEmpty()) { START Prefab prefab = entityManager.getPrefabManager().getPrefab(prefabName); END return create(prefab, position); } return create(); } Above in line 103 you check for the prefab to not being `null`, but here the check is missing.

Target:
public EntityRef create(String prefabName, Vector3f position) { return create(prefabName, position, null); }
Source:
private void destroy(EntityRef ref) { // Don't allow the destruction of unloaded entities. long entityId = ref.getId(); entityStore.remove(entityId); entityManager.remove(entityId); START if (ref instanceof PojoEntityRef) { END ((PojoEntityRef) ref).invalidate(); } componentStore.remove(entityId); } Can we get around this `instanceof` somehow? Should it be generally possible to invalidate EntityRef?

Target:
private void destroy(EntityRef ref) { // Don't allow the destruction of unloaded entities. long entityId = ref.getId(); entityStore.remove(entityId); entityManager.remove(entityId); ref.invalidate(); componentStore.remove(entityId); }
Source:
private static boolean posixSystemIs64() throws IOException, InterruptedException { Process unameProc = new ProcessBuilder("uname", "-m").start(); START BufferedReader unameStdout = new BufferedReader(new InputStreamReader(unameProc.getInputStream())); END unameProc.waitFor(); boolean result = unameStdout.readLine().endsWith("64"); unameStdout.close(); return result; } you could use the try-with-ressources statement here.

Target:
private static boolean posixSystemIs64() throws IOException, InterruptedException { Process unameProc = new ProcessBuilder("uname", "-m").start(); unameProc.waitFor(); try (BufferedReader unameStdout = new BufferedReader(new InputStreamReader(unameProc.getInputStream()))) { return unameStdout.readLine().endsWith("64"); } }
Source:
public boolean equals(Object obj) { START return (obj instanceof DisableDepthWriting) && this.enabled == ((DisableDepthWriting) obj).enabled; END } This is an example of changes where you kind of go off track. I appreciate when you see something you don't like you want to change it right away. But from a structuring-the-PR point of view you should keep a commit focused on a particular goal and note down unnecessary changes for a further commit.

Target:
public boolean equals(Object obj) { return (obj instanceof DisableDepthWriting); }
Source:
public void process() { if (material == null) { shaderManager.disableShader(); START } else { END material.enable(); } } Hmmm. The process() method should be as lean as possible. This calls for a DisableMaterial() class to be used as default instance, in which the process method is just `shaderManager.disableShader();`

Target:
public void process() { material.enable(); }
Source:
public void update() { START FBO ssaoFbo = displayResolutionDependentFBOs.get(SSAO_FBO); END outputFboWidth = ssaoFbo.width(); outputFboHeight = ssaoFbo.height(); } We discussed this already, but please remind me: update() is executed, for example, when the user resize the window. Why not to avoid any form of memory allocation in those circumstances, even if it's admittedly small in this case?

Target:
public void update() { ssaoFbo = displayResolutionDependentFBOs.get(SSAO_FBO); outputFboWidth = ssaoFbo.width(); outputFboHeight = ssaoFbo.height(); }
Source:
public CopyImageToScreenNode(Context context) { WorldRenderer worldRenderer = context.get(WorldRenderer.class); displayResolutionDependentFBOs = context.get(DisplayResolutionDependentFBOs.class); START requiresCondition(() -> worldRenderer.getCurrentRenderStage() == MONO || worldRenderer.getCurrentRenderStage() == LEFT_EYE); END addDesiredStateChange(new BindFBO(DEFAULT_FBO, displayResolutionDependentFBOs)); update(); // Cheeky way to initialise sceneFinalFbo displayResolutionDependentFBOs.subscribe(this); addDesiredStateChange(new EnableMaterial(DEFAULT_TEXTURED_MATERIAL)); } Can this line be placed just under the worldRenderer variable assignment?

Target:
public CopyImageToScreenNode(Context context) { super(context); WorldRenderer worldRenderer = context.get(WorldRenderer.class); requiresCondition(() -> worldRenderer.getCurrentRenderStage() == MONO || worldRenderer.getCurrentRenderStage() == LEFT_EYE); displayResolutionDependentFBOs = context.get(DisplayResolutionDependentFBOs.class); addDesiredStateChange(new BindFBO(DEFAULT_FBO, displayResolutionDependentFBOs)); update(); // Cheeky way to initialise sceneFinalFbo displayResolutionDependentFBOs.subscribe(this); addDesiredStateChange(new EnableMaterial(DEFAULT_TEXTURED_MATERIAL)); }
Source:
public CopyImageToScreenNode(Context context) { START displayResolutionDependentFBOs = context.get(DisplayResolutionDependentFBOs.class); END WorldRenderer worldRenderer = context.get(WorldRenderer.class); requiresCondition(() -> worldRenderer.getCurrentRenderStage() == MONO || worldRenderer.getCurrentRenderStage() == LEFT_EYE); addDesiredStateChange(new BindFBO(DEFAULT_FBO, displayResolutionDependentFBOs)); update(); // Cheeky way to initialise sceneFinalFbo displayResolutionDependentFBOs.subscribe(this); addDesiredStateChange(new EnableMaterial(DEFAULT_TEXTURED_MATERIAL)); } Let's move this line to just before the first addDesiredStateChange line.

Target:
public CopyImageToScreenNode(Context context) { super(context); WorldRenderer worldRenderer = context.get(WorldRenderer.class); requiresCondition(() -> worldRenderer.getCurrentRenderStage() == MONO || worldRenderer.getCurrentRenderStage() == LEFT_EYE); displayResolutionDependentFBOs = context.get(DisplayResolutionDependentFBOs.class); addDesiredStateChange(new BindFBO(DEFAULT_FBO, displayResolutionDependentFBOs)); update(); // Cheeky way to initialise sceneFinalFbo displayResolutionDependentFBOs.subscribe(this); addDesiredStateChange(new EnableMaterial(DEFAULT_TEXTURED_MATERIAL)); }
Source:
public void initialise() { requiresCondition(() -> worldRenderer.getCurrentRenderStage() == MONO || worldRenderer.getCurrentRenderStage() == LEFT_EYE); addDesiredStateChange(new BindFBO(DEFAULT_FRAME_BUFFER_URN, displayResolutionDependentFBOs)); update(); addDesiredStateChange(new EnableMaterial("engine:prog.defaultTextured")); START displayResolutionDependentFBOs.subscribe(this); END } Move up, please.

Target:
public void initialise() { requiresCondition(() -> worldRenderer.getCurrentRenderStage() == MONO || worldRenderer.getCurrentRenderStage() == LEFT_EYE); addDesiredStateChange(new BindFBO(DEFAULT_FRAME_BUFFER_URN, displayResolutionDependentFBOs)); update(); // Cheeky way to initialise sceneFinalFbo displayResolutionDependentFBOs.subscribe(this); addDesiredStateChange(new EnableMaterial("engine:prog.defaultTextured")); }
Source:
public void initialise() { playerCamera = worldRenderer.getActiveCamera(); addDesiredStateChange(new EnableMaterial(LIGHT_GEOMETRY_MATERIAL.toString())); lightGeometryMaterial = getMaterial(LIGHT_GEOMETRY_MATERIAL); addDesiredStateChange(new DisableDepthTest()); addDesiredStateChange(new EnableBlending()); addDesiredStateChange(new SetBlendFunction(GL_ONE, GL_ONE_MINUS_SRC_COLOR)); addDesiredStateChange(new BindFBO(READONLY_GBUFFER, displayResolutionDependentFBOs)); update(); initMainDirectionalLight(); START displayResolutionDependentFBOs.subscribe(this); END } Move up please.

Target:
public void initialise() { playerCamera = worldRenderer.getActiveCamera(); addDesiredStateChange(new EnableMaterial(LIGHT_GEOMETRY_MATERIAL.toString())); lightGeometryMaterial = getMaterial(LIGHT_GEOMETRY_MATERIAL); addDesiredStateChange(new DisableDepthTest()); addDesiredStateChange(new EnableBlending()); addDesiredStateChange(new SetBlendFunction(GL_ONE, GL_ONE_MINUS_SRC_COLOR)); addDesiredStateChange(new BindFBO(READONLY_GBUFFER, displayResolutionDependentFBOs)); update(); // Cheeky way to initialise readOnlyGBufferFbo displayResolutionDependentFBOs.subscribe(this); initMainDirectionalLight(); }
Source:
public void initialise() { wireframeStateChange = new SetWireframe(true); renderingDebugConfig = config.getRendering().getDebug(); new WireframeTrigger(renderingDebugConfig, this); playerCamera = worldRenderer.getActiveCamera(); addDesiredStateChange(new LookThrough(playerCamera)); addDesiredStateChange(new SetViewportToSizeOf(READONLY_GBUFFER, displayResolutionDependentFBOs)); addDesiredStateChange(new BindFBO(READONLY_GBUFFER, displayResolutionDependentFBOs)); update(); START displayResolutionDependentFBOs.subscribe(this); END } Let's move this up please.

Target:
public void initialise() { wireframeStateChange = new SetWireframe(true); renderingDebugConfig = config.getRendering().getDebug(); new WireframeTrigger(renderingDebugConfig, this); playerCamera = worldRenderer.getActiveCamera(); addDesiredStateChange(new LookThrough(playerCamera)); addDesiredStateChange(new BindFBO(READONLY_GBUFFER, displayResolutionDependentFBOs)); }
Source:
public void initialise() { playerCamera = worldRenderer.getActiveCamera(); addDesiredStateChange(new LookThrough(playerCamera)); refractiveReflectiveFbo = requiresFBO(new FBOConfig(REFRACTIVE_REFLECTIVE, FULL_SCALE, FBO.Type.HDR).useNormalBuffer(), displayResolutionDependentFBOs); addDesiredStateChange(new BindFBO(REFRACTIVE_REFLECTIVE, displayResolutionDependentFBOs)); START readOnlyGBufferFbo = displayResolutionDependentFBOs.get(READONLY_GBUFFER); END addDesiredStateChange(new EnableMaterial(CHUNK_SHADER.toString())); chunkShader = getMaterial(CHUNK_SHADER); displayResolutionDependentFBOs.subscribe(this); } Do we need this line here? readOnlyGBufferFbo seems to be used only in update(), where it is refetched.

Target:
public void initialise() { playerCamera = worldRenderer.getActiveCamera(); addDesiredStateChange(new LookThrough(playerCamera)); requiresFBO(new FBOConfig(REFRACTIVE_REFLECTIVE, FULL_SCALE, FBO.Type.HDR).useNormalBuffer(), displayResolutionDependentFBOs); addDesiredStateChange(new BindFBO(REFRACTIVE_REFLECTIVE, displayResolutionDependentFBOs)); update(); // Cheeky way to initialise readOnlyGBufferFbo, refractiveReflectiveFbo displayResolutionDependentFBOs.subscribe(this); addDesiredStateChange(new EnableMaterial(CHUNK_SHADER.toString())); chunkShader = getMaterial(CHUNK_SHADER); }
Source:
public boolean isBound(Input newInput) { START return data.containsValue(newInput) && newInput != null; END } This is a minor nitpick, but a "newInput != null; && data.containsValue(newInput)" will be much more efficient when newInput is null, because of the most programming languages handle AND (using short circuit logic).

Target:
public boolean isBound(Input newInput) { return newInput != null && data.containsValue(newInput) ; }
Source:
public void process() { PerformanceMonitor.startActivity("rendering/backdrop"); FBO sceneOpaqueFbo = displayResolutionDependentFBOs.get(new ResourceUrn("engine:sceneOpaque")); START sceneOpaqueFbo.bind(); // TODO: remove when we can bind this via a StateChange END sceneOpaqueFbo.setRenderBufferMask(true, false, false); glCallList(skySphere); // Draws the skysphere sceneOpaqueFbo.setRenderBufferMask(true, true, true); // TODO: handle these via new StateChange to be created PerformanceMonitor.endActivity(); } Same as above, let's not instantiate the FBO within process and let's try to use BindFBO in initialize() instead of this bind() line.

Target:
public void process() { PerformanceMonitor.startActivity("rendering/backdrop"); sceneOpaqueFbo.bind(); // TODO: remove when we can bind this via a StateChange sceneOpaqueFbo.setRenderBufferMask(true, false, false); glCallList(skySphere); // Draws the skysphere sceneOpaqueFbo.setRenderBufferMask(true, true, true); // TODO: handle these via new StateChange to be created PerformanceMonitor.endActivity(); }
Source:
public FBOConfig getFboConfig(ResourceUrn fboName) { FBOConfig fboConfig = fboConfigs.get(fboName); START if (fboConfigs == null) { END logger.error("Failed to retrieve FBOConfig '" + fboName + "'!"); } return fboConfig; } `fboConfig` I presume - without the s

Target:
public FBOConfig getFboConfig(ResourceUrn fboName) { FBOConfig fboConfig = fboConfigs.get(fboName); if (fboConfig == null) { logger.warn("Failed to retrieve FBOConfig '" + fboName + "'!"); } return fboConfig; }
Source:
public void process() { PerformanceMonitor.startActivity("rendering/applyDeferredLighting"); sceneOpaquePingPongFbo.bind(); // TODO: remove and replace with a state change sceneOpaquePingPongFbo.setRenderBufferMask(true, true, true); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // TODO: this is necessary - but why? Verify in the shader. renderFullscreenQuad(); START displayResolutionDependentFBOs.swapReadWriteBuffers(); // Doesn't exactly help with a lean process() function.. END sceneOpaqueFbo.attachDepthBufferTo(refractiveReflectiveFbo); PerformanceMonitor.endActivity(); } Actually, I just wrote issue #2828 about it.

Target:
public void process() { PerformanceMonitor.startActivity("rendering/applyDeferredLighting"); sceneOpaquePingPongFbo.bind(); // TODO: remove and replace with a state change sceneOpaquePingPongFbo.setRenderBufferMask(true, true, true); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // TODO: this is necessary - but why? Verify in the shader. renderFullscreenQuad(); displayResolutionDependentFBOs.swapReadWriteBuffers(); PerformanceMonitor.endActivity(); }
Source:
START private String getMaterialName() { END return materialName; } Why this change?

Target:
public String getMaterialName() { return materialName; }
Source:
private FBO getFbo() { if (defaultDynamicFBO == null) return frameBuffersManager.get(fboName); START return defaultDynamicFBO.getFbo(); END } A ternary statement is fine here.

Target:
private FBO getFbo() { return defaultDynamicFBO != null ? defaultDynamicFBO.getFbo() : frameBuffersManager.get(fboName); }
Source:
ViewDistance(String displayName, int index, Vector3i chunkDistance) { START this.displayName = String.format(displayName + " (%1$dx%2$dx%3$d)", chunkDistance.getX(), chunkDistance.getY(), chunkDistance.getZ()); END this.index = index; this.chunkDistance = chunkDistance; } 1. Instead of assigning a different value to `displayName` in the constructor, please return this formatted string in the `toString()` method. This is because we might want to use the original `displayName` for purposes such as internal log output. 2. Since you're using `String.format()`, `displayName` should be made part of the format string for consistency - i.e. ```java String.format("%s (%1$dx%2$dx%3$d)", displayName /* , ... */); ```

Target:
ViewDistance(String displayName, int index, Vector3i chunkDistance) { this.displayName = displayName; this.index = index; this.chunkDistance = chunkDistance; }
Source:
public void setButtonData(UIInputBind bindButton) { this.bindButton = bindButton; String messageText = "Key " + bindButton.getNewInput().getDisplayName() + " has already been assigned an action. Press ok to change anyway."; START find("title", UILabel.class).setText("Rebinding"); END find("message", UILabel.class).setText(messageText); } Since the label text is static, you can set it in `confirmChangePopup.ui` instead. (`"text": "Rebinding` instead of `"text": "Title"`)

Target:
public void setButtonData(UIInputBind bindButton) { this.bindButton = bindButton; String messageText = "Key " + bindButton.getNewInput().getDisplayName() + " has already been assigned an action. Press ok to change anyway."; find("message", UILabel.class).setText(messageText); }
Source:
public void refresh() { START logger.info("Refresh"); END ServerInfo i = visibleList.getSelection(); visibleList.setSelection(null); extInfo.clear(); visibleList.setSelection(i); } I'd either remove this message or expand on it a bit (i.e. "Refreshing info for server X").

Target:
public void refresh() { ServerInfo i = visibleList.getSelection(); visibleList.setSelection(null); extInfo.clear(); visibleList.setSelection(i); }
Source:
public void submitFrame() { if (vrCompositor == null) { return; } if (vrCompositor.Submit == null) { return; START } END for (int nEye = 0; nEye < 2; nEye++) { vrCompositor.Submit.apply( nEye, texType[nEye], null, JOpenVRLibrary.EVRSubmitFlags.EVRSubmitFlags_Submit_Default); } if (vrCompositor.PostPresentHandoff != null) { vrCompositor.PostPresentHandoff.apply(); } } About the previous IF blocks: why these checks? By the time submitFrame() is called, can't we be reasonably certain we have everything needed? This also applies to the PostPresentHandOff IF block below.

Target:
public void submitFrame() { for (int nEye = 0; nEye < 2; nEye++) { vrCompositor.Submit.apply( nEye, texType[nEye], null, JOpenVRLibrary.EVRSubmitFlags.EVRSubmitFlags_Submit_Default); } if (vrCompositor.PostPresentHandoff != null) { vrCompositor.PostPresentHandoff.apply(); } }
Source:
private void preRenderSetupSimpleBlendMaterials() { START dynamicFBOsManager.get(DefaultDynamicFBOs.READ_ONLY_GBUFFER.getName()).setRenderBufferMask(true, true, true); END GL11.glEnable(GL_BLEND); GL11.glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // (*) GL11.glDepthMask(false); // (*) In this context SRC is Foreground. This effectively says: // Resulting RGB = ForegroundRGB * ForegroundAlpha + BackgroundRGB * (1 - ForegroundAlpha) // Which might still look complicated, but it's actually the most typical alpha-driven composite. // A neat tool to play with this settings can be found here: http://www.andersriggelsen.dk/glblendfunc.php } This should become: ` READ_ONLY_GBUFFER.setRenderBufferMask(true, true, true);`

Target:
private void preRenderSetupSimpleBlendMaterials() { READ_ONLY_GBUFFER.setRenderBufferMask(true, true, true); GL11.glEnable(GL_BLEND); GL11.glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // (*) GL11.glDepthMask(false); // (*) In this context SRC is Foreground. This effectively says: // Resulting RGB = ForegroundRGB * ForegroundAlpha + BackgroundRGB * (1 - ForegroundAlpha) // Which might still look complicated, but it's actually the most typical alpha-driven composite. // A neat tool to play with this settings can be found here: http://www.andersriggelsen.dk/glblendfunc.php }
Source:
public SetFacesToCull(int mode) { START if (mode != GL_BACK END && mode != GL_FRONT && mode != GL_FRONT_AND_BACK) { throw new IllegalArgumentException("Mode must be GL_BACK, GL_FRONT or GL_FRONT_AND_BACK."); } this.mode = mode; } What happened here? Why did you revert to individual checks instead of checking against the map? In any case you should reverse the handling of this IF block. The current true case is the least likely to happen.

Target:
public SetFacesToCull(int mode) { if (mode == GL_BACK || mode == GL_FRONT || mode == GL_FRONT_AND_BACK) { this.mode = mode; } else { throw new IllegalArgumentException("Mode must be GL_BACK, GL_FRONT or GL_FRONT_AND_BACK."); } }
Source:
public void process() { PerformanceMonitor.startActivity("rendering/prePostComposite"); START sceneReflectiveRefractive = displayResolutionDependentFBOs.get(REFLECTIVE_REFRACTIVE); END glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // TODO: verify this is necessary renderFullscreenQuad(); bindDisplay(); // TODO: verify this is necessary setViewportToSizeOf(READ_ONLY_GBUFFER); // TODO: verify this is necessary displayResolutionDependentFBOs.swapReadWriteBuffers(); READ_ONLY_GBUFFER.attachDepthBufferTo(sceneReflectiveRefractive); // TODO: verify why we can't move the buffer attachment to before the swap by using WRITE_ONLY_GBUFFER instead. // TODO: See right-side streaks in https://cloud.githubusercontent.com/assets/136392/17794231/456f542a-65b6-11e6-83bb-f2cc3f10ee66.png PerformanceMonitor.endActivity(); } Can we move this line to just above READ_ONLY_GBUFFER.attachDepthBufferTo?

Target:
public void process() { PerformanceMonitor.startActivity("rendering/prePostComposite"); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // TODO: verify this is necessary renderFullscreenQuad(); displayResolutionDependentFBOs.swapReadWriteBuffers(); sceneReflectiveRefractive = displayResolutionDependentFBOs.get(REFLECTIVE_REFRACTIVE); READ_ONLY_GBUFFER.attachDepthBufferTo(sceneReflectiveRefractive); // TODO: verify why we can't move the buffer attachment to before the swap by using WRITE_ONLY_GBUFFER instead. // TODO: See right-side streaks in https://cloud.githubusercontent.com/assets/136392/17794231/456f542a-65b6-11e6-83bb-f2cc3f10ee66.png PerformanceMonitor.endActivity(); }
Source:
public void process() { PerformanceMonitor.startActivity("rendering/outline"); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // TODO: verify this is necessary renderFullscreenQuad(); START bindDisplay(); // TODO: verify this is necessary END PerformanceMonitor.endActivity(); } I'm pretty sure we can remove this now. If necessary the default state change task will do it. Just verify enabling/disabling the outline still works ok.

Target:
public void process() { PerformanceMonitor.startActivity("rendering/outline"); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // TODO: verify this is necessary renderFullscreenQuad(); PerformanceMonitor.endActivity(); }
Source:
public BindFBO(String fboName) { this.fboName = fboName; START if (fboName.equals(DEFAULT_FRAME_BUFFER_NAME)) { END fboId = DEFAULT_FRAME_BUFFER_ID; } else { fboId = frameBuffersManager.getFBO(fboName).fboId; } } I think the most likely case is that fboName is not the default frame buffer. But it's a very minor issue, so let's leave it as it is.

Target:
public BindFBO(String fboName) { this.fboName = fboName; }
Source:
public SetViewportSizeOf(String fboName) { this.fboName = fboName; if (!fboName.equals(DEFAULT_FBO)) { fbo = frameBuffersManager.getFBO(fboName); START } END } I'm not sure about this IF block. Why do we need it? Can we just store only the fboName and then get the fbo itself only when we need it?

Target:
public SetViewportSizeOf(String fboName) { this.fboName = fboName; }
Source:
public BindFBO(String fboName) { this.fboName = fboName; if (!fboName.equals(DEFAULT_FRAME_BUFFER_NAME)) { fboId = frameBuffersManager.getFBO(fboName).fboId; } else { START fboId = DEFAULT_FRAME_BUFFER_ID; END } } That been said, I just reviewed the rest of this PR and apart from these issues I couldn't find any other problem. So, we are almost there with this one too. :smiley:

Target:
public BindFBO(String fboName) { this.fboName = fboName; }
Source:
public String addNode(Node node, String suggestedId) { nodes.add(node); START return null; // TODO: for instance if "blur" present make id "blur1" and return it END } I'd return suggestedId for the time being, but if you have reasons to keep it this way for the time being I'd be ok with it.

Target:
public String addNode(Node node, String suggestedId) { nodes.add(node); return suggestedId; // TODO: for instance if "blur" present make id "blur1" and return it }
Source:
public void process() { START PerformanceMonitor.startActivity("rendering/ambientocclusionpasses"); END if (renderingConfig.isSsao()) { // TODO: consider moving these into initialise without breaking existing implementation sceneOpaque = frameBuffersManager.getFBO("sceneOpaque"); ssaoBlurredFBO = frameBuffersManager.getFBO("ssaoBlurred"); ssaoFBO = frameBuffersManager.getFBO("ssao"); generateSSAO(); generateBlurredSSAO(); } PerformanceMonitor.endActivity(); } I'd say that PerformanceMonitor statements should be within the IF block, so that if something is disabled it doesn't get monitored.

Target:
public void process() { if (renderingConfig.isSsao()) { PerformanceMonitor.startActivity("rendering/ambientocclusionpasses"); // TODO: consider moving these into initialise without breaking existing implementation sceneOpaque = frameBuffersManager.getFBO("sceneOpaque"); ssaoBlurredFBO = frameBuffersManager.getFBO("ssaoBlurred"); ssaoFBO = frameBuffersManager.getFBO("ssao"); generateSSAO(); generateBlurredSSAO(); PerformanceMonitor.endActivity(); } }
Source:
public void process() { PerformanceMonitor.startActivity("rendering/chunksrefractivereflective"); START boolean isHeadUnderWater = worldRenderer.isHeadUnderWater(); END preRenderSetupSceneReflectiveRefractive(isHeadUnderWater); worldRenderer.renderChunks(renderQueues.chunksAlphaBlend, ChunkMesh.RenderPhase.REFRACTIVE, playerCamera, WorldRendererImpl.ChunkRenderMode.DEFAULT); postRenderCleanupSceneReflectiveRefractive(isHeadUnderWater); PerformanceMonitor.endActivity(); } Let's make this boolean a private variable please.

Target:
public void process() { PerformanceMonitor.startActivity("rendering/chunksrefractivereflective"); // TODO: Eliminate this assignment isHeadUnderWater = worldRenderer.isHeadUnderWater(); preRenderSetupSceneReflectiveRefractive(); worldRenderer.renderChunks(renderQueues.chunksAlphaBlend, ChunkMesh.RenderPhase.REFRACTIVE, playerCamera, WorldRendererImpl.ChunkRenderMode.DEFAULT); postRenderCleanupSceneReflectiveRefractive(); PerformanceMonitor.endActivity(); }
Source:
START public void setTime(Time t) END { time = t; } Might this be a valid spot to use package private level access instead of public? Since the test is in the same package just under engine-tests? Can't entirely recall if it works that way.

Target:
void setTime(Time t) { time = t; }
Source:
public void test1DelayedAction() { ArbritaryDelayActionComponent a1 = new ArbritaryDelayActionComponent(); a1.value = 3; vals = new ArrayList<Integer>(Arrays.asList(3)); long currentTime = time.getGameTimeInMs(); START delayedActionSystem.addDelayedAction(createFakeEntityWith(a1), END "Blah Blah", ((currentTime + 1000) - currentTime)); nextFakeEntityId++; } I don't think you need a line break here. 120ish chars is OK.

Target:
public void test1DelayedAction() { ArbritaryDelayActionComponent a1 = new ArbritaryDelayActionComponent(); a1.value = 3; vals = new ArrayList<Integer>(Arrays.asList(3)); delayedActionSystem.addDelayedAction(createFakeEntityWith(a1), "Blah Blah", ((time.getGameTimeInMs() + 1000) - time.getGameTimeInMs())); nextFakeEntityId++; }
Source:
public float getInterpolation(float v) { START return (float) Math.pow(v, factor) * (end - start) + start; END } Linear acceleration is always quadratic in terms of position (i.e. the interpolated value). I suggest using a multiplicate factor instead. This would also avoid the comparatively costly call to `Math.pow()`.

Target:
public float getInterpolation(float v) { return (float) v * v; }
Source:
START void ensureCameraEntityCreated() { END if (!localPlayer.getCameraEntity().exists()) { ClientComponent clientComponent = localPlayer.getClientEntity().getComponent(ClientComponent.class); EntityBuilder builder = entityManager.newBuilder("engine:camera"); builder.setPersistent(false); clientComponent.camera = builder.build(); localPlayer.getClientEntity().saveComponent(clientComponent); mountCamera(); } } Is this method intentionally package-private?

Target:
private void ensureCameraEntityCreated() { if (!localPlayer.getCameraEntity().exists()) { ClientComponent clientComponent = localPlayer.getClientEntity().getComponent(ClientComponent.class); // create the camera from the prefab EntityBuilder builder = entityManager.newBuilder("engine:camera"); builder.setPersistent(false); clientComponent.camera = builder.build(); localPlayer.getClientEntity().saveComponent(clientComponent); } }
Source:
public Set<Name> suggest(EntityRef sender, Object... resolvedParameters) { Collection<ConsoleCommand> commands = console.getCommands(); Set<Name> suggestions = Sets.newHashSetWithExpectedSize(commands.size()); START suggestions.addAll(commands.stream().map(ConsoleCommand::getName).collect(Collectors.toList())); END return suggestions; } I find the original version easier to read in this case.

Target:
public Set<Name> suggest(EntityRef sender, Object... resolvedParameters) { Collection<ConsoleCommand> commands = console.getCommands(); Set<Name> suggestions = Sets.newHashSetWithExpectedSize(commands.size()); for (ConsoleCommand command : commands) { suggestions.add(command.getName()); } return suggestions; }
Source:
private void destroyClientTempEntities(AbstractMoveItemRequest removedRequest) { START removedRequest.getClientSideTempEntities().stream().filter(tempEntity -> tempEntity.exists()).forEach(EntityRef::destroy); END } I find the original version easier to read in this case.

Target:
private void destroyClientTempEntities(AbstractMoveItemRequest removedRequest) { for (EntityRef tempEntity : removedRequest.getClientSideTempEntities()) { if (tempEntity.exists()) { tempEntity.destroy(); } } }
Source:
public static synchronized List<SingleThreadMonitor> getThreadMonitors(List<SingleThreadMonitor> output, boolean aliveThreadsOnly) { Preconditions.checkNotNull(output, "The parameter 'output' must not be null"); output.clear(); START output.addAll(THREAD_INFO_BY_ID.values().stream().filter(entry -> !aliveThreadsOnly || entry.isAlive()).collect(Collectors.toList())); END return output; } I find the original version easier to read in this case.

Target:
public static synchronized List<SingleThreadMonitor> getThreadMonitors(List<SingleThreadMonitor> output, boolean aliveThreadsOnly) { Preconditions.checkNotNull(output, "The parameter 'output' must not be null"); output.clear(); for (SingleThreadMonitor entry : THREAD_INFO_BY_ID.values()) { if (!aliveThreadsOnly || entry.isAlive()) { output.add(entry); } } return output; }
Source:
public void deserializeOnto(Object target, Map<FieldMetadata<?, ?>, PersistedData> values, DeserializationContext context, DeserializeFieldCheck check) { START values.entrySet().stream().filter(field -> check.shouldDeserialize(classMetadata, field.getKey())).forEach(field -> { END deserializeOnto(target, field.getKey(), field.getValue(), context); }); } I'd go with the original version, because I find it easier to read and it's called very often.

Target:
public void deserializeOnto(Object target, Map<FieldMetadata<?, ?>, PersistedData> values, DeserializationContext context, DeserializeFieldCheck check) { for (Map.Entry<FieldMetadata<?, ?>, PersistedData> field : values.entrySet()) { if (check.shouldDeserialize(classMetadata, field.getKey())) { deserializeOnto(target, field.getKey(), field.getValue(), context); } } }
Source:
public PersistedData serializeCollection(Collection<T> value, SerializationContext context) { List<PersistedData> rawList = Lists.newArrayList(); START rawList.addAll(value.stream().map(item -> serialize(item, context)).collect(Collectors.toList())); END return context.create(rawList); } I'd go with the original version, because I find it easier to read and it's called very often.

Target:
public PersistedData serializeCollection(Collection<T> value, SerializationContext context) { List<PersistedData> rawList = Lists.newArrayList(); for (T item : value) { rawList.add(serialize(item, context)); } return context.create(rawList); }
Source:
public static void initialize(Path logFileFolder) { String timestamp = TIMESTAMP_FORMAT.format(new Date()); loggingPath = logFileFolder.resolve(timestamp).normalize(); String pathString = loggingPath.toString(); System.setProperty(LOG_FILE_FOLDER, pathString); try { START deleteLogFiles(logFileFolder, ((int) Duration.ofDays(5).getSeconds())); END } catch (IOException e) { e.printStackTrace(); } // Unfortunately, setting context-based variables works only after initialization // has completed. Manual initialization will work but is overriden by the first // (static) access to slf4j's StaticLoggerBinder. // This default initialization will attempt to create a folder "logFileFolder_IS_UNDEFINED" though. // TODO: file a report at logback/slf4j // LoggerContext context = new LoggerContext(); // context.setName(CoreConstants.DEFAULT_CONTEXT_NAME); // context.putProperty("targetFolder", pathString); // JoranConfigurator configurator = new JoranConfigurator(); // configurator.setContext(context); // // try { // ContextInitializer ci = new ContextInitializer(context); // ci.autoConfig(); // } catch (JoranException e) { // e.printStackTrace(); // } } Maybe `deleteLogFiles` could take a `long` parameter? This could avoid the need to downcast without reason.

Target:
public static void initialize(Path logFileFolder) { String timestamp = TIMESTAMP_FORMAT.format(new Date()); loggingPath = logFileFolder.resolve(timestamp).normalize(); String pathString = loggingPath.toString(); System.setProperty(LOG_FILE_FOLDER, pathString); try { deleteLogFiles(logFileFolder, Duration.ofDays(5).getSeconds()); } catch (IOException e) { e.printStackTrace(); } // Unfortunately, setting context-based variables works only after initialization // has completed. Manual initialization will work but is overriden by the first // (static) access to slf4j's StaticLoggerBinder. // This default initialization will attempt to create a folder "logFileFolder_IS_UNDEFINED" though. // TODO: file a report at logback/slf4j // LoggerContext context = new LoggerContext(); // context.setName(CoreConstants.DEFAULT_CONTEXT_NAME); // context.putProperty("targetFolder", pathString); // JoranConfigurator configurator = new JoranConfigurator(); // configurator.setContext(context); // // try { // ContextInitializer ci = new ContextInitializer(context); // ci.autoConfig(); // } catch (JoranException e) { // e.printStackTrace(); // } }
Source:
public static <T, U extends T> U put(Class<T> type, U object) { START if (context == null) END return null; context.put(type, object); return object; } Brackets please - part of our code convention to always use them :-)

Target:
public static <T, U extends T> U put(Class<T> type, U object) { if (context == null) { return null; } context.put(type, object); return object; }
Source:
public Prefab getPrefab(String name) { if (!name.isEmpty()) { START Preconditions.checkArgument(!Strings.isNullOrEmpty(name)); END return assetManager.getAsset(name, Prefab.class).orElse(null); } return null; } Uh, you would put this inside an `if(!name.isEmpty())` block? I would have just put `Preconditions.checkNotNull` on the outside, since name should not be null.

Target:
public Prefab getPrefab(String name) { if (Strings.isNullOrEmpty(name)) { return null; } return assetManager.getAsset(name, Prefab.class).orElse(null); }
Source:
public boolean exists(String name) { START Preconditions.checkArgument(!Strings.isNullOrEmpty(name)); END return assetManager.getAsset(name, Prefab.class).isPresent(); } I would argue it is ok if name is empty, so the contract can be loosened a little.

Target:
public boolean exists(String name) { if (Strings.isNullOrEmpty(name)) { return false; } return assetManager.getAsset(name, Prefab.class).isPresent(); }
Source:
public ScreenshotFormat get() { switch (config.getScreenshotFormat()) { START case PNG: END return PNG; case JPEG: return JPEG; default: return PNG; } } This seems a bit odd.... why not just check return the format unless null, and return the default value in that case?

Target:
public ScreenshotFormat get() { if(config.getScreenshotFormat() != null) { return config.getScreenshotFormat(); } else { return ScreenshotFormat.PNG; } }
Source:
public AssetUri getPrefabURI() { if (exists()) { EntityInfoComponent info = getComponent(EntityInfoComponent.class); START if (info != null && !info.parentPrefab.exists()) { END return new AssetUri(AssetType.PREFAB, info.parentPrefab.getName()); } } return null; } This doesn't look right, should the `!` be there?

Target:
public AssetUri getPrefabURI() { if (exists()) { EntityInfoComponent info = getComponent(EntityInfoComponent.class); if (info != null && info.parentPrefab.exists()) { return new AssetUri(AssetType.PREFAB, info.parentPrefab.getName()); } } return null; }