igen 3: revenge of the sith
@ -130,7 +130,9 @@ public abstract class BlockDummyable extends BlockContainer {
|
||||
if(!(player instanceof EntityPlayer))
|
||||
return;
|
||||
|
||||
safeRem = true;
|
||||
world.setBlockToAir(x, y, z);
|
||||
safeRem = false;
|
||||
|
||||
EntityPlayer pl = (EntityPlayer) player;
|
||||
|
||||
@ -195,7 +197,6 @@ public abstract class BlockDummyable extends BlockContainer {
|
||||
}
|
||||
|
||||
protected void fillSpace(World world, int x, int y, int z, ForgeDirection dir, int o) {
|
||||
|
||||
MultiblockHandlerXR.fillSpace(world, x + dir.offsetX * o, y + dir.offsetY * o, z + dir.offsetZ * o, getDimensions(), this, dir);
|
||||
}
|
||||
|
||||
|
||||
@ -174,6 +174,7 @@ public class BlockBobble extends BlockContainer {
|
||||
ADAM29("Adam29", "Adam29", "Ethanol, liquid petroleum gas", "You know, nukes are really quite beatiful.$It's like watching a star be born for a split second.", true),
|
||||
UFFR("UFFR", "UFFR", "All sorts of things from his PR", "fried shrimp", false),
|
||||
VAER("vaer", "vaer", "ZIRNOX", "taken de family out to the weekend cigarette festival", true),
|
||||
NOS("Dr Nostalgia", "Dr Nostalgia", "SSG and Vortex models", "Take a picture, I'ma pose, paparazzi$I've been drinking, moving like a zombie", true),
|
||||
//testing garbage. why is she so dumb?
|
||||
CIRNO("Cirno", "Cirno", "being a dumb ice fairy", "No brain. Head empty.", true);
|
||||
|
||||
|
||||
@ -48,7 +48,7 @@ public class MachineIGenerator extends BlockDummyable {
|
||||
return false;
|
||||
}
|
||||
|
||||
/*@Override
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
||||
|
||||
if(world.isRemote) {
|
||||
@ -69,53 +69,22 @@ public class MachineIGenerator extends BlockDummyable {
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fillSpace(World world, int x, int y, int z, ForgeDirection dir, int o) {
|
||||
super.fillSpace(world, x, y, z, dir, o);
|
||||
this.makeExtra(world, x + dir.offsetX * (o - 3), y, z + dir.offsetZ * (o - 3));
|
||||
this.makeExtra(world, x + dir.offsetX * (o + 2), y, z + dir.offsetZ * (o + 2));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getDimensions() {
|
||||
return new int [] {1,0,2,2,2,4};
|
||||
return new int [] {2, 0, 3, 2, 1, 1};
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getOffset() {
|
||||
return 2;
|
||||
}
|
||||
|
||||
protected boolean checkRequirement(World world, int x, int y, int z, ForgeDirection dir, int o) {
|
||||
|
||||
if(!MultiblockHandlerXR.checkSpace(world, x + dir.offsetX * o , y + dir.offsetY * o, z + dir.offsetZ * o, getDimensions(), x, y, z, dir))
|
||||
return false;
|
||||
if(!MultiblockHandlerXR.checkSpace(world, x + dir.offsetX * o , y + dir.offsetY * o, z + dir.offsetZ * o, new int [] {5,0,2,2,8,-2}, x, y, z, dir))
|
||||
return false;
|
||||
if(!MultiblockHandlerXR.checkSpace(world, x + dir.offsetX * o , y + dir.offsetY * o, z + dir.offsetZ * o, new int [] {4,0,2,2,-4,8}, x, y, z, dir))
|
||||
return false;
|
||||
if(!MultiblockHandlerXR.checkSpace(world, x + dir.offsetX * o , y + dir.offsetY * o, z + dir.offsetZ * o, new int [] {3,-2,1,1,-1,3}, x, y, z, dir))
|
||||
return false;
|
||||
if(!MultiblockHandlerXR.checkSpace(world, x + dir.offsetX * o , y + dir.offsetY * o, z + dir.offsetZ * o, new int [] {4,-2,1,1,1,0}, x, y, z, dir))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
protected void fillSpace(World world, int x, int y, int z, ForgeDirection dir, int o) {
|
||||
|
||||
MultiblockHandlerXR.fillSpace(world, x + dir.offsetX * o , y + dir.offsetY * o, z + dir.offsetZ * o, getDimensions(), this, dir);
|
||||
MultiblockHandlerXR.fillSpace(world, x + dir.offsetX * o , y + dir.offsetY * o, z + dir.offsetZ * o, new int [] {5,0,2,2,8,-2}, this, dir);
|
||||
MultiblockHandlerXR.fillSpace(world, x + dir.offsetX * o , y + dir.offsetY * o, z + dir.offsetZ * o, new int [] {4,0,2,2,-4,8}, this, dir);
|
||||
MultiblockHandlerXR.fillSpace(world, x + dir.offsetX * o , y + dir.offsetY * o, z + dir.offsetZ * o, new int [] {3,-2,1,1,-1,3}, this, dir);
|
||||
MultiblockHandlerXR.fillSpace(world, x + dir.offsetX * o , y + dir.offsetY * o, z + dir.offsetZ * o, new int [] {4,-2,1,1,1,0}, this, dir);
|
||||
|
||||
/*int[] rot = MultiblockHandlerXR.rotate(new int [] {1,0,2,2,8,8}, dir);
|
||||
|
||||
for(int iy = 0; iy <= 1; iy++) {
|
||||
for(int ix = -rot[4]; ix <= rot[5]; ix++) {
|
||||
for(int iz = -rot[2]; iz <= rot[3]; iz++) {
|
||||
|
||||
if(ix == -rot[4] || ix == rot[5] || iz == -rot[2] || iz == rot[3]) {
|
||||
this.makeExtra(world, x + dir.offsetX * o + ix, y + iy, z + dir.offsetZ * o + iz);
|
||||
}
|
||||
}
|
||||
}
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
||||
@ -18,81 +18,66 @@ public class ContainerIGenerator extends Container {
|
||||
|
||||
igen = te;
|
||||
|
||||
//Solid Fuel
|
||||
this.addSlotToContainer(new Slot(te, 0, 5, 27));
|
||||
//RTG In
|
||||
this.addSlotToContainer(new Slot(te, 1, 41, 63));
|
||||
//RTG Out
|
||||
this.addSlotToContainer(new SlotMachineOutput(te, 2, 41, 99));
|
||||
//Thermo Slots
|
||||
this.addSlotToContainer(new Slot(te, 3, 68, 36));
|
||||
this.addSlotToContainer(new Slot(te, 4, 86, 36));
|
||||
this.addSlotToContainer(new Slot(te, 5, 104, 36));
|
||||
//Battery
|
||||
this.addSlotToContainer(new Slot(te, 6, 86, 108));
|
||||
//Water In
|
||||
this.addSlotToContainer(new Slot(te, 7, 131, 27));
|
||||
//Water Out
|
||||
this.addSlotToContainer(new SlotMachineOutput(te, 8, 167, 27));
|
||||
//Fuel In
|
||||
this.addSlotToContainer(new Slot(te, 9, 131, 63));
|
||||
//Fuel Out
|
||||
this.addSlotToContainer(new SlotMachineOutput(te, 10, 167, 63));
|
||||
//ID In
|
||||
this.addSlotToContainer(new Slot(te, 11, 131, 81));
|
||||
//ID Out
|
||||
this.addSlotToContainer(new SlotMachineOutput(te, 12, 167, 81));
|
||||
//Lube In
|
||||
this.addSlotToContainer(new Slot(te, 13, 131, 99));
|
||||
//Lube Out
|
||||
this.addSlotToContainer(new SlotMachineOutput(te, 14, 167, 99));
|
||||
|
||||
for(int i = 0; i < 3; i++)
|
||||
{
|
||||
for(int j = 0; j < 9; j++)
|
||||
{
|
||||
this.addSlotToContainer(new Slot(invPlayer, j + i * 9 + 9, 14 + j * 18, 84 + i * 18 + 56));
|
||||
this.addSlotToContainer(new Slot(te, 0, 8, 134));
|
||||
//Water
|
||||
this.addSlotToContainer(new Slot(te, 1, 62, 112));
|
||||
this.addSlotToContainer(new SlotMachineOutput(te, 2, 154, 112));
|
||||
//Solid Fuel
|
||||
this.addSlotToContainer(new Slot(te, 3, 67, 51));
|
||||
this.addSlotToContainer(new Slot(te, 4, 85, 51));
|
||||
this.addSlotToContainer(new Slot(te, 5, 67, 87));
|
||||
this.addSlotToContainer(new Slot(te, 6, 85, 87));
|
||||
//Lubricant
|
||||
this.addSlotToContainer(new Slot(te, 7, 132, 33));
|
||||
this.addSlotToContainer(new SlotMachineOutput(te, 8, 132, 51));
|
||||
//Fuel
|
||||
this.addSlotToContainer(new Slot(te, 9, 132, 69));
|
||||
this.addSlotToContainer(new SlotMachineOutput(te, 10, 132, 87));
|
||||
//RTG
|
||||
for(int i = 0; i < 5; i++) {
|
||||
for(int j = 0; j < 2; j++) {
|
||||
this.addSlotToContainer(new Slot(te, 11 + i * 2 + j, 15 + j * 18, 35 + i * 18));
|
||||
}
|
||||
}
|
||||
|
||||
for(int i = 0; i < 9; i++)
|
||||
{
|
||||
this.addSlotToContainer(new Slot(invPlayer, i, 14 + i * 18, 142 + 56));
|
||||
for(int i = 0; i < 3; i++) {
|
||||
for(int j = 0; j < 9; j++) {
|
||||
this.addSlotToContainer(new Slot(invPlayer, j + i * 9 + 9, 8 + j * 18, 84 + i * 18 + 71));
|
||||
}
|
||||
}
|
||||
|
||||
for(int i = 0; i < 9; i++) {
|
||||
this.addSlotToContainer(new Slot(invPlayer, i, 8 + i * 18, 142 + 71));
|
||||
}
|
||||
}
|
||||
|
||||
//TODO: use smart shift click magic
|
||||
@Override
|
||||
public ItemStack transferStackInSlot(EntityPlayer p_82846_1_, int par2) {
|
||||
public ItemStack transferStackInSlot(EntityPlayer p_82846_1_, int par2) {
|
||||
ItemStack var3 = null;
|
||||
Slot var4 = (Slot) this.inventorySlots.get(par2);
|
||||
|
||||
if (var4 != null && var4.getHasStack())
|
||||
{
|
||||
|
||||
if(var4 != null && var4.getHasStack()) {
|
||||
ItemStack var5 = var4.getStack();
|
||||
var3 = var5.copy();
|
||||
|
||||
if (par2 <= 14) {
|
||||
if (!this.mergeItemStack(var5, 15, this.inventorySlots.size(), true))
|
||||
{
|
||||
|
||||
if(par2 <= 20) {
|
||||
if(!this.mergeItemStack(var5, 21, this.inventorySlots.size(), true)) {
|
||||
return null;
|
||||
}
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (var5.stackSize == 0)
|
||||
{
|
||||
|
||||
if(var5.stackSize == 0) {
|
||||
var4.putStack((ItemStack) null);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
var4.onSlotChanged();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return var3;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInteractWith(EntityPlayer player) {
|
||||
|
||||
@ -1,90 +1,62 @@
|
||||
package com.hbm.inventory.gui;
|
||||
|
||||
import org.lwjgl.input.Mouse;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.hbm.inventory.FluidTank;
|
||||
import com.hbm.inventory.container.ContainerIGenerator;
|
||||
import com.hbm.lib.Library;
|
||||
import com.hbm.lib.RefStrings;
|
||||
import com.hbm.packet.AuxButtonPacket;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
import com.hbm.render.util.GaugeUtil;
|
||||
import com.hbm.render.util.GaugeUtil.Gauge;
|
||||
import com.hbm.tileentity.machine.TileEntityMachineIGenerator;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.audio.PositionedSoundRecord;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.Vec3;
|
||||
|
||||
public class GUIIGenerator extends GuiInfoContainer {
|
||||
|
||||
|
||||
private static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/generators/gui_igen.png");
|
||||
private TileEntityMachineIGenerator igen;
|
||||
boolean caughtMouse = false;
|
||||
|
||||
public GUIIGenerator(InventoryPlayer invPlayer, TileEntityMachineIGenerator tedf) {
|
||||
super(new ContainerIGenerator(invPlayer, tedf));
|
||||
igen = tedf;
|
||||
|
||||
this.xSize = 188;
|
||||
this.ySize = 222;
|
||||
|
||||
this.xSize = 176;
|
||||
this.ySize = 237;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void drawScreen(int x, int y, float f) {
|
||||
super.drawScreen(x, y, f);
|
||||
|
||||
if(!caughtMouse && Mouse.isButtonDown(0) && guiLeft + 85 <= x && guiLeft + 85 + 18 > x && guiTop + 71 < y && guiTop + 71 + 18 >= y) {
|
||||
caughtMouse = true;
|
||||
}
|
||||
|
||||
if(caughtMouse && !Mouse.isButtonDown(0)) {
|
||||
int dial = (int) Math.round(Math.toDegrees(getAngle(x, y)));
|
||||
igen.setDialByAngle(dial);
|
||||
PacketDispatcher.wrapper.sendToServer(new AuxButtonPacket(igen.xCoord, igen.yCoord, igen.zCoord, dial, 2));
|
||||
caughtMouse = false;
|
||||
}
|
||||
|
||||
this.drawCustomInfoStat(x, y, guiLeft + 76, guiTop + 20, 36, 12, x, y, new String[] { (igen.temperature + 300) + "K" });
|
||||
this.drawCustomInfoStat(x, y, guiLeft + 76, guiTop + 56, 36, 12, x, y, new String[] { (Math.round((igen.torque * igen.animSpeed / (360D * 20D)) * 10D) / 10D) + "RPM" });
|
||||
this.drawCustomInfoStat(x, y, guiLeft + 76, guiTop + 92, 36, 12, x, y, new String[] { Library.getShortNumber(igen.power) + "HE" });
|
||||
this.drawCustomInfoStat(x, y, guiLeft + 40, guiTop + 26, 18, 18, x, y, new String[] { (igen.burnTime / 20) + "s" });
|
||||
this.drawCustomInfoStat(x, y, guiLeft + 24, guiTop + 64, 14, 14, x, y, new String[] { "Add pellet to stack" });
|
||||
this.drawCustomInfoStat(x, y, guiLeft + 24, guiTop + 100, 14, 14, x, y, new String[] { "Take pellet from stack" });
|
||||
|
||||
igen.tanks[0].renderTankInfo(this, x, y, guiLeft + 148, guiTop + 26, 18, 18);
|
||||
igen.tanks[1].renderTankInfo(this, x, y, guiLeft + 148, guiTop + 62, 18, 18);
|
||||
igen.tanks[2].renderTankInfo(this, x, y, guiLeft + 148, guiTop + 98, 18, 18);
|
||||
this.drawElectricityInfo(this, x, y, guiLeft + 26, guiTop + 134, 142, 16, igen.power, igen.maxPower);
|
||||
|
||||
for(int i = 0; i < 4; i++) {
|
||||
int fire = igen.burn[i];
|
||||
|
||||
this.drawCustomInfoStat(x, y, guiLeft + 68 + (i % 2) * 18, guiTop + 34 + (i / 2) * 36, 14, 14, x, y, new String[] {(fire / 20) + "s"});
|
||||
}
|
||||
|
||||
this.drawCustomInfoStat(x, y, guiLeft + 113, guiTop + 4, 54, 18, x, y, new String[] {"Heat generated"});
|
||||
|
||||
igen.tanks[0].renderTankInfo(this, x, y, guiLeft + 80, guiTop + 112, 72, 16);
|
||||
igen.tanks[1].renderTankInfo(this, x, y, guiLeft + 114, guiTop + 33, 16, 70);
|
||||
igen.tanks[2].renderTankInfo(this, x, y, guiLeft + 150, guiTop + 33, 18, 70);
|
||||
}
|
||||
|
||||
protected void mouseClicked(int x, int y, int i) {
|
||||
super.mouseClicked(x, y, i);
|
||||
|
||||
if(guiLeft + 24 <= x && guiLeft + 24 + 14 > x && guiTop + 64 < y && guiTop + 64 + 14 >= y) {
|
||||
|
||||
//push pellet
|
||||
mc.getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 1.0F));
|
||||
PacketDispatcher.wrapper.sendToServer(new AuxButtonPacket(igen.xCoord, igen.yCoord, igen.zCoord, 0, 0));
|
||||
}
|
||||
|
||||
if(guiLeft + 24 <= x && guiLeft + 24 + 14 > x && guiTop + 100 < y && guiTop + 100 + 14 >= y) {
|
||||
|
||||
//pop pellet
|
||||
mc.getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 1.0F));
|
||||
PacketDispatcher.wrapper.sendToServer(new AuxButtonPacket(igen.xCoord, igen.yCoord, igen.zCoord, 0, 1));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int i, int j) {
|
||||
String name = this.igen.hasCustomInventoryName() ? this.igen.getInventoryName() : I18n.format(this.igen.getInventoryName());
|
||||
|
||||
this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6, 4210752);
|
||||
this.fontRendererObj.drawString(I18n.format("container.inventory"), 14, this.ySize - 96 + 2, 4210752);
|
||||
GL11.glPushMatrix();
|
||||
double scale = 0.75D;
|
||||
GL11.glScaled(scale, scale, 1);
|
||||
this.fontRendererObj.drawString(name, 22, 18, 0x303030);
|
||||
GL11.glPopMatrix();
|
||||
|
||||
String spin = this.igen.spin + "";
|
||||
this.fontRendererObj.drawString(spin, 139 - this.fontRendererObj.getStringWidth(spin) / 2, 10, 0x00ff00);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -92,75 +64,30 @@ public class GUIIGenerator extends GuiInfoContainer {
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
|
||||
drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
|
||||
|
||||
int water = igen.tanks[0].getFill() * 72 / igen.tanks[0].getMaxFill();
|
||||
drawTexturedModalRect(guiLeft + 80, guiTop + 112, 184, 14, water, 16);
|
||||
|
||||
int power = (int) (igen.power * 142 / igen.maxPower);
|
||||
drawTexturedModalRect(guiLeft + 26, guiTop + 134, 0, 237, power, 16);
|
||||
|
||||
for(int i = 0; i < igen.pellets.length; i++) {
|
||||
for(int i = 0; i < 4; i++) {
|
||||
int fire = igen.burn[i];
|
||||
|
||||
if(igen.pellets[i] != null)
|
||||
drawTexturedModalRect(guiLeft + 6, guiTop + 106 - 4 * i, 188, igen.pellets[i].offset, 14, 9);
|
||||
}
|
||||
|
||||
for(int i = 0; i < 3; i++) {
|
||||
if(igen.tanks[i].getFill() > 0) {
|
||||
|
||||
int hex = igen.tanks[i].getTankType().getColor();
|
||||
|
||||
int r = (hex & 0xFF0000) >> 16;
|
||||
int g = (hex & 0xFF00) >> 8;
|
||||
int b = (hex & 0xFF);
|
||||
|
||||
GL11.glColor3f(r / 256F, g / 256F, b / 256F);
|
||||
|
||||
drawTexturedModalRect(guiLeft + 149, guiTop + 39 + 36 * i, 218, 0, 16, 4);
|
||||
if(fire > 0) {
|
||||
drawTexturedModalRect(guiLeft + 68 + (i % 2) * 18, guiTop + 34 + (i / 2) * 36, 184, 0, 14, 14);
|
||||
}
|
||||
}
|
||||
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
|
||||
drawDial(x, y);
|
||||
|
||||
GaugeUtil.renderGauge(Gauge.BOW_SMALL, guiLeft + 40, guiTop + 26, this.zLevel, igen.getSolidGauge());
|
||||
if(igen.hasRTG) {
|
||||
drawTexturedModalRect(guiLeft + 9, guiTop + 34, 176, 0, 4, 89);
|
||||
drawTexturedModalRect(guiLeft + 51, guiTop + 34, 180, 0, 4, 89);
|
||||
}
|
||||
|
||||
GaugeUtil.renderGauge(Gauge.BAR_SMALL, guiLeft + 76, guiTop + 20, this.zLevel, igen.getTempGauge());
|
||||
GaugeUtil.renderGauge(Gauge.BAR_SMALL, guiLeft + 76, guiTop + 56, this.zLevel, igen.getTorqueGauge());
|
||||
GaugeUtil.renderGauge(Gauge.BAR_SMALL, guiLeft + 76, guiTop + 92, this.zLevel, igen.getPowerGauge());
|
||||
|
||||
GaugeUtil.renderGauge(Gauge.WIDE_SMALL, guiLeft + 148, guiTop + 26, this.zLevel, (double)igen.tanks[0].getFill() / (double)igen.tanks[0].getMaxFill());
|
||||
GaugeUtil.renderGauge(Gauge.WIDE_SMALL, guiLeft + 148, guiTop + 62, this.zLevel, (double)igen.tanks[1].getFill() / (double)igen.tanks[1].getMaxFill());
|
||||
GaugeUtil.renderGauge(Gauge.WIDE_SMALL, guiLeft + 148, guiTop + 98, this.zLevel, (double)igen.tanks[2].getFill() / (double)igen.tanks[2].getMaxFill());
|
||||
}
|
||||
|
||||
private void drawDial(float x, float y) {
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture(igen.tanks[1].getSheet());
|
||||
igen.tanks[1].renderTank(this, guiLeft + 114, guiTop + 103, igen.tanks[1].getTankType().textureX() * FluidTank.x, igen.tanks[1].getTankType().textureY() * FluidTank.y, 16, 70);
|
||||
|
||||
float angle = (float) getAngle(x, y);
|
||||
double pixel = 1D/256D;
|
||||
|
||||
Vec3 vec = Vec3.createVectorHelper(8, 8, 0);
|
||||
vec.rotateAroundZ(-angle);
|
||||
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
tessellator.startDrawingQuads();
|
||||
|
||||
tessellator.addVertexWithUV(guiLeft + 94 + vec.xCoord, guiTop + 80 + vec.yCoord, this.zLevel, pixel * 218, 0);
|
||||
vec.rotateAroundZ((float)Math.toRadians(90));
|
||||
tessellator.addVertexWithUV(guiLeft + 94 + vec.xCoord, guiTop + 80 + vec.yCoord, this.zLevel, pixel * 218, pixel * 16);
|
||||
vec.rotateAroundZ((float)Math.toRadians(90));
|
||||
tessellator.addVertexWithUV(guiLeft + 94 + vec.xCoord, guiTop + 80 + vec.yCoord, this.zLevel, pixel * 202, pixel * 16);
|
||||
vec.rotateAroundZ((float)Math.toRadians(90));
|
||||
tessellator.addVertexWithUV(guiLeft + 94 + vec.xCoord, guiTop + 80 + vec.yCoord, this.zLevel, pixel * 202, 0);
|
||||
|
||||
tessellator.draw();
|
||||
}
|
||||
|
||||
private double getAngle(float x, float y) {
|
||||
|
||||
if(!caughtMouse)
|
||||
return Math.toRadians(igen.getAngleFromDial());
|
||||
|
||||
double angle = -Math.atan2(guiLeft + 94 - x, guiTop + 80 - y) + (float) Math.PI * 1;
|
||||
|
||||
angle = Math.max(angle, Math.PI * 0.25);
|
||||
angle = Math.min(angle, Math.PI * 1.75);
|
||||
|
||||
return angle;
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture(igen.tanks[2].getSheet());
|
||||
igen.tanks[2].renderTank(this, guiLeft + 150, guiTop + 103, igen.tanks[2].getTankType().textureX() * FluidTank.x, igen.tanks[2].getTankType().textureY() * FluidTank.y, 16, 70);
|
||||
}
|
||||
}
|
||||
|
||||
@ -43,7 +43,7 @@ public class GUIMachineDiFurnaceRTG extends GuiInfoContainer {
|
||||
|
||||
for(int i = 0; i < pellets.size(); i++) {
|
||||
ItemRTGPellet pellet = pellets.get(i);
|
||||
pelletText[i + 1] = I18nUtil.resolveKey("desc.gui.rtgBFurnace.pellet", I18nUtil.resolveKey(pellet.getUnlocalizedName()), pellet.getHeat());
|
||||
pelletText[i + 1] = I18nUtil.resolveKey("desc.gui.rtgBFurnace.pellet", I18nUtil.resolveKey(pellet.getUnlocalizedName() + ".name"), pellet.getHeat());
|
||||
}
|
||||
|
||||
this.drawCustomInfoStat(mouseX, mouseY, guiLeft - 15, guiTop + 36, 16, 16, guiLeft - 8, guiTop + 36 + 16, pelletText);
|
||||
|
||||
@ -166,6 +166,16 @@ public class AnvilRecipes {
|
||||
new ComparableStack(ModItems.circuit_aluminium, 1 * ukModifier)
|
||||
}, new AnvilOutput(new ItemStack(ModBlocks.machine_assembler))).setTier(2));
|
||||
|
||||
constructionRecipes.add(new AnvilConstructionRecipe(
|
||||
new AStack[] {
|
||||
new OreDictStack(STEEL.ingot(), 6),
|
||||
new OreDictStack(IRON.plate(), 8),
|
||||
new OreDictStack(POLYMER.ingot(), 4),
|
||||
new ComparableStack(ModItems.generator_steel, 2),
|
||||
new ComparableStack(ModItems.turbine_titanium, 1),
|
||||
new ComparableStack(ModItems.thermo_element, 3)
|
||||
}, new AnvilOutput(new ItemStack(ModBlocks.machine_industrial_generator))).setTier(2));
|
||||
|
||||
constructionRecipes.add(new AnvilConstructionRecipe(
|
||||
new AStack[] {
|
||||
new ComparableStack(ModBlocks.brick_concrete, 64),
|
||||
@ -498,19 +508,6 @@ public class AnvilRecipes {
|
||||
new AnvilOutput(new ItemStack(ModItems.ingot_boron, 2)),
|
||||
new AnvilOutput(new ItemStack(Items.stick, 2))
|
||||
}).setTier(2));
|
||||
|
||||
constructionRecipes.add(new AnvilConstructionRecipe(
|
||||
new ComparableStack(ModBlocks.machine_industrial_generator), new AnvilOutput[] {
|
||||
new AnvilOutput(new ItemStack(ModBlocks.machine_coal_off, 2)),
|
||||
new AnvilOutput(new ItemStack(ModBlocks.machine_boiler_off, 2)),
|
||||
new AnvilOutput(new ItemStack(ModBlocks.machine_large_turbine, 1)),
|
||||
new AnvilOutput(new ItemStack(ModBlocks.machine_transformer, 1)),
|
||||
new AnvilOutput(new ItemStack(ModBlocks.steel_scaffold, 20)),
|
||||
new AnvilOutput(new ItemStack(ModItems.ingot_steel, 12)),
|
||||
new AnvilOutput(new ItemStack(ModItems.plate_lead, 8)),
|
||||
new AnvilOutput(new ItemStack(ModItems.plate_aluminium, 12)),
|
||||
new AnvilOutput(new ItemStack(ModItems.pipes_steel, 1))
|
||||
}).setTier(2));
|
||||
|
||||
constructionRecipes.add(new AnvilConstructionRecipe(
|
||||
new ComparableStack(ModBlocks.rbmk_moderator), new AnvilOutput[] {
|
||||
|
||||
@ -3,7 +3,7 @@ package com.hbm.lib;
|
||||
public class RefStrings {
|
||||
public static final String MODID = "hbm";
|
||||
public static final String NAME = "Hbm's Nuclear Tech Mod";
|
||||
public static final String VERSION = "1.0.27 BETA (4060)";
|
||||
public static final String VERSION = "1.0.27 BETA (4074)";
|
||||
//HBM's Beta Naming Convention:
|
||||
//V T (X)
|
||||
//V -> next release version
|
||||
|
||||
@ -44,6 +44,7 @@ public class RenderBobble extends TileEntitySpecialRenderer {
|
||||
public static final ResourceLocation bobble_adam = new ResourceLocation(RefStrings.MODID, "textures/models/trinkets/adam29.png");
|
||||
public static final ResourceLocation bobble_uffr = new ResourceLocation(RefStrings.MODID, "textures/models/trinkets/uffr.png");
|
||||
public static final ResourceLocation bobble_vaer = new ResourceLocation(RefStrings.MODID, "textures/models/trinkets/vaer.png");
|
||||
public static final ResourceLocation bobble_nos = new ResourceLocation(RefStrings.MODID, "textures/models/trinkets/nos.png");
|
||||
public static final ResourceLocation bobble_cirno = new ResourceLocation(RefStrings.MODID, "textures/models/trinkets/cirno.png");
|
||||
|
||||
@Override
|
||||
@ -92,6 +93,7 @@ public class RenderBobble extends TileEntitySpecialRenderer {
|
||||
case ADAM29: bindTexture(bobble_adam); break;
|
||||
case UFFR: bindTexture(bobble_uffr); break;
|
||||
case VAER: bindTexture(bobble_vaer); break;
|
||||
case NOS: bindTexture(bobble_nos); break;
|
||||
default: bindTexture(ResourceManager.universal);
|
||||
}
|
||||
|
||||
@ -286,6 +288,15 @@ public class RenderBobble extends TileEntitySpecialRenderer {
|
||||
this.renderItem(new ItemStack(ModItems.cigarette));
|
||||
}
|
||||
|
||||
if(type == BobbleType.NOS) {
|
||||
GL11.glTranslated(0, 1.75, 0);
|
||||
GL11.glRotated(180, 1, 0, 0);
|
||||
double scale = 0.095D;
|
||||
GL11.glScaled(scale, scale, scale);
|
||||
this.bindTexture(ResourceManager.hat);
|
||||
ResourceManager.armor_hat.renderAll();
|
||||
}
|
||||
|
||||
GL11.glPopMatrix();
|
||||
|
||||
GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F);
|
||||
|
||||
@ -15,110 +15,35 @@ import net.minecraft.util.Vec3;
|
||||
|
||||
public class RenderIGenerator extends TileEntitySpecialRenderer {
|
||||
|
||||
@Override
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity te, double x, double y, double z, float f) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(x + 0.5D, y, z + 0.5D);
|
||||
|
||||
switch(te.getBlockMetadata() - BlockDummyable.offset)
|
||||
{
|
||||
case 2: GL11.glRotatef(90, 0F, 1F, 0F); break;
|
||||
case 4: GL11.glRotatef(180, 0F, 1F, 0F); break;
|
||||
case 3: GL11.glRotatef(270, 0F, 1F, 0F); break;
|
||||
case 5: GL11.glRotatef(0, 0F, 1F, 0F); break;
|
||||
}
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(x + 0.5D, y, z + 0.5D);
|
||||
|
||||
TileEntityMachineIGenerator igen = (TileEntityMachineIGenerator)te;
|
||||
GL11.glTranslated(1, 0, 0);
|
||||
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GL11.glDisable(GL11.GL_CULL_FACE);
|
||||
GL11.glShadeModel(GL11.GL_SMOOTH);
|
||||
|
||||
bindTexture(ResourceManager.igen_tex);
|
||||
ResourceManager.igen.renderPart("Base");
|
||||
|
||||
float angle = igen.prevRotation + (igen.rotation - igen.prevRotation) * f;
|
||||
float px = 0.0625F;
|
||||
float sine = (float) Math.sin(Math.toRadians(angle));
|
||||
float cosine = (float) Math.cos(Math.toRadians(angle));
|
||||
float armAng = 22.5F;
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(0, 3.5, 0);
|
||||
GL11.glRotatef(angle, 0, 0, 1);
|
||||
GL11.glTranslated(0, -3.5, 0);
|
||||
|
||||
bindTexture(ResourceManager.igen_rotor);
|
||||
ResourceManager.igen.renderPart("Rotor");
|
||||
GL11.glPopMatrix();
|
||||
|
||||
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(0, 3.5, px * 5);
|
||||
GL11.glRotatef(angle, -1, 0, 0);
|
||||
GL11.glTranslated(0, -3.5, px * -5);
|
||||
|
||||
bindTexture(ResourceManager.igen_cog);
|
||||
ResourceManager.igen.renderPart("CogLeft");
|
||||
GL11.glPopMatrix();
|
||||
|
||||
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(0, 3.5, px * 5);
|
||||
GL11.glRotatef(angle, 1, 0, 0);
|
||||
GL11.glTranslated(0, -3.5, px * -5);
|
||||
|
||||
bindTexture(ResourceManager.igen_cog);
|
||||
ResourceManager.igen.renderPart("CogRight");
|
||||
GL11.glPopMatrix();
|
||||
|
||||
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(0, 0, cosine * 0.8725 - 1);
|
||||
|
||||
bindTexture(ResourceManager.igen_pistons);
|
||||
ResourceManager.igen.renderPart("Pistons");
|
||||
GL11.glPopMatrix();
|
||||
|
||||
GL11.glPushMatrix();
|
||||
|
||||
GL11.glTranslated(0, sine * 0.55, cosine * 0.8725 - 1.125);
|
||||
|
||||
GL11.glTranslated(0, 3.5, px * 6.5);
|
||||
GL11.glRotatef(sine * -armAng, 1, 0, 0);
|
||||
GL11.glTranslated(0, -3.5, px * -5);
|
||||
|
||||
bindTexture(ResourceManager.igen_arm);
|
||||
ResourceManager.igen.renderPart("ArmLeft");
|
||||
GL11.glPopMatrix();
|
||||
|
||||
GL11.glPushMatrix();
|
||||
|
||||
GL11.glTranslated(0, -sine * 0.55, cosine * 0.8725 - 1.125);
|
||||
|
||||
GL11.glTranslated(0, 3.5, px * 6.5);
|
||||
GL11.glRotatef(sine * armAng, 1, 0, 0);
|
||||
GL11.glTranslated(0, -3.5, px * -5);
|
||||
|
||||
bindTexture(ResourceManager.igen_arm);
|
||||
ResourceManager.igen.renderPart("ArmRight");
|
||||
GL11.glPopMatrix();
|
||||
switch(te.getBlockMetadata() - BlockDummyable.offset) {
|
||||
case 2: GL11.glRotatef(180, 0F, 1F, 0F); break;
|
||||
case 4: GL11.glRotatef(270, 0F, 1F, 0F); break;
|
||||
case 3: GL11.glRotatef(0, 0F, 1F, 0F); break;
|
||||
case 5: GL11.glRotatef(90, 0F, 1F, 0F); break;
|
||||
}
|
||||
|
||||
GL11.glTranslated(-0.75, 5.5625, -7);
|
||||
|
||||
if(igen.torque > 0) {
|
||||
for(int i = 0; i < 2; i++) {
|
||||
BeamPronter.prontBeam(Vec3.createVectorHelper(1.5, 0, 0), EnumWaveType.RANDOM, EnumBeamType.LINE, 0x8080ff, 0x0000ff, (int)te.getWorldObj().getTotalWorldTime() % 1000 + i, 5, px * 4, 0, 0);
|
||||
BeamPronter.prontBeam(Vec3.createVectorHelper(1.5, 0, 0), EnumWaveType.RANDOM, EnumBeamType.LINE, 0xffffff, 0x0000ff, (int)te.getWorldObj().getTotalWorldTime() % 1000 + 2 + i, 5, px * 4, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
GL11.glShadeModel(GL11.GL_FLAT);
|
||||
GL11.glEnable(GL11.GL_CULL_FACE);
|
||||
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
TileEntityMachineIGenerator igen = (TileEntityMachineIGenerator) te;
|
||||
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GL11.glDisable(GL11.GL_CULL_FACE);
|
||||
GL11.glShadeModel(GL11.GL_SMOOTH);
|
||||
|
||||
bindTexture(ResourceManager.igen_tex);
|
||||
ResourceManager.igen.renderPart("Body");
|
||||
|
||||
float rot = igen.prevRotation + (igen.rotation - igen.prevRotation) * f;
|
||||
GL11.glTranslated(0, 1.5D, 0);
|
||||
GL11.glRotatef(-rot, 0, 0, 1);
|
||||
GL11.glTranslated(0, -1.5D, 0);
|
||||
ResourceManager.igen.renderPart("Rotor");
|
||||
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
|
||||
@ -149,7 +149,7 @@ public class TileEntityMachineDiesel extends TileEntityMachineBase implements IE
|
||||
public int getHEFromFuel() {
|
||||
FluidType type = tank.getTankType();
|
||||
Integer value = fuels.get(type);
|
||||
return value != null ? value : null;
|
||||
return value != null ? value : 0;
|
||||
}
|
||||
|
||||
public void generate() {
|
||||
|
||||
@ -1,22 +1,22 @@
|
||||
package com.hbm.tileentity.machine;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import com.google.common.collect.HashBiMap;
|
||||
import com.hbm.handler.MultiblockHandlerXR;
|
||||
import com.hbm.blocks.BlockDummyable;
|
||||
import com.hbm.handler.FluidTypeHandler.FluidType;
|
||||
import com.hbm.interfaces.IFluidAcceptor;
|
||||
import com.hbm.inventory.FluidTank;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.items.machine.ItemRTGPellet;
|
||||
import com.hbm.lib.Library;
|
||||
import com.hbm.tileentity.TileEntityMachineBase;
|
||||
|
||||
import api.hbm.energy.IEnergyGenerator;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
@ -24,36 +24,29 @@ import net.minecraft.tileentity.TileEntityFurnace;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class TileEntityMachineIGenerator extends TileEntityMachineBase implements IFluidAcceptor {
|
||||
public class TileEntityMachineIGenerator extends TileEntityMachineBase implements IFluidAcceptor, IEnergyGenerator {
|
||||
|
||||
public long power;
|
||||
public static final long maxPower = 1000000;
|
||||
public int lastBurnTime;
|
||||
public int burnTime;
|
||||
public int temperature;
|
||||
public static final int maxTemperature = 1000;
|
||||
public int torque;
|
||||
public static final int maxTorque = 10000;
|
||||
public float limiter = 0.0F; /// 0 - 1 ///
|
||||
|
||||
public static final int animSpeed = 50;
|
||||
public int spin;
|
||||
public int[] burn = new int[4];
|
||||
public boolean hasRTG = false;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public float rotation;
|
||||
@SideOnly(Side.CLIENT)
|
||||
public float prevRotation;
|
||||
|
||||
public IGenRTG[] pellets = new IGenRTG[12];
|
||||
public FluidTank[] tanks;
|
||||
|
||||
public int age = 0;
|
||||
|
||||
public TileEntityMachineIGenerator() {
|
||||
super(15);
|
||||
super(21);
|
||||
tanks = new FluidTank[3];
|
||||
tanks[0] = new FluidTank(FluidType.WATER, 8000, 0);
|
||||
tanks[0] = new FluidTank(FluidType.WATER, 16000, 0);
|
||||
tanks[1] = new FluidTank(FluidType.HEATINGOIL, 16000, 1);
|
||||
tanks[2] = new FluidTank(FluidType.LUBRICANT, 2000, 2);
|
||||
tanks[2] = new FluidTank(FluidType.LUBRICANT, 4000, 2);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -66,64 +59,116 @@ public class TileEntityMachineIGenerator extends TileEntityMachineBase implement
|
||||
|
||||
if(!worldObj.isRemote) {
|
||||
|
||||
age++;
|
||||
if (age >= 20) {
|
||||
age = 0;
|
||||
}
|
||||
|
||||
tanks[0].loadTank(7, 8, slots);
|
||||
power = Library.chargeItemsFromTE(slots, 0, power, maxPower);
|
||||
|
||||
ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata() - BlockDummyable.offset);
|
||||
this.sendPower(worldObj, xCoord + dir.offsetX * -4, yCoord, zCoord + dir.offsetZ * -4, dir.getOpposite());
|
||||
this.sendPower(worldObj, xCoord + dir.offsetX * 3, yCoord, zCoord + dir.offsetZ * 3, dir);
|
||||
|
||||
tanks[1].setType(9, 10, slots);
|
||||
tanks[0].loadTank(1, 2, slots);
|
||||
tanks[1].loadTank(9, 10, slots);
|
||||
tanks[1].setType(11, 12, slots);
|
||||
tanks[2].loadTank(13, 14, slots);
|
||||
tanks[2].loadTank(7, 8, slots);
|
||||
|
||||
loadFuel();
|
||||
pelletAction();
|
||||
this.spin = 0;
|
||||
|
||||
if(burnTime > 0) {
|
||||
burnTime --;
|
||||
temperature += 100;
|
||||
/// LIQUID FUEL ///
|
||||
if(tanks[1].getFill() > 0) {
|
||||
int pow = this.getPowerFromFuel();
|
||||
|
||||
if(pow > 0) {
|
||||
tanks[1].setFill(tanks[1].getFill() - 1);
|
||||
this.spin += pow;
|
||||
}
|
||||
}
|
||||
|
||||
fuelAction();
|
||||
///SOLID FUEL ///
|
||||
for(int i = 0; i < 4; i++) {
|
||||
|
||||
// POWER GEN //
|
||||
if(burn[i] > 0) {
|
||||
burn[i]--;
|
||||
this.spin += coalGenRate;
|
||||
|
||||
// REFUELING //
|
||||
} else {
|
||||
int slot = i + 3;
|
||||
|
||||
if(slots[slot] != null) {
|
||||
ItemStack fuel = slots[slot];
|
||||
int burnTime = TileEntityFurnace.getItemBurnTime(fuel) / 2;
|
||||
|
||||
if(burnTime > 0) {
|
||||
|
||||
if(fuel.getItem() == Items.coal)
|
||||
burnTime *= 1.5;
|
||||
if(fuel.getItem() == ModItems.solid_fuel)
|
||||
burnTime *= 2;
|
||||
|
||||
burn[i] = burnTime;
|
||||
|
||||
slots[slot].stackSize--;
|
||||
|
||||
if(slots[slot].stackSize <= 0) {
|
||||
|
||||
if(slots[slot].getItem().hasContainerItem(slots[slot])) {
|
||||
slots[slot] = slots[slot].getItem().getContainerItem(slots[slot]);
|
||||
} else {
|
||||
slots[slot] = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(temperature > maxTemperature)
|
||||
temperature = maxTemperature;
|
||||
// RTG ///
|
||||
this.hasRTG = false;
|
||||
for(int i = 11; i < 21; i++) {
|
||||
if(slots[i] != null && slots[i].getItem() instanceof ItemRTGPellet) {
|
||||
ItemRTGPellet pellet = (ItemRTGPellet) slots[i].getItem();
|
||||
this.spin += pellet.getHeat() * 10;
|
||||
this.hasRTG = true;
|
||||
}
|
||||
}
|
||||
|
||||
int displayHeat = temperature;
|
||||
|
||||
rtgAction();
|
||||
|
||||
rotorAction();
|
||||
generatorAction();
|
||||
|
||||
this.power = Library.chargeItemsFromTE(slots, 6, power, maxPower);
|
||||
if(this.spin > 0) {
|
||||
|
||||
int powerGen = this.spin;
|
||||
|
||||
if(this.tanks[0].getFill() >= 10) {
|
||||
powerGen += this.spin;
|
||||
this.tanks[0].setFill(this.tanks[0].getFill() - 10);
|
||||
}
|
||||
|
||||
if(this.tanks[2].getFill() >= 1) {
|
||||
powerGen += this.spin * 3;
|
||||
this.tanks[2].setFill(this.tanks[2].getFill() - 1);
|
||||
}
|
||||
|
||||
this.power += Math.pow(powerGen, 1.15D);
|
||||
|
||||
if(this.power > this.maxPower)
|
||||
this.power = this.maxPower;
|
||||
}
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
int[] rtgs = new int[pellets.length];
|
||||
|
||||
for(int i = 0; i < pellets.length; i++) {
|
||||
if(pellets[i] != null)
|
||||
rtgs[i] = pellets[i].ordinal();
|
||||
else
|
||||
rtgs[i] = -1;
|
||||
}
|
||||
|
||||
data.setIntArray("rtgs", rtgs);
|
||||
data.setInteger("temp", displayHeat);
|
||||
data.setInteger("torque", torque);
|
||||
data.setInteger("power", (int)power);
|
||||
data.setShort("burn", (short) burnTime);
|
||||
data.setShort("lastBurn", (short) lastBurnTime);
|
||||
data.setFloat("dial", limiter);
|
||||
this.networkPack(data, 250);
|
||||
data.setLong("power", power);
|
||||
data.setInteger("spin", spin);
|
||||
data.setIntArray("burn", burn);
|
||||
data.setBoolean("hasRTG", hasRTG);
|
||||
this.networkPack(data, 150);
|
||||
|
||||
for(int i = 0; i < 3; i++)
|
||||
tanks[i].updateTank(xCoord, yCoord, zCoord, this.worldObj.provider.dimensionId);
|
||||
|
||||
} else {
|
||||
|
||||
this.prevRotation = this.rotation;
|
||||
|
||||
this.rotation += this.torque * animSpeed / maxTorque;
|
||||
if(this.spin > 0) {
|
||||
this.rotation += 15;
|
||||
}
|
||||
|
||||
if(this.rotation >= 360) {
|
||||
this.rotation -= 360;
|
||||
@ -134,253 +179,34 @@ public class TileEntityMachineIGenerator extends TileEntityMachineBase implement
|
||||
|
||||
@Override
|
||||
public void networkUnpack(NBTTagCompound nbt) {
|
||||
|
||||
int[] rtgs = nbt.getIntArray("rtgs");
|
||||
|
||||
if(rtgs != null) {
|
||||
for(int i = 0; i < pellets.length; i++) {
|
||||
|
||||
int pellet = rtgs[i];
|
||||
if(pellet >= 0 && pellet < IGenRTG.values().length) {
|
||||
pellets[i] = IGenRTG.values()[pellet];
|
||||
} else {
|
||||
pellets[i] = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.temperature = nbt.getInteger("temp");
|
||||
this.torque = nbt.getInteger("torque");
|
||||
this.power = nbt.getInteger("power");
|
||||
this.burnTime = nbt.getShort("burn");
|
||||
this.lastBurnTime = nbt.getShort("lastBurn");
|
||||
|
||||
if(ignoreNext <= 0) {
|
||||
this.limiter = nbt.getFloat("dial");
|
||||
} else {
|
||||
ignoreNext--;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleButtonPacket(int value, int meta) {
|
||||
|
||||
if(meta == 0)
|
||||
pushPellet();
|
||||
if(meta == 1)
|
||||
popPellet();
|
||||
if(meta == 2)
|
||||
setDialByAngle(value);
|
||||
this.power = nbt.getLong("power");
|
||||
this.spin = nbt.getInteger("spin");
|
||||
this.burn = nbt.getIntArray("burn");
|
||||
this.hasRTG = nbt.getBoolean("hasRTG");
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks for solid fuel and burns it
|
||||
*/
|
||||
private void loadFuel() {
|
||||
|
||||
if(this.burnTime <= 0 && slots[0] != null) {
|
||||
|
||||
int time = TileEntityFurnace.getItemBurnTime(slots[0]) / 2;
|
||||
|
||||
if(time > 0) {
|
||||
|
||||
if(slots[0].getItem().hasContainerItem(slots[0]) && slots[0].stackSize == 1) {
|
||||
slots[0] = slots[0].getItem().getContainerItem(slots[0]);
|
||||
} else {
|
||||
this.decrStackSize(0, 1);
|
||||
}
|
||||
|
||||
this.burnTime = time;
|
||||
this.lastBurnTime = time;
|
||||
|
||||
this.markDirty();
|
||||
}
|
||||
}
|
||||
public static final int coalGenRate = 50;
|
||||
public static final HashMap<FluidType, Integer> fuels = new HashMap();
|
||||
|
||||
static {
|
||||
fuels.put(FluidType.SMEAR, 50);
|
||||
fuels.put(FluidType.HEATINGOIL, 75);
|
||||
fuels.put(FluidType.HYDROGEN, 5);
|
||||
fuels.put(FluidType.DIESEL, 225);
|
||||
fuels.put(FluidType.KEROSENE, 300);
|
||||
fuels.put(FluidType.RECLAIMED, 100);
|
||||
fuels.put(FluidType.PETROIL, 125);
|
||||
fuels.put(FluidType.BIOFUEL, 200);
|
||||
fuels.put(FluidType.GASOLINE, 700);
|
||||
fuels.put(FluidType.NITAN, 2500);
|
||||
fuels.put(FluidType.LPG, 200);
|
||||
fuels.put(FluidType.ETHANOL, 75);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates heat from RTG pellets
|
||||
*/
|
||||
private void pelletAction() {
|
||||
|
||||
for(int i = 0; i < pellets.length; i++) {
|
||||
if(pellets[i] != null)
|
||||
this.temperature += pellets[i].heat;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Burns liquid fuel
|
||||
*/
|
||||
private void fuelAction() {
|
||||
|
||||
int heat = getHeatFromFuel(tanks[1].getTankType());
|
||||
|
||||
int maxBurn = 2;
|
||||
|
||||
if(tanks[1].getFill() > 0) {
|
||||
|
||||
int burn = Math.min(maxBurn, tanks[1].getFill());
|
||||
|
||||
tanks[1].setFill(tanks[1].getFill() - burn);
|
||||
temperature += heat * burn;
|
||||
}
|
||||
}
|
||||
|
||||
public int getHeatFromFuel(FluidType type) {
|
||||
|
||||
switch(type) {
|
||||
case SMEAR: return 75;
|
||||
case HEATINGOIL: return 150;
|
||||
case DIESEL: return 225;
|
||||
case KEROSENE: return 300;
|
||||
case RECLAIMED: return 100;
|
||||
case PETROIL: return 125;
|
||||
case BIOFUEL: return 200;
|
||||
case NITAN: return 2500;
|
||||
default: return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* does the thing with the thermo elements
|
||||
*/
|
||||
private void rtgAction() {
|
||||
|
||||
int rtg = 0;
|
||||
|
||||
for(int i = 3; i <= 5; i++) {
|
||||
|
||||
if(slots[i] != null && slots[i].getItem() == ModItems.thermo_element)
|
||||
rtg += 15;
|
||||
}
|
||||
|
||||
int pow = Math.min(this.temperature, rtg);
|
||||
|
||||
this.temperature -= pow;
|
||||
this.power += pow;
|
||||
|
||||
if(power > maxPower)
|
||||
power = maxPower;
|
||||
}
|
||||
|
||||
/**
|
||||
* Turns heat into rotational energy
|
||||
*/
|
||||
private void rotorAction() {
|
||||
|
||||
int conversion = getConversion();
|
||||
|
||||
if(temperature > 10 && tanks[0].getFill() > 0)
|
||||
tanks[0].setFill(tanks[0].getFill() - 1);
|
||||
|
||||
if(torque > 10 && tanks[2].getFill() > 0 && worldObj.rand.nextInt(2) == 0)
|
||||
tanks[2].setFill(tanks[2].getFill() - 1);
|
||||
|
||||
this.torque += conversion * (tanks[0].getFill() > 0 ? 1.5 : 1);
|
||||
this.temperature -= conversion;
|
||||
|
||||
if(torque > maxTorque)
|
||||
worldObj.createExplosion(null, xCoord + 0.5, yCoord + 0.5, zCoord + 0.5, 5, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Do the power stuff
|
||||
*/
|
||||
private void generatorAction() {
|
||||
|
||||
double balanceFactor = 0.025D;
|
||||
|
||||
this.power += this.torque * balanceFactor;
|
||||
torque -= getBrake();
|
||||
|
||||
if(power > maxPower)
|
||||
power = maxPower;
|
||||
}
|
||||
|
||||
public int getBrake() {
|
||||
return (int) Math.ceil(torque * 0.1 * (tanks[2].getFill() > 0 ? 0.5 : 1));
|
||||
}
|
||||
|
||||
public int getConversion() {
|
||||
return (int) (temperature * limiter);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a pellet onto the pile
|
||||
*/
|
||||
private void pushPellet() {
|
||||
|
||||
if(pellets[11] != null)
|
||||
return;
|
||||
|
||||
if(slots[1] != null) {
|
||||
|
||||
IGenRTG pellet = IGenRTG.getPellet(slots[1].getItem());
|
||||
|
||||
if(pellet != null) {
|
||||
|
||||
for(int i = 0; i < pellets.length; i++) {
|
||||
|
||||
if(pellets[i] == null) {
|
||||
pellets[i] = pellet;
|
||||
this.decrStackSize(1, 1);
|
||||
|
||||
this.markDirty();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes a pellet from the bottom of the pile
|
||||
*/
|
||||
private void popPellet() {
|
||||
|
||||
if(slots[2] != null)
|
||||
return;
|
||||
|
||||
if(pellets[0] == null)
|
||||
return;
|
||||
|
||||
//i don't feel like adding null checks because they won't trigger anyway
|
||||
slots[2] = new ItemStack(this.rtgPellets.inverse().get(pellets[0]));
|
||||
|
||||
for(int i = 0; i < pellets.length - 1; i++) {
|
||||
pellets[i] = pellets[i + 1];
|
||||
}
|
||||
|
||||
pellets[pellets.length - 1] = null;
|
||||
|
||||
this.markDirty();
|
||||
}
|
||||
|
||||
public double getSolidGauge() {
|
||||
return (double) burnTime / (double) lastBurnTime;
|
||||
}
|
||||
|
||||
public double getPowerGauge() {
|
||||
return (double) power / (double) maxPower;
|
||||
}
|
||||
|
||||
public double getTempGauge() {
|
||||
return (double) temperature / (double) maxTemperature;
|
||||
}
|
||||
|
||||
public double getTorqueGauge() {
|
||||
return (double) torque / (double) maxTorque;
|
||||
}
|
||||
|
||||
public float getAngleFromDial() {
|
||||
return (45F + limiter * 270F) % 360F;
|
||||
}
|
||||
|
||||
int ignoreNext = 0;
|
||||
public void setDialByAngle(float angle) {
|
||||
this.limiter = (angle - 45F) / 270F;
|
||||
ignoreNext = 5;
|
||||
public int getPowerFromFuel() {
|
||||
FluidType type = tanks[1].getTankType();
|
||||
Integer value = fuels.get(type);
|
||||
return value != null ? value : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -433,59 +259,22 @@ public class TileEntityMachineIGenerator extends TileEntityMachineBase implement
|
||||
public void readFromNBT(NBTTagCompound nbt) {
|
||||
super.readFromNBT(nbt);
|
||||
|
||||
for(int i = 0; i < pellets.length; i++) {
|
||||
|
||||
short s = nbt.getShort("pellet" + i);
|
||||
|
||||
if(s >= 0 && s < IGenRTG.values().length) {
|
||||
pellets[i] = IGenRTG.values()[s];
|
||||
} else {
|
||||
pellets[i] = null;
|
||||
}
|
||||
}
|
||||
|
||||
this.burnTime = nbt.getInteger("burn");
|
||||
this.lastBurnTime = nbt.getInteger("lastBurn");
|
||||
this.limiter = nbt.getFloat("limiter");
|
||||
for(int i = 0; i < 3; i++)
|
||||
tanks[i].readFromNBT(nbt, "tank_" + i);
|
||||
|
||||
this.power = nbt.getLong("power");
|
||||
this.burn = nbt.getIntArray("burn");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound nbt) {
|
||||
super.writeToNBT(nbt);
|
||||
|
||||
for(int i = 0; i < pellets.length; i++) {
|
||||
|
||||
if(pellets[i] != null) {
|
||||
nbt.setShort("pellet" + i, (short) pellets[i].ordinal());
|
||||
} else {
|
||||
nbt.setShort("pellet" + i, (short)-1);
|
||||
}
|
||||
}
|
||||
|
||||
nbt.setInteger("burn", burnTime);
|
||||
nbt.setInteger("lastBurn", lastBurnTime);
|
||||
nbt.setFloat("limiter", limiter);
|
||||
}
|
||||
|
||||
private static HashBiMap<Item, IGenRTG> rtgPellets = HashBiMap.create();
|
||||
|
||||
public static enum IGenRTG {
|
||||
PLUTONIUM(ModItems.pellet_rtg, 0, 5),
|
||||
URANIUM(ModItems.pellet_rtg_weak, 9, 3),
|
||||
POLONIUM(ModItems.pellet_rtg_polonium, 18, 25);
|
||||
for(int i = 0; i < 3; i++)
|
||||
tanks[i].writeToNBT(nbt, "tank_" + i);
|
||||
|
||||
public int offset;
|
||||
public int heat;
|
||||
|
||||
private IGenRTG(Item item, int offset, int heat) {
|
||||
rtgPellets.put(item, this);
|
||||
this.offset = offset;
|
||||
this.heat = heat;
|
||||
}
|
||||
|
||||
public static IGenRTG getPellet(Item item) {
|
||||
return rtgPellets.get(item);
|
||||
}
|
||||
nbt.setLong("power", power);
|
||||
nbt.setIntArray("burn", burn);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -499,4 +288,19 @@ public class TileEntityMachineIGenerator extends TileEntityMachineBase implement
|
||||
{
|
||||
return 65536.0D;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPower(long power) {
|
||||
this.power = power;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getPower() {
|
||||
return this.power;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getMaxPower() {
|
||||
return this.maxPower;
|
||||
}
|
||||
}
|
||||
|
||||
@ -276,7 +276,7 @@ public class TileEntityMachineSeleniumEngine extends TileEntity implements ISide
|
||||
public int getHEFromFuel() {
|
||||
FluidType type = tank.getTankType();
|
||||
Integer value = fuels.get(type);
|
||||
return value != null ? value : null;
|
||||
return value != null ? value : 0;
|
||||
}
|
||||
|
||||
public void generate() {
|
||||
|
||||
@ -50,7 +50,7 @@ public class TileEntityConnector extends TileEntityPylonBase {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canConnect(ForgeDirection dir) {
|
||||
return dir == ForgeDirection.getOrientation(this.getBlockMetadata()).getOpposite();
|
||||
public boolean canConnect(ForgeDirection dir) { //i've about had it with your fucking bullshit
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1595,6 +1595,8 @@ item.insert_xsapi.name=XSAPI-Einlage
|
||||
item.insert_yharonite.name=Yharoniteinlage
|
||||
item.iv_blood.name=Blutbeutel
|
||||
item.iv_empty.name=Infusionsbeutel
|
||||
item.iv_xp.name=Erfahrungsbeutel
|
||||
item.iv_xp_empty.name=Leerer Erfahrungsbeutel
|
||||
item.jackt.name=Verdammt stylische Kugeljacke
|
||||
item.jackt2.name=Verdammt stylische Kugeljacke 2: Tokyo Drift
|
||||
item.jetpack_boost.name=Boosterrucksack
|
||||
@ -1993,9 +1995,12 @@ item.pellet_mes.name=MES-Watzpellet
|
||||
item.pellet_meteorite.name=Meteoritenkugeln
|
||||
item.pellet_neptunium.name=Neptunium-Watzpellet
|
||||
item.pellet_rtg.name=Plutonium-238 Pellet
|
||||
item.pellet_rtg_actinium.name=Actinium Pellet
|
||||
item.pellet_rtg_americium.name=Americium-241 Pellet
|
||||
item.pellet_rtg_berkelium.name=Berkelium Pellet
|
||||
item.pellet_rtg_gold.name=Gold-198 Pellet
|
||||
item.pellet_rtg_polonium.name=Polonium-210 Pellet
|
||||
item.pellet_rtg_strontium.name=Strontium-90 Pellet
|
||||
item.pellet_rtg_weak.name=Schwaches Uran RTG-Pellet
|
||||
item.pellet_schrabidium.name=Pures Schrabidium-Watzpellet
|
||||
item.photo_panel.name=Photovoltaikpanele
|
||||
@ -3345,6 +3350,7 @@ tile.reactor_hatch.name=Kraftwerkszugriffsluke
|
||||
tile.reactor_inserter.name=Reaktor-Brennstoffeinlass
|
||||
tile.red_barrel.name=Explosives Fass
|
||||
tile.red_cable.name=Rotes Kupferkabel
|
||||
tile.red_connector.name=Stromverbindungsstück
|
||||
tile.red_pylon.name=Strommasten
|
||||
tile.red_wire_coated.name=Geschirmtes rotes Kupferkabel
|
||||
tile.reinforced_brick.name=Verstärkter Stein
|
||||
|
||||
@ -1667,6 +1667,8 @@ item.insert_xsapi.name=XSAPI Insert
|
||||
item.insert_yharonite.name=Yharonite Insert
|
||||
item.iv_blood.name=Blood Bag
|
||||
item.iv_empty.name=IV Bag
|
||||
item.iv_xp.name=Experience Bag
|
||||
item.iv_xp_empty.name=Empty Experience Bag
|
||||
item.jackt.name=Damn Stylish Ballistic Jacket
|
||||
item.jackt2.name=Damn Stylish Ballistic Jacket 2: Tokyo Drift
|
||||
item.jetpack_boost.name=Boostpack
|
||||
@ -2065,9 +2067,12 @@ item.pellet_mes.name=MES Watz Pellet
|
||||
item.pellet_meteorite.name=Meteorite Rounds
|
||||
item.pellet_neptunium.name=Neptunium Watz Pellet
|
||||
item.pellet_rtg.name=Plutonium-238 Fuel Pellet
|
||||
item.pellet_rtg_actinium.name=Actinium Fuel Pellet
|
||||
item.pellet_rtg_americium.name=Americium-241 Fuel Pellet
|
||||
item.pellet_rtg_berkelium.name=Berkelium Fuel Pellet
|
||||
item.pellet_rtg_gold.name=Gold-198 Fuel Pellet
|
||||
item.pellet_rtg_polonium.name=Polonium-210 Fuel Pellet
|
||||
item.pellet_rtg_strontium.name=Strontium-90 Fuel Pellet
|
||||
item.pellet_rtg_weak.name=Weak Uranium RTG Pellet
|
||||
item.pellet_schrabidium.name=Pure Schrabidium Watz Pellet
|
||||
item.photo_panel.name=Photovoltaic Panel
|
||||
@ -3417,6 +3422,7 @@ tile.reactor_hatch.name=Reactor Access Hatch
|
||||
tile.reactor_inserter.name=Reactor Fuel Inserter
|
||||
tile.red_barrel.name=Explosive Barrel
|
||||
tile.red_cable.name=Red Copper Cable
|
||||
tile.red_connector.name=Electricity Connector
|
||||
tile.red_pylon.name=Electricity Pole
|
||||
tile.red_wire_coated.name=Coated Red Copper Cable
|
||||
tile.reinforced_brick.name=Reinforced Stone
|
||||
|
||||
|
Before Width: | Height: | Size: 4.5 KiB After Width: | Height: | Size: 5.0 KiB |
|
Before Width: | Height: | Size: 2.9 KiB |
|
Before Width: | Height: | Size: 3.9 KiB |
|
Before Width: | Height: | Size: 6.4 KiB After Width: | Height: | Size: 2.6 KiB |
|
Before Width: | Height: | Size: 2.7 KiB |
BIN
src/main/resources/assets/hbm/textures/models/trinkets/nos.png
Normal file
|
After Width: | Height: | Size: 3.6 KiB |
@ -3,7 +3,7 @@
|
||||
"modid": "hbm",
|
||||
"name": "Hbm's Nuclear Tech",
|
||||
"description": "A mod that adds weapons, nuclear themed stuff and machines",
|
||||
"version":"1.0.27_X4060",
|
||||
"version":"1.0.27_X4074",
|
||||
"mcversion": "1.7.10",
|
||||
"url": "",
|
||||
"updateUrl": "",
|
||||
|
||||