chore: remove quilt specific build + fabric api + architectury api
This commit is contained in:
parent
021d61ad13
commit
f34d13a0cc
17 changed files with 34 additions and 209 deletions
BIN
arrow.webp
Normal file
BIN
arrow.webp
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.6 KiB |
|
@ -1,43 +1,38 @@
|
||||||
package dev.newty.projectileding.mixin.client;
|
package dev.newty.projectileding.mixin;
|
||||||
|
|
||||||
import net.minecraft.client.MinecraftClient;
|
|
||||||
import net.minecraft.client.network.ClientPlayerEntity;
|
|
||||||
import net.minecraft.entity.Entity;
|
|
||||||
import net.minecraft.entity.LivingEntity;
|
import net.minecraft.entity.LivingEntity;
|
||||||
import net.minecraft.entity.projectile.PersistentProjectileEntity;
|
import net.minecraft.entity.projectile.PersistentProjectileEntity;
|
||||||
import net.minecraft.entity.projectile.ProjectileEntity;
|
|
||||||
import net.minecraft.sound.SoundEvent;
|
import net.minecraft.sound.SoundEvent;
|
||||||
import net.minecraft.sound.SoundEvents;
|
import net.minecraft.sound.SoundEvents;
|
||||||
import net.minecraft.util.hit.EntityHitResult;
|
import net.minecraft.util.hit.EntityHitResult;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.Shadow;
|
import org.spongepowered.asm.mixin.Shadow;
|
||||||
|
import org.spongepowered.asm.mixin.Unique;
|
||||||
import org.spongepowered.asm.mixin.injection.At;
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
import org.spongepowered.asm.mixin.injection.Inject;
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
|
|
||||||
@Mixin(PersistentProjectileEntity.class)
|
@Mixin(PersistentProjectileEntity.class)
|
||||||
public abstract class PersistentProjectileEntityMixin {
|
public abstract class PersistentProjectileEntityMixin {
|
||||||
|
@Unique private boolean projectileDing$targetAlive;
|
||||||
|
|
||||||
@Shadow public abstract void setSound(SoundEvent sound);
|
@Shadow public abstract void setSound(SoundEvent sound);
|
||||||
|
|
||||||
@Inject(method = "onEntityHit", at = @At("HEAD"))
|
@Inject(method = "onEntityHit", at = @At("HEAD"))
|
||||||
private void changeSound(EntityHitResult entityHitResult, CallbackInfo ci) {
|
private void changeSound(EntityHitResult entityHitResult, CallbackInfo ci) {
|
||||||
Entity target = entityHitResult.getEntity();
|
projectileDing$targetAlive = entityHitResult.getEntity() instanceof LivingEntity;
|
||||||
|
|
||||||
// ensure that the target is alive
|
// if the arrow hits a living target, change the sound to the custom sound
|
||||||
if (target instanceof LivingEntity) {
|
if (projectileDing$targetAlive) {
|
||||||
ClientPlayerEntity player = MinecraftClient.getInstance().player;
|
this.setSound(SoundEvents.ENTITY_ARROW_HIT_PLAYER);
|
||||||
ProjectileEntity projectile = (ProjectileEntity) (Object) this;
|
|
||||||
|
|
||||||
if (player != null && player.equals(projectile.getOwner())) {
|
|
||||||
// change the sound to the custom sound
|
|
||||||
this.setSound(SoundEvents.ENTITY_ARROW_HIT_PLAYER);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Inject(method = "onEntityHit", at = @At("TAIL"))
|
@Inject(method = "onEntityHit", at = @At("TAIL"))
|
||||||
private void revertSound(EntityHitResult entityHitResult, CallbackInfo ci) {
|
private void revertSound(EntityHitResult entityHitResult, CallbackInfo ci) {
|
||||||
// revert the sound back to default, even if it hasn't been changed
|
// if the arrow hit a living target, revert the sound back to the default
|
||||||
this.setSound(SoundEvents.ENTITY_ARROW_HIT);
|
if (projectileDing$targetAlive) {
|
||||||
|
this.setSound(SoundEvents.ENTITY_ARROW_HIT);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -3,10 +3,8 @@
|
||||||
"package": "dev.newty.projectileding.mixin",
|
"package": "dev.newty.projectileding.mixin",
|
||||||
"compatibilityLevel": "JAVA_21",
|
"compatibilityLevel": "JAVA_21",
|
||||||
"minVersion": "0.8",
|
"minVersion": "0.8",
|
||||||
"client": [
|
|
||||||
"client.PersistentProjectileEntityMixin"
|
|
||||||
],
|
|
||||||
"mixins": [
|
"mixins": [
|
||||||
|
"PersistentProjectileEntityMixin"
|
||||||
],
|
],
|
||||||
"injectors": {
|
"injectors": {
|
||||||
"defaultRequire": 1
|
"defaultRequire": 1
|
||||||
|
|
|
@ -1,13 +0,0 @@
|
||||||
architectury {
|
|
||||||
common rootProject.enabled_platforms.split(',')
|
|
||||||
}
|
|
||||||
|
|
||||||
dependencies {
|
|
||||||
modImplementation "net.fabricmc:fabric-loader:$rootProject.fabric_loader_version"
|
|
||||||
modImplementation "net.fabricmc.fabric-api:fabric-api:$rootProject.fabric_api_version"
|
|
||||||
|
|
||||||
// Architectury API. This is optional, and you can comment it out if you don't need it.
|
|
||||||
modImplementation "dev.architectury:architectury-fabric:$rootProject.architectury_api_version"
|
|
||||||
|
|
||||||
compileOnly(project(path: ':common', configuration: 'namedElements')) { transitive false }
|
|
||||||
}
|
|
|
@ -1,10 +0,0 @@
|
||||||
package dev.newty.projectileding.fabriclike;
|
|
||||||
|
|
||||||
import dev.newty.projectileding.ProjectileDing;
|
|
||||||
|
|
||||||
public final class ProjectileDingFabricLike {
|
|
||||||
public static void init() {
|
|
||||||
// Run our common setup.
|
|
||||||
ProjectileDing.init();
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -27,16 +27,8 @@ configurations {
|
||||||
dependencies {
|
dependencies {
|
||||||
modImplementation "net.fabricmc:fabric-loader:$rootProject.fabric_loader_version"
|
modImplementation "net.fabricmc:fabric-loader:$rootProject.fabric_loader_version"
|
||||||
|
|
||||||
// Fabric API. This is technically optional, but you probably want it anyway.
|
|
||||||
modImplementation "net.fabricmc.fabric-api:fabric-api:$rootProject.fabric_api_version"
|
|
||||||
|
|
||||||
// Architectury API. This is optional, and you can comment it out if you don't need it.
|
|
||||||
modImplementation "dev.architectury:architectury-fabric:$rootProject.architectury_api_version"
|
|
||||||
|
|
||||||
common(project(path: ':common', configuration: 'namedElements')) { transitive false }
|
common(project(path: ':common', configuration: 'namedElements')) { transitive false }
|
||||||
shadowBundle project(path: ':common', configuration: 'transformProductionFabric')
|
shadowBundle project(path: ':common', configuration: 'transformProductionFabric')
|
||||||
common(project(path: ':fabric-like', configuration: 'namedElements')) { transitive false }
|
|
||||||
shadowBundle project(path: ':fabric-like', configuration: 'transformProductionFabric')
|
|
||||||
}
|
}
|
||||||
|
|
||||||
processResources {
|
processResources {
|
||||||
|
|
|
@ -1,17 +1,12 @@
|
||||||
package dev.newty.projectileding.fabric;
|
package dev.newty.projectileding.fabric;
|
||||||
|
|
||||||
|
import dev.newty.projectileding.ProjectileDing;
|
||||||
import net.fabricmc.api.ModInitializer;
|
import net.fabricmc.api.ModInitializer;
|
||||||
|
|
||||||
import dev.newty.projectileding.fabriclike.ProjectileDingFabricLike;
|
|
||||||
|
|
||||||
public final class ProjectileDingFabric implements ModInitializer {
|
public final class ProjectileDingFabric implements ModInitializer {
|
||||||
@Override
|
@Override
|
||||||
public void onInitialize() {
|
public void onInitialize() {
|
||||||
// This code runs as soon as Minecraft is in a mod-load-ready state.
|
// Run our common setup.
|
||||||
// However, some things (like resources) may still be uninitialized.
|
ProjectileDing.init();
|
||||||
// Proceed with mild caution.
|
|
||||||
|
|
||||||
// Run the Fabric-like setup.
|
|
||||||
ProjectileDingFabricLike.init();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +0,0 @@
|
||||||
package dev.newty.projectileding.fabric.client;
|
|
||||||
|
|
||||||
import net.fabricmc.api.ClientModInitializer;
|
|
||||||
|
|
||||||
public final class ProjectileDingFabricClient implements ClientModInitializer {
|
|
||||||
@Override
|
|
||||||
public void onInitializeClient() {
|
|
||||||
// This entrypoint is suitable for setting up client-specific logic, such as rendering.
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -17,9 +17,6 @@
|
||||||
"entrypoints": {
|
"entrypoints": {
|
||||||
"main": [
|
"main": [
|
||||||
"dev.newty.projectileding.fabric.ProjectileDingFabric"
|
"dev.newty.projectileding.fabric.ProjectileDingFabric"
|
||||||
],
|
|
||||||
"client": [
|
|
||||||
"dev.newty.projectileding.fabric.client.ProjectileDingFabricClient"
|
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"mixins": [
|
"mixins": [
|
||||||
|
@ -28,9 +25,7 @@
|
||||||
"depends": {
|
"depends": {
|
||||||
"fabricloader": ">=0.16.3",
|
"fabricloader": ">=0.16.3",
|
||||||
"minecraft": "~1.21",
|
"minecraft": "~1.21",
|
||||||
"java": ">=21",
|
"java": ">=21"
|
||||||
"architectury": ">=13.0.2",
|
|
||||||
"fabric-api": "*"
|
|
||||||
},
|
},
|
||||||
"suggests": {
|
"suggests": {
|
||||||
"another-mod": "*"
|
"another-mod": "*"
|
||||||
|
|
|
@ -6,7 +6,7 @@ org.gradle.parallel=true
|
||||||
mod_version = 1.0.0
|
mod_version = 1.0.0
|
||||||
maven_group = dev.newty
|
maven_group = dev.newty
|
||||||
archives_name = projectileding
|
archives_name = projectileding
|
||||||
enabled_platforms = fabric,neoforge,quilt
|
enabled_platforms = fabric,neoforge
|
||||||
|
|
||||||
# Minecraft properties
|
# Minecraft properties
|
||||||
minecraft_version = 1.21
|
minecraft_version = 1.21
|
||||||
|
@ -15,8 +15,5 @@ yarn_mappings = 1.21+build.1
|
||||||
# Dependencies
|
# Dependencies
|
||||||
architectury_api_version = 13.0.2
|
architectury_api_version = 13.0.2
|
||||||
fabric_loader_version = 0.16.3
|
fabric_loader_version = 0.16.3
|
||||||
fabric_api_version = 0.102.0+1.21
|
|
||||||
neoforge_version = 21.0.42-beta
|
neoforge_version = 21.0.42-beta
|
||||||
yarn_mappings_patch_neoforge_version = 1.21+build.4
|
yarn_mappings_patch_neoforge_version = 1.21+build.4
|
||||||
quilt_loader_version = 0.26.4-beta.5
|
|
||||||
quilted_fabric_api_version = 11.0.0-alpha.3+0.100.7-1.21
|
|
||||||
|
|
|
@ -34,9 +34,6 @@ repositories {
|
||||||
dependencies {
|
dependencies {
|
||||||
neoForge "net.neoforged:neoforge:$rootProject.neoforge_version"
|
neoForge "net.neoforged:neoforge:$rootProject.neoforge_version"
|
||||||
|
|
||||||
// Architectury API. This is optional, and you can comment it out if you don't need it.
|
|
||||||
modImplementation "dev.architectury:architectury-neoforge:$rootProject.architectury_api_version"
|
|
||||||
|
|
||||||
common(project(path: ':common', configuration: 'namedElements')) { transitive false }
|
common(project(path: ':common', configuration: 'namedElements')) { transitive false }
|
||||||
shadowBundle project(path: ':common', configuration: 'transformProductionNeoForge')
|
shadowBundle project(path: ':common', configuration: 'transformProductionNeoForge')
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,66 +0,0 @@
|
||||||
plugins {
|
|
||||||
id 'com.github.johnrengelman.shadow'
|
|
||||||
}
|
|
||||||
|
|
||||||
repositories {
|
|
||||||
maven { url 'https://maven.quiltmc.org/repository/release/' }
|
|
||||||
}
|
|
||||||
|
|
||||||
architectury {
|
|
||||||
platformSetupLoomIde()
|
|
||||||
loader('quilt')
|
|
||||||
}
|
|
||||||
|
|
||||||
configurations {
|
|
||||||
common {
|
|
||||||
canBeResolved = true
|
|
||||||
canBeConsumed = false
|
|
||||||
}
|
|
||||||
compileClasspath.extendsFrom common
|
|
||||||
runtimeClasspath.extendsFrom common
|
|
||||||
developmentQuilt.extendsFrom common
|
|
||||||
|
|
||||||
// Files in this configuration will be bundled into your mod using the Shadow plugin.
|
|
||||||
// Don't use the `shadow` configuration from the plugin itself as it's meant for excluding files.
|
|
||||||
shadowBundle {
|
|
||||||
canBeResolved = true
|
|
||||||
canBeConsumed = false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
dependencies {
|
|
||||||
modImplementation "org.quiltmc:quilt-loader:$rootProject.quilt_loader_version"
|
|
||||||
|
|
||||||
// Quilt Standard Libraries and QSL.
|
|
||||||
modImplementation "org.quiltmc.quilted-fabric-api:quilted-fabric-api:$rootProject.quilted_fabric_api_version"
|
|
||||||
|
|
||||||
// Architectury API. This is optional, and you can comment it out if you don't need it.
|
|
||||||
modImplementation("dev.architectury:architectury-fabric:$rootProject.architectury_api_version") {
|
|
||||||
// We must not pull Fabric Loader and Fabric API from Architectury Fabric.
|
|
||||||
exclude group: 'net.fabricmc'
|
|
||||||
exclude group: 'net.fabricmc.fabric-api'
|
|
||||||
}
|
|
||||||
|
|
||||||
common(project(path: ':common', configuration: 'namedElements')) { transitive false }
|
|
||||||
shadowBundle project(path: ':common', configuration: 'transformProductionQuilt')
|
|
||||||
common(project(path: ':fabric-like', configuration: 'namedElements')) { transitive false }
|
|
||||||
shadowBundle project(path: ':fabric-like', configuration: 'transformProductionQuilt')
|
|
||||||
}
|
|
||||||
|
|
||||||
processResources {
|
|
||||||
inputs.property 'group', project.group
|
|
||||||
inputs.property 'version', project.version
|
|
||||||
|
|
||||||
filesMatching('quilt.mod.json') {
|
|
||||||
expand group: project.group, version: project.version
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
shadowJar {
|
|
||||||
configurations = [project.configurations.shadowBundle]
|
|
||||||
archiveClassifier = 'dev-shadow'
|
|
||||||
}
|
|
||||||
|
|
||||||
remapJar {
|
|
||||||
input.set shadowJar.archiveFile
|
|
||||||
}
|
|
|
@ -1 +0,0 @@
|
||||||
loom.platform = quilt
|
|
|
@ -1,14 +0,0 @@
|
||||||
package dev.newty.projectileding.quilt;
|
|
||||||
|
|
||||||
import org.quiltmc.loader.api.ModContainer;
|
|
||||||
import org.quiltmc.qsl.base.api.entrypoint.ModInitializer;
|
|
||||||
|
|
||||||
import dev.newty.projectileding.fabriclike.ProjectileDingFabricLike;
|
|
||||||
|
|
||||||
public final class ProjectileDingQuilt implements ModInitializer {
|
|
||||||
@Override
|
|
||||||
public void onInitialize(ModContainer mod) {
|
|
||||||
// Run the Fabric-like setup.
|
|
||||||
ProjectileDingFabricLike.init();
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,43 +0,0 @@
|
||||||
{
|
|
||||||
"schema_version": 1,
|
|
||||||
"quilt_loader": {
|
|
||||||
"group": "${group}",
|
|
||||||
"id": "projectileding",
|
|
||||||
"version": "${version}",
|
|
||||||
"metadata": {
|
|
||||||
"name": "ProjectileDing",
|
|
||||||
"description": "This is an example description! Tell everyone what your mod is about!",
|
|
||||||
"contributors": {
|
|
||||||
"Me!": "Author"
|
|
||||||
},
|
|
||||||
"icon": "assets/projectileding/icon.png"
|
|
||||||
},
|
|
||||||
"intermediate_mappings": "net.fabricmc:intermediary",
|
|
||||||
"entrypoints": {
|
|
||||||
"init": [
|
|
||||||
"dev.newty.quilt.ExampleModQuilt"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"depends": [
|
|
||||||
{
|
|
||||||
"id": "quilt_loader",
|
|
||||||
"version": "*"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id": "quilt_base",
|
|
||||||
"version": "*"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id": "minecraft",
|
|
||||||
"version": ">=1.21"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id": "architectury",
|
|
||||||
"version": ">=13.0.2"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"mixin": [
|
|
||||||
"projectileding.mixins.json"
|
|
||||||
]
|
|
||||||
}
|
|
17
readme.md
17
readme.md
|
@ -1,5 +1,20 @@
|
||||||
<div align="center">
|
<div align="center">
|
||||||
<h1>DrinkableXP</h1>
|
<img src="arrow.webp" height="125">
|
||||||
|
<h1>ProjectileDing</h1>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
[![Modrinth Downloads](https://img.shields.io/modrinth/dt/INLXGXFI?style=for-the-badge&logo=modrinth&color=a79aff)](https://modrinth.com/mod/projectile-ding)
|
||||||
|
|
||||||
|
Plays the ENTITY_ARROW_HIT_PLAYER sound effect whenever you hit a living entity with an arrow. You can find a
|
||||||
|
demonstration of the mod in action on YouTube [here](https://www.youtube.com/watch?v=WpB4vh8CIRk).
|
||||||
|
|
||||||
|
### Supported versions of Minecraft
|
||||||
|
|
||||||
|
- 1.21.1
|
||||||
|
|
||||||
|
### Supported mod loaders
|
||||||
|
|
||||||
|
- [Fabric](https://fabricmc.net/)/[Quilt](https://quiltmc.org/en/)
|
||||||
|
- [NeoForge](https://neoforged.net/)
|
||||||
|
|
||||||
<sub>This project is licensed with the Opinionated Queer License v1.2 - you can view it <a href="https://git.newty.dev/amethyst/drinkable-xp/src/branch/main/license.md">here</a>.</sub>
|
<sub>This project is licensed with the Opinionated Queer License v1.2 - you can view it <a href="https://git.newty.dev/amethyst/drinkable-xp/src/branch/main/license.md">here</a>.</sub>
|
|
@ -11,6 +11,4 @@ rootProject.name = 'projectileding'
|
||||||
|
|
||||||
include 'common'
|
include 'common'
|
||||||
include 'fabric'
|
include 'fabric'
|
||||||
include 'fabric-like'
|
|
||||||
include 'neoforge'
|
include 'neoforge'
|
||||||
include 'quilt'
|
|
||||||
|
|
Loading…
Reference in a new issue