Skip to content

Commit

Permalink
code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
UpcraftLP committed Oct 17, 2024
1 parent a942666 commit 8f6aeed
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 53 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import dev.cammiescorner.arcanuscontinuum.Arcanus;
import dev.cammiescorner.arcanuscontinuum.common.blocks.MagicDoorBlock;
import dev.cammiescorner.arcanuscontinuum.common.blocks.entities.MagicDoorBlockEntity;
import dev.cammiescorner.arcanuscontinuum.common.registry.ArcanusBlocks;
import dev.cammiescorner.arcanuscontinuum.common.registry.ArcanusPointsOfInterest;
import net.minecraft.block.BlockState;
import net.minecraft.network.message.MessageType;
Expand Down Expand Up @@ -41,22 +42,23 @@ public class PlayerManagerMixin {
if (player != null && this.registryManager.getCompositeManager().get(RegistryKeys.MESSAGE_TYPE).getKey(parameters.messageType()).map(key -> key.equals(MessageType.CHAT)).orElse(false)) {
ServerWorld world = player.getServerWorld();
PointOfInterestStorage poiStorage = world.getChunkManager().getPointOfInterestStorage();
Stream<BlockPos> pointOfInterest = poiStorage.getInSquare(poiTypeHolder -> poiTypeHolder.isRegistryKey(ArcanusPointsOfInterest.MAGIC_DOOR), player.getBlockPos(), 8, PointOfInterestStorage.OccupationStatus.ANY).map(PointOfInterest::getPos);
boolean beep = false;

for (BlockPos pos : pointOfInterest.collect(Collectors.toSet())) {
BlockState state = world.getBlockState(pos);
var beep = new boolean[1];

poiStorage.getInCircle(poiTypeHolder -> poiTypeHolder.isRegistryKey(ArcanusPointsOfInterest.MAGIC_DOOR), player.getBlockPos(), 8, PointOfInterestStorage.OccupationStatus.ANY).map(PointOfInterest::getPos).forEach(pos -> {
BlockState state = world.getBlockState(pos);
if (state.getBlock() instanceof MagicDoorBlock doorBlock && world.getBlockEntity(pos) instanceof MagicDoorBlockEntity door) {
if (chatMessage.getContent().toLowerCase(Locale.ROOT).equals(door.getPassword())) {
if (chatMessage.getContent().equalsIgnoreCase(door.getPassword())) {
doorBlock.setOpen(null, world, state, pos, true);
player.sendMessage(Arcanus.translate("door", "access_granted").formatted(Formatting.GRAY, Formatting.ITALIC), true);
beep = true;
beep[0] = true;
}
}
}
if (beep)
});

if (beep[0]) {
return List.of();
}
}
return original;
}
Expand Down
90 changes: 45 additions & 45 deletions src/main/resources/arcanuscontinuum.mixins.json
Original file line number Diff line number Diff line change
@@ -1,48 +1,48 @@
{
"required": true,
"minVersion": "0.8",
"package": "dev.cammiescorner.arcanuscontinuum.mixin",
"plugin": "dev.cammiescorner.arcanuscontinuum.ArcanusMixinConfig",
"compatibilityLevel": "JAVA_17",
"mixins": [
"common.AbstractBlockStateMixin",
"common.ArmorStandEntityMixin",
"common.EntityPartMixin",
"common.EntityViewMixin",
"common.ExplosionMixin",
"common.FallingBlockMixin",
"common.HungerManagerMixin",
"common.ItemEntityMixin",
"common.ItemStackMixin",
"common.LecternBlockEntityMixin",
"common.LivingEntityMixin",
"common.MilkBucketItemMixin",
"common.MobEntityMixin",
"common.PistonBlockMixin",
"common.PlayerEntityMixin",
"required": true,
"minVersion": "0.8",
"package": "dev.cammiescorner.arcanuscontinuum.mixin",
"plugin": "dev.cammiescorner.arcanuscontinuum.ArcanusMixinConfig",
"compatibilityLevel": "JAVA_17",
"mixins": [
"common.AbstractBlockStateMixin",
"common.ArmorStandEntityMixin",
"common.EntityPartMixin",
"common.EntityViewMixin",
"common.ExplosionMixin",
"common.FallingBlockMixin",
"common.HungerManagerMixin",
"common.ItemEntityMixin",
"common.ItemStackMixin",
"common.LecternBlockEntityMixin",
"common.LivingEntityMixin",
"common.MilkBucketItemMixin",
"common.MobEntityMixin",
"common.PistonBlockMixin",
"common.PlayerEntityMixin",
"common.PlayerManagerMixin",
"common.ScreenHandlerTypeMixin",
"common.ServerWorldMixin",
"common.ThrownEntityMixin",
"common.WorldMixin",
"compat.pehkui.LivingEntityMixin"
],
"client": [
"client.BipedEntityModelMixin",
"client.ClientWorldMixin",
"client.CraftingScreenMixin",
"client.FramebufferMixin",
"client.HeldItemFeatureRendererMixin",
"client.HeldItemRendererMixin",
"client.InGameHudMixin",
"client.ItemRendererMixin",
"client.LivingEntityRendererMixin",
"client.MinecraftClientMixin",
"client.MouseMixin",
"client.PlayerEntityRendererMixin",
"client.WorldRendererMixin"
],
"injectors": {
"defaultRequire": 1
}
"common.ScreenHandlerTypeMixin",
"common.ServerWorldMixin",
"common.ThrownEntityMixin",
"common.WorldMixin",
"compat.pehkui.LivingEntityMixin"
],
"client": [
"client.BipedEntityModelMixin",
"client.ClientWorldMixin",
"client.CraftingScreenMixin",
"client.FramebufferMixin",
"client.HeldItemFeatureRendererMixin",
"client.HeldItemRendererMixin",
"client.InGameHudMixin",
"client.ItemRendererMixin",
"client.LivingEntityRendererMixin",
"client.MinecraftClientMixin",
"client.MouseMixin",
"client.PlayerEntityRendererMixin",
"client.WorldRendererMixin"
],
"injectors": {
"defaultRequire": 1
}
}

0 comments on commit 8f6aeed

Please sign in to comment.