Skip to content

Commit

Permalink
Fix pressure plates remaining pressed in certain conditions
Browse files Browse the repository at this point in the history
fixes #43
  • Loading branch information
DrexHD committed Jun 30, 2024
1 parent 092cbe8 commit e7790de
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Fixed
- Containers remaining open by vanished players in certain conditions
- Pressure plates remaining pressed by vanished players in certain conditions

## [1.5.6] - 2024-06-20
### Added
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import net.minecraft.world.item.ArmorItem;
import net.minecraft.world.level.EntityGetter;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.BasePressurePlateBlock;
import net.minecraft.world.level.block.BeehiveBlock;
import net.minecraft.world.phys.AABB;
import org.spongepowered.asm.mixin.Mixin;
Expand Down Expand Up @@ -117,7 +118,7 @@ public abstract static class AbstractMinecartMixin {
)
)
private List<Entity> vanish_preventMinecartColision(Level instance, Entity entity, AABB aABB, Operation<List<Entity>> original) {
return true ? instance.getEntities(entity, aABB, VanishMod.NO_SPECTATORS_AND_NO_VANISH) : original.call(instance, entity, aABB);
return ConfigManager.vanish().interaction.entityCollisions ? instance.getEntities(entity, aABB, VanishMod.NO_SPECTATORS_AND_NO_VANISH) : original.call(instance, entity, aABB);
}

}
Expand Down Expand Up @@ -152,4 +153,18 @@ private List<LivingEntity> vanish_preventBeeAnger(Level instance, Class<LivingEn
}
}

@Mixin(BasePressurePlateBlock.class)
public abstract static class BasePressurePlateBlockMixin {
@WrapOperation(
method = "getEntityCount",
at = @At(
value = "FIELD",
target = "Lnet/minecraft/world/entity/EntitySelector;NO_SPECTATORS:Ljava/util/function/Predicate;"
)
)
private static Predicate<Entity> vanish_preventPressurePlatePress(Operation<Predicate<Entity>> original) {
return ConfigManager.vanish().interaction.blocks ? VanishMod.NO_SPECTATORS_AND_NO_VANISH : original.call();
}
}

}
1 change: 1 addition & 0 deletions src/main/resources/vanish.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
"interaction.StepOnBlockMixin",
"interaction.VanishEntitySelector$AbstractMinecartMixin",
"interaction.VanishEntitySelector$ArmorItemMixin",
"interaction.VanishEntitySelector$BasePressurePlateBlockMixin",
"interaction.VanishEntitySelector$BeehiveBlockMixin",
"interaction.VanishEntitySelector$EntityGetterMixin",
"interaction.VanishEntitySelector$EntitySelectorMixin",
Expand Down

0 comments on commit e7790de

Please sign in to comment.