mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-07-04 12:06:41 +00:00
Fix some api compatibility issues
This commit is contained in:
@ -26,6 +26,7 @@ import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.blocks.BaseItem;
|
||||
import com.sk89q.worldedit.registry.state.PropertyKey;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
@ -150,10 +151,16 @@ public class LegacyMapper {
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public Integer getLegacyFromItem(ItemType itemType) {
|
||||
public Integer getLegacyCombined(ItemType itemType) {
|
||||
return itemMap.inverse().get(itemType);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public int[] getLegacyFromItem(ItemType itemType) {
|
||||
Integer combinedId = getLegacyCombined(itemType);
|
||||
return combinedId == null ? null : new int[] { combinedId >> 4, combinedId & 0xF };
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public BlockState getBlockFromLegacy(int legacyId) {
|
||||
return getBlock(legacyId << 4);
|
||||
@ -190,17 +197,23 @@ public class LegacyMapper {
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public Integer getLegacyFromBlock(BlockState blockState) {
|
||||
public Integer getLegacyCombined(BlockState blockState) {
|
||||
Integer result = blockStateToLegacyId4Data.get(blockState.getInternalId());
|
||||
if (result == null) result = blockStateToLegacyId4Data.get(blockState.getInternalBlockTypeId());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public Integer getLegacyFromBlock(BlockType type) {
|
||||
public Integer getLegacyCombined(BlockType type) {
|
||||
return blockStateToLegacyId4Data.get(type.getDefaultState());
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public int[] getLegacyFromBlock(BlockState blockState) {
|
||||
Integer combinedId = getLegacyCombined(blockState);
|
||||
return combinedId == null ? null : new int[] { combinedId >> 4, combinedId & 0xF };
|
||||
}
|
||||
|
||||
public static LegacyMapper getInstance() {
|
||||
if (INSTANCE == null) {
|
||||
INSTANCE = new LegacyMapper();
|
||||
|
Reference in New Issue
Block a user