Introduced crash reports
This commit is contained in:
parent
a425af01d8
commit
c1194b7601
@ -502,7 +502,8 @@ public class ArrayUtil {
|
||||
|
||||
int end = offset + length;
|
||||
if (end > arrayLength || offset < 0)
|
||||
throw new IllegalArgumentException("Array contains [0; " + arrayLength + "), requested [" + offset + "; " + end + ")");
|
||||
throw new IllegalArgumentException(
|
||||
"Array contains [0; " + arrayLength + "), requested [" + offset + "; " + end + ")");
|
||||
|
||||
return length;
|
||||
}
|
||||
@ -517,7 +518,8 @@ public class ArrayUtil {
|
||||
throw new IllegalArgumentException("Start > end: " + start + " > " + end);
|
||||
|
||||
if (end > arrayLength || start < 0)
|
||||
throw new IllegalArgumentException("Array contains [0; " + arrayLength + "), requested [" + start + "; " + end + ")");
|
||||
throw new IllegalArgumentException(
|
||||
"Array contains [0; " + arrayLength + "), requested [" + start + "; " + end + ")");
|
||||
|
||||
return end;
|
||||
}
|
||||
|
@ -26,6 +26,7 @@ import ru.windcorp.progressia.client.graphics.font.Typefaces;
|
||||
import ru.windcorp.progressia.client.graphics.texture.Atlases;
|
||||
import ru.windcorp.progressia.client.graphics.world.WorldRenderProgram;
|
||||
import ru.windcorp.progressia.common.resource.ResourceManager;
|
||||
import ru.windcorp.progressia.common.util.crash.CrashReports;
|
||||
import ru.windcorp.progressia.server.ServerState;
|
||||
import ru.windcorp.progressia.test.TestContent;
|
||||
|
||||
@ -39,8 +40,7 @@ public class ClientProxy implements Proxy {
|
||||
RenderTaskQueue.waitAndInvoke(WorldRenderProgram::init);
|
||||
RenderTaskQueue.waitAndInvoke(() -> Typefaces.setDefault(GNUUnifontLoader.load(ResourceManager.getResource("assets/unifont-13.0.03.hex.gz"))));
|
||||
} catch (InterruptedException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
CrashReports.report(e, "ClientProxy failed");
|
||||
}
|
||||
|
||||
TestContent.registerContent();
|
||||
|
@ -20,7 +20,7 @@ package ru.windcorp.progressia.client;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import ru.windcorp.progressia.ProgressiaLauncher;
|
||||
import ru.windcorp.progressia.common.util.crash.CrashReportGenerator;
|
||||
import ru.windcorp.progressia.common.util.crash.CrashReports;
|
||||
import ru.windcorp.progressia.common.util.crash.analyzers.OutOfMemoryAnalyzer;
|
||||
import ru.windcorp.progressia.common.util.crash.providers.OSContextProvider;
|
||||
|
||||
@ -31,14 +31,13 @@ public class ProgressiaClientMain {
|
||||
public static void main(String[] args) {
|
||||
logger.info("App started!");
|
||||
|
||||
CrashReportGenerator.registerProvider(new OSContextProvider());
|
||||
CrashReportGenerator.registerAnalyzer(new OutOfMemoryAnalyzer());
|
||||
CrashReports.registerProvider(new OSContextProvider());
|
||||
CrashReports.registerAnalyzer(new OutOfMemoryAnalyzer());
|
||||
try {
|
||||
@SuppressWarnings("unused")
|
||||
long[] ssdss = new long[1 << 30];
|
||||
} catch (Throwable t)
|
||||
{
|
||||
CrashReportGenerator.crash(t, "u %s stupid", "vry");
|
||||
} catch (Throwable t) {
|
||||
CrashReports.report(t, "u %s stupid", "vry");
|
||||
}
|
||||
|
||||
ProgressiaLauncher.launch(args, new ClientProxy());
|
||||
|
@ -8,6 +8,7 @@ import ru.windcorp.progressia.common.comms.CommsListener;
|
||||
import ru.windcorp.progressia.common.comms.packets.Packet;
|
||||
import ru.windcorp.progressia.common.comms.packets.PacketSetLocalPlayer;
|
||||
import ru.windcorp.progressia.common.comms.packets.PacketWorldChange;
|
||||
import ru.windcorp.progressia.common.util.crash.CrashReports;
|
||||
import ru.windcorp.progressia.common.world.entity.EntityData;
|
||||
import ru.windcorp.progressia.common.world.entity.PacketEntityChange;
|
||||
|
||||
@ -41,7 +42,7 @@ public class DefaultClientCommsListener implements CommsListener {
|
||||
);
|
||||
|
||||
if (entity == null) {
|
||||
throw new RuntimeException("");
|
||||
CrashReports.report(null, "Player entity not found");
|
||||
}
|
||||
|
||||
getClient().setLocalPlayer(entity);
|
||||
|
@ -24,6 +24,7 @@ import ru.windcorp.progressia.client.graphics.backend.OpenGLObjectTracker;
|
||||
import ru.windcorp.progressia.client.graphics.backend.OpenGLObjectTracker.OpenGLDeletable;
|
||||
import ru.windcorp.progressia.client.graphics.backend.shaders.attributes.Attribute;
|
||||
import ru.windcorp.progressia.client.graphics.backend.shaders.uniforms.Uniform;
|
||||
import ru.windcorp.progressia.common.util.crash.CrashReports;
|
||||
|
||||
public class Program implements OpenGLDeletable {
|
||||
|
||||
@ -39,7 +40,7 @@ public class Program implements OpenGLDeletable {
|
||||
glLinkProgram(handle);
|
||||
|
||||
if (glGetProgrami(handle, GL_LINK_STATUS) == GL_FALSE) {
|
||||
throw new RuntimeException("Bad program:\n" + glGetProgramInfoLog(handle));
|
||||
CrashReports.report(null, "Bad program:\n %s", glGetProgramInfoLog(handle));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -26,12 +26,12 @@ import ru.windcorp.progressia.client.graphics.backend.OpenGLObjectTracker;
|
||||
import ru.windcorp.progressia.client.graphics.backend.OpenGLObjectTracker.OpenGLDeletable;
|
||||
import ru.windcorp.progressia.common.resource.Resource;
|
||||
import ru.windcorp.progressia.common.resource.ResourceManager;
|
||||
import ru.windcorp.progressia.common.util.crash.CrashReports;
|
||||
|
||||
public class Shader implements OpenGLDeletable {
|
||||
|
||||
public static enum ShaderType {
|
||||
VERTEX(GL_VERTEX_SHADER),
|
||||
FRAGMENT(GL_FRAGMENT_SHADER);
|
||||
VERTEX(GL_VERTEX_SHADER), FRAGMENT(GL_FRAGMENT_SHADER);
|
||||
|
||||
private final int glCode;
|
||||
|
||||
@ -79,7 +79,7 @@ public class Shader implements OpenGLDeletable {
|
||||
if (glGetShaderi(handle, GL_COMPILE_STATUS) == GL_FALSE) {
|
||||
System.out.println("***************** ERROR ******************");
|
||||
System.out.println(source);
|
||||
throw new RuntimeException("Bad shader:\n" + glGetShaderInfoLog(handle));
|
||||
CrashReports.report(null, "Bad shader:\n %s", glGetShaderInfoLog(handle));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -18,6 +18,7 @@
|
||||
package ru.windcorp.progressia.client.graphics.backend.shaders.attributes;
|
||||
|
||||
import ru.windcorp.progressia.client.graphics.backend.shaders.Program;
|
||||
import ru.windcorp.progressia.common.util.crash.CrashReports;
|
||||
|
||||
public class Attribute {
|
||||
|
||||
@ -26,7 +27,7 @@ public class Attribute {
|
||||
|
||||
public Attribute(int handle, Program program) {
|
||||
if (handle < 0) {
|
||||
throw new RuntimeException("Bad handle: " + handle);
|
||||
CrashReports.report(null, "Bad handle: %s", handle);
|
||||
}
|
||||
|
||||
this.handle = handle;
|
||||
|
@ -18,6 +18,7 @@
|
||||
package ru.windcorp.progressia.client.graphics.backend.shaders.uniforms;
|
||||
|
||||
import ru.windcorp.progressia.client.graphics.backend.shaders.Program;
|
||||
import ru.windcorp.progressia.common.util.crash.CrashReports;
|
||||
|
||||
public class Uniform {
|
||||
|
||||
@ -26,7 +27,7 @@ public class Uniform {
|
||||
|
||||
public Uniform(int handle, Program program) {
|
||||
if (handle < 0) {
|
||||
throw new RuntimeException("Bad handle: " + handle);
|
||||
CrashReports.report(null, "Bad handle: %s", handle);
|
||||
}
|
||||
|
||||
this.handle = handle;
|
||||
|
@ -21,14 +21,13 @@ import ru.windcorp.progressia.client.graphics.texture.Texture;
|
||||
import ru.windcorp.progressia.client.graphics.texture.TextureDataEditor;
|
||||
import ru.windcorp.progressia.client.graphics.texture.TextureSettings;
|
||||
import ru.windcorp.progressia.common.resource.Resource;
|
||||
import ru.windcorp.progressia.common.util.crash.CrashReports;
|
||||
|
||||
public class GNUUnifontLoader {
|
||||
|
||||
private static final AtlasGroup ATLAS_GROUP_GNU_UNIFONT =
|
||||
new AtlasGroup("GNUUnifont", 1 << 12);
|
||||
private static final AtlasGroup ATLAS_GROUP_GNU_UNIFONT = new AtlasGroup("GNUUnifont", 1 << 12);
|
||||
|
||||
private static final TextureSettings TEXTURE_SETTINGS =
|
||||
new TextureSettings(false);
|
||||
private static final TextureSettings TEXTURE_SETTINGS = new TextureSettings(false);
|
||||
|
||||
private static final int BITS_PER_HEX_DIGIT = 4;
|
||||
private static final int PREFIX_LENGTH = "0000:".length();
|
||||
@ -55,29 +54,17 @@ public class GNUUnifontLoader {
|
||||
|
||||
public static GNUUnifont load(Resource resource) {
|
||||
try (BufferedReader reader = createReader(resource)) {
|
||||
return createStream(reader)
|
||||
.map(GNUUnifontLoader::parse)
|
||||
.map(GNUUnifontLoader::addToAtlas)
|
||||
.collect(Collectors.collectingAndThen(
|
||||
createMapper(),
|
||||
GNUUnifont::new
|
||||
));
|
||||
return createStream(reader).map(GNUUnifontLoader::parse).map(GNUUnifontLoader::addToAtlas)
|
||||
.collect(Collectors.collectingAndThen(createMapper(), GNUUnifont::new));
|
||||
} catch (IOException | UncheckedIOException e) {
|
||||
throw new RuntimeException(e);
|
||||
CrashReports.report(e, "Problem with load GNUUnifont");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private static BufferedReader createReader(Resource resource)
|
||||
throws IOException
|
||||
{
|
||||
private static BufferedReader createReader(Resource resource) throws IOException {
|
||||
return new BufferedReader(
|
||||
new InputStreamReader(
|
||||
new GZIPInputStream(
|
||||
resource.getInputStream()
|
||||
),
|
||||
StandardCharsets.UTF_8
|
||||
)
|
||||
);
|
||||
new InputStreamReader(new GZIPInputStream(resource.getInputStream()), StandardCharsets.UTF_8));
|
||||
}
|
||||
|
||||
private static Stream<String> createStream(BufferedReader reader) {
|
||||
@ -90,20 +77,14 @@ public class GNUUnifontLoader {
|
||||
|
||||
char c = getChar(declar);
|
||||
|
||||
TextureDataEditor editor = new TextureDataEditor(
|
||||
width, GNUUnifont.HEIGHT,
|
||||
width, GNUUnifont.HEIGHT,
|
||||
TEXTURE_SETTINGS
|
||||
);
|
||||
TextureDataEditor editor = new TextureDataEditor(width, GNUUnifont.HEIGHT, width, GNUUnifont.HEIGHT,
|
||||
TEXTURE_SETTINGS);
|
||||
|
||||
for (int y = 0; y < GNUUnifont.HEIGHT; ++y) {
|
||||
for (int x = 0; x < width; ++x) {
|
||||
int bit = x + y * width;
|
||||
|
||||
editor.setPixel(
|
||||
x, GNUUnifont.HEIGHT - y - 1,
|
||||
getBit(declar, bit) ? 0xFFFFFFFF : 0x00000000
|
||||
);
|
||||
editor.setPixel(x, GNUUnifont.HEIGHT - y - 1, getBit(declar, bit) ? 0xFFFFFFFF : 0x00000000);
|
||||
}
|
||||
}
|
||||
|
||||
@ -114,9 +95,7 @@ public class GNUUnifontLoader {
|
||||
int result = 0;
|
||||
|
||||
for (int i = 0; i < 4; ++i) {
|
||||
result =
|
||||
(result << BITS_PER_HEX_DIGIT) |
|
||||
getHexValue(declar.charAt(i));
|
||||
result = (result << BITS_PER_HEX_DIGIT) | getHexValue(declar.charAt(i));
|
||||
}
|
||||
|
||||
return (char) result;
|
||||
@ -140,33 +119,38 @@ public class GNUUnifontLoader {
|
||||
|
||||
private static void checkDeclaration(String declar, int width) {
|
||||
if (!GNUUnifont.WIDTHS.contains(width)) {
|
||||
throw new RuntimeException("Width " + width + " is not supported (in declar \"" + declar + "\")");
|
||||
CrashReports.report(null, "Width %d is not supported (in declar \"%s\")", width, declar);
|
||||
}
|
||||
|
||||
if ((declar.length() - PREFIX_LENGTH) % width != 0) {
|
||||
throw new RuntimeException("Declar \"" + declar + "\" has invalid length");
|
||||
CrashReports.report(null, "Declar \"%s\" has invalid length", declar);
|
||||
}
|
||||
|
||||
for (int i = 0; i < declar.length(); ++i) {
|
||||
if (i == BITS_PER_HEX_DIGIT) {
|
||||
if (declar.charAt(i) != ':') {
|
||||
throw new RuntimeException("No colon ':' found in declar \"" + declar + "\" at index 4");
|
||||
CrashReports.report(null, "No colon ':' found in declar \"%s\" at index 4", declar);
|
||||
}
|
||||
} else {
|
||||
char c = declar.charAt(i);
|
||||
|
||||
if (!((c >= '0' && c <= '9') || (c >= 'A' && c <= 'F'))) {
|
||||
throw new RuntimeException("Illegal char in declar \"" + declar + "\" at index " + i + "; expected 0-9A-F");
|
||||
CrashReports.report(null,
|
||||
"Illegal char in declar \"%s\" at index " + i + "; expected 0-9A-F", declar);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static int getHexValue(char digit) {
|
||||
if (digit < '0') throw new NumberFormatException(digit + " is not a hex digit (0-9A-F expected)");
|
||||
if (digit <= '9') return digit - '0';
|
||||
if (digit < 'A') throw new NumberFormatException(digit + " is not a hex digit (0-9A-F expected)");
|
||||
if (digit <= 'F') return digit - 'A' + 0xA;
|
||||
if (digit < '0')
|
||||
throw new NumberFormatException(digit + " is not a hex digit (0-9A-F expected)");
|
||||
if (digit <= '9')
|
||||
return digit - '0';
|
||||
if (digit < 'A')
|
||||
throw new NumberFormatException(digit + " is not a hex digit (0-9A-F expected)");
|
||||
if (digit <= 'F')
|
||||
return digit - 'A' + 0xA;
|
||||
throw new NumberFormatException(digit + " is not a hex digit (0-9A-F expected)");
|
||||
}
|
||||
|
||||
@ -175,11 +159,8 @@ public class GNUUnifontLoader {
|
||||
return new AtlasGlyph(glyph.c, new SimpleTexture(sprite));
|
||||
}
|
||||
|
||||
private static
|
||||
Collector<AtlasGlyph, ?, TCharObjectMap<Texture>>
|
||||
createMapper() {
|
||||
return Collector.of(
|
||||
TCharObjectHashMap<Texture>::new,
|
||||
private static Collector<AtlasGlyph, ?, TCharObjectMap<Texture>> createMapper() {
|
||||
return Collector.of(TCharObjectHashMap<Texture>::new,
|
||||
|
||||
(map, glyph) -> map.put(glyph.c, glyph.texture),
|
||||
|
||||
@ -188,10 +169,10 @@ public class GNUUnifontLoader {
|
||||
return a;
|
||||
},
|
||||
|
||||
Characteristics.UNORDERED
|
||||
);
|
||||
Characteristics.UNORDERED);
|
||||
}
|
||||
|
||||
private GNUUnifontLoader() {}
|
||||
private GNUUnifontLoader() {
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -39,11 +39,11 @@ import ru.windcorp.progressia.client.graphics.input.bus.Input;
|
||||
import ru.windcorp.progressia.client.graphics.input.bus.InputBus;
|
||||
import ru.windcorp.progressia.client.graphics.input.bus.InputListener;
|
||||
import ru.windcorp.progressia.common.util.Named;
|
||||
import ru.windcorp.progressia.common.util.crash.CrashReports;
|
||||
|
||||
public class Component extends Named {
|
||||
|
||||
private final List<Component> children =
|
||||
Collections.synchronizedList(new CopyOnWriteArrayList<>());
|
||||
private final List<Component> children = Collections.synchronizedList(new CopyOnWriteArrayList<>());
|
||||
|
||||
private Component parent = null;
|
||||
|
||||
@ -88,7 +88,8 @@ public class Component extends Named {
|
||||
|
||||
public Component getChild(int index) {
|
||||
synchronized (getChildren()) {
|
||||
if (index < 0 || index >= getChildren().size()) return null;
|
||||
if (index < 0 || index >= getChildren().size())
|
||||
return null;
|
||||
return getChildren().get(index);
|
||||
}
|
||||
}
|
||||
@ -107,7 +108,8 @@ public class Component extends Named {
|
||||
}
|
||||
|
||||
public void moveChild(Component child, int newIndex) {
|
||||
if (newIndex == -1) newIndex = getChildren().size() - 1;
|
||||
if (newIndex == -1)
|
||||
newIndex = getChildren().size() - 1;
|
||||
|
||||
if (getChildren().remove(child)) {
|
||||
getChildren().add(newIndex, child);
|
||||
@ -123,7 +125,8 @@ public class Component extends Named {
|
||||
}
|
||||
|
||||
public Component addChild(Component child, int index) {
|
||||
if (index == -1) index = getChildren().size();
|
||||
if (index == -1)
|
||||
index = getChildren().size();
|
||||
|
||||
invalidate();
|
||||
getChildren().add(index, child);
|
||||
@ -232,7 +235,7 @@ public class Component extends Named {
|
||||
|
||||
valid = true;
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
CrashReports.report(e, "__DOC__ME__");
|
||||
}
|
||||
}
|
||||
|
||||
@ -245,7 +248,7 @@ public class Component extends Named {
|
||||
try {
|
||||
return getLayout().calculatePreferredSize(this);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
CrashReports.report(e, "__DOC__ME__");
|
||||
}
|
||||
}
|
||||
|
||||
@ -342,7 +345,8 @@ public class Component extends Named {
|
||||
}
|
||||
|
||||
private Component getNextFocusCandidate(boolean canUseChildren) {
|
||||
if (canUseChildren) synchronized (getChildren()) {
|
||||
if (canUseChildren)
|
||||
synchronized (getChildren()) {
|
||||
if (!getChildren().isEmpty()) {
|
||||
return getChild(0);
|
||||
}
|
||||
@ -458,20 +462,19 @@ public class Component extends Named {
|
||||
}
|
||||
|
||||
public void removeListener(Object listener) {
|
||||
if (eventBus == null) return;
|
||||
if (eventBus == null)
|
||||
return;
|
||||
eventBus.unregister(listener);
|
||||
}
|
||||
|
||||
public void dispatchEvent(Object event) {
|
||||
if (eventBus == null) return;
|
||||
if (eventBus == null)
|
||||
return;
|
||||
eventBus.post(event);
|
||||
}
|
||||
|
||||
public <T extends InputEvent> void addListener(
|
||||
Class<? extends T> type,
|
||||
boolean handlesConsumed,
|
||||
InputListener<T> listener
|
||||
) {
|
||||
public <T extends InputEvent> void addListener(Class<? extends T> type, boolean handlesConsumed,
|
||||
InputListener<T> listener) {
|
||||
if (inputBus == null) {
|
||||
inputBus = new InputBus();
|
||||
}
|
||||
@ -479,10 +482,7 @@ public class Component extends Named {
|
||||
inputBus.register(type, handlesConsumed, listener);
|
||||
}
|
||||
|
||||
public <T extends InputEvent> void addListener(
|
||||
Class<? extends T> type,
|
||||
InputListener<T> listener
|
||||
) {
|
||||
public <T extends InputEvent> void addListener(Class<? extends T> type, InputListener<T> listener) {
|
||||
if (inputBus == null) {
|
||||
inputBus = new InputBus();
|
||||
}
|
||||
@ -517,15 +517,17 @@ public class Component extends Named {
|
||||
break;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
CrashReports.report(e, "__DOC__ME__");
|
||||
}
|
||||
}
|
||||
|
||||
private void dispatchInputToFocused(Input input) {
|
||||
Component c = findFocused();
|
||||
|
||||
if (c == null) return;
|
||||
if (attemptFocusTransfer(input, c)) return;
|
||||
if (c == null)
|
||||
return;
|
||||
if (attemptFocusTransfer(input, c))
|
||||
return;
|
||||
|
||||
while (c != null) {
|
||||
c.handleInput(input);
|
||||
@ -555,8 +557,10 @@ public class Component extends Named {
|
||||
}
|
||||
|
||||
private boolean attemptFocusTransfer(Input input, Component focused) {
|
||||
if (input.isConsumed()) return false;
|
||||
if (!(input.getEvent() instanceof KeyEvent)) return false;
|
||||
if (input.isConsumed())
|
||||
return false;
|
||||
if (!(input.getEvent() instanceof KeyEvent))
|
||||
return false;
|
||||
|
||||
KeyEvent keyInput = (KeyEvent) input.getEvent();
|
||||
|
||||
@ -574,16 +578,11 @@ public class Component extends Named {
|
||||
}
|
||||
|
||||
public synchronized boolean contains(int x, int y) {
|
||||
return
|
||||
x >= getX() && x < getX() + getWidth() &&
|
||||
y >= getY() && y < getY() + getHeight();
|
||||
return x >= getX() && x < getX() + getWidth() && y >= getY() && y < getY() + getHeight();
|
||||
}
|
||||
|
||||
public boolean containsCursor() {
|
||||
return contains(
|
||||
(int) InputTracker.getCursorX(),
|
||||
(int) InputTracker.getCursorY()
|
||||
);
|
||||
return contains((int) InputTracker.getCursorX(), (int) InputTracker.getCursorY());
|
||||
}
|
||||
|
||||
public void requestReassembly() {
|
||||
@ -610,7 +609,7 @@ public class Component extends Named {
|
||||
try {
|
||||
assembleSelf(target);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
CrashReports.report(e, "__DOC__ME__");
|
||||
}
|
||||
|
||||
assembleChildren(target);
|
||||
@ -618,7 +617,7 @@ public class Component extends Named {
|
||||
try {
|
||||
postAssembleSelf(target);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
CrashReports.report(e, "__DOC__ME__");
|
||||
}
|
||||
}
|
||||
|
||||
@ -634,28 +633,28 @@ public class Component extends Named {
|
||||
getChildren().forEach(child -> child.assemble(target));
|
||||
}
|
||||
|
||||
// /**
|
||||
// * Returns a component that displays this component in its center.
|
||||
// * @return a {@link Aligner} initialized to center this component
|
||||
// */
|
||||
// public Component center() {
|
||||
// return new Aligner(this);
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Returns a component that aligns this component.
|
||||
// * @return a {@link Aligner} initialized with this component
|
||||
// */
|
||||
// public Component align(double x, double y) {
|
||||
// return new Aligner(this, x, y);
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Returns a component that allows scrolling this component
|
||||
// * @return a {@link Scroller} initialized with this component
|
||||
// */
|
||||
// public Component scroller() {
|
||||
// return new Scroller(this);
|
||||
// }
|
||||
// /**
|
||||
// * Returns a component that displays this component in its center.
|
||||
// * @return a {@link Aligner} initialized to center this component
|
||||
// */
|
||||
// public Component center() {
|
||||
// return new Aligner(this);
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Returns a component that aligns this component.
|
||||
// * @return a {@link Aligner} initialized with this component
|
||||
// */
|
||||
// public Component align(double x, double y) {
|
||||
// return new Aligner(this, x, y);
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Returns a component that allows scrolling this component
|
||||
// * @return a {@link Scroller} initialized with this component
|
||||
// */
|
||||
// public Component scroller() {
|
||||
// return new Scroller(this);
|
||||
// }
|
||||
|
||||
}
|
@ -31,26 +31,23 @@ import gnu.trove.map.hash.TIntObjectHashMap;
|
||||
import gnu.trove.map.hash.TObjectIntHashMap;
|
||||
import gnu.trove.set.TIntSet;
|
||||
import gnu.trove.set.hash.TIntHashSet;
|
||||
import ru.windcorp.progressia.common.util.crash.CrashReports;
|
||||
|
||||
public class Keys {
|
||||
|
||||
private static final TIntObjectMap<String> CODES_TO_NAMES =
|
||||
new TIntObjectHashMap<>();
|
||||
private static final TIntObjectMap<String> CODES_TO_NAMES = new TIntObjectHashMap<>();
|
||||
|
||||
private static final TObjectIntMap<String> NAMES_TO_CODES =
|
||||
new TObjectIntHashMap<>();
|
||||
private static final TObjectIntMap<String> NAMES_TO_CODES = new TObjectIntHashMap<>();
|
||||
|
||||
private static final TIntSet MOUSE_BUTTONS = new TIntHashSet();
|
||||
|
||||
private static final String KEY_PREFIX = "GLFW_KEY_";
|
||||
private static final String MOUSE_BUTTON_PREFIX = "GLFW_MOUSE_BUTTON_";
|
||||
|
||||
private static final Set<String> IGNORE_FIELDS =
|
||||
new HashSet<>(Arrays.asList(
|
||||
"GLFW_KEY_UNKNOWN",
|
||||
"GLFW_KEY_LAST",
|
||||
"GLFW_MOUSE_BUTTON_LAST",
|
||||
"GLFW_MOUSE_BUTTON_1", // Alias for LEFT
|
||||
private static final Set<String> IGNORE_FIELDS = new HashSet<>(
|
||||
Arrays.asList("GLFW_KEY_UNKNOWN", "GLFW_KEY_LAST", "GLFW_MOUSE_BUTTON_LAST", "GLFW_MOUSE_BUTTON_1", // Alias
|
||||
// for
|
||||
// LEFT
|
||||
"GLFW_MOUSE_BUTTON_2", // Alias for RIGHT
|
||||
"GLFW_MOUSE_BUTTON_3" // Alias for MIDDLE
|
||||
));
|
||||
@ -63,28 +60,28 @@ public class Keys {
|
||||
try {
|
||||
|
||||
for (Field field : GLFW.class.getFields()) {
|
||||
if (!Modifier.isStatic(field.getModifiers())) continue;
|
||||
if (!Modifier.isFinal(field.getModifiers())) continue;
|
||||
if (!Modifier.isStatic(field.getModifiers()))
|
||||
continue;
|
||||
if (!Modifier.isFinal(field.getModifiers()))
|
||||
continue;
|
||||
|
||||
String name = field.getName();
|
||||
|
||||
if (
|
||||
!name.startsWith(KEY_PREFIX) &&
|
||||
!name.startsWith(MOUSE_BUTTON_PREFIX)
|
||||
) continue;
|
||||
if (!name.startsWith(KEY_PREFIX) && !name.startsWith(MOUSE_BUTTON_PREFIX))
|
||||
continue;
|
||||
|
||||
if (IGNORE_FIELDS.contains(name)) continue;
|
||||
if (IGNORE_FIELDS.contains(name))
|
||||
continue;
|
||||
|
||||
addToDictionary(field);
|
||||
}
|
||||
|
||||
} catch (IllegalAccessException e) {
|
||||
throw new RuntimeException(e);
|
||||
CrashReports.report(e, "Cannot access GLFW constants");
|
||||
}
|
||||
}
|
||||
|
||||
private static void addToDictionary(Field field)
|
||||
throws IllegalAccessException {
|
||||
private static void addToDictionary(Field field) throws IllegalAccessException {
|
||||
|
||||
int value = field.getInt(null);
|
||||
String name = field.getName();
|
||||
@ -97,11 +94,8 @@ public class Keys {
|
||||
}
|
||||
|
||||
if (CODES_TO_NAMES.containsKey(value)) {
|
||||
throw new RuntimeException(
|
||||
"Duplicate keys: " + CODES_TO_NAMES.get(value) +
|
||||
" and " + name + " both map to " + value +
|
||||
"(0x" + Integer.toHexString(value) + ")"
|
||||
);
|
||||
CrashReports.report(null, "Duplicate keys: %s and %s both map to %d(0x%s)",
|
||||
CODES_TO_NAMES.get(value), name, value, Integer.toHexString(value));
|
||||
}
|
||||
|
||||
CODES_TO_NAMES.put(value, name);
|
||||
@ -125,8 +119,7 @@ public class Keys {
|
||||
name = "KEYPAD_" + name.substring("KP_".length());
|
||||
}
|
||||
|
||||
name = Character.toTitleCase(name.charAt(0)) +
|
||||
name.substring(1).toLowerCase();
|
||||
name = Character.toTitleCase(name.charAt(0)) + name.substring(1).toLowerCase();
|
||||
|
||||
name = name.replace('_', ' ');
|
||||
|
||||
|
@ -13,6 +13,7 @@ import ru.windcorp.progressia.client.graphics.backend.RenderTaskQueue;
|
||||
import ru.windcorp.progressia.common.resource.Resource;
|
||||
import ru.windcorp.progressia.common.util.BinUtil;
|
||||
import ru.windcorp.progressia.common.util.Named;
|
||||
import ru.windcorp.progressia.common.util.crash.CrashReports;
|
||||
|
||||
public class Atlases {
|
||||
|
||||
@ -24,10 +25,7 @@ public class Atlases {
|
||||
this.atlasSize = atlasSize;
|
||||
|
||||
if (!BinUtil.isPowerOf2(atlasSize)) {
|
||||
throw new IllegalArgumentException(
|
||||
"Atlas size " + atlasSize
|
||||
+ " is not a power of 2"
|
||||
);
|
||||
throw new IllegalArgumentException("Atlas size " + atlasSize + " is not a power of 2");
|
||||
}
|
||||
}
|
||||
|
||||
@ -71,11 +69,8 @@ public class Atlases {
|
||||
|
||||
editor.draw(data, nextX, nextY);
|
||||
|
||||
Sprite result = new Sprite(
|
||||
getPrimitive(),
|
||||
toPrimitiveCoords(nextX, nextY),
|
||||
toPrimitiveCoords(width, height)
|
||||
);
|
||||
Sprite result = new Sprite(getPrimitive(), toPrimitiveCoords(nextX, nextY),
|
||||
toPrimitiveCoords(width, height));
|
||||
|
||||
nextX += width;
|
||||
|
||||
@ -99,10 +94,7 @@ public class Atlases {
|
||||
}
|
||||
|
||||
private Vec2 toPrimitiveCoords(int x, int y) {
|
||||
return new Vec2(
|
||||
toPrimitiveCoord(x),
|
||||
toPrimitiveCoord(y)
|
||||
);
|
||||
return new Vec2(toPrimitiveCoord(x), toPrimitiveCoord(y));
|
||||
}
|
||||
|
||||
private float toPrimitiveCoord(int c) {
|
||||
@ -152,10 +144,8 @@ public class Atlases {
|
||||
|
||||
private static final TextureSettings SETTINGS = new TextureSettings(false);
|
||||
|
||||
private static final Map<Resource, Sprite> LOADED =
|
||||
new HashMap<>();
|
||||
private static final Multimap<AtlasGroup, Atlas> ATLASES =
|
||||
MultimapBuilder.hashKeys().arrayListValues().build();
|
||||
private static final Map<Resource, Sprite> LOADED = new HashMap<>();
|
||||
private static final Multimap<AtlasGroup, Atlas> ATLASES = MultimapBuilder.hashKeys().arrayListValues().build();
|
||||
|
||||
public static Sprite getSprite(Resource resource, AtlasGroup group) {
|
||||
return LOADED.computeIfAbsent(resource, k -> loadSprite(k, group));
|
||||
@ -163,12 +153,12 @@ public class Atlases {
|
||||
|
||||
private static Sprite loadSprite(Resource resource, AtlasGroup group) {
|
||||
try {
|
||||
TextureDataEditor data =
|
||||
TextureLoader.loadPixels(resource, SETTINGS);
|
||||
TextureDataEditor data = TextureLoader.loadPixels(resource, SETTINGS);
|
||||
|
||||
return loadSprite(data.getData(), group);
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
CrashReports.report(e, "Problem with load atlases sprite");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@ -180,14 +170,11 @@ public class Atlases {
|
||||
private static Atlas getReadyAtlas(AtlasGroup group, TextureData data) {
|
||||
List<Atlas> atlases = (List<Atlas>) ATLASES.get(group);
|
||||
|
||||
if (
|
||||
atlases.isEmpty() ||
|
||||
!(atlases.get(atlases.size() - 1).canAddSprite(data))
|
||||
) {
|
||||
if (atlases.isEmpty() || !(atlases.get(atlases.size() - 1).canAddSprite(data))) {
|
||||
Atlas newAtlas = new Atlas(group);
|
||||
|
||||
if (!newAtlas.canAddSprite(data)) {
|
||||
throw new RuntimeException("Could not fit tex into atlas of size " + newAtlas.getSize());
|
||||
CrashReports.report(null, "Could not fit tex into atlas of size %d", newAtlas.getSize());
|
||||
}
|
||||
|
||||
atlases.add(newAtlas);
|
||||
@ -202,6 +189,7 @@ public class Atlases {
|
||||
});
|
||||
}
|
||||
|
||||
private Atlases() {}
|
||||
private Atlases() {
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -6,6 +6,7 @@ import java.util.Map;
|
||||
|
||||
import ru.windcorp.progressia.common.resource.Resource;
|
||||
import ru.windcorp.progressia.common.resource.ResourceManager;
|
||||
import ru.windcorp.progressia.common.util.crash.CrashReports;
|
||||
|
||||
public class SimpleTextures {
|
||||
|
||||
@ -30,7 +31,8 @@ public class SimpleTextures {
|
||||
new Sprite(new TexturePrimitive(data.getData()))
|
||||
);
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
CrashReports.report(e, "Problem with load texture");
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -24,6 +24,7 @@ import java.util.Arrays;
|
||||
|
||||
import ru.windcorp.progressia.client.graphics.backend.OpenGLObjectTracker;
|
||||
import ru.windcorp.progressia.client.graphics.backend.OpenGLObjectTracker.OpenGLDeletable;
|
||||
import ru.windcorp.progressia.common.util.crash.CrashReports;
|
||||
|
||||
public class TexturePrimitive implements OpenGLDeletable {
|
||||
|
||||
@ -89,7 +90,7 @@ public class TexturePrimitive implements OpenGLDeletable {
|
||||
OpenGLObjectTracker.register(this);
|
||||
|
||||
if (handle < 0) {
|
||||
throw new RuntimeException("oops");
|
||||
CrashReports.report(null, "Failed to create texture");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3,6 +3,8 @@ package ru.windcorp.progressia.client.localization;
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.*;
|
||||
|
||||
import ru.windcorp.progressia.common.util.crash.CrashReports;
|
||||
|
||||
public class Localizer {
|
||||
private static final Localizer INSTANCE = new Localizer("assets/languages/", "en-US");
|
||||
|
||||
@ -17,7 +19,7 @@ public class Localizer {
|
||||
private final Collection<WeakReference<LocaleListener>> listeners =
|
||||
Collections.synchronizedCollection(new LinkedList<>());
|
||||
|
||||
//lang list must be in the same folder as .lang files
|
||||
// lang list must be in the same folder as .lang files
|
||||
public Localizer(String langFolder) {
|
||||
this.langFolder = langFolder;
|
||||
this.langList = new Parser(langFolder + "lang_list.txt").parse();
|
||||
@ -41,7 +43,7 @@ public class Localizer {
|
||||
data = new Parser(langFolder + this.language + ".lang").parse();
|
||||
pokeListeners(language);
|
||||
} else {
|
||||
throw new RuntimeException("Language not found: " + language);
|
||||
CrashReports.report(null, "Language not found: %s", language);
|
||||
}
|
||||
}
|
||||
|
||||
@ -64,7 +66,7 @@ public class Localizer {
|
||||
}
|
||||
|
||||
private void pokeListeners(String newLanguage) {
|
||||
//TODO extract as weak bus listener class
|
||||
// TODO extract as weak bus listener class
|
||||
synchronized (listeners) {
|
||||
Iterator<WeakReference<LocaleListener>> iterator = listeners.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
|
@ -3,6 +3,7 @@ package ru.windcorp.progressia.client.localization;
|
||||
import ru.windcorp.jputil.chars.EscapeException;
|
||||
import ru.windcorp.jputil.chars.Escaper;
|
||||
import ru.windcorp.progressia.common.resource.ResourceManager;
|
||||
import ru.windcorp.progressia.common.util.crash.CrashReports;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Reader;
|
||||
@ -54,7 +55,7 @@ public class Parser {
|
||||
if (c == '=') {
|
||||
String key = ESCAPER.escape(stringBuilder.toString());
|
||||
stringBuilder.setLength(0);
|
||||
rawData.read(); //skip a char
|
||||
rawData.read(); // skip a char
|
||||
while (true) {
|
||||
code = rawData.read();
|
||||
if (code == -1) {
|
||||
@ -80,7 +81,8 @@ public class Parser {
|
||||
}
|
||||
|
||||
} catch (IOException | EscapeException e) {
|
||||
throw new RuntimeException(e);
|
||||
CrashReports.report(e, "Problems with parsing");
|
||||
return null;
|
||||
}
|
||||
return parsedData;
|
||||
}
|
||||
|
@ -7,6 +7,7 @@ import ru.windcorp.progressia.client.graphics.texture.TexturePrimitive;
|
||||
import ru.windcorp.progressia.client.graphics.texture.TextureSettings;
|
||||
import ru.windcorp.progressia.common.resource.ResourceManager;
|
||||
import ru.windcorp.progressia.common.util.NamespacedRegistry;
|
||||
import ru.windcorp.progressia.common.util.crash.CrashReports;
|
||||
|
||||
public class EntityRenderRegistry extends NamespacedRegistry<EntityRender> {
|
||||
|
||||
@ -28,7 +29,8 @@ public class EntityRenderRegistry extends NamespacedRegistry<EntityRender> {
|
||||
).getData()
|
||||
);
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
CrashReports.report(e, "__DOC__ME__");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -30,6 +30,7 @@ import com.google.common.io.CharStreams;
|
||||
|
||||
import ru.windcorp.progressia.Progressia;
|
||||
import ru.windcorp.progressia.common.util.Named;
|
||||
import ru.windcorp.progressia.common.util.crash.CrashReports;
|
||||
|
||||
public class Resource extends Named {
|
||||
|
||||
@ -50,7 +51,8 @@ public class Resource extends Named {
|
||||
try (Reader reader = getReader()) {
|
||||
return CharStreams.toString(reader);
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e); // TODO handle gracefully
|
||||
CrashReports.report(e, "__DOC__ME__");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@ -59,7 +61,8 @@ public class Resource extends Named {
|
||||
try (InputStream stream = getInputStream()) {
|
||||
byteArray = ByteStreams.toByteArray(stream);
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e); // TODO handle gracefully
|
||||
CrashReports.report(e, "__DOC__ME__");
|
||||
return null;
|
||||
}
|
||||
|
||||
if (output == null || output.remaining() < byteArray.length) {
|
||||
|
@ -4,6 +4,8 @@ import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.apache.logging.log4j.core.util.StringBuilderWriter;
|
||||
|
||||
import ru.windcorp.jputil.chars.StringUtil;
|
||||
|
||||
import java.io.BufferedWriter;
|
||||
import java.io.IOException;
|
||||
import java.io.PrintWriter;
|
||||
@ -16,17 +18,16 @@ import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
|
||||
public class CrashReportGenerator {
|
||||
public class CrashReports {
|
||||
|
||||
private CrashReportGenerator() {}
|
||||
private CrashReports() {
|
||||
}
|
||||
|
||||
private static final Path CRASH_REPORTS_PATH = Paths.get("crash-reports");
|
||||
|
||||
private static final Collection<ContextProvider> PROVIDERS =
|
||||
Collections.synchronizedCollection(new ArrayList<>());
|
||||
private static final Collection<ContextProvider> PROVIDERS = Collections.synchronizedCollection(new ArrayList<>());
|
||||
|
||||
private static final Collection<Analyzer> ANALYZERS =
|
||||
Collections.synchronizedCollection(new ArrayList<>());
|
||||
private static final Collection<Analyzer> ANALYZERS = Collections.synchronizedCollection(new ArrayList<>());
|
||||
|
||||
private static final Logger LOGGER = LogManager.getLogger("crash");
|
||||
|
||||
@ -34,11 +35,12 @@ public class CrashReportGenerator {
|
||||
* <em>This method never returns.</em>
|
||||
* <p>
|
||||
* TODO document
|
||||
*
|
||||
* @param throwable
|
||||
* @param messageFormat
|
||||
* @param args
|
||||
*/
|
||||
public static void crash(Throwable throwable, String messageFormat, Object... args) {
|
||||
public static void report(Throwable throwable, String messageFormat, Object... args) {
|
||||
StringBuilder output = new StringBuilder();
|
||||
|
||||
appendContextProviders(output);
|
||||
@ -59,11 +61,11 @@ public class CrashReportGenerator {
|
||||
private static void appendContextProviders(StringBuilder output) {
|
||||
|
||||
// Do a local copy to avoid deadlocks -OLEGSHA
|
||||
ContextProvider[] localProvidersCopy =
|
||||
PROVIDERS.toArray(new ContextProvider[PROVIDERS.size()]);
|
||||
ContextProvider[] localProvidersCopy = PROVIDERS.toArray(new ContextProvider[PROVIDERS.size()]);
|
||||
|
||||
for (ContextProvider provider : localProvidersCopy) {
|
||||
if (provider == null) continue;
|
||||
if (provider == null)
|
||||
continue;
|
||||
|
||||
addSeparator(output);
|
||||
|
||||
@ -94,18 +96,16 @@ public class CrashReportGenerator {
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean appendAnalyzers(
|
||||
StringBuilder output,
|
||||
Throwable throwable, String messageFormat, Object[] args
|
||||
) {
|
||||
private static boolean appendAnalyzers(StringBuilder output, Throwable throwable, String messageFormat,
|
||||
Object[] args) {
|
||||
boolean analyzerResponsesExist = false;
|
||||
|
||||
// Do a local copy to avoid deadlocks -OLEGSHA
|
||||
Analyzer[] localAnalyzersCopy =
|
||||
ANALYZERS.toArray(new Analyzer[ANALYZERS.size()]);
|
||||
Analyzer[] localAnalyzersCopy = ANALYZERS.toArray(new Analyzer[ANALYZERS.size()]);
|
||||
|
||||
for (Analyzer analyzer : localAnalyzersCopy) {
|
||||
if (analyzer == null) continue;
|
||||
if (analyzer == null)
|
||||
continue;
|
||||
|
||||
String answer;
|
||||
try {
|
||||
@ -177,22 +177,19 @@ public class CrashReportGenerator {
|
||||
DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd-HH.mm.ss");
|
||||
|
||||
try {
|
||||
if (!Files.exists(CRASH_REPORTS_PATH)) Files.createDirectory(CRASH_REPORTS_PATH);
|
||||
if (!Files.exists(CRASH_REPORTS_PATH))
|
||||
Files.createDirectory(CRASH_REPORTS_PATH);
|
||||
|
||||
createFileForCrashReport(output, CRASH_REPORTS_PATH.toString() + "/latest.log");
|
||||
createFileForCrashReport(output, CRASH_REPORTS_PATH.toString() + "/crash-" + dateFormat.format(date) + ".log");
|
||||
createFileForCrashReport(output,
|
||||
CRASH_REPORTS_PATH.toString() + "/crash-" + dateFormat.format(date) + ".log");
|
||||
} catch (Throwable t) {
|
||||
// Crash Report not created
|
||||
}
|
||||
}
|
||||
|
||||
private static void createFileForCrashReport(String buffer, String filename) {
|
||||
try (
|
||||
BufferedWriter writer = Files.newBufferedWriter(
|
||||
Paths.get(filename),
|
||||
StandardCharsets.UTF_8
|
||||
)
|
||||
) {
|
||||
try (BufferedWriter writer = Files.newBufferedWriter(Paths.get(filename), StandardCharsets.UTF_8)) {
|
||||
writer.write(buffer);
|
||||
} catch (IOException ex) {
|
||||
// Crash Report not created
|
||||
@ -210,7 +207,6 @@ public class CrashReportGenerator {
|
||||
private static void addSeparator(StringBuilder sb) {
|
||||
sb.append(
|
||||
// 80 chars
|
||||
"--------------------------------------------------------------------------------"
|
||||
).append("\n");
|
||||
"--------------------------------------------------------------------------------").append("\n");
|
||||
}
|
||||
}
|
@ -7,6 +7,7 @@ import java.io.IOException;
|
||||
import ru.windcorp.progressia.common.comms.packets.PacketWorldChange;
|
||||
import ru.windcorp.progressia.common.state.IOContext;
|
||||
import ru.windcorp.progressia.common.util.DataBuffer;
|
||||
import ru.windcorp.progressia.common.util.crash.CrashReports;
|
||||
import ru.windcorp.progressia.common.world.WorldData;
|
||||
|
||||
public class PacketEntityChange extends PacketWorldChange {
|
||||
@ -43,17 +44,13 @@ public class PacketEntityChange extends PacketWorldChange {
|
||||
EntityData entity = world.getEntity(getEntityId());
|
||||
|
||||
if (entity == null) {
|
||||
throw new RuntimeException(
|
||||
"Entity with ID " + getEntityId() + " not found"
|
||||
);
|
||||
CrashReports.report(null, "Entity with ID %d not found", getEntityId());
|
||||
}
|
||||
|
||||
try {
|
||||
entity.read(getReader(), IOContext.COMMS);
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(
|
||||
"Entity could not be read", e
|
||||
);
|
||||
CrashReports.report(e, "Entity could not be read");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -11,6 +11,7 @@ import ru.windcorp.progressia.common.comms.packets.PacketWorldChange;
|
||||
import ru.windcorp.progressia.common.state.IOContext;
|
||||
import ru.windcorp.progressia.common.util.LowOverheadCache;
|
||||
import ru.windcorp.progressia.common.util.Vectors;
|
||||
import ru.windcorp.progressia.common.util.crash.CrashReports;
|
||||
import ru.windcorp.progressia.common.world.Coordinates;
|
||||
import ru.windcorp.progressia.common.world.WorldData;
|
||||
import ru.windcorp.progressia.common.world.block.BlockData;
|
||||
@ -95,8 +96,7 @@ public class ImplementedChangeTracker implements Changer {
|
||||
Vec3i blockInChunk = Vectors.grab3i();
|
||||
Coordinates.convertInWorldToInChunk(position, blockInChunk);
|
||||
|
||||
List<TileData> tiles = world.getChunkByBlock(position)
|
||||
.getTiles(blockInChunk, face);
|
||||
List<TileData> tiles = world.getChunkByBlock(position).getTiles(blockInChunk, face);
|
||||
|
||||
if (shouldAdd) {
|
||||
tiles.add(tile);
|
||||
@ -134,7 +134,7 @@ public class ImplementedChangeTracker implements Changer {
|
||||
try {
|
||||
entity.write(packet.getWriter(), IOContext.COMMS);
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
CrashReports.report(e, "__DOC__ME__");
|
||||
}
|
||||
}
|
||||
|
||||
@ -146,7 +146,7 @@ public class ImplementedChangeTracker implements Changer {
|
||||
try {
|
||||
entity.write(packet.getWriter(), IOContext.COMMS);
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException("Entity could not be written", e);
|
||||
CrashReports.report(e, "Entity could not be written");
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user