mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2024-11-18 01:46:11 +00:00
Correctness improvement for legacy data in expression generation.
This commit is contained in:
parent
e53962dadd
commit
c3ee926a2e
@ -1897,12 +1897,25 @@ public class EditSession implements Extent, AutoCloseable {
|
|||||||
final Vector3 scaled = current.subtract(zero).divide(unit);
|
final Vector3 scaled = current.subtract(zero).divide(unit);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (expression.evaluate(scaled.getX(), scaled.getY(), scaled.getZ(), defaultMaterial.getBlockType().getLegacyId(), 0) <= 0) {
|
int[] legacy = LegacyMapper.getInstance().getLegacyFromBlock(defaultMaterial.toImmutableState());
|
||||||
// TODO data
|
int typeVar = 0;
|
||||||
|
int dataVar = 0;
|
||||||
|
if (legacy != null) {
|
||||||
|
typeVar = legacy[0];
|
||||||
|
if (legacy.length > 1) {
|
||||||
|
dataVar = legacy[1];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (expression.evaluate(scaled.getX(), scaled.getY(), scaled.getZ(), typeVar, dataVar) <= 0) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
int newType = (int) typeVariable.getValue();
|
||||||
|
int newData = (int) dataVariable.getValue();
|
||||||
|
if (newType != typeVar || newData != dataVar) {
|
||||||
return LegacyMapper.getInstance().getBlockFromLegacy((int) typeVariable.getValue(), (int) dataVariable.getValue()).toBaseBlock();
|
return LegacyMapper.getInstance().getBlockFromLegacy((int) typeVariable.getValue(), (int) dataVariable.getValue()).toBaseBlock();
|
||||||
|
} else {
|
||||||
|
return defaultMaterial;
|
||||||
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.log(Level.WARNING, "Failed to create shape", e);
|
log.log(Level.WARNING, "Failed to create shape", e);
|
||||||
return null;
|
return null;
|
||||||
|
Loading…
Reference in New Issue
Block a user