Skip to content

Commit

Permalink
Add compat to electricity/fluid slots
Browse files Browse the repository at this point in the history
  • Loading branch information
glowredman committed May 29, 2023
1 parent 04bcd0d commit 3a94161
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
import net.minecraft.inventory.IInventory;
import net.minecraft.tileentity.TileEntity;

import micdoodle8.mods.galacticraft.core.energy.item.ItemElectricBase;
import micdoodle8.mods.galacticraft.api.item.IItemElectric;
import micdoodle8.mods.galacticraft.core.inventory.SlotSpecific;

public class ContainerArtificalGravity extends ContainerWithPlayerInventory {

public ContainerArtificalGravity(final InventoryPlayer playerInv, final IInventory tile) {
super(tile);
this.addSlotToContainer(new SlotSpecific(tile, 0, 152, 132, ItemElectricBase.class));
this.addSlotToContainer(new SlotSpecific(tile, 0, 152, 132, IItemElectric.class));
this.initPlayerInventorySlots(playerInv, 35);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
import net.minecraft.entity.player.InventoryPlayer;

import de.katzenpapst.amunra.tile.TileEntityIsotopeGenerator;
import micdoodle8.mods.galacticraft.core.energy.item.ItemElectricBase;
import micdoodle8.mods.galacticraft.api.item.IItemElectric;
import micdoodle8.mods.galacticraft.core.inventory.SlotSpecific;

public class ContainerAtomBattery extends ContainerWithPlayerInventory {

public ContainerAtomBattery(final InventoryPlayer par1InventoryPlayer, final TileEntityIsotopeGenerator solarGen) {
super(solarGen);
this.addSlotToContainer(new SlotSpecific(solarGen, 0, 152, 83, ItemElectricBase.class));
this.addSlotToContainer(new SlotSpecific(solarGen, 0, 152, 83, IItemElectric.class));
this.initPlayerInventorySlots(par1InventoryPlayer);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@
import net.minecraft.item.ItemStack;

import de.katzenpapst.amunra.tile.TileEntityHydroponics;
import micdoodle8.mods.galacticraft.core.energy.item.ItemElectricBase;
import micdoodle8.mods.galacticraft.api.item.IItemElectric;
import micdoodle8.mods.galacticraft.core.inventory.SlotSpecific;

public class ContainerHydroponics extends ContainerWithPlayerInventory {

public ContainerHydroponics(final InventoryPlayer player, final TileEntityHydroponics tile) {
super(tile);

this.addSlotToContainer(new SlotSpecific(tile, 0, 32, 27, ItemElectricBase.class));
this.addSlotToContainer(new SlotSpecific(tile, 0, 32, 27, IItemElectric.class));

final SlotSpecific secondarySlot = new SlotSpecific(
tile,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import net.minecraft.entity.player.InventoryPlayer;

import de.katzenpapst.amunra.tile.TileEntityMothershipEngineAbstract;
import micdoodle8.mods.galacticraft.core.energy.item.ItemElectricBase;
import micdoodle8.mods.galacticraft.api.item.IItemElectric;
import micdoodle8.mods.galacticraft.core.inventory.SlotSpecific;

public class ContainerIonEngine extends ContainerRocketEngine {
Expand All @@ -16,7 +16,7 @@ public ContainerIonEngine(final InventoryPlayer par1InventoryPlayer,
@Override
protected void initSlots(final TileEntityMothershipEngineAbstract tile) {
super.initSlots(tile);
this.addSlotToContainer(new SlotSpecific(tile, 1, 152, 86, ItemElectricBase.class));
this.addSlotToContainer(new SlotSpecific(tile, 1, 152, 86, IItemElectric.class));
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,14 @@

import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Slot;
import net.minecraft.item.Item;
import net.minecraft.item.ItemBucket;
import net.minecraftforge.fluids.ItemFluidContainer;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.FluidContainerRegistry;
import net.minecraftforge.fluids.IFluidContainerItem;

import de.katzenpapst.amunra.tile.TileEntityMothershipEngineAbstract;
import micdoodle8.mods.galacticraft.core.inventory.SlotSpecific;

public class ContainerRocketEngine extends ContainerWithPlayerInventory {

Expand All @@ -26,7 +29,15 @@ public ContainerRocketEngine(final InventoryPlayer par1InventoryPlayer,
}

protected void initSlots(final TileEntityMothershipEngineAbstract tile) {
this.addSlotToContainer(new SlotSpecific(tile, 0, 8, 7, ItemFluidContainer.class, ItemBucket.class));
this.addSlotToContainer(new Slot(tile, 0, 8, 7) {

@Override
public boolean isItemValid(ItemStack stack) {
final Item item = stack.getItem();
return item instanceof IFluidContainerItem || item instanceof ItemBucket
|| FluidContainerRegistry.isContainer(stack);
}
});
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,6 @@ protected void initPlayerInventorySlots(final InventoryPlayer player, final int
}
}

// let's try to fix shiftclicking
@Override
protected Slot addSlotToContainer(Slot p_75146_1_) {
return super.addSlotToContainer(p_75146_1_);
}

protected boolean mergeSingleSlot(final ItemStack mergeFrom, final Slot slotToMergeTo) {

final ItemStack targetStack = slotToMergeTo.getStack();
Expand Down

0 comments on commit 3a94161

Please sign in to comment.