Add JSON compressed sieve blocks

The JSON schema for adding a compressed sieve block is exactly the same as with regular sieve blocks.
This commit is contained in:
thedarkcolour 2024-07-28 16:12:33 -07:00
parent c030b7a8f1
commit 3ff01d6c26
No known key found for this signature in database
GPG Key ID: 6599A8E0516C8F38
2 changed files with 16 additions and 1 deletions

View File

@ -20,6 +20,7 @@ package thedarkcolour.exdeorum.material;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.SoundType;
import org.jetbrains.annotations.Nullable;
import thedarkcolour.exdeorum.block.CompressedSieveBlock;
public class CompressedSieveMaterial extends SieveMaterial {
@ -31,4 +32,18 @@ public class CompressedSieveMaterial extends SieveMaterial {
protected Block createBlock() {
return new CompressedSieveBlock(props().noOcclusion());
}
@Nullable
public static CompressedSieveMaterial readFromJson(MaterialParser parser) {
SoundType soundType = parser.getSoundType();
float strength = parser.getStrength();
boolean needsCorrectTool = parser.getOptionalBoolean("needs_correct_tool");
String requiredModId = parser.getRequiredModId();
if (parser.error) {
return null;
} else {
return new CompressedSieveMaterial(soundType, strength, needsCorrectTool, requiredModId);
}
}
}

View File

@ -239,7 +239,7 @@ public class DefaultMaterials {
public static void registerMaterials() {
BARRELS.search(BarrelMaterial::readFromJson);
SIEVES.search(SieveMaterial::readFromJson);
// todo compressed sieve JSON
COMPRESSED_SIEVES.search(CompressedSieveMaterial::readFromJson);
LAVA_CRUCIBLES.search(parser -> AbstractCrucibleMaterial.readFromJson(parser, LavaCrucibleMaterial::new));
WATER_CRUCIBLES.search(parser -> AbstractCrucibleMaterial.readFromJson(parser, WaterCrucibleMaterial::new));
}