Skip to content

Commit

Permalink
Merged 7.0.2 release
Browse files Browse the repository at this point in the history
  • Loading branch information
Majrusz authored Dec 9, 2023
2 parents c6a18df + ea4f0f5 commit 986a637
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 16 deletions.
7 changes: 1 addition & 6 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,6 +1 @@
- fixed game crash `java.lang.NullPointerException: Registry Object not present` (reported by @reboundrefice)
- fixed bug with trying to load folders instead of mods (reported by @SettingDust)
- fixed bug with weather changes not working properly
- fixed compatibility issue with Sodium (reported by @LonelyFear)
- fixed compatibility issue with Epic Fight (reported by @Orphion_)
- fixed compatibility issue with Marium's Soulslike Weaponry (reported by @mariumbacchus)
- fixed compatibility bug with items not dropping at all when Porting Lib is used (reported by @Cornell)
2 changes: 1 addition & 1 deletion common/src/main/java/com/majruszlibrary/math/AnyPos.java
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,6 @@ public Vec3i vec3i() {
}

public BlockPos block() {
return new BlockPos( ( int )this.x, ( int )this.y, ( int )this.z );
return new BlockPos( ( int )Math.floor( this.x ), ( int )Math.floor( this.y ), ( int )Math.floor( this.z ) );
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,11 @@
import net.minecraft.world.level.storage.loot.LootTable;
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.ModifyVariable;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

import java.util.function.Consumer;

@Mixin( LootTable.class )
@Mixin( value = LootTable.class, priority = 990 )
public abstract class MixinLootTable implements IMixinLootTable {
ResourceLocation majruszlibrary$id = null;
Consumer< ItemStack > majruszlibrary$consumer = itemStack->{};
Expand All @@ -27,11 +25,8 @@ public abstract class MixinLootTable implements IMixinLootTable {
this.majruszlibrary$id = id;
}

@Inject(
at = @At( "RETURN" ),
method = "getRandomItemsRaw (Lnet/minecraft/world/level/storage/loot/LootContext;Ljava/util/function/Consumer;)V"
)
private void getRandomItemsRaw( LootContext context, Consumer< ItemStack > consumer, CallbackInfo callback ) {
@Override
public void majruszlibrary$modify( LootContext context ) {
Events.dispatch( new OnLootGenerated( this.majruszlibrary$items, this.majruszlibrary$id, context ) ).generatedLoot.forEach( this.majruszlibrary$consumer );
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package com.majruszlibrary.mixin.fabric;

import com.majruszlibrary.mixininterfaces.fabric.IMixinLootTable;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.storage.loot.LootContext;
import net.minecraft.world.level.storage.loot.LootTable;
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 java.util.function.Consumer;

@Mixin( value = LootTable.class, priority = 1010 )
public abstract class MixinLootTable2 implements IMixinLootTable {
@Inject(
at = @At( "RETURN" ),
method = "getRandomItemsRaw (Lnet/minecraft/world/level/storage/loot/LootContext;Ljava/util/function/Consumer;)V"
)
private void getRandomItemsRaw( LootContext context, Consumer< ItemStack > consumer, CallbackInfo callback ) {
this.majruszlibrary$modify( context ); // compatibility with porting library
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
package com.majruszlibrary.mixininterfaces.fabric;

import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.level.storage.loot.LootContext;

public interface IMixinLootTable {
void majruszlibrary$set( ResourceLocation id );

void majruszlibrary$modify( LootContext context );
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"MixinLivingEntity",
"MixinLootDataType",
"MixinLootTable",
"MixinLootTable2",
"MixinLootTableBuilder",
"MixinPlayer"
],
Expand Down
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.1
mod_version=7.0.2
mod_display_name=Majrusz Library
mod_description=Library with common code for my other modifications.
mod_authors=Majrusz
Expand Down

0 comments on commit 986a637

Please sign in to comment.