Fixed items clipping into each other on conveyors

This commit is contained in:
Anuken
2022-10-10 17:34:00 -04:00
parent 3f3cd116f0
commit 35af2f4b9a

View File

@@ -157,16 +157,20 @@ public class Conveyor extends Block implements Autotiler{
Draw.rect(regions[blendbits][frame], x, y, tilesize * blendsclx, tilesize * blendscly, rotation * 90);
Draw.z(Layer.block - 0.1f);
float layer = Layer.block - 0.1f, wwidth = world.unitWidth(), wheight = world.unitHeight(), scaling = 0.01f;
for(int i = 0; i < len; i++){
Item item = ids[i];
Tmp.v1.trns(rotation * 90, tilesize, 0);
Tmp.v2.trns(rotation * 90, -tilesize / 2f, xs[i] * tilesize / 2f);
Draw.rect(item.fullIcon,
(x + Tmp.v1.x * ys[i] + Tmp.v2.x),
(y + Tmp.v1.y * ys[i] + Tmp.v2.y),
itemSize, itemSize);
float
ix = (x + Tmp.v1.x * ys[i] + Tmp.v2.x),
iy = (y + Tmp.v1.y * ys[i] + Tmp.v2.y);
//keep draw position deterministic.
Draw.z(layer + (ix / wwidth + iy / wheight) * scaling);
Draw.rect(item.fullIcon, ix, iy, itemSize, itemSize);
}
}