Search in sources :

Example 1 with IMachinePropertiesTesr

use of forestry.core.blocks.IMachinePropertiesTesr in project ForestryMC by ForestryMC.

the class MachineParticleCallback method setTexture.

@Override
@SideOnly(Side.CLIENT)
protected void setTexture(ParticleDigging fx, World world, BlockPos pos, IBlockState state) {
    IMachineProperties<?> machineProperties = blockType.getMachineProperties();
    if (machineProperties instanceof IMachinePropertiesTesr) {
        Minecraft minecraft = Minecraft.getMinecraft();
        TextureMap textureMapBlocks = minecraft.getTextureMapBlocks();
        IMachinePropertiesTesr machinePropertiesTesr = (IMachinePropertiesTesr) machineProperties;
        String particleTextureLocation = machinePropertiesTesr.getParticleTextureLocation();
        TextureAtlasSprite particleTexture = textureMapBlocks.getAtlasSprite(particleTextureLocation);
        fx.setParticleTexture(particleTexture);
    }
}
Also used : TextureMap(net.minecraft.client.renderer.texture.TextureMap) IMachinePropertiesTesr(forestry.core.blocks.IMachinePropertiesTesr) TextureAtlasSprite(net.minecraft.client.renderer.texture.TextureAtlasSprite) Minecraft(net.minecraft.client.Minecraft) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 2 with IMachinePropertiesTesr

use of forestry.core.blocks.IMachinePropertiesTesr in project ForestryMC by ForestryMC.

the class MachineStateMapper method putStateModelLocations.

@Override
public Map<IBlockState, ModelResourceLocation> putStateModelLocations(Block block) {
    if (!(type.getMachineProperties() instanceof IMachinePropertiesTesr)) {
        for (EnumFacing facing : EnumFacing.values()) {
            if (facing == EnumFacing.DOWN || facing == EnumFacing.UP) {
                continue;
            }
            IBlockState state = block.getDefaultState().withProperty(BlockBase.FACING, facing);
            LinkedHashMap<IProperty<?>, Comparable<?>> linkedhashmap = Maps.newLinkedHashMap(state.getProperties());
            ResourceLocation blockLocation = Block.REGISTRY.getNameForObject(block);
            String s = String.format("%s:%s", blockLocation.getResourceDomain(), blockLocation.getResourcePath());
            mapStateModelLocations.put(state, new ModelResourceLocation(s, getPropertyString(linkedhashmap)));
        }
    }
    return this.mapStateModelLocations;
}
Also used : IBlockState(net.minecraft.block.state.IBlockState) IMachinePropertiesTesr(forestry.core.blocks.IMachinePropertiesTesr) IProperty(net.minecraft.block.properties.IProperty) EnumFacing(net.minecraft.util.EnumFacing) ModelResourceLocation(net.minecraft.client.renderer.block.model.ModelResourceLocation) ResourceLocation(net.minecraft.util.ResourceLocation) ModelResourceLocation(net.minecraft.client.renderer.block.model.ModelResourceLocation)

Aggregations

IMachinePropertiesTesr (forestry.core.blocks.IMachinePropertiesTesr)2 IProperty (net.minecraft.block.properties.IProperty)1 IBlockState (net.minecraft.block.state.IBlockState)1 Minecraft (net.minecraft.client.Minecraft)1 ModelResourceLocation (net.minecraft.client.renderer.block.model.ModelResourceLocation)1 TextureAtlasSprite (net.minecraft.client.renderer.texture.TextureAtlasSprite)1 TextureMap (net.minecraft.client.renderer.texture.TextureMap)1 EnumFacing (net.minecraft.util.EnumFacing)1 ResourceLocation (net.minecraft.util.ResourceLocation)1 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)1