Skip to content

Commit

Permalink
Debug mixins :(
Browse files Browse the repository at this point in the history
  • Loading branch information
SammySemicolon committed Dec 5, 2024
1 parent e3c613a commit 6ce5b12
Show file tree
Hide file tree
Showing 7 changed files with 109 additions and 3 deletions.
37 changes: 36 additions & 1 deletion src/main/java/com/sammy/malum/MalumMod.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,21 @@
import com.sammy.malum.compability.tetra.*;
import com.sammy.malum.config.*;
import com.sammy.malum.registry.common.item.tabs.*;
import net.minecraft.core.Holder;
import net.minecraft.core.HolderOwner;
import net.minecraft.core.Registry;
import net.minecraft.resources.*;
import net.minecraft.tags.TagKey;
import net.minecraft.util.*;
import net.neoforged.bus.api.IEventBus;
import net.neoforged.fml.ModLoadingContext;
import net.neoforged.fml.common.Mod;
import net.neoforged.fml.config.ModConfig;
import org.apache.logging.log4j.*;
import org.spongepowered.asm.mixin.Unique;

import java.util.List;
import java.util.Map;

import static com.sammy.malum.registry.client.ParticleRegistry.*;
import static com.sammy.malum.registry.common.AttributeRegistry.*;
Expand Down Expand Up @@ -72,4 +80,31 @@ public static ResourceLocation malumPath(String path) {
}


}
public static void asdas(Map<TagKey<?>, List<Holder<?>>> tagMap) {
System.out.print("SAFHSA");
}

public static void aahhhh(ResourceKey<? extends Registry<?>> registry, ResourceLocation location, TagKey<?> returnValue) {
if (registry == null) {
System.out.println("AAH");
}
if (location == null) {
System.out.println("AAH");
}
if (returnValue == null) {
System.out.println("AAH");
}
}

public static void innfsdjh(HolderOwner owner, TagKey key) {
if (key == null) {
System.out.print("AHFSD");
}
}
public static void innfddddsdjh(TagKey key) {
float f = 0;
if (key == null) {
System.out.print("AHFSD");
}
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.sammy.malum.common.item.curiosities.curios.sets.soulward;
package com.sammy.malum.common.item.curiosities.curios.sets.soulward;

import com.google.common.collect.Multimap;
import com.sammy.malum.MalumMod;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public static void shieldPlayer(LivingDamageEvent.Pre event) {
}
if (event.getEntity() instanceof Player player) {
var handler = MalumPlayerDataCapability.getCapability(player).soulWardHandler;
handler.addCooldown(player, 4);
handler.addCooldown(player, 4f);
if (!handler.isDepleted()) {
var source = event.getSource();
float amount = event.getOriginalDamage();
Expand Down
19 changes: 19 additions & 0 deletions src/main/java/com/sammy/malum/mixin/HolderSetNamedMixin.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package com.sammy.malum.mixin;

import com.sammy.malum.MalumMod;
import net.minecraft.core.HolderOwner;
import net.minecraft.core.HolderSet;
import net.minecraft.tags.TagKey;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

@Mixin(HolderSet.Named.class)
public class HolderSetNamedMixin {

@Inject(method = "<init>", at = @At("TAIL"))
private void innfsdjh(HolderOwner owner, TagKey key, CallbackInfo ci) {
MalumMod.innfsdjh(owner, key);
}
}
28 changes: 28 additions & 0 deletions src/main/java/com/sammy/malum/mixin/MappedRegistryMixin.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package com.sammy.malum.mixin;

import com.sammy.malum.MalumMod;
import net.minecraft.core.Holder;
import net.minecraft.core.HolderSet;
import net.minecraft.core.MappedRegistry;
import net.minecraft.tags.TagKey;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;

import java.util.List;
import java.util.Map;

@Mixin(MappedRegistry.class)
public class MappedRegistryMixin {

@Inject(method = "bindTags", at = @At("HEAD"))
private void gsdg(Map<TagKey<?>, List<Holder<?>>> tagMap, CallbackInfo ci) {

}
@Inject(method = "createTag", at = @At("HEAD"))
private void gsdgdd(TagKey<?> key, CallbackInfoReturnable<HolderSet.Named<?>> cir) {
MalumMod.innfddddsdjh(key);
}
}
21 changes: 21 additions & 0 deletions src/main/java/com/sammy/malum/mixin/TagKeyMixin.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package com.sammy.malum.mixin;

import com.sammy.malum.MalumMod;
import net.minecraft.core.Registry;
import net.minecraft.resources.ResourceKey;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.tags.TagKey;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;

@Mixin(TagKey.class)
public class TagKeyMixin {
@Inject(method = "create", at = @At("RETURN"))
private static void aaa(ResourceKey<? extends Registry<?>> registry, ResourceLocation location, CallbackInfoReturnable<TagKey<?>> cir) {
TagKey<?> returnValue = cir.getReturnValue();
MalumMod.aahhhh(registry, location, returnValue);
}

}
3 changes: 3 additions & 0 deletions src/main/resources/malum.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,11 @@
"ExplosionMixin",
"FeatureFlagSetMixin",
"FishingHookEntityMixin",
"HolderSetNamedMixin",
"ItemStackMixin",
"MappedRegistryMixin",
"PlayerMixin",
"TagKeyMixin",
"VanillaRecipeProviderMixin",
"VanillaRecipeProviderMixin$RecipeBuilderMixin",
"AccessorEvent.PostDamage"
Expand Down

0 comments on commit 6ce5b12

Please sign in to comment.