diff --git a/build.gradle b/build.gradle index d51f070cb..eedc0a468 100644 --- a/build.gradle +++ b/build.gradle @@ -9,24 +9,28 @@ buildscript { } plugins { + id 'java-library' id 'eclipse' id 'idea' - id 'net.minecraftforge.gradle' version '[6.0,6.2)' + id 'maven-publish' + id 'net.neoforged.gradle' version '[6.0.18,6.2)' id 'org.parchmentmc.librarian.forgegradle' version '1.+' } apply plugin: 'org.spongepowered.mixin' -group = mod_group_id version = mod_version +group = mod_group_id + +repositories { + mavenLocal() +} base { archivesName = mod_id } -java { - toolchain.languageVersion = JavaLanguageVersion.of(17) -} +java.toolchain.languageVersion = JavaLanguageVersion.of(17) mixin { add sourceSets.main, "${mod_id}.refmap.json" @@ -101,7 +105,7 @@ repositories { } dependencies { - minecraft "net.minecraftforge:forge:${minecraft_version}-${forge_version}" + minecraft "net.neoforged:forge:${minecraft_version}-${neo_version}" implementation fg.deobf("software.bernie.geckolib:geckolib-forge-${minecraft_version}:${geckolib_version}") annotationProcessor 'org.spongepowered:mixin:0.8.5:processor' } @@ -109,7 +113,7 @@ dependencies { tasks.named('processResources', ProcessResources).configure { var replaceProperties = [ minecraft_version: minecraft_version, minecraft_version_range: minecraft_version_range, - forge_version: forge_version, forge_version_range: forge_version_range, + neo_version: neo_version, neo_version_range: neo_version_range, loader_version_range: loader_version_range, mod_id: mod_id, mod_name: mod_name, mod_license: mod_license, mod_version: mod_version, mod_authors: mod_authors, mod_description: mod_description, diff --git a/gradle.properties b/gradle.properties index d9b711072..38685ffa7 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,8 +3,8 @@ org.gradle.daemon=false minecraft_version=1.20.1 minecraft_version_range=[1.20.1,1.21) -forge_version=47.2.1 -forge_version_range=[47,) +neo_version=47.1.79 +neo_version_range=[47,) loader_version_range=[47,) mapping_channel=parchment diff --git a/settings.gradle b/settings.gradle index 80dead8c1..4c0c6c25c 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,7 +1,7 @@ pluginManagement { repositories { gradlePluginPortal() - maven { url = 'https://maven.minecraftforge.net/' } + maven { url = 'https://maven.neoforged.net/releases/' } maven { url = 'https://maven.parchmentmc.org' } } } diff --git a/src/main/java/radon/jujutsu_kaisen/ability/limitless/Infinity.java b/src/main/java/radon/jujutsu_kaisen/ability/limitless/Infinity.java index 68aba26fa..e56585ee2 100644 --- a/src/main/java/radon/jujutsu_kaisen/ability/limitless/Infinity.java +++ b/src/main/java/radon/jujutsu_kaisen/ability/limitless/Infinity.java @@ -247,7 +247,7 @@ public static void onProjectileImpact(ProjectileImpactEvent event) { if (!Infinity.canBlock(target, projectile)) return; if (projectile.getOwner() == target) { - event.setImpactResult(ProjectileImpactEvent.ImpactResult.SKIP_ENTITY); + event.setCanceled(true); return; } @@ -255,7 +255,7 @@ public static void onProjectileImpact(ProjectileImpactEvent event) { projectile.discard(); } else { data.add(target, projectile); - event.setImpactResult(ProjectileImpactEvent.ImpactResult.SKIP_ENTITY); + event.setCanceled(true); } } } diff --git a/src/main/java/radon/jujutsu_kaisen/ability/misc/Dash.java b/src/main/java/radon/jujutsu_kaisen/ability/misc/Dash.java index 2aa5d4a63..8733bd141 100644 --- a/src/main/java/radon/jujutsu_kaisen/ability/misc/Dash.java +++ b/src/main/java/radon/jujutsu_kaisen/ability/misc/Dash.java @@ -52,19 +52,6 @@ public void run(LivingEntity owner) { if (!(owner.level() instanceof ServerLevel level)) return; Vec3 look = owner.getLookAngle(); - Vec3 pos = owner.position().add(0.0D, owner.getBbHeight() / 2.0F, 0.0D); - - for (int i = 0; i < 32; i++) { - double theta = HelperMethods.RANDOM.nextDouble() * 2 * Math.PI; - double phi = HelperMethods.RANDOM.nextDouble() * Math.PI; - double r = HelperMethods.RANDOM.nextDouble() * 0.8D; - double x = r * Math.sin(phi) * Math.cos(theta); - double y = r * Math.sin(phi) * Math.sin(theta); - double z = r * Math.cos(phi); - Vec3 speed = look.add(x, y, z).reverse(); - Vec3 offset = pos.add(look); - level.sendParticles(ParticleTypes.CLOUD, offset.x(), offset.y(), offset.z(), 0, speed.x(), speed.y(), speed.z(), 1.0D); - } if (HelperMethods.getLookAtHit(owner, RANGE) instanceof EntityHitResult hit) { Entity target = hit.getEntity(); @@ -87,6 +74,19 @@ public void run(LivingEntity owner) { return; } + Vec3 pos = owner.position().add(0.0D, owner.getBbHeight() / 2.0F, 0.0D); + + for (int i = 0; i < 32; i++) { + double theta = HelperMethods.RANDOM.nextDouble() * 2 * Math.PI; + double phi = HelperMethods.RANDOM.nextDouble() * Math.PI; + double r = HelperMethods.RANDOM.nextDouble() * 0.8D; + double x = r * Math.sin(phi) * Math.cos(theta); + double y = r * Math.sin(phi) * Math.sin(theta); + double z = r * Math.cos(phi); + Vec3 speed = look.add(x, y, z).reverse(); + Vec3 offset = pos.add(look); + level.sendParticles(ParticleTypes.CLOUD, offset.x(), offset.y(), offset.z(), 0, speed.x(), speed.y(), speed.z(), 1.0D); + } owner.level().playSound(null, owner.getX(), owner.getY(), owner.getZ(), JJKSounds.DASH.get(), SoundSource.MASTER, 1.0F, 1.0F); owner.addEffect(new MobEffectInstance(MobEffects.INVISIBILITY, 5, 0, false, false, false)); level.sendParticles(new MirageParticle.MirageParticleOptions(owner.getId()), owner.getX(), owner.getY(), owner.getZ(), diff --git a/src/main/java/radon/jujutsu_kaisen/ability/misc/WaterWalking.java b/src/main/java/radon/jujutsu_kaisen/ability/misc/WaterWalking.java index 6b880b798..79e184781 100644 --- a/src/main/java/radon/jujutsu_kaisen/ability/misc/WaterWalking.java +++ b/src/main/java/radon/jujutsu_kaisen/ability/misc/WaterWalking.java @@ -1,8 +1,10 @@ package radon.jujutsu_kaisen.ability.misc; +import net.minecraft.core.BlockPos; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.PathfinderMob; import net.minecraft.world.entity.ai.navigation.GroundPathNavigation; +import net.minecraft.world.entity.player.Player; import net.minecraft.world.phys.Vec3; import net.minecraftforge.event.entity.living.LivingEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; @@ -36,6 +38,17 @@ public void run(LivingEntity owner) { owner.setDeltaMovement(owner.getDeltaMovement().x(), 0.01D, owner.getDeltaMovement().z()); owner.setOnGround(true); } + + if (owner instanceof Player player) { + float f; + + if (owner.onGround() && !owner.isDeadOrDying() && !owner.isSwimming()) { + f = Math.min(0.1F, (float) owner.getDeltaMovement().horizontalDistance()); + } else { + f = 0.0F; + } + player.bob += (f - player.bob) * 0.4F; + } } @Override @@ -57,19 +70,4 @@ public void onDisabled(LivingEntity owner) { public MenuType getMenuType() { return MenuType.NONE; } - - @Mod.EventBusSubscriber(modid = JujutsuKaisen.MOD_ID, bus = Mod.EventBusSubscriber.Bus.FORGE) - public static class ForgeEvents { - @SubscribeEvent - public static void onLivingTick(LivingEvent.LivingTickEvent event) { - LivingEntity owner = event.getEntity(); - - if (JJKAbilities.hasToggled(owner, JJKAbilities.WATER_WALKING.get())) { - if (owner.isInFluidType()) { - Vec3 movement = owner.getDeltaMovement(); - owner.setDeltaMovement(movement.x(), 0.1D, movement.z()); - } - } - } - } } diff --git a/src/main/java/radon/jujutsu_kaisen/capability/data/SorcererData.java b/src/main/java/radon/jujutsu_kaisen/capability/data/SorcererData.java index 27c99175c..de43c1d19 100644 --- a/src/main/java/radon/jujutsu_kaisen/capability/data/SorcererData.java +++ b/src/main/java/radon/jujutsu_kaisen/capability/data/SorcererData.java @@ -448,7 +448,7 @@ public void tick(LivingEntity owner) { if (this.speedStacks > 0) { this.applyModifier(owner, Attributes.MOVEMENT_SPEED, PROJECTION_SORCERY_MOVEMENT_SPEED_UUID, "Movement speed", this.speedStacks * 2.0D, AttributeModifier.Operation.MULTIPLY_TOTAL); this.applyModifier(owner, Attributes.ATTACK_SPEED, PROJECTION_ATTACK_SPEED_UUID, "Attack speed", this.speedStacks, AttributeModifier.Operation.MULTIPLY_TOTAL); - this.applyModifier(owner, ForgeMod.STEP_HEIGHT_ADDITION.get(), STEP_HEIGHT_ADDITION_UUID, "Step height addition", 2.0F, AttributeModifier.Operation.ADDITION); + this.applyModifier(owner, ForgeMod.STEP_HEIGHT.get(), STEP_HEIGHT_ADDITION_UUID, "Step height addition", 2.0F, AttributeModifier.Operation.ADDITION); if (owner.walkDist == owner.walkDistO) { this.noMotionTime++; @@ -462,7 +462,7 @@ public void tick(LivingEntity owner) { } else { this.removeModifier(owner, Attributes.MOVEMENT_SPEED, PROJECTION_SORCERY_MOVEMENT_SPEED_UUID); this.removeModifier(owner, Attributes.ATTACK_SPEED, PROJECTION_ATTACK_SPEED_UUID); - this.removeModifier(owner, ForgeMod.STEP_HEIGHT_ADDITION.get(), STEP_HEIGHT_ADDITION_UUID); + this.removeModifier(owner, ForgeMod.STEP_HEIGHT.get(), STEP_HEIGHT_ADDITION_UUID); } } diff --git a/src/main/java/radon/jujutsu_kaisen/client/particle/MirageParticle.java b/src/main/java/radon/jujutsu_kaisen/client/particle/MirageParticle.java index e39c5fe8d..80128b2a6 100644 --- a/src/main/java/radon/jujutsu_kaisen/client/particle/MirageParticle.java +++ b/src/main/java/radon/jujutsu_kaisen/client/particle/MirageParticle.java @@ -10,13 +10,16 @@ import net.minecraft.client.multiplayer.ClientLevel; import net.minecraft.client.particle.*; import net.minecraft.client.renderer.MultiBufferSource; +import net.minecraft.client.renderer.RenderType; import net.minecraft.client.renderer.entity.EntityRenderDispatcher; +import net.minecraft.client.renderer.entity.EntityRenderer; import net.minecraft.core.particles.ParticleOptions; import net.minecraft.core.particles.ParticleType; import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.network.FriendlyByteBuf; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.phys.Vec3; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import radon.jujutsu_kaisen.client.MixinData; @@ -88,8 +91,6 @@ public void render(@NotNull VertexConsumer pBuffer, @NotNull Camera pRenderInfo, if (this.entity != null) { PoseStack stack = new PoseStack(); - MultiBufferSource.BufferSource buffer = Minecraft.getInstance().renderBuffers().bufferSource(); - float yRot = this.entity.getYRot(); float yRotO = this.entity.yRotO; @@ -123,12 +124,18 @@ public void render(@NotNull VertexConsumer pBuffer, @NotNull Camera pRenderInfo, this.entity.setYRot(this.yRot); this.entity.yRotO = this.yRot0; - RenderSystem.enableBlend(); - RenderSystem.defaultBlendFunc(); RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, this.alpha); EntityRenderDispatcher manager = Minecraft.getInstance().getEntityRenderDispatcher(); - manager.render(this.entity, this.x - pRenderInfo.getPosition().x(), this.y - pRenderInfo.getPosition().y(), this.z - pRenderInfo.getPosition().z(), 0.0F, pPartialTicks, stack, buffer, manager.getPackedLightCoords(this.entity, pPartialTicks)); + EntityRenderer renderer = manager.getRenderer(this.entity); + + MultiBufferSource.BufferSource buffer = Minecraft.getInstance().renderBuffers().bufferSource(); + + Vec3 offset = renderer.getRenderOffset(this.entity, pPartialTicks); + stack.translate((this.x - pRenderInfo.getPosition().x()) + offset.x(), (this.y - pRenderInfo.getPosition().y()) + offset.y(), (this.z - pRenderInfo.getPosition().z()) + offset.z()); + renderer.render(this.entity, 0.0F, pPartialTicks, stack, buffer, manager.getPackedLightCoords(this.entity, pPartialTicks)); + + buffer.getBuffer(RenderType.translucent()); RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); diff --git a/src/main/java/radon/jujutsu_kaisen/client/particle/ProjectionParticle.java b/src/main/java/radon/jujutsu_kaisen/client/particle/ProjectionParticle.java index e2a46e866..16b6d61c1 100644 --- a/src/main/java/radon/jujutsu_kaisen/client/particle/ProjectionParticle.java +++ b/src/main/java/radon/jujutsu_kaisen/client/particle/ProjectionParticle.java @@ -5,22 +5,39 @@ import com.mojang.blaze3d.vertex.VertexConsumer; import com.mojang.brigadier.StringReader; import com.mojang.brigadier.exceptions.CommandSyntaxException; +import net.minecraft.CrashReport; +import net.minecraft.CrashReportCategory; +import net.minecraft.ReportedException; import net.minecraft.client.Camera; import net.minecraft.client.Minecraft; import net.minecraft.client.multiplayer.ClientLevel; import net.minecraft.client.particle.*; +import net.minecraft.client.renderer.LightTexture; import net.minecraft.client.renderer.MultiBufferSource; +import net.minecraft.client.renderer.RenderType; import net.minecraft.client.renderer.entity.EntityRenderDispatcher; import net.minecraft.client.renderer.entity.EntityRenderer; +import net.minecraft.client.renderer.texture.OverlayTexture; +import net.minecraft.core.BlockPos; import net.minecraft.core.particles.ParticleOptions; import net.minecraft.core.particles.ParticleType; import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.util.Mth; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.Mob; +import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.block.RenderShape; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.chunk.ChunkAccess; +import net.minecraft.world.phys.AABB; import net.minecraft.world.phys.Vec3; +import net.minecraft.world.phys.shapes.VoxelShape; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +import org.joml.Vector3f; import radon.jujutsu_kaisen.ability.JJKAbilities; import radon.jujutsu_kaisen.client.MixinData; @@ -69,8 +86,6 @@ public void render(@NotNull VertexConsumer pBuffer, @NotNull Camera pRenderInfo, if (this.entity != null) { PoseStack stack = new PoseStack(); - MultiBufferSource.BufferSource buffer = Minecraft.getInstance().renderBuffers().bufferSource(); - float yRot = this.entity.getYRot(); float yRotO = this.entity.yRotO; @@ -97,12 +112,18 @@ public void render(@NotNull VertexConsumer pBuffer, @NotNull Camera pRenderInfo, this.entity.yBodyRot = this.yaw; this.entity.yBodyRotO = this.yaw; - RenderSystem.enableBlend(); - RenderSystem.defaultBlendFunc(); RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, this.alpha); EntityRenderDispatcher manager = Minecraft.getInstance().getEntityRenderDispatcher(); - manager.render(this.entity, this.x - pRenderInfo.getPosition().x(), this.y - pRenderInfo.getPosition().y(), this.z - pRenderInfo.getPosition().z(), 0.0F, pPartialTicks, stack, buffer, manager.getPackedLightCoords(this.entity, pPartialTicks)); + EntityRenderer renderer = manager.getRenderer(this.entity); + + MultiBufferSource.BufferSource buffer = Minecraft.getInstance().renderBuffers().bufferSource(); + + Vec3 offset = renderer.getRenderOffset(this.entity, pPartialTicks); + stack.translate((this.x - pRenderInfo.getPosition().x()) + offset.x(), (this.y - pRenderInfo.getPosition().y()) + offset.y(), (this.z - pRenderInfo.getPosition().z()) + offset.z()); + renderer.render(this.entity, 0.0F, pPartialTicks, stack, buffer, manager.getPackedLightCoords(this.entity, pPartialTicks)); + + buffer.getBuffer(RenderType.translucent()); RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); diff --git a/src/main/resources/META-INF/mods.toml b/src/main/resources/META-INF/mods.toml index a9f1df5a8..45eca15b9 100644 --- a/src/main/resources/META-INF/mods.toml +++ b/src/main/resources/META-INF/mods.toml @@ -10,7 +10,7 @@ description='''${mod_description}''' [[dependencies.${mod_id}]] modId="forge" mandatory=true -versionRange="${forge_version_range}" +versionRange="${neo_version_range}" ordering="NONE" side="BOTH" [[dependencies.${mod_id}]]