@@ -36,12 +36,6 @@ public void onInitializeClient() {
36
36
37
37
ColorProviderRegistry .ITEM .register (ScarvesClient ::getScarfTint , ScarvesItems .SCARF );
38
38
39
-
40
- //MinecraftClient.getInstance().getEntityRenderDispatcher().getRenderer(MinecraftClient.getInstance().player);
41
- //PlayerEntityModel.getModelData(Dilation.NONE, 0).getRoot().createPart(64, 64);
42
- //PlayerEntityModel<ClientPlayerEntity> model = new PlayerEntityModel<>(ctx.getPart(slim ? EntityModelLayers.PLAYER_SLIM : EntityModelLayers.PLAYER), slim)
43
-
44
- //PlayerEntityModel<ClientPlayerEntity> model = new PlayerEntityModel<ClientPlayerEntity>(.getRoot(), false);
45
39
}
46
40
47
41
public static int getScarfTint (ItemStack stack , int index ) {
@@ -73,96 +67,19 @@ public static void afterEntities(WorldRenderContext ctx) {
73
67
for (Entity entity : ctx .world ().getEntities ()) {
74
68
if (entity instanceof IScarfHaver scarfHaver ) {
75
69
76
- /*
77
- Map<String, Matrix4f> registrations = ModelExtractor.extract(entity, tickDelta);
78
- Matrix4f bodyMatrix = registrations.get("body");
79
- if (bodyMatrix != null) {
80
- if (entity instanceof AbstractClientPlayerEntity player) {
81
- //MORE DEBUG
82
- System.out.println("\n"+bodyMatrix.toString());
83
- }
84
-
85
-
86
- Vec3d lerpedPosD = entity.getLerpedPos(tickDelta);
87
- Vector4f lerpedPos = new Vector4f((float) lerpedPosD.x, (float) lerpedPosD.y, (float) lerpedPosD.z, 1);
88
-
89
- ctx.matrixStack().push();
90
-
91
- Matrix4f bodyRotation = new Matrix4f().rotationY((float) -(scarfHaver.iScarfHaver_getBodyYaw(tickDelta) * Math.PI / 180d));
92
-
93
- Vector4f a = new Vector4f(-4/16f, 0, -2/16f, 1);
94
- Vector4f b = new Vector4f(-4/16f, 12/16f, -2/16f, 1);
95
- Vector4f c = new Vector4f( 4/16f, 12/16f, -2/16f, 1);
96
- Vector4f d = new Vector4f( 4/16f, 0, -2/16f, 1);
97
-
98
- a.add(0, -1.501f, 0, 0).mul(-1, -1, 1, 1);
99
- b.add(0, -1.501f, 0, 0).mul(-1, -1, 1, 1);
100
- c.add(0, -1.501f, 0, 0).mul(-1, -1, 1, 1);
101
- d.add(0, -1.501f, 0, 0).mul(-1, -1, 1, 1);
102
-
103
- bodyMatrix.transform(a);
104
- bodyMatrix.transform(b);
105
- bodyMatrix.transform(c);
106
- bodyMatrix.transform(d);
107
-
108
- a.add(0,0,-0.25f, 0);
109
- b.add(0,0,-0.25f, 0);
110
- c.add(0,0,-0.25f, 0);
111
- d.add(0,0,-0.25f, 0);
112
-
113
- bodyRotation.transform(a);
114
- bodyRotation.transform(b);
115
- bodyRotation.transform(c);
116
- bodyRotation.transform(d);
117
-
118
- a.add(lerpedPos);
119
- b.add(lerpedPos);
120
- c.add(lerpedPos);
121
- d.add(lerpedPos);
122
-
123
- ScarfRenderer.quad(
124
- a,
125
- b,
126
- c,
127
- d,
128
-
129
- new FabricSquare(Identifier.of("minecraft", "block/white_wool")),
130
-
131
- ctx.consumers(),
132
- ctx.matrixStack(),
133
- LightmapTextureManager.pack(15,15)
134
- );
135
-
136
- ctx.matrixStack().pop();
137
- }*/
138
-
139
70
try {
140
- //final boolean tickDeprived = (entity instanceof ITickDeprivationAware depAware) ?
141
- // depAware.scarves_isTickDeprived(ctx.world().getTime()) :
142
- // false;
143
- //final boolean tickDeprived = false;
144
71
145
72
scarfHaver .iScarfHaver_getAttachments (ctx .tickCounter ().getTickDelta (false )).forEach ( it -> {
146
- //Physics - gravity and collisions run on the tick thread
73
+
147
74
List <ScarfNode > nodes = it .nodes ();
148
75
if (nodes .isEmpty ()) return ;
149
- /*
150
- nodes.get(0).pullTowards(it.getLocation());
151
- if (nodes.size()>1) for(int i=1; i<nodes.size(); i++) {
152
- ScarfNode prev = nodes.get(i-1);
153
- ScarfNode cur = nodes.get(i);
154
- cur.pullTowards(prev.position);
155
- }*/
156
76
157
77
//Rendering
158
78
Vec3d prev = it .getLocation ();
159
79
Vec3d prevUp = new Vec3d (0 ,1 ,0 ).multiply (ScarfNode .FABRIC_SQUARE_WIDTH );
160
80
for (int i =0 ; i <nodes .size (); i ++) {
161
81
ScarfNode cur = nodes .get (i );
162
82
Vec3d lerpedPos = cur .getLerpedPosition (tickDelta );
163
- //Vec3d lerpedPos = (tickDeprived) ?
164
- // cur.getPosition() :
165
- // cur.getLerpedPosition(ctx.tickCounter().getTickDelta(false));
166
83
167
84
BlockPos curPos = new BlockPos (
168
85
(int ) lerpedPos .x ,
0 commit comments