Skip to content

Commit

Permalink
Update create compat patch. Closes #337
Browse files Browse the repository at this point in the history
  • Loading branch information
Sollace committed Nov 1, 2024
1 parent 9a257d6 commit f53f65d
Showing 1 changed file with 12 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,25 +14,27 @@
@Mixin(value = Entity.class, priority = 9999 /* Run us last */)
abstract class MEntity implements ContraptionCollidable {

private int lastCollidedContraptionStateTick = -1;
private BlockState lastCollidedContraptionState = Blocks.AIR.getDefaultState();
private int presenceFootsteps$lastCollidedContraptionStateTick = -1;
private BlockState presenceFootsteps$lastCollidedContraptionState = Blocks.AIR.getDefaultState();

@Dynamic(
value = "forCollission(center, consumer) - Private member injected by Create. See: https://github.com/Fabricators-of-Create/Create/blob/49cc17e3de33c965b1c409130abe436821f7410c/src/main/java/com/simibubi/create/foundation/mixin/client/EntityContraptionInteractionMixin.java#L81C21-L81C21"
value = "create$forCollision(center, consumer) - Private member injected by Create. See: https://github.com/Fabricators-of-Create/Create/blob/49cc17e3de33c965b1c409130abe436821f7410c/src/main/java/com/simibubi/create/foundation/mixin/client/EntityContraptionInteractionMixin.java#L81C21-L81C21"
)
@Shadow
private void forCollision(Vec3d anchorPos, TriConsumer<Object, BlockState, BlockPos> action) {}
@Shadow(aliases = {
"forCollision", "create$forCollision"
})
private void create$forCollision(Vec3d anchorPos, TriConsumer<Object, BlockState, BlockPos> action) {}

@Override
public BlockState getCollidedStateAt(BlockPos pos) {
if (lastCollidedContraptionStateTick != ((Entity)(Object)this).age) {
lastCollidedContraptionStateTick = ((Entity)(Object)this).age;
forCollision(((Entity)(Object)this).getPos().add(0, -0.2, 0), (unused, state, p) -> {
if (presenceFootsteps$lastCollidedContraptionStateTick != ((Entity)(Object)this).age) {
presenceFootsteps$lastCollidedContraptionStateTick = ((Entity)(Object)this).age;
create$forCollision(((Entity)(Object)this).getPos().add(0, -0.2, 0), (unused, state, p) -> {
if (pos.equals(p)) {
lastCollidedContraptionState = state;
presenceFootsteps$lastCollidedContraptionState = state;
}
});
}
return lastCollidedContraptionState;
return presenceFootsteps$lastCollidedContraptionState;
}
}

0 comments on commit f53f65d

Please sign in to comment.