mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2026-04-14 11:46:06 +00:00
createBlockData -> createBlockState
This commit is contained in:
@@ -91,7 +91,7 @@ public class SpongeSchematicAddon implements AddonInitializer {
|
||||
for(int y = 0; y < hei; y++) {
|
||||
String block = data.get((int) arr[x + z * wid + y * wid * len]);
|
||||
if(block.startsWith("minecraft:structure_void")) continue;
|
||||
states[x][z][y] = platform.getWorldHandle().createBlockData(block);
|
||||
states[x][z][y] = platform.getWorldHandle().createBlockState(block);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -79,7 +79,7 @@ public class BlockFunction implements Function<Void> {
|
||||
}
|
||||
|
||||
protected BlockState getBlockState(ImplementationArguments arguments, Map<String, Variable<?>> variableMap) {
|
||||
return data.computeIfAbsent(blockData.apply(arguments, variableMap), platform.getWorldHandle()::createBlockData);
|
||||
return data.computeIfAbsent(blockData.apply(arguments, variableMap), platform.getWorldHandle()::createBlockState);
|
||||
}
|
||||
|
||||
|
||||
@@ -89,7 +89,7 @@ public class BlockFunction implements Function<Void> {
|
||||
public Constant(Returnable<Number> x, Returnable<Number> y, Returnable<Number> z, StringConstant blockData,
|
||||
Returnable<Boolean> overwrite, Platform platform, Position position) {
|
||||
super(x, y, z, blockData, overwrite, platform, position);
|
||||
this.state = platform.getWorldHandle().createBlockData(blockData.getConstant());
|
||||
this.state = platform.getWorldHandle().createBlockState(blockData.getConstant());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -37,7 +37,7 @@ public class PullFunction implements Function<Void> {
|
||||
this.position = position;
|
||||
if(!(data instanceof ConstantExpression)) throw new ParseException("Block data must be constant", data.getPosition());
|
||||
|
||||
this.data = platform.getWorldHandle().createBlockData(((ConstantExpression<String>) data).getConstant());
|
||||
this.data = platform.getWorldHandle().createBlockState(((ConstantExpression<String>) data).getConstant());
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
|
||||
@@ -20,7 +20,7 @@ import com.dfsek.terra.api.entity.EntityType;
|
||||
public interface WorldHandle {
|
||||
@NotNull
|
||||
@Contract("_ -> new")
|
||||
BlockState createBlockData(@NotNull String data);
|
||||
BlockState createBlockState(@NotNull String data);
|
||||
|
||||
@NotNull
|
||||
@Contract(pure = true)
|
||||
|
||||
@@ -58,8 +58,8 @@ public class GenericLoaders implements LoaderRegistrar {
|
||||
if(platform != null) {
|
||||
registry.registerLoader(BaseAddon.class, platform.getAddons())
|
||||
.registerLoader(BlockType.class,
|
||||
(t, object, cf) -> platform.getWorldHandle().createBlockData((String) object).getBlockType())
|
||||
.registerLoader(BlockState.class, (t, object, cf) -> platform.getWorldHandle().createBlockData((String) object));
|
||||
(t, object, cf) -> platform.getWorldHandle().createBlockState((String) object).getBlockType())
|
||||
.registerLoader(BlockState.class, (t, object, cf) -> platform.getWorldHandle().createBlockState((String) object));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -85,7 +85,7 @@ public class PlatformImpl extends AbstractPlatform {
|
||||
@Override
|
||||
public void register(TypeRegistry registry) {
|
||||
super.register(registry);
|
||||
registry.registerLoader(BlockState.class, (t, o, l) -> handle.createBlockData((String) o))
|
||||
registry.registerLoader(BlockState.class, (t, o, l) -> handle.createBlockState((String) o))
|
||||
.registerLoader(PlatformBiome.class, (t, o, l) -> parseBiome((String) o))
|
||||
.registerLoader(EntityType.class, (t, o, l) -> EntityType.valueOf((String) o));
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ public class BukkitWorldHandle implements WorldHandle {
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull BlockState createBlockData(@NotNull String data) {
|
||||
public @NotNull BlockState createBlockState(@NotNull String data) {
|
||||
org.bukkit.block.data.BlockData bukkitData = Bukkit.createBlockData(data);
|
||||
return BukkitBlockState.newInstance(bukkitData);
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ public class FabricWorldHandle implements WorldHandle {
|
||||
private static final com.dfsek.terra.api.block.state.BlockState AIR = FabricAdapter.adapt(Blocks.AIR.getDefaultState());
|
||||
|
||||
@Override
|
||||
public @NotNull FabricBlockState createBlockData(@NotNull String data) {
|
||||
public @NotNull FabricBlockState createBlockState(@NotNull String data) {
|
||||
BlockArgumentParser parser = new BlockArgumentParser(new StringReader(data), true);
|
||||
try {
|
||||
BlockState state = parser.parse(true).getBlockState();
|
||||
|
||||
@@ -35,7 +35,7 @@ public class SpongeWorldHandle implements WorldHandle {
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull BlockState createBlockData(@NotNull String data) {
|
||||
public @NotNull BlockState createBlockState(@NotNull String data) {
|
||||
return new SpongeBlockState(org.spongepowered.api.block.BlockState.fromString(data));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user