Update #43 - Fix invisible block entities and other issues

This commit is contained in:
lax1dude
2024-11-20 19:39:40 -08:00
parent 6cd2eed5b3
commit 1e235f93bf
31 changed files with 237 additions and 198 deletions

View File

@ -679,16 +679,8 @@ public class PlatformInput {
return 0;
}
public static float touchGetEventTouchRadiusX(int pointId) {
return 0.0f;
}
public static float touchGetEventTouchRadiusY(int pointId) {
return 0.0f;
}
public static float touchGetEventTouchRadiusMixed(int pointId) {
return touchGetEventTouchRadiusX(pointId) * 0.5f + touchGetEventTouchRadiusY(pointId) * 0.5f;
return 0.0f;
}
public static float touchGetEventTouchForce(int pointId) {
@ -711,16 +703,8 @@ public class PlatformInput {
return 0;
}
public static float touchRadiusX(int pointId) {
return 0.0f;
}
public static float touchRadiusY(int pointId) {
return 0.0f;
}
public static float touchRadiusMixed(int pointId) {
return touchRadiusX(pointId) * 0.5f + touchRadiusY(pointId) * 0.5f;
return 0.0f;
}
public static float touchForce(int pointId) {

View File

@ -413,15 +413,11 @@ public class PlatformWebRTC {
synchronized (serverLANEventBuffer) {
serverLANEventBuffer.put(peerId, e);
}
if (client.peerStateDesc != PEERSTATE_SUCCESS)
client.peerStateDesc = PEERSTATE_SUCCESS;
}
@Override
public void onFailure(String s) {
logger.error("Failed to set local description for \"{}\"! {}", peerId, s);
if (client.peerStateDesc == PEERSTATE_LOADING)
client.peerStateDesc = PEERSTATE_FAILED;
client.signalRemoteDisconnect(peerId);
}
});
@ -430,8 +426,6 @@ public class PlatformWebRTC {
@Override
public void onFailure(String s) {
logger.error("Failed to create answer for \"{}\"! {}", peerId, s);
if (client.peerStateDesc == PEERSTATE_LOADING)
client.peerStateDesc = PEERSTATE_FAILED;
client.signalRemoteDisconnect(peerId);
}
});
@ -441,13 +435,11 @@ public class PlatformWebRTC {
@Override
public void onFailure(String s) {
logger.error("Failed to set remote description for \"{}\"! {}", peerId, s);
if (client.peerStateDesc == PEERSTATE_LOADING) client.peerStateDesc = PEERSTATE_FAILED;
client.signalRemoteDisconnect(peerId);
}
});
} catch (Throwable err) {
logger.error("Failed to parse remote description for \"{}\"! {}", peerId, err.getMessage());
if (client.peerStateDesc == PEERSTATE_LOADING) client.peerStateDesc = PEERSTATE_FAILED;
client.signalRemoteDisconnect(peerId);
}
}
@ -459,10 +451,8 @@ public class PlatformWebRTC {
JSONObject candidate = jsonArray.getJSONObject(i);
peerConnection.addIceCandidate(new RTCIceCandidate(null, candidate.getInt("sdpMLineIndex"), candidate.getString("candidate")));
}
if (client.peerStateIce != PEERSTATE_SUCCESS) client.peerStateIce = PEERSTATE_SUCCESS;
} catch (Throwable err) {
logger.error("Failed to parse ice candidate for \"{}\"! {}", peerId, err.getMessage());
if (client.peerStateIce == PEERSTATE_LOADING) client.peerStateIce = PEERSTATE_FAILED;
client.signalRemoteDisconnect(peerId);
}
}
@ -490,11 +480,6 @@ public class PlatformWebRTC {
public Set<Map<String, String>> iceServers = new HashSet<>();
public Map<String, LANPeer> peerList = new HashMap<>();
public Map<String, LANPeer> ipcMapList = new HashMap<>();
public byte peerState = PEERSTATE_LOADING;
public byte peerStateConnect = PEERSTATE_LOADING;
public byte peerStateInitial = PEERSTATE_LOADING;
public byte peerStateDesc = PEERSTATE_LOADING;
public byte peerStateIce = PEERSTATE_LOADING;
private final Object lock3 = new Object();
public void setIceServers(String[] urls) {
@ -541,10 +526,6 @@ public class PlatformWebRTC {
}
}
public void resetPeerStates() {
peerState = peerStateConnect = peerStateInitial = peerStateDesc = peerStateIce = PEERSTATE_LOADING;
}
public void signalRemoteConnect(String peerId) {
try {
List<Map<String, String>> iceCandidates = new ArrayList<>();
@ -597,7 +578,6 @@ public class PlatformWebRTC {
final Runnable[] retry = new Runnable[1];
final int[] loopCount = new int[1];
scheduleTask(-1l, retry[0] = () -> {
int i = 0;
f: {
synchronized (lock3) {
if (iceCandidates.isEmpty()) {
@ -650,14 +630,7 @@ public class PlatformWebRTC {
@Override
public void onConnectionChange(RTCPeerConnectionState connectionState) {
if (connectionState == RTCPeerConnectionState.DISCONNECTED) {
LANServer.this.signalRemoteDisconnect(peerId);
} else if (connectionState == RTCPeerConnectionState.CONNECTED) {
if (LANServer.this.peerState != PEERSTATE_SUCCESS)
LANServer.this.peerState = PEERSTATE_SUCCESS;
} else if (connectionState == RTCPeerConnectionState.FAILED) {
if (LANServer.this.peerState == PEERSTATE_LOADING)
LANServer.this.peerState = PEERSTATE_FAILED;
if (connectionState == RTCPeerConnectionState.DISCONNECTED || connectionState == RTCPeerConnectionState.FAILED) {
LANServer.this.signalRemoteDisconnect(peerId);
}
}
@ -666,9 +639,10 @@ public class PlatformWebRTC {
synchronized(peerList) {
peerList.put(peerId, peerInstance[0]);
}
if (peerStateConnect != PEERSTATE_SUCCESS) peerStateConnect = PEERSTATE_SUCCESS;
} catch (Throwable e) {
if (peerStateConnect == PEERSTATE_LOADING) peerStateConnect = PEERSTATE_FAILED;
logger.error("Failed to create peer for \"{}\"", peerId);
logger.error(e);
signalRemoteDisconnect(peerId);
}
}
@ -871,7 +845,6 @@ public class PlatformWebRTC {
synchronized(serverLANEventBuffer) {
serverLANEventBuffer.clear();
}
rtcLANServer.resetPeerStates();
rtcLANServer.setIceServers(servers);
}

View File

@ -25,11 +25,20 @@ public class EaglerLWJGLAllocator {
}
}
private static final boolean enableAllocCount = false;
private static volatile int allocCount = 0;
public static int getAllocCount() {
if(!enableAllocCount) throw new UnsupportedOperationException();
return allocCount;
}
public static ByteBuffer allocByteBuffer(int len) {
long ret = JEmalloc.nje_malloc(len);
if(ret == 0l) {
throw new OutOfMemoryError("Native je_malloc call returned null pointer!");
}
if(enableAllocCount) ++allocCount;
return new EaglerLWJGLByteBuffer(ret, len, true);
}
@ -38,6 +47,7 @@ public class EaglerLWJGLAllocator {
if(ret == 0l) {
throw new OutOfMemoryError("Native je_malloc call returned null pointer!");
}
if(enableAllocCount) ++allocCount;
return new EaglerLWJGLShortBuffer(ret, len, true);
}
@ -46,6 +56,7 @@ public class EaglerLWJGLAllocator {
if(ret == 0l) {
throw new OutOfMemoryError("Native je_malloc call returned null pointer!");
}
if(enableAllocCount) ++allocCount;
return new EaglerLWJGLIntBuffer(ret, len, true);
}
@ -54,6 +65,7 @@ public class EaglerLWJGLAllocator {
if(ret == 0l) {
throw new OutOfMemoryError("Native je_malloc call returned null pointer!");
}
if(enableAllocCount) ++allocCount;
return new EaglerLWJGLFloatBuffer(ret, len, true);
}
@ -62,6 +74,7 @@ public class EaglerLWJGLAllocator {
EaglerLWJGLByteBuffer buf = (EaglerLWJGLByteBuffer)buffer;
if(buf.original) {
JEmalloc.nje_free(buf.address);
if(enableAllocCount) --allocCount;
}else {
throwNotOriginal(buffer);
}
@ -84,6 +97,7 @@ public class EaglerLWJGLAllocator {
EaglerLWJGLShortBuffer buf = (EaglerLWJGLShortBuffer)buffer;
if(buf.original) {
JEmalloc.nje_free(buf.address);
if(enableAllocCount) --allocCount;
}else {
throwNotOriginal(buffer);
}
@ -106,6 +120,7 @@ public class EaglerLWJGLAllocator {
EaglerLWJGLIntBuffer buf = (EaglerLWJGLIntBuffer)buffer;
if(buf.original) {
JEmalloc.nje_free(buf.address);
if(enableAllocCount) --allocCount;
}else {
throwNotOriginal(buffer);
}
@ -128,6 +143,7 @@ public class EaglerLWJGLAllocator {
EaglerLWJGLFloatBuffer buf = (EaglerLWJGLFloatBuffer)buffer;
if(buf.original) {
JEmalloc.nje_free(buf.address);
if(enableAllocCount) --allocCount;
}else {
throwNotOriginal(buffer);
}