Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,18 @@ repositories {
}

maven { url = "https://mvn.devos.one/snapshots/" }

exclusiveContent {
forRepository {
maven {
name = "Modrinth"
url = "https://api.modrinth.com/maven"
}
}
filter {
includeGroup "maven.modrinth"
}
}
}

fabricApi {
Expand All @@ -52,6 +64,7 @@ dependencies {
modImplementation("dev.emi:trinkets:${project.trinkets_version}")
modImplementation("foundry.veil:veil-fabric-${project.minecraft_version}:${project.veil_version}") { exclude group: "maven.modrinth" }
// modImplementation(include("com.tterrag.registrate_fabric:Registrate:${project.registrate_version}"))
modRuntimeOnly(modCompileOnly("maven.modrinth:marksman:${project.marksman_version}"))
}

processResources {
Expand Down Expand Up @@ -98,4 +111,4 @@ publishing {
// The repositories here will be used for publishing your artifact, not for
// retrieving dependencies.
}
}
}
5 changes: 3 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ org.gradle.parallel=true
# check these on https://fabricmc.net/develop
minecraft_version=1.21.1
yarn_mappings=1.21.1+build.3
loader_version=0.16.9
loader_version=0.16.10

# Mod Properties
mod_version=1.0.0
Expand All @@ -17,4 +17,5 @@ archives_base_name=clean_cut
fabric_version=0.110.0+1.21.1
veil_version=1.0.0.6
trinkets_version=3.10.0
#registrate_version=1.3.0
#registrate_version=1.3.0
marksman_version=1.2.0
49 changes: 49 additions & 0 deletions src/main/java/net/dustley/clean_cut/CleanCutMixinConfigPlugin.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
package net.dustley.clean_cut;

import net.fabricmc.loader.api.FabricLoader;
import org.objectweb.asm.tree.ClassNode;
import org.spongepowered.asm.mixin.extensibility.IMixinConfigPlugin;
import org.spongepowered.asm.mixin.extensibility.IMixinInfo;

import java.util.List;
import java.util.Set;

public class CleanCutMixinConfigPlugin implements IMixinConfigPlugin {
@Override
public void onLoad(String mixinPackage) {

}

@Override
public String getRefMapperConfig() {
return null;
}

@Override
public boolean shouldApplyMixin(String targetClassName, String mixinClassName) {
// If more compat is added this should be replaced with a switch statement
if (mixinClassName.equals("net.dustley.clean_cut.mixin.MarksmanCleaverProjectileEntityMixin"))
return FabricLoader.getInstance().isModLoaded("marksman");
return true;
}

@Override
public void acceptTargets(Set<String> myTargets, Set<String> otherTargets) {

}

@Override
public List<String> getMixins() {
return null;
}

@Override
public void preApply(String targetClassName, ClassNode targetClass, String mixinClassName, IMixinInfo mixinInfo) {

}

@Override
public void postApply(String targetClassName, ClassNode targetClass, String mixinClassName, IMixinInfo mixinInfo) {

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package net.dustley.clean_cut.mixin;

import archives.tater.marksman.Marksman;
import archives.tater.marksman.Ricoshottable;
import net.dustley.clean_cut.entity.cleaver.CleaverProjectileEntity;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.ProjectileDeflection;
import net.minecraft.entity.projectile.PersistentProjectileEntity;
import net.minecraft.entity.projectile.ProjectileEntity;
import net.minecraft.world.World;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Unique;

@Mixin(CleaverProjectileEntity.class)
public abstract class MarksmanCleaverProjectileEntityMixin extends PersistentProjectileEntity implements Ricoshottable {
@Unique
private boolean marksman$ricoshotted = false;

protected MarksmanCleaverProjectileEntityMixin(EntityType<? extends PersistentProjectileEntity> entityType, World world) {
super(entityType, world);
}

@Override
public ProjectileDeflection getProjectileDeflection(ProjectileEntity projectile) {
return marksman$canBeRicoshotted() ? Marksman.AIM_AT_TARGET : super.getProjectileDeflection(projectile);
}

@Override
public boolean marksman$canBeRicoshotted() {
return !marksman$ricoshotted && age > 6 && !isOnGround();
}

@Override
public void marksman$setRicoshotted() {
marksman$ricoshotted = true;
}
}
7 changes: 5 additions & 2 deletions src/main/resources/clean_cut.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,15 @@
"required": true,
"package": "net.dustley.clean_cut.mixin",
"compatibilityLevel": "JAVA_21",
"mixins": [ ],
"mixins": [
"MarksmanCleaverProjectileEntityMixin"
],
"plugin": "net.dustley.clean_cut.CleanCutMixinConfigPlugin",
"injectors": {
"defaultRequire": 1
},
"client": [
"client.ItemRendererMixin",
"client.ModelLoaderMixin"
]
}
}