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;
2019-11-04 19:08:49 +01:00
import net.minecraft.block.SlabBlock;
2020-01-29 00:40:28 +01:00
import net.minecraft.util.ResourceLocation;
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
2020-01-29 00:40:28 +01:00
public Slab(String baseName, String textureName, 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;
2020-01-22 01:32:26 +01:00
ModRegistry.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) {
ResourceLocation texture = generator.modLoc("block/" + this.textureName);
generator.models().cubeAll(this.getBaseName() + "_double", texture);
generator.slabBlock(this, generator.modLoc(this.getBaseName() + "_double"), texture);
}
2019-11-04 19:08:49 +01:00
}