NaturesAura/src/main/java/de/ellpeck/naturesaura/blocks/Slab.java

34 lines
1.1 KiB
Java
Raw Normal View History

2019-11-04 19:08:49 +01:00
package de.ellpeck.naturesaura.blocks;
2020-01-29 00:40:28 +01:00
import de.ellpeck.naturesaura.data.BlockStateGenerator;
import de.ellpeck.naturesaura.reg.ICustomBlockState;
2019-11-04 19:08:49 +01:00
import de.ellpeck.naturesaura.reg.IModItem;
2020-01-22 01:32:26 +01:00
import de.ellpeck.naturesaura.reg.ModRegistry;
2021-12-05 23:32:31 +01:00
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.SlabBlock;
2019-11-04 19:08:49 +01:00
2020-01-29 00:40:28 +01:00
public class Slab extends SlabBlock implements IModItem, ICustomBlockState {
2019-11-04 19:08:49 +01:00
2020-01-29 00:40:28 +01:00
public final String textureName;
2020-02-07 15:22:30 +01:00
private final String baseName;
2019-11-04 19:08:49 +01:00
2021-12-05 23:32:31 +01:00
public Slab(String baseName, String textureName, Block.Properties properties) {
2019-11-04 19:08:49 +01:00
super(properties);
this.baseName = baseName;
2020-01-29 00:40:28 +01:00
this.textureName = textureName;
2022-06-27 15:24:04 +02:00
ModRegistry.ALL_ITEMS.add(this);
2019-11-04 19:08:49 +01:00
}
@Override
public String getBaseName() {
return this.baseName;
}
2020-01-29 00:40:28 +01:00
@Override
public void generateCustomBlockState(BlockStateGenerator generator) {
2021-12-05 23:32:31 +01:00
var texture = generator.modLoc("block/" + this.textureName);
2020-01-29 00:40:28 +01:00
generator.models().cubeAll(this.getBaseName() + "_double", texture);
generator.slabBlock(this, generator.modLoc(this.getBaseName() + "_double"), texture);
}
2019-11-04 19:08:49 +01:00
}