generated from tilera/1710mod
fix: research table now dropping extension content
This commit is contained in:
parent
96e611fd13
commit
0b2eed4b7c
|
@ -24,7 +24,7 @@ apply from: './gradle/scripts/mixins.gradle'
|
||||||
sourceCompatibility = JavaVersion.VERSION_1_8
|
sourceCompatibility = JavaVersion.VERSION_1_8
|
||||||
targetCompatibility = JavaVersion.VERSION_1_8
|
targetCompatibility = JavaVersion.VERSION_1_8
|
||||||
|
|
||||||
version = "1.7.2"
|
version = "1.7.3"
|
||||||
group= "dev.tilera"
|
group= "dev.tilera"
|
||||||
archivesBaseName = "auracore"
|
archivesBaseName = "auracore"
|
||||||
|
|
||||||
|
|
|
@ -5,11 +5,14 @@ import org.spongepowered.asm.mixin.Overwrite;
|
||||||
import org.spongepowered.asm.mixin.injection.Inject;
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
import org.spongepowered.asm.mixin.injection.At;
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||||
|
|
||||||
import dev.tilera.auracore.api.research.IResearchTable;
|
import dev.tilera.auracore.api.research.IResearchTable;
|
||||||
import dev.tilera.auracore.api.research.ResearchTableExtension;
|
import dev.tilera.auracore.api.research.ResearchTableExtension;
|
||||||
import dev.tilera.auracore.api.research.ResearchTableExtensionRegistry;
|
import dev.tilera.auracore.api.research.ResearchTableExtensionRegistry;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.inventory.IInventory;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.network.NetworkManager;
|
import net.minecraft.network.NetworkManager;
|
||||||
import net.minecraft.network.Packet;
|
import net.minecraft.network.Packet;
|
||||||
|
@ -132,4 +135,53 @@ public abstract class MixinTileResearchTable extends TileThaumcraft implements I
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Inject(method = "getSizeInventory", at = @At("HEAD"), remap = false)
|
||||||
|
public void onGetInventorySize(CallbackInfoReturnable<Integer> ci) {
|
||||||
|
if (extension instanceof IInventory) {
|
||||||
|
IInventory ext = (IInventory) extension;
|
||||||
|
ci.setReturnValue(2 + ext.getSizeInventory());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Inject(method = "getStackInSlot", at = @At("HEAD"), remap = false)
|
||||||
|
public void onGetStackInSlot(int slot, CallbackInfoReturnable<ItemStack> ci) {
|
||||||
|
if (extension instanceof IInventory && slot >= 2) {
|
||||||
|
IInventory ext = (IInventory) extension;
|
||||||
|
ci.setReturnValue(ext.getStackInSlot(slot - 2));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Inject(method = "getStackInSlotOnClosing", at = @At("HEAD"), remap = false)
|
||||||
|
public void onGetStackInSlotOnClosing(int slot, CallbackInfoReturnable<ItemStack> ci) {
|
||||||
|
if (extension instanceof IInventory && slot >= 2) {
|
||||||
|
IInventory ext = (IInventory) extension;
|
||||||
|
ci.setReturnValue(ext.getStackInSlotOnClosing(slot - 2));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Inject(method = "decrStackSize", at = @At("HEAD"), remap = false)
|
||||||
|
public void onDecrStackSize(int slot, int amt, CallbackInfoReturnable<ItemStack> ci) {
|
||||||
|
if (extension instanceof IInventory && slot >= 2) {
|
||||||
|
IInventory ext = (IInventory) extension;
|
||||||
|
ci.setReturnValue(ext.decrStackSize(slot - 2, amt));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Inject(method = "setInventorySlotContents", at = @At("HEAD"), remap = false)
|
||||||
|
public void onSetSlotContents(int slot, ItemStack stack, CallbackInfo ci) {
|
||||||
|
if (extension instanceof IInventory && slot >= 2) {
|
||||||
|
IInventory ext = (IInventory) extension;
|
||||||
|
ext.setInventorySlotContents(slot - 2, stack);
|
||||||
|
ci.cancel();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Inject(method = "isItemValidForSlot", at = @At("HEAD"), remap = false)
|
||||||
|
public void onIsItemValid(int slot, ItemStack stack, CallbackInfoReturnable<Boolean> ci) {
|
||||||
|
if (extension instanceof IInventory) {
|
||||||
|
IInventory ext = (IInventory) extension;
|
||||||
|
ci.setReturnValue(ext.isItemValidForSlot(slot - 2, stack));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue