mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-12-19 15:09:18 +00:00
fix more unsafe mantle operations
This commit is contained in:
@@ -220,7 +220,9 @@ public class MantleChunk {
|
||||
|
||||
if (matter == null) {
|
||||
matter = new IrisMatter(16, 16, 16);
|
||||
sections.set(section, matter);
|
||||
if (!sections.compareAndSet(section, null, matter)) {
|
||||
matter = get(section);
|
||||
}
|
||||
}
|
||||
|
||||
return matter;
|
||||
|
||||
@@ -25,6 +25,8 @@ import com.volmit.iris.util.json.JSONObject;
|
||||
import com.volmit.iris.util.plugin.VolmitSender;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
public class IrisMatter extends IrisRegistrant implements Matter {
|
||||
protected static final KMap<Class<?>, MatterSlice<?>> slicers = buildSlicers();
|
||||
|
||||
@@ -65,6 +67,12 @@ public class IrisMatter extends IrisRegistrant implements Matter {
|
||||
return c;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public <T> MatterSlice<T> slice(Class<?> c) {
|
||||
return (MatterSlice<T>) sliceMap.computeIfAbsent(c, $ -> Objects.requireNonNull(createSlice(c, this), "Bad slice " + c.getCanonicalName()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> MatterSlice<T> createSlice(Class<T> type, Matter m) {
|
||||
MatterSlice<?> slice = slicers.get(type);
|
||||
|
||||
Reference in New Issue
Block a user