StateMapperBase .java

net.minecraft.client.renderer.block.statemap.StateMapperBase (class, 53 lines): members: mapStateModelLocations, getPropertyString, putStateModelLocations.

net.minecraft.client.renderer.block.statemapclass53 linesclient1.7 KB

Implements

API Surface (2)

String getPropertyString(Map<IProperty, Comparable> p_178131_1_)
Map<IBlockState, ModelResourceLocation> putStateModelLocations(Block blockIn)

Fields & Constants (1)

mapStateModelLocations

String literals (1)

"normal"

Code Graph: Dependencies (5)

Edges (calls / imports / inherits / references) resolved by graphify from the AST. Every chip opens the class source.

Full Source

StateMapperBase.java53 lines · MCP 1.8.9 · verbatimOriginal ↗
1
package net.minecraft.client.renderer.block.statemap;
2
3
import com.google.common.collect.Maps;
4
import java.util.Map;
5
import java.util.Map.Entry;
6
import net.minecraft.block.Block;
7
import net.minecraft.block.properties.IProperty;
8
import net.minecraft.block.state.IBlockState;
9
import net.minecraft.client.resources.model.ModelResourceLocation;
10
11
public abstract class StateMapperBase implements IStateMapper
12
{
13
    protected Map<IBlockState, ModelResourceLocation> mapStateModelLocations = Maps.<IBlockState, ModelResourceLocation>newLinkedHashMap();
14
15
    public String getPropertyString(Map<IProperty, Comparable> p_178131_1_)
16
    {
17
        StringBuilder stringbuilder = new StringBuilder();
18
19
        for (Entry<IProperty, Comparable> entry : p_178131_1_.entrySet())
20
        {
21
            if (stringbuilder.length() != 0)
22
            {
23
                stringbuilder.append(",");
24
            }
25
26
            IProperty iproperty = (IProperty)entry.getKey();
27
            Comparable comparable = (Comparable)entry.getValue();
28
            stringbuilder.append(iproperty.getName());
29
            stringbuilder.append("=");
30
            stringbuilder.append(iproperty.getName(comparable));
31
        }
32
33
        if (stringbuilder.length() == 0)
34
        {
35
            stringbuilder.append("normal");
36
        }
37
38
        return stringbuilder.toString();
39
    }
40
41
    public Map<IBlockState, ModelResourceLocation> putStateModelLocations(Block blockIn)
42
    {
43
        for (IBlockState iblockstate : blockIn.getBlockState().getValidStates())
44
        {
45
            this.mapStateModelLocations.put(iblockstate, this.getModelResourceLocation(iblockstate));
46
        }
47
48
        return this.mapStateModelLocations;
49
    }
50
51
    protected abstract ModelResourceLocation getModelResourceLocation(IBlockState state);
52
}
53

Deobfuscated MCP 1.8.9 source of StateMapperBase from Marcelektro/MavenMCP-1.8.9 (net/minecraft/client/renderer/block/statemap/StateMapperBase.java), stored verbatim.