#Making a Status effect that stops block placing
10 messages · Page 1 of 1 (latest)
if (player instanceof ServerPlayerEntity) {
StatusEffectInstance effectInstance = player.getStatusEffect((RegistryEntry<StatusEffect>) ANTI_PLACE);
if (effectInstance != null) {
if (hitResult instanceof BlockHitResult && !player.isCreative()) {
System.out.println("Block placement prevented due to effect");
return ActionResult.FAIL; // Cancel the placement
}
}
}
return ActionResult.PASS; // Allow the placement
});
that is what I had but it did not work?
would this work @cobalt mirage java UseBlockCallback.EVENT.register((player, world, hand, hitResult) -> { if(player instanceof ServerPlayerEntity) { if(player.hasStatusEffect((RegistryEntry<StatusEffect>) ANTI_PLACE)) { return ActionResult.FAIL; } } return ActionResult.PASS; });
tryitandsee
i did and no @cobalt mirage
straight fail the action and see if that works