mirror of
https://github.com/Thorfusion/Mekanism-Community-Edition.git
synced 2026-11-22 04:52:25 +00:00
49 lines
1.3 KiB
Java
49 lines
1.3 KiB
Java
package mekanism.common.block.states;
|
|
|
|
import mekanism.common.block.BlockPlastic;
|
|
import net.minecraft.block.properties.PropertyEnum;
|
|
import net.minecraft.block.state.IBlockState;
|
|
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
|
import net.minecraft.client.renderer.block.statemap.StateMapperBase;
|
|
import net.minecraft.item.EnumDyeColor;
|
|
import net.minecraft.util.IStringSerializable;
|
|
import net.minecraft.util.ResourceLocation;
|
|
|
|
public class BlockStatePlastic extends BlockState
|
|
{
|
|
public static PropertyEnum<EnumDyeColor> colorProperty = PropertyEnum.create("color", EnumDyeColor.class);
|
|
|
|
public BlockStatePlastic(BlockPlastic block)
|
|
{
|
|
super(block, colorProperty);
|
|
}
|
|
|
|
public static enum PlasticBlockType implements IStringSerializable
|
|
{
|
|
PLASTIC,
|
|
SLICK,
|
|
GLOW,
|
|
REINFORCED,
|
|
ROAD;
|
|
|
|
@Override
|
|
public String getName()
|
|
{
|
|
return name().toLowerCase();
|
|
}
|
|
}
|
|
|
|
public static class PlasticBlockStateMapper extends StateMapperBase
|
|
{
|
|
@Override
|
|
protected ModelResourceLocation getModelResourceLocation(IBlockState state)
|
|
{
|
|
PlasticBlockType type = ((BlockPlastic)state.getBlock()).type;
|
|
String property = "type=" + type.getName();
|
|
|
|
ResourceLocation baseLocation = new ResourceLocation("mekanism", "plastic_block");
|
|
return new ModelResourceLocation(baseLocation, property);
|
|
}
|
|
}
|
|
}
|