Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package net.mcreator.chillzoneoriginsaddon.procedures;
- /* imports omitted */
- @Mod.EventBusSubscriber
- public class AdaptionProcedure {
- @SubscribeEvent
- public static void onEntityAttacked(LivingHurtEvent event) {
- if (event != null && event.getEntity() != null) {
- execute(event, event.getEntity().level(), event.getSource(), event.getEntity(), event.getSource().getEntity());
- }
- }
- public static void execute(LevelAccessor world, DamageSource damagesource, Entity entity, Entity sourceentity) {
- execute(null, world, damagesource, entity, sourceentity);
- }
- private static void execute(@Nullable Event event, LevelAccessor world, DamageSource damagesource, Entity entity, Entity sourceentity) {
- if (damagesource == null || entity == null || sourceentity == null)
- return;
- double index = 0;
- if ((entity.getCapability(ChillzoneoriginsaddonModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new ChillzoneoriginsaddonModVariables.PlayerVariables())).Morphai) {
- index = 0;
- for (int index0 = 0; index0 < (int) ChillzoneoriginsaddonModVariables.Adaption.size(); index0++) {
- if ((ChillzoneoriginsaddonModVariables.Adaption.get((int) index) instanceof Entity _e ? _e : null) == sourceentity) {
- if (event != null && event.isCancelable()) {
- event.setCanceled(true);
- }
- }
- index = index + 1;
- }
- if (sourceentity == null) {
- index = 0;
- for (int index1 = 0; index1 < (int) ChillzoneoriginsaddonModVariables.AdaptionEnviroment.size(); index1++) {
- if (ChillzoneoriginsaddonModVariables.AdaptionEnviroment.get((int) index).is(DamageTypes.FALLING_ANVIL)) {
- if (event != null && event.isCancelable()) {
- event.setCanceled(true);
- }
- break;
- }
- if (ChillzoneoriginsaddonModVariables.AdaptionEnviroment.get((int) index).is(DamageTypes.BAD_RESPAWN_POINT)) {
- if (event != null && event.isCancelable()) {
- event.setCanceled(true);
- }
- break;
- }
- if (ChillzoneoriginsaddonModVariables.AdaptionEnviroment.get((int) index).is(DamageTypes.CACTUS)) {
- if (event != null && event.isCancelable()) {
- event.setCanceled(true);
- }
- break;
- }
- if (ChillzoneoriginsaddonModVariables.AdaptionEnviroment.get((int) index).is(DamageTypes.CRAMMING)) {
- if (event != null && event.isCancelable()) {
- event.setCanceled(true);
- }
- break;
- }
- if (ChillzoneoriginsaddonModVariables.AdaptionEnviroment.get((int) index).is(DamageTypes.DRAGON_BREATH)) {
- if (event != null && event.isCancelable()) {
- event.setCanceled(true);
- }
- break;
- }
- if (ChillzoneoriginsaddonModVariables.AdaptionEnviroment.get((int) index).is(DamageTypes.DROWN)) {
- if (event != null && event.isCancelable()) {
- event.setCanceled(true);
- }
- break;
- }
- if (ChillzoneoriginsaddonModVariables.AdaptionEnviroment.get((int) index).is(DamageTypes.DRY_OUT)) {
- if (event != null && event.isCancelable()) {
- event.setCanceled(true);
- }
- break;
- }
- if (ChillzoneoriginsaddonModVariables.AdaptionEnviroment.get((int) index).is(DamageTypes.EXPLOSION)) {
- if (event != null && event.isCancelable()) {
- event.setCanceled(true);
- }
- break;
- }
- if (ChillzoneoriginsaddonModVariables.AdaptionEnviroment.get((int) index).is(DamageTypes.FALL)) {
- if (event != null && event.isCancelable()) {
- event.setCanceled(true);
- }
- break;
- }
- if (ChillzoneoriginsaddonModVariables.AdaptionEnviroment.get((int) index).is(DamageTypes.FALLING_BLOCK)) {
- if (event != null && event.isCancelable()) {
- event.setCanceled(true);
- }
- break;
- }
- if (ChillzoneoriginsaddonModVariables.AdaptionEnviroment.get((int) index).is(DamageTypes.FALLING_STALACTITE)) {
- if (event != null && event.isCancelable()) {
- event.setCanceled(true);
- }
- break;
- }
- if (ChillzoneoriginsaddonModVariables.AdaptionEnviroment.get((int) index).is(DamageTypes.FIREBALL)) {
- if (event != null && event.isCancelable()) {
- event.setCanceled(true);
- }
- break;
- }
- if (ChillzoneoriginsaddonModVariables.AdaptionEnviroment.get((int) index).is(DamageTypes.FLY_INTO_WALL)) {
- if (event != null && event.isCancelable()) {
- event.setCanceled(true);
- }
- break;
- }
- if (ChillzoneoriginsaddonModVariables.AdaptionEnviroment.get((int) index).is(DamageTypes.FREEZE)) {
- if (event != null && event.isCancelable()) {
- event.setCanceled(true);
- }
- break;
- }
- if (ChillzoneoriginsaddonModVariables.AdaptionEnviroment.get((int) index).is(DamageTypes.HOT_FLOOR)) {
- if (event != null && event.isCancelable()) {
- event.setCanceled(true);
- }
- break;
- }
- if (ChillzoneoriginsaddonModVariables.AdaptionEnviroment.get((int) index).is(DamageTypes.IN_FIRE)) {
- if (event != null && event.isCancelable()) {
- event.setCanceled(true);
- }
- break;
- }
- if (ChillzoneoriginsaddonModVariables.AdaptionEnviroment.get((int) index).is(DamageTypes.IN_WALL)) {
- if (event != null && event.isCancelable()) {
- event.setCanceled(true);
- }
- break;
- }
- if (ChillzoneoriginsaddonModVariables.AdaptionEnviroment.get((int) index).is(DamageTypes.INDIRECT_MAGIC)) {
- if (event != null && event.isCancelable()) {
- event.setCanceled(true);
- }
- break;
- }
- if (ChillzoneoriginsaddonModVariables.AdaptionEnviroment.get((int) index).is(DamageTypes.LAVA)) {
- if (event != null && event.isCancelable()) {
- event.setCanceled(true);
- }
- break;
- }
- if (ChillzoneoriginsaddonModVariables.AdaptionEnviroment.get((int) index).is(DamageTypes.LIGHTNING_BOLT)) {
- if (event != null && event.isCancelable()) {
- event.setCanceled(true);
- }
- break;
- }
- if (ChillzoneoriginsaddonModVariables.AdaptionEnviroment.get((int) index).is(DamageTypes.MAGIC)) {
- if (event != null && event.isCancelable()) {
- event.setCanceled(true);
- }
- break;
- }
- if (ChillzoneoriginsaddonModVariables.AdaptionEnviroment.get((int) index).is(DamageTypes.ON_FIRE)) {
- if (event != null && event.isCancelable()) {
- event.setCanceled(true);
- }
- break;
- }
- if (ChillzoneoriginsaddonModVariables.AdaptionEnviroment.get((int) index).is(DamageTypes.SONIC_BOOM)) {
- if (event != null && event.isCancelable()) {
- event.setCanceled(true);
- }
- break;
- }
- if (ChillzoneoriginsaddonModVariables.AdaptionEnviroment.get((int) index).is(DamageTypes.STALAGMITE)) {
- if (event != null && event.isCancelable()) {
- event.setCanceled(true);
- }
- break;
- }
- if (ChillzoneoriginsaddonModVariables.AdaptionEnviroment.get((int) index).is(DamageTypes.STARVE)) {
- if (event != null && event.isCancelable()) {
- event.setCanceled(true);
- }
- break;
- }
- if (ChillzoneoriginsaddonModVariables.AdaptionEnviroment.get((int) index).is(DamageTypes.STING)) {
- if (event != null && event.isCancelable()) {
- event.setCanceled(true);
- }
- break;
- }
- if (ChillzoneoriginsaddonModVariables.AdaptionEnviroment.get((int) index).is(DamageTypes.SWEET_BERRY_BUSH)) {
- if (event != null && event.isCancelable()) {
- event.setCanceled(true);
- }
- break;
- }
- if (ChillzoneoriginsaddonModVariables.AdaptionEnviroment.get((int) index).is(DamageTypes.THROWN)) {
- if (event != null && event.isCancelable()) {
- event.setCanceled(true);
- }
- break;
- }
- if (ChillzoneoriginsaddonModVariables.AdaptionEnviroment.get((int) index).is(DamageTypes.UNATTRIBUTED_FIREBALL)) {
- if (event != null && event.isCancelable()) {
- event.setCanceled(true);
- }
- break;
- }
- if (ChillzoneoriginsaddonModVariables.AdaptionEnviroment.get((int) index).is(DamageTypes.WITHER)) {
- if (event != null && event.isCancelable()) {
- event.setCanceled(true);
- }
- break;
- }
- if (ChillzoneoriginsaddonModVariables.AdaptionEnviroment.get((int) index).is(DamageTypes.WITHER_SKULL)) {
- if (event != null && event.isCancelable()) {
- event.setCanceled(true);
- }
- break;
- }
- index = index + 1;
- }
- ChillzoneoriginsaddonMod.queueServerWork(1200, () -> {
- ChillzoneoriginsaddonModVariables.AdaptionEnviroment.add(damagesource);
- if (entity instanceof Player _player && !_player.level().isClientSide())
- _player.displayClientMessage(Component.literal("ADAPTED"), true);
- });
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement