mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2024-12-22 17:27:38 +00:00
Fix property loading
This commit is contained in:
parent
fee9029bf0
commit
99a58f66cd
@ -507,24 +507,42 @@ public final class PaperweightAdapter implements BukkitImplAdapter<net.minecraft
|
|||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||||
private static final LoadingCache<net.minecraft.world.level.block.state.properties.Property, Property<?>> PROPERTY_CACHE = CacheBuilder.newBuilder().build(new CacheLoader<net.minecraft.world.level.block.state.properties.Property, Property<?>>() {
|
private static final LoadingCache<net.minecraft.world.level.block.state.properties.Property, Property<?>> PROPERTY_CACHE = CacheBuilder
|
||||||
@Override
|
.newBuilder()
|
||||||
public Property<?> load(net.minecraft.world.level.block.state.properties.Property state) throws Exception {
|
.build(new CacheLoader<>() {
|
||||||
if (state instanceof net.minecraft.world.level.block.state.properties.BooleanProperty) {
|
@Override
|
||||||
return new BooleanProperty(state.getName(), ImmutableList.copyOf(state.getPossibleValues()));
|
public Property<?> load(net.minecraft.world.level.block.state.properties.Property state) {
|
||||||
} else if (state instanceof DirectionProperty) {
|
if (state instanceof net.minecraft.world.level.block.state.properties.BooleanProperty) {
|
||||||
return new DirectionalProperty(state.getName(),
|
return new BooleanProperty(state.getName(), ImmutableList.copyOf(state.getPossibleValues()));
|
||||||
(List<Direction>) state.getPossibleValues().stream().map(e -> Direction.valueOf(((StringRepresentable) e).getSerializedName().toUpperCase(Locale.ROOT))).collect(Collectors.toList()));
|
} else if (state instanceof DirectionProperty) {
|
||||||
} else if (state instanceof net.minecraft.world.level.block.state.properties.EnumProperty) {
|
return new DirectionalProperty(
|
||||||
return new EnumProperty(state.getName(),
|
state.getName(),
|
||||||
(List<String>) state.getPossibleValues().stream().map(e -> ((StringRepresentable) e).getSerializedName()).collect(Collectors.toList()));
|
new ArrayList<>((List<Direction>) state
|
||||||
} else if (state instanceof net.minecraft.world.level.block.state.properties.IntegerProperty) {
|
.getPossibleValues()
|
||||||
return new IntegerProperty(state.getName(), ImmutableList.copyOf(state.getPossibleValues()));
|
.stream()
|
||||||
} else {
|
.map(e -> Direction.valueOf(((StringRepresentable) e)
|
||||||
throw new IllegalArgumentException("WorldEdit needs an update to support " + state.getClass().getSimpleName());
|
.getSerializedName()
|
||||||
}
|
.toUpperCase(Locale.ROOT)))
|
||||||
}
|
.toList())
|
||||||
});
|
);
|
||||||
|
} else if (state instanceof net.minecraft.world.level.block.state.properties.EnumProperty) {
|
||||||
|
return new EnumProperty(
|
||||||
|
state.getName(),
|
||||||
|
new ArrayList<>((List<String>) state
|
||||||
|
.getPossibleValues()
|
||||||
|
.stream()
|
||||||
|
.map(e -> ((StringRepresentable) e).getSerializedName())
|
||||||
|
.toList())
|
||||||
|
);
|
||||||
|
} else if (state instanceof net.minecraft.world.level.block.state.properties.IntegerProperty) {
|
||||||
|
return new IntegerProperty(state.getName(), ImmutableList.copyOf(state.getPossibleValues()));
|
||||||
|
} else {
|
||||||
|
throw new IllegalArgumentException("WorldEdit needs an update to support " + state
|
||||||
|
.getClass()
|
||||||
|
.getSimpleName());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
@SuppressWarnings({ "rawtypes" })
|
@SuppressWarnings({ "rawtypes" })
|
||||||
@Override
|
@Override
|
||||||
|
@ -561,24 +561,42 @@ public final class PaperweightAdapter implements BukkitImplAdapter<net.minecraft
|
|||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||||
private static final LoadingCache<net.minecraft.world.level.block.state.properties.Property, Property<?>> PROPERTY_CACHE = CacheBuilder.newBuilder().build(new CacheLoader<net.minecraft.world.level.block.state.properties.Property, Property<?>>() {
|
private static final LoadingCache<net.minecraft.world.level.block.state.properties.Property, Property<?>> PROPERTY_CACHE = CacheBuilder
|
||||||
@Override
|
.newBuilder()
|
||||||
public Property<?> load(net.minecraft.world.level.block.state.properties.Property state) throws Exception {
|
.build(new CacheLoader<>() {
|
||||||
if (state instanceof net.minecraft.world.level.block.state.properties.BooleanProperty) {
|
@Override
|
||||||
return new BooleanProperty(state.getName(), ImmutableList.copyOf(state.getPossibleValues()));
|
public Property<?> load(net.minecraft.world.level.block.state.properties.Property state) {
|
||||||
} else if (state instanceof DirectionProperty) {
|
if (state instanceof net.minecraft.world.level.block.state.properties.BooleanProperty) {
|
||||||
return new DirectionalProperty(state.getName(),
|
return new BooleanProperty(state.getName(), ImmutableList.copyOf(state.getPossibleValues()));
|
||||||
(List<Direction>) state.getPossibleValues().stream().map(e -> Direction.valueOf(((StringRepresentable) e).getSerializedName().toUpperCase(Locale.ROOT))).collect(Collectors.toList()));
|
} else if (state instanceof DirectionProperty) {
|
||||||
} else if (state instanceof net.minecraft.world.level.block.state.properties.EnumProperty) {
|
return new DirectionalProperty(
|
||||||
return new EnumProperty(state.getName(),
|
state.getName(),
|
||||||
(List<String>) state.getPossibleValues().stream().map(e -> ((StringRepresentable) e).getSerializedName()).collect(Collectors.toList()));
|
new ArrayList<>((List<Direction>) state
|
||||||
} else if (state instanceof net.minecraft.world.level.block.state.properties.IntegerProperty) {
|
.getPossibleValues()
|
||||||
return new IntegerProperty(state.getName(), ImmutableList.copyOf(state.getPossibleValues()));
|
.stream()
|
||||||
} else {
|
.map(e -> Direction.valueOf(((StringRepresentable) e)
|
||||||
throw new IllegalArgumentException("WorldEdit needs an update to support " + state.getClass().getSimpleName());
|
.getSerializedName()
|
||||||
}
|
.toUpperCase(Locale.ROOT)))
|
||||||
}
|
.toList())
|
||||||
});
|
);
|
||||||
|
} else if (state instanceof net.minecraft.world.level.block.state.properties.EnumProperty) {
|
||||||
|
return new EnumProperty(
|
||||||
|
state.getName(),
|
||||||
|
new ArrayList<>((List<String>) state
|
||||||
|
.getPossibleValues()
|
||||||
|
.stream()
|
||||||
|
.map(e -> ((StringRepresentable) e).getSerializedName())
|
||||||
|
.toList())
|
||||||
|
);
|
||||||
|
} else if (state instanceof net.minecraft.world.level.block.state.properties.IntegerProperty) {
|
||||||
|
return new IntegerProperty(state.getName(), ImmutableList.copyOf(state.getPossibleValues()));
|
||||||
|
} else {
|
||||||
|
throw new IllegalArgumentException("WorldEdit needs an update to support " + state
|
||||||
|
.getClass()
|
||||||
|
.getSimpleName());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
@SuppressWarnings({ "rawtypes" })
|
@SuppressWarnings({ "rawtypes" })
|
||||||
@Override
|
@Override
|
||||||
|
@ -551,24 +551,42 @@ public final class PaperweightAdapter implements BukkitImplAdapter<net.minecraft
|
|||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||||
private static final LoadingCache<net.minecraft.world.level.block.state.properties.Property, Property<?>> PROPERTY_CACHE = CacheBuilder.newBuilder().build(new CacheLoader<net.minecraft.world.level.block.state.properties.Property, Property<?>>() {
|
private static final LoadingCache<net.minecraft.world.level.block.state.properties.Property, Property<?>> PROPERTY_CACHE = CacheBuilder
|
||||||
@Override
|
.newBuilder()
|
||||||
public Property<?> load(net.minecraft.world.level.block.state.properties.Property state) throws Exception {
|
.build(new CacheLoader<>() {
|
||||||
if (state instanceof net.minecraft.world.level.block.state.properties.BooleanProperty) {
|
@Override
|
||||||
return new BooleanProperty(state.getName(), ImmutableList.copyOf(state.getPossibleValues()));
|
public Property<?> load(net.minecraft.world.level.block.state.properties.Property state) {
|
||||||
} else if (state instanceof DirectionProperty) {
|
if (state instanceof net.minecraft.world.level.block.state.properties.BooleanProperty) {
|
||||||
return new DirectionalProperty(state.getName(),
|
return new BooleanProperty(state.getName(), ImmutableList.copyOf(state.getPossibleValues()));
|
||||||
(List<Direction>) state.getPossibleValues().stream().map(e -> Direction.valueOf(((StringRepresentable) e).getSerializedName().toUpperCase(Locale.ROOT))).toList());
|
} else if (state instanceof DirectionProperty) {
|
||||||
} else if (state instanceof net.minecraft.world.level.block.state.properties.EnumProperty) {
|
return new DirectionalProperty(
|
||||||
return new EnumProperty(state.getName(),
|
state.getName(),
|
||||||
(List<String>) state.getPossibleValues().stream().map(e -> ((StringRepresentable) e).getSerializedName()).toList());
|
new ArrayList<>((List<Direction>) state
|
||||||
} else if (state instanceof net.minecraft.world.level.block.state.properties.IntegerProperty) {
|
.getPossibleValues()
|
||||||
return new IntegerProperty(state.getName(), ImmutableList.copyOf(state.getPossibleValues()));
|
.stream()
|
||||||
} else {
|
.map(e -> Direction.valueOf(((StringRepresentable) e)
|
||||||
throw new IllegalArgumentException("WorldEdit needs an update to support " + state.getClass().getSimpleName());
|
.getSerializedName()
|
||||||
}
|
.toUpperCase(Locale.ROOT)))
|
||||||
}
|
.toList())
|
||||||
});
|
);
|
||||||
|
} else if (state instanceof net.minecraft.world.level.block.state.properties.EnumProperty) {
|
||||||
|
return new EnumProperty(
|
||||||
|
state.getName(),
|
||||||
|
new ArrayList<>((List<String>) state
|
||||||
|
.getPossibleValues()
|
||||||
|
.stream()
|
||||||
|
.map(e -> ((StringRepresentable) e).getSerializedName())
|
||||||
|
.toList())
|
||||||
|
);
|
||||||
|
} else if (state instanceof net.minecraft.world.level.block.state.properties.IntegerProperty) {
|
||||||
|
return new IntegerProperty(state.getName(), ImmutableList.copyOf(state.getPossibleValues()));
|
||||||
|
} else {
|
||||||
|
throw new IllegalArgumentException("WorldEdit needs an update to support " + state
|
||||||
|
.getClass()
|
||||||
|
.getSimpleName());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
@SuppressWarnings({ "rawtypes" })
|
@SuppressWarnings({ "rawtypes" })
|
||||||
@Override
|
@Override
|
||||||
|
@ -550,24 +550,42 @@ public final class PaperweightAdapter implements BukkitImplAdapter<net.minecraft
|
|||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||||
private static final LoadingCache<net.minecraft.world.level.block.state.properties.Property, Property<?>> PROPERTY_CACHE = CacheBuilder.newBuilder().build(new CacheLoader<net.minecraft.world.level.block.state.properties.Property, Property<?>>() {
|
private static final LoadingCache<net.minecraft.world.level.block.state.properties.Property, Property<?>> PROPERTY_CACHE = CacheBuilder
|
||||||
@Override
|
.newBuilder()
|
||||||
public Property<?> load(net.minecraft.world.level.block.state.properties.Property state) throws Exception {
|
.build(new CacheLoader<>() {
|
||||||
if (state instanceof net.minecraft.world.level.block.state.properties.BooleanProperty) {
|
@Override
|
||||||
return new BooleanProperty(state.getName(), ImmutableList.copyOf(state.getPossibleValues()));
|
public Property<?> load(net.minecraft.world.level.block.state.properties.Property state) {
|
||||||
} else if (state instanceof DirectionProperty) {
|
if (state instanceof net.minecraft.world.level.block.state.properties.BooleanProperty) {
|
||||||
return new DirectionalProperty(state.getName(),
|
return new BooleanProperty(state.getName(), ImmutableList.copyOf(state.getPossibleValues()));
|
||||||
(List<Direction>) state.getPossibleValues().stream().map(e -> Direction.valueOf(((StringRepresentable) e).getSerializedName().toUpperCase(Locale.ROOT))).toList());
|
} else if (state instanceof DirectionProperty) {
|
||||||
} else if (state instanceof net.minecraft.world.level.block.state.properties.EnumProperty) {
|
return new DirectionalProperty(
|
||||||
return new EnumProperty(state.getName(),
|
state.getName(),
|
||||||
(List<String>) state.getPossibleValues().stream().map(e -> ((StringRepresentable) e).getSerializedName()).toList());
|
new ArrayList<>((List<Direction>) state
|
||||||
} else if (state instanceof net.minecraft.world.level.block.state.properties.IntegerProperty) {
|
.getPossibleValues()
|
||||||
return new IntegerProperty(state.getName(), ImmutableList.copyOf(state.getPossibleValues()));
|
.stream()
|
||||||
} else {
|
.map(e -> Direction.valueOf(((StringRepresentable) e)
|
||||||
throw new IllegalArgumentException("WorldEdit needs an update to support " + state.getClass().getSimpleName());
|
.getSerializedName()
|
||||||
}
|
.toUpperCase(Locale.ROOT)))
|
||||||
}
|
.toList())
|
||||||
});
|
);
|
||||||
|
} else if (state instanceof net.minecraft.world.level.block.state.properties.EnumProperty) {
|
||||||
|
return new EnumProperty(
|
||||||
|
state.getName(),
|
||||||
|
new ArrayList<>((List<String>) state
|
||||||
|
.getPossibleValues()
|
||||||
|
.stream()
|
||||||
|
.map(e -> ((StringRepresentable) e).getSerializedName())
|
||||||
|
.toList())
|
||||||
|
);
|
||||||
|
} else if (state instanceof net.minecraft.world.level.block.state.properties.IntegerProperty) {
|
||||||
|
return new IntegerProperty(state.getName(), ImmutableList.copyOf(state.getPossibleValues()));
|
||||||
|
} else {
|
||||||
|
throw new IllegalArgumentException("WorldEdit needs an update to support " + state
|
||||||
|
.getClass()
|
||||||
|
.getSimpleName());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
@SuppressWarnings({ "rawtypes" })
|
@SuppressWarnings({ "rawtypes" })
|
||||||
@Override
|
@Override
|
||||||
|
@ -557,25 +557,43 @@ public final class PaperweightAdapter implements BukkitImplAdapter<net.minecraft
|
|||||||
return TranslatableComponent.of(CraftItemStack.asNMSCopy(BukkitAdapter.adapt(itemStack)).getDescriptionId());
|
return TranslatableComponent.of(CraftItemStack.asNMSCopy(BukkitAdapter.adapt(itemStack)).getDescriptionId());
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||||
private static final LoadingCache<net.minecraft.world.level.block.state.properties.Property, Property<?>> PROPERTY_CACHE = CacheBuilder.newBuilder().build(new CacheLoader<net.minecraft.world.level.block.state.properties.Property, Property<?>>() {
|
private static final LoadingCache<net.minecraft.world.level.block.state.properties.Property, Property<?>> PROPERTY_CACHE = CacheBuilder
|
||||||
@Override
|
.newBuilder()
|
||||||
public Property<?> load(net.minecraft.world.level.block.state.properties.Property state) throws Exception {
|
.build(new CacheLoader<>() {
|
||||||
if (state instanceof net.minecraft.world.level.block.state.properties.BooleanProperty) {
|
@Override
|
||||||
return new BooleanProperty(state.getName(), ImmutableList.copyOf(state.getPossibleValues()));
|
public Property<?> load(net.minecraft.world.level.block.state.properties.Property state) {
|
||||||
} else if (state instanceof DirectionProperty) {
|
if (state instanceof net.minecraft.world.level.block.state.properties.BooleanProperty) {
|
||||||
return new DirectionalProperty(state.getName(),
|
return new BooleanProperty(state.getName(), ImmutableList.copyOf(state.getPossibleValues()));
|
||||||
(List<Direction>) state.getPossibleValues().stream().map(e -> Direction.valueOf(((StringRepresentable) e).getSerializedName().toUpperCase(Locale.ROOT))).toList());
|
} else if (state instanceof DirectionProperty) {
|
||||||
} else if (state instanceof net.minecraft.world.level.block.state.properties.EnumProperty) {
|
return new DirectionalProperty(
|
||||||
return new EnumProperty(state.getName(),
|
state.getName(),
|
||||||
(List<String>) state.getPossibleValues().stream().map(e -> ((StringRepresentable) e).getSerializedName()).toList());
|
new ArrayList<>((List<Direction>) state
|
||||||
} else if (state instanceof net.minecraft.world.level.block.state.properties.IntegerProperty) {
|
.getPossibleValues()
|
||||||
return new IntegerProperty(state.getName(), ImmutableList.copyOf(state.getPossibleValues()));
|
.stream()
|
||||||
} else {
|
.map(e -> Direction.valueOf(((StringRepresentable) e)
|
||||||
throw new IllegalArgumentException("WorldEdit needs an update to support " + state.getClass().getSimpleName());
|
.getSerializedName()
|
||||||
}
|
.toUpperCase(Locale.ROOT)))
|
||||||
}
|
.toList())
|
||||||
});
|
);
|
||||||
|
} else if (state instanceof net.minecraft.world.level.block.state.properties.EnumProperty) {
|
||||||
|
return new EnumProperty(
|
||||||
|
state.getName(),
|
||||||
|
new ArrayList<>((List<String>) state
|
||||||
|
.getPossibleValues()
|
||||||
|
.stream()
|
||||||
|
.map(e -> ((StringRepresentable) e).getSerializedName())
|
||||||
|
.toList())
|
||||||
|
);
|
||||||
|
} else if (state instanceof net.minecraft.world.level.block.state.properties.IntegerProperty) {
|
||||||
|
return new IntegerProperty(state.getName(), ImmutableList.copyOf(state.getPossibleValues()));
|
||||||
|
} else {
|
||||||
|
throw new IllegalArgumentException("WorldEdit needs an update to support " + state
|
||||||
|
.getClass()
|
||||||
|
.getSimpleName());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
@SuppressWarnings({ "rawtypes" })
|
@SuppressWarnings({ "rawtypes" })
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
Reference in New Issue
Block a user