Skip to content

Commit 02af394

Browse files
committed
Merge branch '1.20.1/dev' into 1.21.1/dev
2 parents 14dfeeb + bb43937 commit 02af394

File tree

2 files changed

+24
-8
lines changed

2 files changed

+24
-8
lines changed

Jenkinsfile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,13 @@
33
pipeline {
44
agent none
55

6+
options {
7+
// After the Build stage the pipeline stalls, waiting for user input to confirm the release stage.
8+
// This leaves the builds in a running state even though no work is being done. Enable this option
9+
// to automatically cancel earlier stalled builds when a new one is started.
10+
disableConcurrentBuilds(abortPrevious: true)
11+
}
12+
613
tools {
714
jdk "jdk-21"
815
}

common/src/vanillin/java/dev/engine_room/vanillin/visuals/ItemVisual.java

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,18 +26,17 @@ public class ItemVisual extends AbstractEntityVisual<ItemEntity> implements Simp
2626
private static final ThreadLocal<RandomSource> RANDOM = ThreadLocal.withInitial(RandomSource::createNewThreadLocalInstance);
2727

2828
private final PoseStack pPoseStack = new PoseStack();
29-
private final BakedModel bakedModel;
29+
private BakedModel bakedModel;
30+
private ItemStack currentStack;
3031

31-
private final InstanceRecycler<TransformedInstance> instances;
32+
private InstanceRecycler<TransformedInstance> instances;
3233

3334
public ItemVisual(VisualizationContext ctx, ItemEntity entity, float partialTick) {
3435
super(ctx, entity, partialTick);
3536

36-
var item = entity.getItem();
37-
bakedModel = ItemModels.getModel(item);
38-
39-
var model = ItemModels.get(level, item, ItemDisplayContext.GROUND);
40-
37+
currentStack = entity.getItem();
38+
bakedModel = ItemModels.getModel(currentStack);
39+
var model = ItemModels.get(level, currentStack, ItemDisplayContext.GROUND);
4140
instances = new InstanceRecycler<>(() -> ctx.instancerProvider()
4241
.instancer(InstanceTypes.TRANSFORMED, model)
4342
.createInstance());
@@ -63,8 +62,18 @@ private void animate(float partialTick) {
6362
TransformStack.of(pPoseStack)
6463
.translate(getVisualPosition(partialTick));
6564

66-
instances.resetCount();
6765
ItemStack itemstack = entity.getItem();
66+
if (!ItemStack.matches(itemstack, currentStack)) {
67+
instances.delete();
68+
currentStack = itemstack.copy();
69+
bakedModel = ItemModels.getModel(currentStack);
70+
var model = ItemModels.get(level, currentStack, ItemDisplayContext.GROUND);
71+
instances = new InstanceRecycler<>(() -> visualizationContext.instancerProvider()
72+
.instancer(InstanceTypes.TRANSFORMED, model)
73+
.createInstance());
74+
}
75+
instances.resetCount();
76+
6877
int i = itemstack.isEmpty() ? 187 : Item.getId(itemstack.getItem()) + itemstack.getDamageValue();
6978
var random = RANDOM.get();
7079
random.setSeed(i);

0 commit comments

Comments
 (0)