Skip to content

Commit ee15ebe

Browse files
committed
Compiles and runs down to 1.16.5!
1 parent 55797d4 commit ee15ebe

File tree

1 file changed

+33
-23
lines changed

1 file changed

+33
-23
lines changed

src/main/java/org/polyfrost/polyhitbox/mixin/MixinRenderManager.java

Lines changed: 33 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,19 @@
1515
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
1616

1717
//#if MC >=1.21.5
18+
import net.minecraft.client.render.entity.state.EntityHitbox;
19+
//#endif
20+
21+
//#if MC >=1.16.5
1822
import net.minecraft.client.util.math.MatrixStack;
1923
import net.minecraft.client.render.VertexConsumer;
2024
import net.minecraft.client.render.VertexConsumerProvider;
21-
import net.minecraft.client.render.entity.state.EntityHitbox;
2225
import org.spongepowered.asm.mixin.Unique;
2326
//#endif
2427

2528
@Mixin(EntityRenderDispatcher.class)
2629
public abstract class MixinRenderManager {
27-
//#if MC >=1.21.5
30+
//#if MC >=1.21.4
2831
@Unique
2932
private static ThreadLocal<Entity> polyhitbox$entity = ThreadLocal.withInitial(() -> null);
3033
//#endif
@@ -45,10 +48,14 @@ public abstract class MixinRenderManager {
4548
//#if MC >=1.21.5
4649
EntityHitbox entityHitbox,
4750
//#else
48-
//$$ Entity entity,
49-
//$$ float tickDelta,
51+
//$$ Entity entity,
52+
//$$ float tickDelta,
53+
//#endif
54+
//#if MC >=1.21.1
55+
//$$ float offsetX, float offsetY, float offsetZ,
5056
//#endif
51-
CallbackInfo ci) {
57+
CallbackInfo ci
58+
) {
5259
//#else
5360
//$$ private void polyhitbox$customRendering(Entity entity, double offsetX, double offsetY, double offsetZ, float yaw, float tickDelta, CallbackInfo ci) {
5461
//#endif
@@ -61,34 +68,37 @@ public abstract class MixinRenderManager {
6168

6269
//#if MC >=1.21.5
6370
Entity entity = polyhitbox$entity.get();
64-
float offsetX = entityHitbox.comp_3855();
65-
float offsetY = entityHitbox.comp_3856();
66-
float offsetZ = entityHitbox.comp_3857();
67-
float collisionBorderSize = 0.0F; /// TODO/NOTE: Doesn't exist?
68-
float width = entity.getWidth();
71+
OmniVec3d offset = new OmniVec3d(entityHitbox.comp_3855(), entityHitbox.comp_3856(), entityHitbox.comp_3857());
6972
//#else
70-
//$$ float collisionBorderSize = entity.getCollisionBorderSize();
71-
//$$ float width = entity.width;
73+
//$$ OmniVec3d offset = OmniVec3d.ZERO;
7274
//#endif
75+
76+
OmniVec3d entityPosition = new OmniVec3d(
77+
//#if MC >=1.16.5
78+
entity.getX(), entity.getY(), entity.getZ()
79+
//#else
80+
//$$ entity.x, entity.y, entity.z
81+
//#endif
82+
);
7383
OmniVec3d lookVec = new OmniVec3d(entity.getRotationVector());
84+
OmniAABB entityAABB = new OmniAABB(entity.getBoundingBox());
7485

7586
HitboxRendererKt.renderHitbox(
7687
stack,
77-
new OmniVec3d(offsetX, offsetY, offsetZ),
78-
new OmniVec3d(
79-
//#if MC >=1.16.5
80-
entity.getX(), entity.getY(), entity.getZ()
81-
//#else
82-
//$$ entity.x, entity.y, entity.z
83-
//#endif
84-
),
88+
offset,
89+
entityPosition,
8590
lookVec,
8691
entity.getStandingEyeHeight(),
8792
entity instanceof LivingEntity,
8893
entity == OmniClient.get().targetedEntity,
89-
width,
90-
collisionBorderSize,
91-
new OmniAABB(entity.getBoundingBox())
94+
//#if MC >=1.16.5
95+
entity.getWidth(),
96+
0.0F, // TODO/NOTE: Doesn't exist?
97+
//#else
98+
//$$ entity.width,
99+
//$$ entity.getCollisionBorderSize(),
100+
//#endif
101+
entityAABB
92102
);
93103
}
94104

0 commit comments

Comments
 (0)