mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
deplorable gollompus
This commit is contained in:
parent
c03801f3af
commit
4024249bec
@ -14,4 +14,5 @@
|
||||
* Fixed incorrect tooltip in the automatic control rod's GUI
|
||||
* Fixed recipe autogen creating recipes for nonexistant thorium bedrock ore
|
||||
* Fixed FBI agents spawning both the old and new bullet entities when firing
|
||||
* Fixed dupe concerning one of the weapon abilities
|
||||
* Fixed dupe concerning one of the weapon abilities
|
||||
* Fixed crates not sending a block update when the contents change, breaking redstone comparator functionality
|
||||
@ -0,0 +1,77 @@
|
||||
package com.hbm.inventory.container;
|
||||
|
||||
import com.hbm.inventory.SlotTakeOnly;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.tileentity.machine.albion.TileEntityPASource;
|
||||
|
||||
import api.hbm.energymk2.IBatteryItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class ContainerPASource extends Container {
|
||||
|
||||
private TileEntityPASource source;
|
||||
|
||||
public ContainerPASource(InventoryPlayer playerInv, TileEntityPASource tile) {
|
||||
source = tile;
|
||||
|
||||
//Battery
|
||||
this.addSlotToContainer(new Slot(tile, 0, 8, 72));
|
||||
//Inouts
|
||||
this.addSlotToContainer(new Slot(tile, 1, 62, 18));
|
||||
this.addSlotToContainer(new Slot(tile, 2, 80, 18));
|
||||
//Containers
|
||||
this.addSlotToContainer(new SlotTakeOnly(tile, 3, 62, 45));
|
||||
this.addSlotToContainer(new SlotTakeOnly(tile, 4, 80, 45));
|
||||
|
||||
for(int i = 0; i < 3; i++) {
|
||||
for(int j = 0; j < 9; j++) {
|
||||
this.addSlotToContainer(new Slot(playerInv, j + i * 9 + 9, 8 + j * 18, 122 + i * 18));
|
||||
}
|
||||
}
|
||||
|
||||
for(int i = 0; i < 9; i++) {
|
||||
this.addSlotToContainer(new Slot(playerInv, i, 8 + i * 18, 180));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInteractWith(EntityPlayer player) {
|
||||
return source.isUseableByPlayer(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack transferStackInSlot(EntityPlayer player, int index) {
|
||||
ItemStack rStack = null;
|
||||
Slot slot = (Slot) this.inventorySlots.get(index);
|
||||
|
||||
if(slot != null && slot.getHasStack()) {
|
||||
ItemStack stack = slot.getStack();
|
||||
rStack = stack.copy();
|
||||
|
||||
if(index <= 5) {
|
||||
if(!this.mergeItemStack(stack, 6, this.inventorySlots.size(), true)) {
|
||||
return null;
|
||||
}
|
||||
} else {
|
||||
|
||||
if(rStack.getItem() instanceof IBatteryItem || rStack.getItem() == ModItems.battery_creative) {
|
||||
if(!this.mergeItemStack(stack, 0, 1, false)) return null;
|
||||
} else {
|
||||
if(!this.mergeItemStack(stack, 1, 3, false)) return null;
|
||||
}
|
||||
}
|
||||
|
||||
if(stack.stackSize == 0) {
|
||||
slot.putStack((ItemStack) null);
|
||||
} else {
|
||||
slot.onSlotChanged();
|
||||
}
|
||||
}
|
||||
|
||||
return rStack;
|
||||
}
|
||||
}
|
||||
@ -18,9 +18,9 @@ public class GUIPADipole extends GuiInfoContainer {
|
||||
private static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/particleaccelerator/gui_dipole.png");
|
||||
private TileEntityPADipole dipole;
|
||||
|
||||
public GUIPADipole(InventoryPlayer player, TileEntityPADipole slopper) {
|
||||
super(new ContainerPADipole(player, slopper));
|
||||
this.dipole = slopper;
|
||||
public GUIPADipole(InventoryPlayer player, TileEntityPADipole dipole) {
|
||||
super(new ContainerPADipole(player, dipole));
|
||||
this.dipole = dipole;
|
||||
|
||||
this.xSize = 176;
|
||||
this.ySize = 204;
|
||||
|
||||
65
src/main/java/com/hbm/inventory/gui/GUIPASource.java
Normal file
65
src/main/java/com/hbm/inventory/gui/GUIPASource.java
Normal file
@ -0,0 +1,65 @@
|
||||
package com.hbm.inventory.gui;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.hbm.inventory.container.ContainerPASource;
|
||||
import com.hbm.lib.RefStrings;
|
||||
import com.hbm.tileentity.machine.albion.TileEntityPASource;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public class GUIPASource extends GuiInfoContainer {
|
||||
|
||||
private static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/particleaccelerator/gui_source.png");
|
||||
private TileEntityPASource source;
|
||||
|
||||
public GUIPASource(InventoryPlayer player, TileEntityPASource source) {
|
||||
super(new ContainerPASource(player, source));
|
||||
this.source = source;
|
||||
|
||||
this.xSize = 176;
|
||||
this.ySize = 204;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen(int mouseX, int mouseY, float f) {
|
||||
super.drawScreen(mouseX, mouseY, f);
|
||||
|
||||
source.tanks[0].renderTankInfo(this, mouseX, mouseY, guiLeft + 134, guiTop + 36, 16, 52);
|
||||
source.tanks[1].renderTankInfo(this, mouseX, mouseY, guiLeft + 152, guiTop + 36, 16, 52);
|
||||
this.drawElectricityInfo(this, mouseX, mouseY, guiLeft + 8, guiTop + 18, 16, 52, source.power, source.getMaxPower());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer( int i, int j) {
|
||||
|
||||
String name = this.source.hasCustomInventoryName() ? this.source.getInventoryName() : I18n.format(this.source.getInventoryName());
|
||||
this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2 - 9, 6, 4210752);
|
||||
this.fontRendererObj.drawString(I18n.format("container.inventory"), 8, this.ySize - 96 + 2, 4210752);
|
||||
|
||||
this.fontRendererObj.drawString(EnumChatFormatting.AQUA + "/123K", 136, 22, 4210752);
|
||||
int heat = (int) Math.ceil(source.temperature);
|
||||
String label = (heat > 123 ? EnumChatFormatting.RED : EnumChatFormatting.AQUA) + "" + heat + "K";
|
||||
this.fontRendererObj.drawString(label, 166 - this.fontRendererObj.getStringWidth(label), 12, 4210752);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float interp, int x, int y) {
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
|
||||
drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
|
||||
|
||||
int j = (int) (source.power * 52 / source.getMaxPower());
|
||||
drawTexturedModalRect(guiLeft + 8, guiTop + 70 - j, 184, 52 - j, 16, j);
|
||||
|
||||
int heat = (int) Math.ceil(source.temperature);
|
||||
if(heat <= 123) drawTexturedModalRect(guiLeft + 44, guiTop + 18, 176, 8, 8, 8);
|
||||
|
||||
source.tanks[0].renderTank(guiLeft + 134, guiTop + 88, this.zLevel, 16, 52);
|
||||
source.tanks[1].renderTank(guiLeft + 152, guiTop + 88, this.zLevel, 16, 52);
|
||||
}
|
||||
}
|
||||
@ -3,8 +3,6 @@ package com.hbm.qmaw;
|
||||
import java.io.File;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.net.URL;
|
||||
import java.security.CodeSource;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.zip.ZipEntry;
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
package com.hbm.tileentity.machine.albion;
|
||||
|
||||
import com.hbm.inventory.container.ContainerPASource;
|
||||
import com.hbm.inventory.gui.GUIPASource;
|
||||
import com.hbm.tileentity.IGUIProvider;
|
||||
import com.hbm.util.fauxpointtwelve.DirPos;
|
||||
|
||||
@ -60,11 +62,11 @@ public class TileEntityPASource extends TileEntityCooledBase implements IGUIProv
|
||||
|
||||
@Override
|
||||
public Container provideContainer(int ID, EntityPlayer player, World world, int x, int y, int z) {
|
||||
return null;
|
||||
return new ContainerPASource(player.inventory, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object provideGUI(int ID, EntityPlayer player, World world, int x, int y, int z) {
|
||||
return null;
|
||||
return new GUIPASource(player.inventory, this);
|
||||
}
|
||||
}
|
||||
|
||||
@ -45,6 +45,7 @@ public abstract class TileEntityCrateBase extends TileEntityLockableBase impleme
|
||||
if (itemStack != null && itemStack.stackSize > getInventoryStackLimit()) {
|
||||
itemStack.stackSize = getInventoryStackLimit();
|
||||
}
|
||||
this.markDirty();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -98,6 +99,7 @@ public abstract class TileEntityCrateBase extends TileEntityLockableBase impleme
|
||||
slots[i] = null;
|
||||
}
|
||||
|
||||
this.markDirty();
|
||||
return itemStack1;
|
||||
} else {
|
||||
return null;
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 3.3 KiB |
Loading…
x
Reference in New Issue
Block a user