-
Notifications
You must be signed in to change notification settings - Fork 497
/
PerspAwareModelBase.java
87 lines (70 loc) · 2.64 KB
/
PerspAwareModelBase.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
package buildcraft.core.lib.client.model;
import java.util.Collections;
import java.util.List;
import javax.vecmath.Matrix4f;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import org.apache.commons.lang3.tuple.Pair;
import net.minecraft.client.renderer.block.model.BakedQuad;
import net.minecraft.client.renderer.block.model.ItemCameraTransforms;
import net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.renderer.vertex.VertexFormat;
import net.minecraft.util.EnumFacing;
import net.minecraftforge.client.model.IFlexibleBakedModel;
import net.minecraftforge.client.model.IPerspectiveAwareModel;
import net.minecraftforge.client.model.TRSRTransformation;
public class PerspAwareModelBase implements IPerspectiveAwareModel {
private final VertexFormat format;
// TODO: BakedQuad -> UnpackedBakedQuad
// (mc -> forge)
private final ImmutableList<BakedQuad> quads;
private final TextureAtlasSprite particle;
@SuppressWarnings("deprecation")
private final ImmutableMap<TransformType, TRSRTransformation> transforms;
public PerspAwareModelBase(VertexFormat format, ImmutableList<BakedQuad> quads, TextureAtlasSprite particle,
@SuppressWarnings("deprecation") ImmutableMap<TransformType, TRSRTransformation> transforms) {
this.format = format;
this.quads = quads == null ? ImmutableList.<BakedQuad> of() : quads;
this.particle = particle;
this.transforms = transforms;
}
@Override
public VertexFormat getFormat() {
return format;
}
@Override
public List<BakedQuad> getFaceQuads(EnumFacing p_177551_1_) {
return Collections.emptyList();
}
@Override
public List<BakedQuad> getGeneralQuads() {
return quads;
}
@Override
public boolean isAmbientOcclusion() {
return true;
}
@Override
public boolean isGui3d() {
return false;
}
@Override
public boolean isBuiltInRenderer() {
return false;
}
@Override
public TextureAtlasSprite getParticleTexture() {
return particle;
}
@Override
@SuppressWarnings("deprecation")
public ItemCameraTransforms getItemCameraTransforms() {
return ItemCameraTransforms.DEFAULT;
}
@Override
@SuppressWarnings("deprecation")
public Pair<? extends IFlexibleBakedModel, Matrix4f> handlePerspective(TransformType cameraTransformType) {
return IPerspectiveAwareModel.MapWrapper.handlePerspective(this, transforms, cameraTransformType);
}
}