[Refactor] Clean up code

pull/12/head
Caroline Bell 2020-02-29 03:43:40 -08:00
parent b482b9c4da
commit ead57a9fa2
13 changed files with 21 additions and 7 deletions

View File

@ -85,7 +85,8 @@ public class Litecraft extends Game
Input.addPressCallback(Keybind.FLY_DOWN, () -> this.movePlayer(RelativeDirection.DOWN));
}
private void setupGinger() {
private void setupGinger()
{
TexturedModel playerModel = ModelLoader.loadGenericCube("block/cubes/stone/brick/stonebrick.png");
StaticCube.scaleCube(1f);
this.player = new Player(playerModel, new Vector3f(0, 0, -3), 0, 180f, 0, new Vector3f(0.2f, 0.2f, 0.2f));
@ -145,7 +146,6 @@ public class Litecraft extends Game
if (this.world != null) this.ginger3D.renderWorld(this, this.world);
this.ginger3D.renderOverlays(this);
this.ginger3D.postRender();
this.dbgStats.w = binds;
this.binds = 0;
}

View File

@ -91,7 +91,8 @@ public class Chunk implements BlockAccess, WorldGenConstants, DataStorage
getBlockInstance(x, y, z - 1).getModel() == null || getBlockInstance(x, y, z + 1).getModel() == null)
renderedBlocks[index(x, y, z)] = block;
}
catch (NullPointerException e) { // this seems to be a hotspot for errors
catch (NullPointerException e)
{ // this seems to be a hotspot for errors
e.printStackTrace(); // so I can add a debug breakpoint on this line
throw e;
}

View File

@ -7,12 +7,14 @@ import com.github.hydos.multithreading.GingerThread;
import it.unimi.dsi.fastutil.longs.*;
public class DynamicChunkLoader extends GingerThread{
public class DynamicChunkLoader extends GingerThread
{
public int chunkX, chunkY, chunkZ;
public World world;
public DynamicChunkLoader(int chunkX, int chunkY, int chunkZ, World world) {
public DynamicChunkLoader(int chunkX, int chunkY, int chunkZ, World world)
{
this.chunkX = chunkX;
this.chunkY = chunkY;
this.chunkZ = chunkZ;
@ -21,7 +23,8 @@ public class DynamicChunkLoader extends GingerThread{
}
@Override
public void run() {
public void run()
{
Long2ObjectMap<Chunk> chunks = world.chunks; //this is to seperate the lists so we dont create render bugs
started = true;

View File

@ -47,7 +47,8 @@ public class EarthChunkGenerator implements ChunkGenerator, WorldGenConstants
return chunk;
}
private static Block pickStone(double rockNoise) {
private static Block pickStone(double rockNoise)
{
if (rockNoise < -0.25)
{
return Blocks.ANDESITE;

View File

@ -4,5 +4,6 @@ interface BaseDataSection<E> extends Iterable<E> {
/**
* @deprecated Should only be used by the parser! Please use the type specific methods instead for writing data.
*/
@Deprecated
<T> void writeForParser(T data);
}

View File

@ -23,6 +23,7 @@ public class ByteArrayDataSection implements BaseDataSection<Byte> {
/**
* @deprecated Should only be used by the parser! Please use the type specific methods instead for writing data.
*/
@Deprecated
@Override
public <T> void writeForParser(T data) throws UnsupportedOperationException {
if (data instanceof Byte) {

View File

@ -18,6 +18,7 @@ public class DataSection implements BaseDataSection<Object> {
/**
* @deprecated Should only be used by the parser! Please use the type specific methods instead for writing data.
*/
@Deprecated
@Override
public <T> void writeForParser(T data) {
this.data.add(data);

View File

@ -23,6 +23,7 @@ public class DoubleArrayDataSection implements BaseDataSection<Double> {
/**
* @deprecated Should only be used by the parser! Please use the type specific methods instead for writing data.
*/
@Deprecated
@Override
public <T> void writeForParser(T data) throws UnsupportedOperationException {
if (data instanceof Double) {

View File

@ -23,6 +23,7 @@ public class FloatArrayDataSection implements BaseDataSection<Float> {
/**
* @deprecated Should only be used by the parser! Please use the type specific methods instead for writing data.
*/
@Deprecated
@Override
public <T> void writeForParser(T data) throws UnsupportedOperationException {
if (data instanceof Float) {

View File

@ -23,6 +23,7 @@ public class IntArrayDataSection implements BaseDataSection<Integer> {
/**
* @deprecated Should only be used by the parser! Please use the type specific methods instead for writing data.
*/
@Deprecated
@Override
public <T> void writeForParser(T data) throws UnsupportedOperationException {
if (data instanceof Integer) {

View File

@ -23,6 +23,7 @@ public class LongArrayDataSection implements BaseDataSection<Long> {
/**
* @deprecated Should only be used by the parser! Please use the type specific methods instead for writing data.
*/
@Deprecated
@Override
public <T> void writeForParser(T data) throws UnsupportedOperationException {
if (data instanceof Long) {

View File

@ -23,6 +23,7 @@ public class ShortArrayDataSection implements BaseDataSection<Short> {
/**
* @deprecated Should only be used by the parser! Please use the type specific methods instead for writing data.
*/
@Deprecated
@Override
public <T> void writeForParser(T data) throws UnsupportedOperationException {
if (data instanceof Short) {

View File

@ -22,6 +22,7 @@ public class StringArrayDataSection implements BaseDataSection<String> {
/**
* @deprecated Should only be used by the parser! Please use the type specific methods instead for writing data.
*/
@Deprecated
@Override
public <T> void writeForParser(T data) throws UnsupportedOperationException {
if (data instanceof String) {