generated from FabricMC/fabric-example-mod
-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Signed-off-by: Hendrix-Shen <[email protected]>
- Loading branch information
1 parent
92b6034
commit d696798
Showing
8 changed files
with
55 additions
and
38 deletions.
There are no files selected for viewing
7 changes: 7 additions & 0 deletions
7
src/main/java/com/plusls/MasaGadget/api/fake/AbstractVillagerAccessor.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,7 @@ | ||
package com.plusls.MasaGadget.api.fake; | ||
|
||
import net.minecraft.world.item.trading.MerchantOffers; | ||
|
||
public interface AbstractVillagerAccessor { | ||
MerchantOffers masa_gadget$safeGetOffers(); | ||
} |
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
39 changes: 39 additions & 0 deletions
39
src/main/java/com/plusls/MasaGadget/mixin/MixinAbstractVillager.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,39 @@ | ||
package com.plusls.MasaGadget.mixin; | ||
|
||
import com.plusls.MasaGadget.api.fake.AbstractVillagerAccessor; | ||
import net.minecraft.world.entity.npc.AbstractVillager; | ||
import net.minecraft.world.item.trading.MerchantOffers; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.Shadow; | ||
|
||
//#if MC > 12006 | ||
//$$ import org.jetbrains.annotations.Nullable; | ||
//#endif | ||
|
||
@Mixin(AbstractVillager.class) | ||
public abstract class MixinAbstractVillager implements AbstractVillagerAccessor { | ||
//#if MC > 12006 | ||
//$$ @Shadow | ||
//$$ @Nullable | ||
//$$ protected MerchantOffers offers; | ||
//$$ @Shadow | ||
//$$ protected abstract void updateTrades(); | ||
//#else | ||
@Shadow | ||
public abstract MerchantOffers getOffers(); | ||
//#endif | ||
|
||
@Override | ||
public MerchantOffers masa_gadget$safeGetOffers() { | ||
//#if MC > 12006 | ||
//$$ if (this.offers == null) { | ||
//$$ this.offers = new MerchantOffers(); | ||
//$$ this.updateTrades(); | ||
//$$ } | ||
//$$ | ||
//$$ return this.offers; | ||
//#else | ||
return this.getOffers(); | ||
//#endif | ||
} | ||
} |
8 changes: 0 additions & 8 deletions
8
...ixin/mod_tweak/tweakeroo/inventoryPreviewSupportTradeOfferList/MixinAbstractVillager.java
This file was deleted.
Oops, something went wrong.
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
24 changes: 0 additions & 24 deletions
24
...ixin/mod_tweak/tweakeroo/inventoryPreviewSupportTradeOfferList/MixinAbstractVillager.java
This file was deleted.
Oops, something went wrong.