package net.mcreator.geckolibthing.procedures; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.eventbus.api.Event; import net.minecraftforge.event.entity.living.LivingEvent; import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.LevelAccessor; import net.minecraft.world.entity.Entity; import net.minecraft.core.BlockPos; import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.entity.JukeboxBlockEntity; import net.minecraft.world.item.ItemStack; import net.minecraft.nbt.CompoundTag; import net.mcreator.geckolibthing.entity.KakapoEntity; import javax.annotation.Nullable; @Mod.EventBusSubscriber public class Gsss2Procedure { @SubscribeEvent public static void onEntityTick(LivingEvent.LivingTickEvent event) { execute(event, event.getEntity().level, event.getEntity().getX(), event.getEntity().getY(), event.getEntity().getZ(), event.getEntity()); } public static void execute(LevelAccessor world, double x, double y, double z, Entity entity) { execute(null, world, x, y, z, entity); } private static void execute(@Nullable Event event, LevelAccessor world, double x, double y, double z, Entity entity) { if (entity == null) return; boolean found = false; double sx = 0; double sy = 0; double sz = 0; sx = -3; found = false; for (int index0 = 0; index0 < (int) (6); index0++) { sy = -3; for (int index1 = 0; index1 < (int) (6); index1++) { sz = -3; for (int index2 = 0; index2 < (int) (6); index2++) { BlockPos blockpos = new BlockPos(x + sx, y + sy, z + sz); if ((world.getBlockState(blockpos)).getBlock() == Blocks.JUKEBOX) { BlockEntity blockEntity = world.getBlockEntity(blockpos); if (blockEntity instanceof JukeboxBlockEntity) { ItemStack disc = ((JukeboxBlockEntity)blockEntity).getRecord(); if (!disc.isEmpty()) { found = true; } } } sz = sz + 1; } sy = sy + 1; } sx = sx + 1; } if (found == true) { if (entity instanceof KakapoEntity) { ((KakapoEntity) entity).animationprocedure = "sneak"; } } } }