Skip to content

Commit

Permalink
Merged 7.0.4 release
Browse files Browse the repository at this point in the history
  • Loading branch information
Majrusz authored Jan 27, 2024
2 parents 87cd8ae + 632dd0f commit 75e8e7a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 25 deletions.
4 changes: 1 addition & 3 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
- added extra debug logs disabled by default that can be enabled via configuration file
- made configuration files continue loading after encountering invalid data
- fixed game crash when items had unsupported NBT format (reported by @bons66)
- fixed compatibility crash with Chrysalis (reported by @Paxx3, @ZacGames)
Original file line number Diff line number Diff line change
Expand Up @@ -4,37 +4,21 @@
import com.majruszlibrary.events.base.Events;
import net.minecraft.world.entity.monster.EnderMan;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
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.Redirect;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;

@Mixin( EnderMan.class )
public abstract class MixinEnderMan {
private Player majruszlibrary$lastPlayer = null;

@Inject(
at = @At( "HEAD" ),
at = @At( "RETURN" ),
cancellable = true,
method = "isLookingAtMe (Lnet/minecraft/world/entity/player/Player;)Z"
)
private void isLookingAtMe( Player player, CallbackInfoReturnable< Boolean > callback ) {
this.majruszlibrary$lastPlayer = player;
}

@Redirect(
at = @At(
target = "Lnet/minecraft/world/item/ItemStack;is (Lnet/minecraft/world/item/Item;)Z",
value = "INVOKE"
),
method = "isLookingAtMe (Lnet/minecraft/world/entity/player/Player;)Z"
)
private boolean is( ItemStack itemStack, Item item ) {
EnderMan enderMan = ( EnderMan )( Object )this;

return itemStack.is( item )
|| Events.dispatch( new OnEnderManAngered( enderMan, this.majruszlibrary$lastPlayer ) ).isAngerCancelled();
if( callback.getReturnValue() && Events.dispatch( new OnEnderManAngered( ( EnderMan )( Object )this, player ) ).isAngerCancelled() ) {
callback.setReturnValue( false );
}
}
}
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ minecraft_version=1.20.1
# Mod
mod_id=majruszlibrary
mod_archives_name=majrusz-library
mod_version=7.0.3
mod_version=7.0.4
mod_display_name=Majrusz Library
mod_description=Library with common code for my other modifications.
mod_authors=Majrusz
Expand Down

0 comments on commit 75e8e7a

Please sign in to comment.