mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2024-12-23 01:37:37 +00:00
idk why we need a lazy reference for an integer here
when null would work better
This commit is contained in:
parent
b292416496
commit
27ec3cdc66
@ -54,8 +54,11 @@ public class BlockType implements FawePattern, Keyed {
|
|||||||
|
|
||||||
private final String id;
|
private final String id;
|
||||||
private final BlockTypesCache.Settings settings;
|
private final BlockTypesCache.Settings settings;
|
||||||
private final LazyReference<Integer> legacyId = LazyReference.from(() -> computeLegacy(0));
|
/*
|
||||||
|
private final LazyReference<Integer> legacyId = LazyReference.from(() -> computeLgacy(0));
|
||||||
private final LazyReference<Integer> legacyData = LazyReference.from(() -> computeLegacy(1));
|
private final LazyReference<Integer> legacyData = LazyReference.from(() -> computeLegacy(1));
|
||||||
|
*/
|
||||||
|
private Integer legacyCombinedId;
|
||||||
private boolean initItemType;
|
private boolean initItemType;
|
||||||
private ItemType itemType;
|
private ItemType itemType;
|
||||||
|
|
||||||
@ -310,7 +313,7 @@ public class BlockType implements FawePattern, Keyed {
|
|||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public int getLegacyId() {
|
public int getLegacyId() {
|
||||||
return legacyId.getValue();
|
return computeLegacy(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -322,11 +325,13 @@ public class BlockType implements FawePattern, Keyed {
|
|||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public int getLegacyData() {
|
public int getLegacyData() {
|
||||||
return legacyData.getValue();
|
return computeLegacy(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
private int computeLegacy(int index) {
|
private int computeLegacy(int index) {
|
||||||
int[] legacy = LegacyMapper.getInstance().getLegacyFromBlock(this.getDefaultState());
|
if (this.legacyCombinedId == null) {
|
||||||
return legacy != null ? legacy[index] : 0;
|
this.legacyCombinedId = LegacyMapper.getInstance().getLegacyCombined(this.getDefaultState());
|
||||||
|
}
|
||||||
|
return index == 0 ? legacyCombinedId >> 4 : legacyCombinedId & 15;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user