mirror of
https://github.com/GTMEGA/EndlessIDs.git
synced 2026-11-12 15:27:34 +00:00
Matter Overdrive compat
This commit is contained in:
6 files changed
+105
No files matched your search
@@ -32,6 +32,9 @@ If you notice any problems when opening NEID worlds with EndlessIDs, please open
|
||||
|
||||
This mod also contains patches for the following mods:
|
||||
|
||||
<details>
|
||||
<summary>Mod list</summary>
|
||||
|
||||
- AbyssalCraft
|
||||
- Advanced Rocketry
|
||||
- Alternate Terrain Generation
|
||||
@@ -59,6 +62,7 @@ This mod also contains patches for the following mods:
|
||||
- Highlands
|
||||
- Immersive Cavegen
|
||||
- Industrial Revolution by Redstone Rebooted
|
||||
- Matter Overdrive
|
||||
- More Fun Quicksand Mod
|
||||
- Nature's Compass
|
||||
- Netherlicious
|
||||
@@ -75,6 +79,9 @@ This mod also contains patches for the following mods:
|
||||
- Witchery
|
||||
- WorldEdit
|
||||
|
||||
</details>
|
||||
|
||||
|
||||
Mods not listed here may or may not work.
|
||||
|
||||
- For item/block IDs:
|
||||
|
||||
@@ -121,6 +121,9 @@ dependencies {
|
||||
//LOTR Mod 36.15
|
||||
compileOnly(deobfCurse("lotrmod-423748:4091561"))
|
||||
|
||||
//Matter Overdrive 0.4.2-hotfix1
|
||||
compileOnly(deobfCurse("matteroverdrive-229694:2331162"))
|
||||
|
||||
//More Fun Quicksands Mod 1.0.8.8-fixed
|
||||
compileOnly(deobfCurse("more-fun-quicksand-mod-321960:2717318"))
|
||||
|
||||
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
package com.falsepattern.endlessids.mixin.mixins.common.blockitem.matteroverdrive;
|
||||
|
||||
import com.falsepattern.endlessids.util.DataUtil;
|
||||
import matteroverdrive.data.Inventory;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
@Mixin(Inventory.class)
|
||||
public abstract class InventoryMixin {
|
||||
@Redirect(method = "readFromNBT",
|
||||
at = @At(value = "INVOKE",
|
||||
target = "Lnet/minecraft/nbt/NBTTagCompound;hasKey(Ljava/lang/String;I)Z"),
|
||||
require = 1)
|
||||
private boolean fixHasKey(NBTTagCompound instance, String p_150297_1_, int p_150297_2_) {
|
||||
return DataUtil.nbtHasID(instance);
|
||||
}
|
||||
}
|
||||
+70
@@ -0,0 +1,70 @@
|
||||
package com.falsepattern.endlessids.mixin.mixins.common.blockitem.matteroverdrive;
|
||||
|
||||
import com.falsepattern.endlessids.constants.VanillaConstants;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import matteroverdrive.data.ItemPattern;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Overwrite;
|
||||
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.CallbackInfo;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.common.util.Constants;
|
||||
|
||||
@Mixin(value = ItemPattern.class,
|
||||
remap = false)
|
||||
public abstract class ItemPatternMixin {
|
||||
@Shadow private int itemID;
|
||||
|
||||
@Shadow private int progress;
|
||||
|
||||
@Shadow private int damage;
|
||||
|
||||
@Shadow private int count;
|
||||
|
||||
@Inject(method = "writeToNBT",
|
||||
at = @At("RETURN"),
|
||||
require = 1)
|
||||
private void writeToNBT$writeInt(NBTTagCompound nbtTagCompound, CallbackInfo ci) {
|
||||
int id = this.itemID;
|
||||
if (id > VanillaConstants.maxItemID) {
|
||||
nbtTagCompound.setShort("id", (short) 0);
|
||||
}
|
||||
nbtTagCompound.setInteger("idExt", id);
|
||||
}
|
||||
|
||||
@Inject(method = "readFromNBT",
|
||||
at = @At("RETURN"),
|
||||
require = 1)
|
||||
private void readFromNBT$readInt(NBTTagCompound nbtTagCompound, CallbackInfo ci) {
|
||||
if (nbtTagCompound.hasKey("idExt", Constants.NBT.TAG_INT))
|
||||
this.itemID = nbtTagCompound.getInteger("idExt");
|
||||
}
|
||||
|
||||
/**
|
||||
* @author FalsePattern
|
||||
* @reason Extend IDs
|
||||
*/
|
||||
@Overwrite
|
||||
public void writeToBuffer(ByteBuf byteBuf) {
|
||||
byteBuf.writeInt(this.itemID);
|
||||
byteBuf.writeByte(this.progress);
|
||||
byteBuf.writeShort(this.damage);
|
||||
byteBuf.writeByte(this.count);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author FalsePattern
|
||||
* @reason Extend IDs
|
||||
*/
|
||||
@Overwrite
|
||||
public void readFromBuffer(ByteBuf byteBuf) {
|
||||
this.itemID = byteBuf.readInt();
|
||||
this.progress = byteBuf.readByte();
|
||||
this.damage = byteBuf.readShort();
|
||||
this.count = byteBuf.readByte();
|
||||
}
|
||||
}
|
||||
@@ -186,6 +186,10 @@ public enum Mixin implements IMixin {
|
||||
DragonAPIBlockPropertiesMixin(Side.COMMON, condition(() -> GeneralConfig.extendBlockItem).and(require(TargetedMod.DRAGONAPI)), "blockitem.dragonapi.BlockPropertiesMixin"),
|
||||
DragonAPIBlockItemIDTypeMixin(Side.COMMON, condition(() -> GeneralConfig.extendBlockItem).and(require(TargetedMod.DRAGONAPI)), "blockitem.dragonapi.IDTypeMixin"),
|
||||
//endregion DragonAPI
|
||||
//region Matter Overdrive
|
||||
MOInventoryMixin(Side.COMMON, condition(() -> GeneralConfig.extendBlockItem).and(require(TargetedMod.MATTEROVERDRIVE)), "blockitem.matteroverdrive.InventoryMixin"),
|
||||
MOItemPatternMixin(Side.COMMON, condition(() -> GeneralConfig.extendBlockItem).and(require(TargetedMod.MATTEROVERDRIVE)), "blockitem.matteroverdrive.ItemPatternMixin"),
|
||||
//endregion Matter Overdrive
|
||||
//region MFQM
|
||||
MFQMMixin(Side.COMMON, condition(() -> GeneralConfig.extendBlockItem).and(require(TargetedMod.MFQM)), "blockitem.mfqm.MFQMMixin"),
|
||||
//endregion MFQM
|
||||
|
||||
@@ -37,6 +37,7 @@ public enum TargetedMod implements ITargetedMod {
|
||||
ICG("Immersive Cavegen", false, startsWith("immersivecavegen")),
|
||||
IR3("Industrial Revolution by Redstone Rebooted", false, startsWith("industrialrevolutionbyredstonerebooted-")),
|
||||
LOTR("LOTR Mod", false, startsWith("lotrmod")),
|
||||
MATTEROVERDRIVE("Matter Overdrive", false, startsWith("matteroverdrive-")),
|
||||
MFQM("More Fun Quicksand Mod", false, startsWith("morefunquicksandmod-")),
|
||||
NATURESCOMPASS("Nature's Compass", false, startsWith("naturescompass")),
|
||||
NETHERLICIOUS("Netherlicious", false, startsWith("netherlicious-")),
|
||||
|
||||
Reference in new issue
Block a user