-
Notifications
You must be signed in to change notification settings - Fork 3
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
b8e0fa0
commit 93f08bd
Showing
9 changed files
with
221 additions
and
5 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
64 changes: 64 additions & 0 deletions
64
src/main/java/sunsetsatellite/signalindustries/containers/ContainerBackpack.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,64 @@ | ||
package sunsetsatellite.signalindustries.containers; | ||
|
||
import net.minecraft.core.entity.player.EntityPlayer; | ||
import net.minecraft.core.item.ItemStack; | ||
import net.minecraft.core.player.inventory.IInventory; | ||
import net.minecraft.core.player.inventory.InventoryPlayer; | ||
import net.minecraft.core.player.inventory.slot.Slot; | ||
import sunsetsatellite.catalyst.fluids.impl.ContainerItemFluid; | ||
import sunsetsatellite.catalyst.fluids.impl.ItemInventoryFluid; | ||
import sunsetsatellite.catalyst.fluids.util.FluidStack; | ||
import sunsetsatellite.catalyst.fluids.util.SlotFluid; | ||
import sunsetsatellite.signalindustries.inventories.item.InventoryBackpack; | ||
import sunsetsatellite.signalindustries.inventories.item.InventoryPulsar; | ||
import sunsetsatellite.signalindustries.items.ItemPulsar; | ||
import sunsetsatellite.signalindustries.items.attachments.ItemBackpackAttachment; | ||
import sunsetsatellite.signalindustries.util.NBTHelper; | ||
import sunsetsatellite.signalindustries.util.SlotBackpack; | ||
|
||
public class ContainerBackpack extends ContainerItemFluid { | ||
ItemStack backpack; | ||
|
||
public ContainerBackpack(InventoryPlayer inventoryPlayer, ItemStack backpack){ | ||
super(inventoryPlayer,new InventoryBackpack(backpack)); | ||
this.backpack = backpack; | ||
|
||
if(backpack.getItem() instanceof ItemBackpackAttachment){ | ||
NBTHelper.loadInvFromNBT(backpack,inv,27*2,4); | ||
} | ||
|
||
for (int y = 0; y < 4; y++) { | ||
addFluidSlot(new SlotFluid(inv,y,174,36 + 18 * y)); | ||
} | ||
|
||
int numberOfRows = (27 * 2) / 9; | ||
int i = (numberOfRows - 4) * 18; | ||
for (int j = 0; j < numberOfRows; j++) { | ||
for (int i1 = 0; i1 < 9; i1++) { | ||
addSlot(new SlotBackpack(inv, i1 + j * 9, 8 + i1 * 18, 18 + j * 18)); | ||
} | ||
|
||
} | ||
|
||
for (int k = 0; k < 3; k++) { | ||
for (int j1 = 0; j1 < 9; j1++) { | ||
addSlot(new Slot(inventoryPlayer, j1 + k * 9 + 9, 8 + j1 * 18, 103 + k * 18 + i)); | ||
} | ||
|
||
} | ||
|
||
for (int l = 0; l < 9; l++) { | ||
addSlot(new Slot(inventoryPlayer, l, 8 + l * 18, 161 + i)); | ||
} | ||
} | ||
|
||
@Override | ||
public FluidStack clickFluidSlot(int slotID, int button, boolean shift, boolean control, EntityPlayer entityplayer) { | ||
return super.clickFluidSlot(slotID, button, shift, control, entityplayer); | ||
} | ||
|
||
@Override | ||
public boolean isUsableByPlayer(EntityPlayer entityPlayer) { | ||
return true; | ||
} | ||
} |
51 changes: 51 additions & 0 deletions
51
src/main/java/sunsetsatellite/signalindustries/gui/GuiBackpack.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,51 @@ | ||
package sunsetsatellite.signalindustries.gui; | ||
|
||
|
||
import net.minecraft.core.entity.player.EntityPlayer; | ||
import net.minecraft.core.item.ItemStack; | ||
import net.minecraft.core.player.inventory.InventoryPlayer; | ||
import org.lwjgl.opengl.GL11; | ||
import sunsetsatellite.catalyst.fluids.impl.GuiItemFluid; | ||
import sunsetsatellite.signalindustries.containers.ContainerBackpack; | ||
import sunsetsatellite.signalindustries.containers.ContainerPulsar; | ||
import sunsetsatellite.signalindustries.items.ItemPulsar; | ||
import sunsetsatellite.signalindustries.items.attachments.ItemBackpackAttachment; | ||
import sunsetsatellite.signalindustries.util.NBTHelper; | ||
|
||
public class GuiBackpack extends GuiItemFluid { | ||
|
||
ItemStack backpack; | ||
EntityPlayer player; | ||
public GuiBackpack(InventoryPlayer inventoryPlayer, ItemStack backpack) { | ||
super(new ContainerBackpack(inventoryPlayer,backpack),inventoryPlayer); | ||
this.backpack = backpack; | ||
this.player = inventoryPlayer.player; | ||
ySize = 223; | ||
xSize = 198; | ||
} | ||
|
||
protected void drawGuiContainerBackgroundLayer(float f) | ||
{ | ||
int i = mc.renderEngine.getTexture("assets/signalindustries/gui/reinforced_backpack.png"); | ||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); | ||
mc.renderEngine.bindTexture(i); | ||
int j = (width - xSize) / 2; | ||
int k = (height - ySize) / 2; | ||
drawTexturedModalRect(j, k, 0, 0, xSize, ySize); | ||
|
||
} | ||
|
||
protected void drawGuiContainerForegroundLayer() | ||
{ | ||
super.drawGuiContainerForegroundLayer(); | ||
fontRenderer.drawCenteredString("Reinforced Backpack", 90, 6, 0xFFCC0000); | ||
} | ||
|
||
@Override | ||
public void onClosed() { | ||
if(backpack.getItem() instanceof ItemBackpackAttachment){ | ||
NBTHelper.saveInvToNBT(backpack,((ContainerBackpack)inventorySlots).inv); | ||
} | ||
} | ||
|
||
} |
41 changes: 41 additions & 0 deletions
41
src/main/java/sunsetsatellite/signalindustries/inventories/item/InventoryBackpack.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 sunsetsatellite.signalindustries.inventories.item; | ||
|
||
import net.minecraft.core.block.BlockFluid; | ||
import net.minecraft.core.item.ItemStack; | ||
import sunsetsatellite.catalyst.CatalystFluids; | ||
import sunsetsatellite.catalyst.fluids.impl.ItemInventoryFluid; | ||
import sunsetsatellite.catalyst.fluids.util.FluidStack; | ||
import sunsetsatellite.signalindustries.SignalIndustries; | ||
|
||
import java.util.ArrayList; | ||
import java.util.Arrays; | ||
|
||
|
||
public class InventoryBackpack extends ItemInventoryFluid { | ||
|
||
private final ItemStack backpack; | ||
|
||
public InventoryBackpack(ItemStack backpack) { | ||
super(backpack); | ||
this.backpack = backpack; | ||
contents = new ItemStack[27 * 2]; | ||
fluidContents = new FluidStack[4]; | ||
fluidCapacity = new int[4]; | ||
Arrays.fill(fluidCapacity,4000); | ||
acceptedFluids.clear(); | ||
for (FluidStack ignored : fluidContents) { | ||
acceptedFluids.add(new ArrayList<>()); | ||
} | ||
for (BlockFluid fluid : CatalystFluids.FLUIDS.getAllFluids()) { | ||
if(fluid != SignalIndustries.energyFlowing) { | ||
acceptedFluids.get(0).add(fluid); | ||
} | ||
} | ||
} | ||
|
||
public String getInvName() { | ||
return "The Pulsar"; | ||
} | ||
|
||
|
||
} |
36 changes: 36 additions & 0 deletions
36
src/main/java/sunsetsatellite/signalindustries/items/attachments/ItemBackpackAttachment.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,36 @@ | ||
package sunsetsatellite.signalindustries.items.attachments; | ||
|
||
import net.minecraft.core.entity.player.EntityPlayer; | ||
import net.minecraft.core.item.ItemStack; | ||
import net.minecraft.core.util.helper.Side; | ||
import net.minecraft.core.world.World; | ||
import sunsetsatellite.signalindustries.SignalIndustries; | ||
import sunsetsatellite.signalindustries.containers.ContainerBackpack; | ||
import sunsetsatellite.signalindustries.containers.ContainerPulsar; | ||
import sunsetsatellite.signalindustries.gui.GuiBackpack; | ||
import sunsetsatellite.signalindustries.gui.GuiPulsar; | ||
import sunsetsatellite.signalindustries.inventories.item.InventoryBackpack; | ||
import sunsetsatellite.signalindustries.inventories.item.InventoryPulsar; | ||
import sunsetsatellite.signalindustries.powersuit.SignalumPowerSuit; | ||
import sunsetsatellite.signalindustries.util.AttachmentPoint; | ||
import sunsetsatellite.signalindustries.util.Tier; | ||
|
||
import java.util.List; | ||
|
||
public class ItemBackpackAttachment extends ItemTieredAttachment{ | ||
|
||
public ItemBackpackAttachment(String name, int id, List<AttachmentPoint> attachmentPoints, Tier tier) { | ||
super(name, id, attachmentPoints, tier); | ||
} | ||
|
||
@Override | ||
public void activate(ItemStack stack, SignalumPowerSuit signalumPowerSuit, EntityPlayer entityplayer, World world) { | ||
SignalIndustries.displayGui(entityplayer,new GuiBackpack(entityplayer.inventory,stack),new ContainerBackpack(entityplayer.inventory,stack),new InventoryBackpack(stack),stack); | ||
} | ||
|
||
@Override | ||
public boolean onItemUse(ItemStack itemstack, EntityPlayer entityplayer, World world, int blockX, int blockY, int blockZ, Side side, double xPlaced, double yPlaced) { | ||
SignalIndustries.displayGui(entityplayer,new GuiBackpack(entityplayer.inventory,entityplayer.inventory.getCurrentItem()),new ContainerBackpack(entityplayer.inventory,entityplayer.inventory.getCurrentItem()),new InventoryBackpack(entityplayer.inventory.getCurrentItem()),itemstack); | ||
return true; | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
src/main/java/sunsetsatellite/signalindustries/util/SlotBackpack.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,22 @@ | ||
package sunsetsatellite.signalindustries.util; | ||
|
||
import net.minecraft.core.item.ItemStack; | ||
import net.minecraft.core.player.inventory.IInventory; | ||
import net.minecraft.core.player.inventory.slot.Slot; | ||
import sunsetsatellite.signalindustries.SignalIndustries; | ||
import sunsetsatellite.signalindustries.inventories.item.InventoryBackpack; | ||
import sunsetsatellite.signalindustries.items.attachments.ItemBackpackAttachment; | ||
|
||
public class SlotBackpack extends Slot { | ||
public SlotBackpack(IInventory inventory, int id, int x, int y) { | ||
super(inventory, id, x, y); | ||
} | ||
|
||
@Override | ||
public boolean canPutStackInSlot(ItemStack itemstack) { | ||
if(itemstack.getItem() instanceof ItemBackpackAttachment){ | ||
return false; | ||
} | ||
return super.canPutStackInSlot(itemstack); | ||
} | ||
} |
Binary file added
BIN
+1002 Bytes
src/main/resources/assets/signalindustries/gui/reinforced_backpack.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+568 Bytes
src/main/resources/assets/signalindustries/item/reinforced_backpack.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.