Skip to content
Open
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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,5 @@ run

# Files from Forge MDK
forge*changelog.txt
/src/generated/resources/.cache/
/run-data/
30 changes: 18 additions & 12 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ buildscript {
}
dependencies {
classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '5.1.+', changing: true
classpath group: 'org.spongepowered', name: 'mixingradle', version: '0.7-SNAPSHOT'
classpath group: 'org.spongepowered', name: 'mixingradle', version: '0.7+'
}
}
apply plugin: 'net.minecraftforge.gradle'
Expand All @@ -30,15 +30,15 @@ minecraft {
runs {
client {
workingDirectory project.file('run')

// properties 'mixin.env.disableRefMap': 'true'

// Recommended logging data for a userdev environment
property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'

// Recommended logging level for the console
property 'forge.logging.console.level', 'debug'

property 'mixin.env.remapRefMap', 'true'
property 'mixin.env.refMapRemappingFile', "${projectDir}/build/createSrgToMcp/output.srg"

Expand All @@ -51,15 +51,15 @@ minecraft {

server {
workingDirectory project.file('run')

// properties 'mixin.env.disableRefMap': 'true'

// Recommended logging data for a userdev environment
property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'

// Recommended logging level for the console
property 'forge.logging.console.level', 'debug'

property 'mixin.env.remapRefMap', 'true'
property 'mixin.env.refMapRemappingFile', "${projectDir}/build/createSrgToMcp/output.srg"

Expand All @@ -72,7 +72,7 @@ minecraft {

data {
workingDirectory project.file('run')

// properties 'mixin.env.disableRefMap': 'true'

// Recommended logging data for a userdev environment
Expand Down Expand Up @@ -116,16 +116,22 @@ dependencies {
// Specify the version of Minecraft to use, If this is any group other then 'net.minecraft' it is assumed
// that the dep is a ForgeGradle 'patcher' dependency. And it's patches will be applied.
// The userdev artifact is a special name and will get all sorts of transformations applied to it.
minecraft 'net.minecraftforge:forge:1.18.2-40.1.51'

minecraft 'net.minecraftforge:forge:1.18.2-40.2.4'

annotationProcessor "org.spongepowered:mixin:${mixin_version}:processor"
implementation(annotationProcessor("io.github.llamalad7:mixinextras-common:${mixin_extras}"))
implementation(jarJar("io.github.llamalad7:mixinextras-forge:${mixin_extras}")) {
jarJar.ranged(it, "[${mixin_extras},)")
}

// compileOnly fg.deobf("mezz.jei:jei-${minecraft_version}:${jei_version}:api")
// runtimeOnly fg.deobf("mezz.jei:jei-${minecraft_version}:${jei_version}")



compileOnly fg.deobf("mezz.jei:jei-1.18.2:9.5.5.174:api")
runtimeOnly fg.deobf("mezz.jei:jei-1.18.2:9.5.5.174")

compileOnly fg.deobf("vazkii.patchouli:Patchouli:${patchouli_version}:api")
runtimeOnly fg.deobf("vazkii.patchouli:Patchouli:${patchouli_version}")

Expand Down
2 changes: 2 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ org.gradle.daemon=false
minecraft_version=1.16.5

#Mod dependencies
mixin_version=0.8.5
mixin_extras=0.2.0
jei_version=7.6.0.49
curios_version=1.18.2-5.0.7.1
patchouli_version=1.18.2-71.1
17 changes: 17 additions & 0 deletions src/main/java/wayoftime/bloodmagic/mixin/client/MixinEntity.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package wayoftime.bloodmagic.mixin.client;

import net.minecraft.world.entity.Entity;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;


@Mixin(Entity.class)
public class MixinEntity
{

@Shadow
public double distanceToSqr(Entity p_20281_)
{
throw new IllegalStateException("Failed to shadow distanceToSqr()");
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package wayoftime.bloodmagic.mixin.client;

import com.llamalad7.mixinextras.injector.ModifyReturnValue;
import net.minecraft.client.Minecraft;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.player.Player;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import wayoftime.bloodmagic.potion.BloodMagicPotions;

@Mixin(LivingEntity.class)
public abstract class MixinLivingEntity extends MixinEntity
{
@ModifyReturnValue(
method = "isCurrentlyGlowing",
at = @At(value = "RETURN")
)
public boolean isCurrentlyGlowing(boolean original){
Player player = Minecraft.getInstance().player;

if(player != null && player.hasEffect(BloodMagicPotions.SPECTRAL_SIGHT))
{
double distance = (player.getEffect(BloodMagicPotions.SPECTRAL_SIGHT).getAmplifier() * 32 + 24);
if (distanceToSqr(Minecraft.getInstance().player) <= (distance * distance))
{
return true;
}
}
return original;
}



}
4 changes: 3 additions & 1 deletion src/main/resources/bloodmagic.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@
"required": true,
"minVersion": "0.8",
"package": "wayoftime.bloodmagic.mixin",
"compatibilityLevel": "JAVA_8",
"compatibilityLevel": "JAVA_17",
"mixins": [
],
"client": [
"client.MixinEntity",
"client.MixinLivingEntity"
],
"injectors": {
"defaultRequire": 1
Expand Down