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:
parent
c030b7a8f1
commit
3ff01d6c26
|
|
@ -20,6 +20,7 @@ package thedarkcolour.exdeorum.material;
|
||||||
|
|
||||||
import net.minecraft.world.level.block.Block;
|
import net.minecraft.world.level.block.Block;
|
||||||
import net.minecraft.world.level.block.SoundType;
|
import net.minecraft.world.level.block.SoundType;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
import thedarkcolour.exdeorum.block.CompressedSieveBlock;
|
import thedarkcolour.exdeorum.block.CompressedSieveBlock;
|
||||||
|
|
||||||
public class CompressedSieveMaterial extends SieveMaterial {
|
public class CompressedSieveMaterial extends SieveMaterial {
|
||||||
|
|
@ -31,4 +32,18 @@ public class CompressedSieveMaterial extends SieveMaterial {
|
||||||
protected Block createBlock() {
|
protected Block createBlock() {
|
||||||
return new CompressedSieveBlock(props().noOcclusion());
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -239,7 +239,7 @@ public class DefaultMaterials {
|
||||||
public static void registerMaterials() {
|
public static void registerMaterials() {
|
||||||
BARRELS.search(BarrelMaterial::readFromJson);
|
BARRELS.search(BarrelMaterial::readFromJson);
|
||||||
SIEVES.search(SieveMaterial::readFromJson);
|
SIEVES.search(SieveMaterial::readFromJson);
|
||||||
// todo compressed sieve JSON
|
COMPRESSED_SIEVES.search(CompressedSieveMaterial::readFromJson);
|
||||||
LAVA_CRUCIBLES.search(parser -> AbstractCrucibleMaterial.readFromJson(parser, LavaCrucibleMaterial::new));
|
LAVA_CRUCIBLES.search(parser -> AbstractCrucibleMaterial.readFromJson(parser, LavaCrucibleMaterial::new));
|
||||||
WATER_CRUCIBLES.search(parser -> AbstractCrucibleMaterial.readFromJson(parser, WaterCrucibleMaterial::new));
|
WATER_CRUCIBLES.search(parser -> AbstractCrucibleMaterial.readFromJson(parser, WaterCrucibleMaterial::new));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user