use of net.minecraft.client.renderer.block.statemap.StateMapperBase in project Railcraft by Railcraft.
the class ActuatorModel method getDependencies.
@Override
public Collection<ResourceLocation> getDependencies() {
BlockMachineActuator block = (BlockMachineActuator) RailcraftBlocks.ACTUATOR.block();
if (block == null)
return Collections.emptyList();
if (models.isEmpty()) {
StateMapperBase baseStateMapper = new StateMap.Builder().withName(block.getVariantProperty()).ignore(BlockMachineActuator.RED_FLAG).ignore(BlockMachineActuator.WHITE_FLAG).build();
baseModelLocations.putAll(baseStateMapper.putStateModelLocations(block));
StateMapperBase redFlagStateMapper = new StateMap.Builder().withSuffix("_flag_red").ignore(block.getVariantProperty()).ignore(BlockMachineActuator.THROWN).ignore(BlockMachineActuator.FACING).ignore(BlockMachineActuator.WHITE_FLAG).build();
redFlagModelLocations.putAll(redFlagStateMapper.putStateModelLocations(block));
StateMapperBase whiteFlagStateMapper = new StateMap.Builder().withSuffix("_flag_white").ignore(block.getVariantProperty()).ignore(BlockMachineActuator.THROWN).ignore(BlockMachineActuator.FACING).ignore(BlockMachineActuator.RED_FLAG).build();
whiteFlagModelLocations.putAll(whiteFlagStateMapper.putStateModelLocations(block));
models.addAll(baseModelLocations.values());
models.addAll(redFlagModelLocations.values());
models.addAll(whiteFlagModelLocations.values());
}
return models;
}
use of net.minecraft.client.renderer.block.statemap.StateMapperBase in project Railcraft by Railcraft.
the class IRailcraftItemBlock method getModelLocation.
@SideOnly(Side.CLIENT)
default default ModelResourceLocation getModelLocation(IBlockState state) {
StateMapperBase stateMapper = null;
if (state.getBlock() instanceof IRailcraftBlock)
stateMapper = ((IRailcraftBlock) state.getBlock()).getStateMapper();
if (stateMapper == null)
return new ModelResourceLocation(state.getBlock().getRegistryName(), new DefaultStateMapper().getPropertyString(state.getProperties()));
Map<IBlockState, ModelResourceLocation> stateMap = stateMapper.putStateModelLocations(state.getBlock());
return stateMap.get(state);
}
use of net.minecraft.client.renderer.block.statemap.StateMapperBase in project Witchworks by Um-Mitternacht.
the class BlockFluid method registerModels.
@Override
@SideOnly(Side.CLIENT)
public void registerModels() {
final Item item = Item.getItemFromBlock(this);
assert item != null;
ModelBakery.registerItemVariants(item);
final ModelResourceLocation modelResourceLocation = new ModelResourceLocation(LibMod.MOD_ID + ":fluid", getFluid().getName());
ModelLoader.setCustomMeshDefinition(item, stack -> modelResourceLocation);
ModelLoader.setCustomStateMapper(this, new StateMapperBase() {
@Override
protected ModelResourceLocation getModelResourceLocation(IBlockState p_178132_1_) {
return modelResourceLocation;
}
});
}
use of net.minecraft.client.renderer.block.statemap.StateMapperBase in project Overloaded by CJ-MC-Mods.
the class AbstractBlockHyperNode method registerModel.
@SideOnly(Side.CLIENT)
@Override
public void registerModel() {
ModelResourceLocation location = new ModelResourceLocation(getRegistryName(), null);
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(this), 0, location);
StateMapperBase ignoreState = new StateMapperBase() {
@Override
@Nonnull
protected ModelResourceLocation getModelResourceLocation(@Nonnull IBlockState iBlockState) {
return location;
}
};
ModelLoader.setCustomStateMapper(this, ignoreState);
}
use of net.minecraft.client.renderer.block.statemap.StateMapperBase in project ImmersiveEngineering by BluSunrize.
the class IECustomStateMapper method getStateMapper.
public static StateMapperBase getStateMapper(IIEMetaBlock metaBlock) {
String key = metaBlock.getIEBlockName();
StateMapperBase mapper = stateMappers.get(key);
if (mapper == null) {
mapper = metaBlock.getCustomMapper();
if (mapper == null)
mapper = new IECustomStateMapper();
stateMappers.put(key, mapper);
}
return mapper;
}
Aggregations