-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a1787a2
commit 3e8f7eb
Showing
8 changed files
with
112 additions
and
3 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
34 changes: 34 additions & 0 deletions
34
src/main/java/de/pilz/mystcraftextras/MystcraftExtrasLateMixins.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,34 @@ | ||
package de.pilz.mystcraftextras; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
import java.util.Set; | ||
|
||
import com.gtnewhorizon.gtnhmixins.ILateMixinLoader; | ||
import com.gtnewhorizon.gtnhmixins.LateMixin; | ||
|
||
@LateMixin | ||
public class MystcraftExtrasLateMixins implements ILateMixinLoader { | ||
|
||
@Override | ||
public String getMixinConfig() { | ||
return "mixins.mystcraftextras.late.json"; | ||
} | ||
|
||
@Override | ||
public List<String> getMixins(Set<String> loadedMods) { | ||
List<String> list = new ArrayList<String>(); | ||
|
||
// Mystcraft | ||
if (loadedMods.contains("Mystcraft")) { | ||
list.add("MixinLinkingAPIDelegate"); | ||
} | ||
|
||
// Tinkers Construct | ||
if (loadedMods.contains("TConstruct")) { | ||
list.add("MixinToolStationLogic"); | ||
} | ||
|
||
return list; | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
src/main/java/de/pilz/mystcraftextras/compat/tc/RenameOnTinkerTable.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,8 @@ | ||
package de.pilz.mystcraftextras.compat.tc; | ||
|
||
public class RenameOnTinkerTable { | ||
|
||
public RenameOnTinkerTable(){ | ||
|
||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
src/main/java/de/pilz/mystcraftextras/configuration/BlocksAndItemsConfig.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 |
---|---|---|
@@ -1,10 +1,17 @@ | ||
package de.pilz.mystcraftextras.configuration; | ||
|
||
import com.gtnewhorizon.gtnhlib.config.Config; | ||
import com.gtnewhorizon.gtnhlib.config.Config.Comment; | ||
import com.gtnewhorizon.gtnhlib.config.Config.DefaultBoolean; | ||
import com.gtnewhorizon.gtnhlib.config.Config.RequiresMcRestart; | ||
|
||
import de.pilz.mystcraftextras.MystcraftExtras; | ||
|
||
@Config(modid = MystcraftExtras.MODID, category = "blocksAndItems") | ||
public class BlocksAndItemsConfig { | ||
|
||
@Comment("Enables some different textured variants of book stands.") | ||
@DefaultBoolean(true) | ||
@RequiresMcRestart | ||
public static boolean enableAdditionalBookStands; | ||
} |
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
41 changes: 41 additions & 0 deletions
41
src/main/java/de/pilz/mystcraftextras/mixins/MixinToolStationLogic.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,41 @@ | ||
package de.pilz.mystcraftextras.mixins; | ||
|
||
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.CallbackInfoReturnable; | ||
|
||
import com.xcompwiz.mystcraft.item.ItemLinkbook; | ||
import com.xcompwiz.mystcraft.linking.LinkOptions; | ||
|
||
import mantle.blocks.abstracts.InventoryLogic; | ||
import net.minecraft.item.ItemStack; | ||
import net.minecraft.nbt.NBTTagCompound; | ||
import tconstruct.tools.logic.ToolStationLogic; | ||
|
||
@Mixin(ToolStationLogic.class) | ||
public abstract class MixinToolStationLogic extends InventoryLogic { | ||
|
||
public MixinToolStationLogic(int invSize) { | ||
super(invSize); | ||
} | ||
|
||
@Inject(method = "canRename(Lnet/minecraft/nbt/NBTTagCompound;Lnet/minecraft/item/ItemStack;)Z", at = @At("RETURN"), cancellable = true, remap = false) | ||
private static void canRename$mystcraftextras$canRenameLinkingBook(NBTTagCompound tags, ItemStack tool, CallbackInfoReturnable<Boolean> callback) { | ||
if (tool != null && tool.getItem() instanceof ItemLinkbook) { | ||
callback.setReturnValue(true); | ||
} | ||
} | ||
|
||
@Inject(method = "tryRenameTool(Lnet/minecraft/item/ItemStack;Ljava/lang/String;)Lnet/minecraft/item/ItemStack;", at = @At("HEAD"), cancellable = true, remap = false) | ||
protected void tryRenameTool$mystcraftextras$renameLinkingBook(ItemStack output, String name, CallbackInfoReturnable<ItemStack> callback) { | ||
var temp = output != null ? output : this.inventory[1].copy(); | ||
|
||
if (temp != null && temp.getItem() instanceof ItemLinkbook && name != null && !name.equals("")) { | ||
LinkOptions.setDisplayName(temp.stackTagCompound, name); | ||
output = temp; | ||
callback.setReturnValue(output); | ||
callback.cancel(); | ||
} | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"required": true, | ||
"minVersion": "0.8.5-GTNH", | ||
"package": "de.pilz.mystcraftextras.mixins", | ||
"refmap": "mixins.mystcraftextras.refmap.json", | ||
"target": "@env(DEFAULT)", | ||
"compatibilityLevel": "JAVA_8", | ||
"mixins": [ | ||
"MixinLinkingAPIDelegate", | ||
"MixinToolStationLogic" | ||
], | ||
"client": [], | ||
"server": [] | ||
} |