2020-02-26 10:55:19 +01:00
|
|
|
package de.ellpeck.naturesaura.blocks;
|
|
|
|
|
|
|
|
import de.ellpeck.naturesaura.api.NaturesAuraAPI;
|
|
|
|
import de.ellpeck.naturesaura.api.aura.type.IAuraType;
|
|
|
|
import de.ellpeck.naturesaura.data.BlockStateGenerator;
|
|
|
|
import de.ellpeck.naturesaura.reg.ICustomBlockState;
|
2021-12-15 14:26:42 +01:00
|
|
|
import net.minecraft.world.item.context.BlockPlaceContext;
|
|
|
|
import net.minecraft.world.level.block.Block;
|
|
|
|
import net.minecraft.world.level.block.state.BlockState;
|
|
|
|
import net.minecraft.world.level.block.state.StateDefinition;
|
2021-12-04 15:40:09 +01:00
|
|
|
import net.minecraft.world.level.block.state.properties.BooleanProperty;
|
2020-02-26 10:55:19 +01:00
|
|
|
|
|
|
|
public class BlockCatalyst extends BlockImpl implements ICustomBlockState {
|
2021-12-15 14:26:42 +01:00
|
|
|
|
2020-02-26 10:55:19 +01:00
|
|
|
public static final BooleanProperty NETHER = BlockNatureAltar.NETHER;
|
|
|
|
|
|
|
|
public BlockCatalyst(String baseName, Properties properties) {
|
|
|
|
super(baseName, properties);
|
2022-06-27 15:24:04 +02:00
|
|
|
this.registerDefaultState(this.defaultBlockState().setValue(BlockCatalyst.NETHER, false));
|
2020-02-26 10:55:19 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2021-12-15 14:26:42 +01:00
|
|
|
public BlockState getStateForPlacement(BlockPlaceContext context) {
|
2021-12-15 16:30:22 +01:00
|
|
|
var nether = IAuraType.forLevel(context.getLevel()).isSimilar(NaturesAuraAPI.TYPE_NETHER);
|
2022-06-27 15:24:04 +02:00
|
|
|
return super.getStateForPlacement(context).setValue(BlockCatalyst.NETHER, nether);
|
2020-02-26 10:55:19 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2021-12-15 14:26:42 +01:00
|
|
|
protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> builder) {
|
|
|
|
super.createBlockStateDefinition(builder);
|
2022-06-27 15:24:04 +02:00
|
|
|
builder.add(BlockCatalyst.NETHER);
|
2020-02-26 10:55:19 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void generateCustomBlockState(BlockStateGenerator generator) {
|
|
|
|
generator.models().cubeAll(this.getBaseName(), generator.modLoc("block/" + this.getBaseName()));
|
|
|
|
generator.models().cubeAll(this.getBaseName() + "_nether", generator.modLoc("block/" + this.getBaseName() + "_nether"));
|
|
|
|
}
|
|
|
|
}
|