-
-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'architectury-1.17.1' into architectury-1.18.1
- Loading branch information
Showing
5 changed files
with
56 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
forge/src/main/java/com/unlikepaladin/pfm/mixin/forge/PFMItemEntryAccessor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package com.unlikepaladin.pfm.mixin.forge; | ||
|
||
import net.minecraft.item.Item; | ||
import net.minecraft.loot.entry.ItemEntry; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.gen.Accessor; | ||
|
||
@Mixin(ItemEntry.class) | ||
public interface PFMItemEntryAccessor { | ||
@Accessor("item") | ||
Item getItem(); | ||
} |
32 changes: 32 additions & 0 deletions
32
forge/src/main/java/com/unlikepaladin/pfm/mixin/forge/PFMLootPool$BuilderMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package com.unlikepaladin.pfm.mixin.forge; | ||
|
||
import com.unlikepaladin.pfm.runtime.PFMGenerator; | ||
import net.minecraft.loot.LootPool; | ||
import net.minecraft.loot.LootTable; | ||
import net.minecraft.loot.entry.ItemEntry; | ||
import net.minecraft.loot.entry.LootPoolEntry; | ||
import net.minecraft.loot.entry.LootPoolEntryTypes; | ||
import net.minecraftforge.registries.ForgeRegistries; | ||
import org.spongepowered.asm.mixin.Final; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.Shadow; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Inject; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; | ||
|
||
import java.util.List; | ||
|
||
@Mixin(LootPool.Builder.class) | ||
public abstract class PFMLootPool$BuilderMixin { | ||
@Shadow @Final private List<LootPoolEntry> entries; | ||
|
||
@Shadow public abstract LootPool.Builder name(String name); | ||
|
||
@Inject(method = "build", at = @At("HEAD")) | ||
private void setPFMName(CallbackInfoReturnable<LootTable> cir) { | ||
if ( PFMGenerator.isDataRunning() && !entries.isEmpty() && entries.get(0).getType().equals(LootPoolEntryTypes.ITEM)) { | ||
PFMItemEntryAccessor entry = (PFMItemEntryAccessor) entries.get(0); | ||
name(ForgeRegistries.ITEMS.getKey(entry.getItem()).getPath()); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters