Skip to content

Commit

Permalink
Fix anvil crushing
Browse files Browse the repository at this point in the history
  • Loading branch information
Electro593 committed Nov 25, 2023
1 parent eaf67fc commit a0045b2
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package de.dafuqs.spectrum.mixin;

import java.util.function.Predicate;

import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.ModifyVariable;

import net.minecraft.entity.Entity;
import net.minecraft.entity.FallingBlockEntity;
import net.minecraft.entity.ItemEntity;

@Mixin(FallingBlockEntity.class)
public class FallingBlockEntityMixin {

@ModifyVariable(method = "handleFallDamage(FFLnet/minecraft/entity/damage/DamageSource;)Z", at = @At(value = "STORE"), ordinal = 0, index = 1, name = "predicate")
public Predicate<Entity> addItemEntityPredicate(Predicate<Entity> predicate) {
return predicate.or(entity -> entity instanceof ItemEntity);
}

}
3 changes: 2 additions & 1 deletion src/main/resources/spectrum.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"EntityMixin",
"EntityTypeMixin",
"ExplosionMixin",
"FallingBlockEntityMixin",
"FarmlandBlockMixin",
"FirstStrikeEnchantmentMixin",
"FishingHookPredicateMixin",
Expand Down Expand Up @@ -109,4 +110,4 @@
"injectors": {
"defaultRequire": 1
}
}
}

0 comments on commit a0045b2

Please sign in to comment.