more igen work, an actual turning dial, more inventory 3d models

This commit is contained in:
Bob 2020-10-16 23:54:52 +02:00
parent c90fbf6289
commit d54e882ae5
26 changed files with 871 additions and 76 deletions

View File

@ -0,0 +1,170 @@
# Blender v2.79 (sub 0) OBJ File: 'BJ.blend'
# www.blender.org
o Head
v -0.250000 1.500000 0.250000
v -0.250000 1.500000 -0.250000
v 0.250000 1.500000 0.250000
v 0.250000 1.500000 -0.250000
v -0.250000 2.000000 0.250000
v -0.250000 2.000000 -0.250000
v 0.250000 2.000000 -0.250000
v 0.250000 2.000000 0.250000
vn 0.0000 -1.0000 0.0000
vn 0.0000 1.0000 0.0000
vn 1.0000 0.0000 0.0000
vn -1.0000 0.0000 0.0000
vn 0.0000 0.0000 1.0000
vn 0.0000 0.0000 -1.0000
s off
f 3//1 2//1 4//1
f 6//2 8//2 7//2
f 4//3 8//3 3//3
f 1//4 6//4 2//4
f 3//5 5//5 1//5
f 2//6 7//6 4//6
f 3//1 1//1 2//1
f 6//2 5//2 8//2
f 4//3 7//3 8//3
f 1//4 5//4 6//4
f 3//5 8//5 5//5
f 2//6 6//6 7//6
o RightArm
v 0.125000 0.750000 0.500000
v 0.125000 1.500000 0.500000
v -0.125000 0.750000 0.500000
v -0.125000 1.500000 0.500000
v 0.125000 0.750000 0.250000
v 0.125000 1.500000 0.250000
v -0.125000 0.750000 0.250000
v -0.125000 1.500000 0.250000
vn 0.0000 0.0000 1.0000
vn -1.0000 0.0000 0.0000
vn 0.0000 0.0000 -1.0000
vn 1.0000 0.0000 -0.0000
vn 0.0000 -1.0000 0.0000
vn 0.0000 1.0000 0.0000
s off
f 10//7 11//7 9//7
f 12//8 15//8 11//8
f 16//9 13//9 15//9
f 14//10 9//10 13//10
f 15//11 9//11 11//11
f 12//12 14//12 16//12
f 10//7 12//7 11//7
f 12//8 16//8 15//8
f 16//9 14//9 13//9
f 14//10 10//10 9//10
f 15//11 13//11 9//11
f 12//12 10//12 14//12
o LeftArm
v 0.125000 0.750000 -0.250000
v 0.125000 1.500000 -0.250000
v -0.125000 0.750000 -0.250000
v -0.125000 1.500000 -0.250000
v 0.125000 0.750000 -0.500000
v 0.125000 1.500000 -0.500000
v -0.125000 0.750000 -0.500000
v -0.125000 1.500000 -0.500000
vn 0.0000 0.0000 1.0000
vn -1.0000 0.0000 0.0000
vn 0.0000 0.0000 -1.0000
vn 1.0000 0.0000 -0.0000
vn 0.0000 -1.0000 0.0000
vn 0.0000 1.0000 -0.0000
s off
f 18//13 19//13 17//13
f 20//14 23//14 19//14
f 24//15 21//15 23//15
f 22//16 17//16 21//16
f 23//17 17//17 19//17
f 20//18 22//18 24//18
f 18//13 20//13 19//13
f 20//14 24//14 23//14
f 24//15 22//15 21//15
f 22//16 18//16 17//16
f 23//17 21//17 17//17
f 20//18 18//18 22//18
o Body
v 0.125000 0.750000 0.250000
v 0.125000 1.500000 0.250000
v -0.125000 0.750000 0.250000
v -0.125000 1.500000 0.250000
v 0.125000 0.750000 -0.250000
v 0.125000 1.500000 -0.250000
v -0.125000 0.750000 -0.250000
v -0.125000 1.500000 -0.250000
vn 0.0000 0.0000 1.0000
vn -1.0000 0.0000 0.0000
vn 0.0000 0.0000 -1.0000
vn 1.0000 0.0000 -0.0000
vn 0.0000 -1.0000 -0.0000
vn 0.0000 1.0000 0.0000
s off
f 26//19 27//19 25//19
f 28//20 31//20 27//20
f 32//21 29//21 31//21
f 30//22 25//22 29//22
f 31//23 25//23 27//23
f 28//24 30//24 32//24
f 26//19 28//19 27//19
f 28//20 32//20 31//20
f 32//21 30//21 29//21
f 30//22 26//22 25//22
f 31//23 29//23 25//23
f 28//24 26//24 30//24
o RightLeg
v 0.125000 0.000000 0.250000
v 0.125000 0.750000 0.250000
v -0.125000 0.000000 0.250000
v -0.125000 0.750000 0.250000
v 0.125000 0.000000 -0.000000
v 0.125000 0.750000 -0.000000
v -0.125000 0.000000 0.000000
v -0.125000 0.750000 0.000000
vn 0.0000 0.0000 1.0000
vn -1.0000 0.0000 0.0000
vn -0.0000 0.0000 -1.0000
vn 1.0000 0.0000 -0.0000
vn 0.0000 -1.0000 0.0000
vn 0.0000 1.0000 0.0000
s off
f 34//25 35//25 33//25
f 36//26 39//26 35//26
f 40//27 37//27 39//27
f 38//28 33//28 37//28
f 39//29 33//29 35//29
f 36//30 38//30 40//30
f 34//25 36//25 35//25
f 36//26 40//26 39//26
f 40//27 38//27 37//27
f 38//28 34//28 33//28
f 39//29 37//29 33//29
f 36//30 34//30 38//30
o LeftLeg
v 0.125000 0.000000 -0.000000
v 0.125000 0.750000 -0.000000
v -0.125000 0.000000 0.000000
v -0.125000 0.750000 0.000000
v 0.125000 0.000000 -0.250000
v 0.125000 0.750000 -0.250000
v -0.125000 0.000000 -0.250000
v -0.125000 0.750000 -0.250000
vn 0.0000 0.0000 1.0000
vn -1.0000 0.0000 0.0000
vn 0.0000 0.0000 -1.0000
vn 1.0000 0.0000 -0.0000
vn 0.0000 -1.0000 0.0000
vn 0.0000 1.0000 -0.0000
s off
f 42//31 43//31 41//31
f 44//32 47//32 43//32
f 48//33 45//33 47//33
f 46//34 41//34 45//34
f 47//35 41//35 43//35
f 44//36 46//36 48//36
f 42//31 44//31 43//31
f 44//32 48//32 47//32
f 48//33 46//33 45//33
f 46//34 42//34 41//34
f 47//35 45//35 41//35
f 44//36 42//36 46//36

Binary file not shown.

After

Width:  |  Height:  |  Size: 135 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 138 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.2 KiB

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 207 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 225 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 225 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 251 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 274 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 268 B

After

Width:  |  Height:  |  Size: 309 B

View File

@ -398,6 +398,7 @@ public class ModBlocks {
public static final int guiID_puf6_tank = 8;
public static Block machine_reactor;
public static Block machine_reactor_on;
public static final int guiID_reactor = 9;
public static Block machine_nuke_furnace_off;
@ -1106,6 +1107,7 @@ public class ModBlocks {
machine_puf6_tank = new MachinePuF6Tank(Material.iron).setBlockName("machine_puf6_tank").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab);
machine_reactor = new MachineReactor(Material.iron).setBlockName("machine_reactor").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":machine_reactor");
machine_reactor_on = new MachineReactor(Material.iron).setBlockName("machine_reactor_on").setHardness(5.0F).setResistance(10.0F).setCreativeTab(null).setBlockTextureName(RefStrings.MODID + ":machine_reactor_on");
machine_nuke_furnace_off = new MachineNukeFurnace(false).setBlockName("machine_nuke_furnace_off").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab);
machine_nuke_furnace_on = new MachineNukeFurnace(true).setBlockName("machine_nuke_furnace_on").setHardness(5.0F).setLightLevel(1.0F).setResistance(10.0F);
@ -1820,6 +1822,7 @@ public class ModBlocks {
GameRegistry.registerBlock(machine_uf6_tank, machine_uf6_tank.getUnlocalizedName());
GameRegistry.registerBlock(machine_puf6_tank, machine_puf6_tank.getUnlocalizedName());
GameRegistry.registerBlock(machine_reactor, machine_reactor.getUnlocalizedName());
//GameRegistry.registerBlock(machine_reactor_on, machine_reactor_on.getUnlocalizedName());
GameRegistry.registerBlock(machine_nuke_furnace_off, machine_nuke_furnace_off.getUnlocalizedName());
GameRegistry.registerBlock(machine_nuke_furnace_on, machine_nuke_furnace_on.getUnlocalizedName());
GameRegistry.registerBlock(machine_rtg_furnace_off, machine_rtg_furnace_off.getUnlocalizedName());

View File

@ -1,5 +1,6 @@
package com.hbm.inventory.gui;
import org.lwjgl.input.Mouse;
import org.lwjgl.opengl.GL11;
import com.hbm.inventory.container.ContainerIGenerator;
@ -12,14 +13,17 @@ 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));
@ -30,8 +34,23 @@ public class GUIIGenerator extends GuiInfoContainer {
}
@Override
public void drawScreen(int mouseX, int mouseY, float f) {
super.drawScreen(mouseX, mouseY, f);
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;
}
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);
}
protected void mouseClicked(int x, int y, int i) {
@ -58,10 +77,12 @@ public class GUIIGenerator extends GuiInfoContainer {
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);
this.fontRendererObj.drawString(igen.getConversion() + "", 100, this.ySize - 96 + 2, 0xffffff);
this.fontRendererObj.drawString(igen.getBrake() + "", 100, this.ySize - 96 + 12, 0xffffff);
}
@Override
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) {
protected void drawGuiContainerBackgroundLayer(float iinterpolation, 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);
@ -72,14 +93,51 @@ public class GUIIGenerator extends GuiInfoContainer {
drawTexturedModalRect(guiLeft + 6, guiTop + 106 - 4 * i, 188, igen.pellets[i].offset, 14, 9);
}
drawDial(x, y);
GaugeUtil.renderGauge(Gauge.BOW_SMALL, guiLeft + 40, guiTop + 26, this.zLevel, igen.getSolidGauge());
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, Math.sin(System.currentTimeMillis() * 0.0025D) * 0.5 + 0.5);
GaugeUtil.renderGauge(Gauge.WIDE_SMALL, guiLeft + 148, guiTop + 62, this.zLevel, Math.sin(System.currentTimeMillis() * 0.0025D) * 0.5 + 0.5);
GaugeUtil.renderGauge(Gauge.WIDE_SMALL, guiLeft + 148, guiTop + 98, this.zLevel, Math.sin(System.currentTimeMillis() * 0.0025D) * 0.5 + 0.5);
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) {
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;
}
}

View File

@ -1582,6 +1582,10 @@ public class ModItems {
public static Item starmetal_plate;
public static Item starmetal_legs;
public static Item starmetal_boots;
public static Item bj_helmet;
public static Item bj_plate;
public static Item bj_legs;
public static Item bj_boots;
public static Item australium_iii;
public static Item australium_iv;
@ -1651,6 +1655,7 @@ public class ModItems {
public static Item shimmer_sledge;
public static Item shimmer_axe;
public static Item bottle_opener;
public static Item pch; //for compat please do not hit me
public static Item wood_gavel;
public static Item lead_gavel;
public static Item diamond_gavel;
@ -3604,6 +3609,12 @@ public class ModItems {
starmetal_plate = new ArmorFSB(MainRegistry.aMatStarmetal, 7, 1, RefStrings.MODID + ":textures/armor/starmetal_1.png").cloneStats((ArmorFSB) starmetal_helmet).setUnlocalizedName("starmetal_plate").setTextureName(RefStrings.MODID + ":starmetal_plate");
starmetal_legs = new ArmorFSB(MainRegistry.aMatStarmetal, 7, 2, RefStrings.MODID + ":textures/armor/starmetal_2.png").cloneStats((ArmorFSB) starmetal_helmet).setUnlocalizedName("starmetal_legs").setTextureName(RefStrings.MODID + ":starmetal_legs");
starmetal_boots = new ArmorFSB(MainRegistry.aMatStarmetal, 7, 3, RefStrings.MODID + ":textures/armor/starmetal_1.png").cloneStats((ArmorFSB) starmetal_helmet).setUnlocalizedName("starmetal_boots").setTextureName(RefStrings.MODID + ":starmetal_boots");
bj_helmet = new ArmorBJ(MainRegistry.aMatStarmetal, 7, 0, RefStrings.MODID + ":textures/armor/starmetal_1.png", 10000, 100, 10).setMod(0.5F).setCap(15F)
.setFireproof(true).setUnlocalizedName("bj_helmet").setTextureName(RefStrings.MODID + ":bj_helmet");
bj_plate = new ArmorBJ(MainRegistry.aMatStarmetal, 7, 1, RefStrings.MODID + ":textures/armor/starmetal_1.png", 10000, 100, 10).cloneStats((ArmorFSB) bj_helmet).setUnlocalizedName("bj_plate").setTextureName(RefStrings.MODID + ":bj_plate");
bj_legs = new ArmorBJ(MainRegistry.aMatStarmetal, 7, 2, RefStrings.MODID + ":textures/armor/starmetal_2.png", 10000, 100, 10).cloneStats((ArmorFSB) bj_helmet).setUnlocalizedName("bj_legs").setTextureName(RefStrings.MODID + ":bj_legs");
bj_boots = new ArmorBJ(MainRegistry.aMatStarmetal, 7, 3, RefStrings.MODID + ":textures/armor/starmetal_1.png", 10000, 100, 10).cloneStats((ArmorFSB) bj_helmet).setUnlocalizedName("bj_boots").setTextureName(RefStrings.MODID + ":bj_boots");
jackt = new ModArmor(MainRegistry.aMatSteel, 7, 1).setUnlocalizedName("jackt").setTextureName(RefStrings.MODID + ":jackt");
jackt2 = new ModArmor(MainRegistry.aMatSteel, 7, 1).setUnlocalizedName("jackt2").setTextureName(RefStrings.MODID + ":jackt2");
@ -3852,6 +3863,7 @@ public class ModItems {
shimmer_sledge = new WeaponSpecial(MainRegistry.enumToolMaterialSledge).setUnlocalizedName("shimmer_sledge").setMaxStackSize(1).setTextureName(RefStrings.MODID + ":shimmer_sledge_original");
shimmer_axe = new WeaponSpecial(MainRegistry.enumToolMaterialSledge).setUnlocalizedName("shimmer_axe").setMaxStackSize(1).setTextureName(RefStrings.MODID + ":shimmer_axe");
bottle_opener = new WeaponSpecial(MainRegistry.enumToolMaterialBottleOpener).setUnlocalizedName("bottle_opener").setCreativeTab(MainRegistry.consumableTab).setMaxStackSize(1).setTextureName(RefStrings.MODID + ":bottle_opener");
pch = new WeaponSpecial(MainRegistry.tMatHammmer).setUnlocalizedName("pch").setMaxStackSize(1).setCreativeTab(null).setTextureName(RefStrings.MODID + ":schrabidium_hammer");
euphemium_stopper = new ItemSyringe().setUnlocalizedName("euphemium_stopper").setMaxStackSize(1).setFull3D().setTextureName(RefStrings.MODID + ":euphemium_stopper");
matchstick = new ItemMatch().setUnlocalizedName("matchstick").setCreativeTab(CreativeTabs.tabTools).setFull3D().setTextureName(RefStrings.MODID + ":matchstick");
balefire_and_steel = new ItemBalefireMatch().setUnlocalizedName("balefire_and_steel").setCreativeTab(CreativeTabs.tabTools).setFull3D().setTextureName(RefStrings.MODID + ":balefire_and_steel");
@ -5502,6 +5514,7 @@ public class ModItems {
GameRegistry.registerItem(schrabidium_hammer, schrabidium_hammer.getUnlocalizedName());
GameRegistry.registerItem(shimmer_sledge, shimmer_sledge.getUnlocalizedName());
GameRegistry.registerItem(shimmer_axe, shimmer_axe.getUnlocalizedName());
//GameRegistry.registerItem(pch, pch.getUnlocalizedName()); //sike, nevermind
GameRegistry.registerItem(wood_gavel, wood_gavel.getUnlocalizedName());
GameRegistry.registerItem(lead_gavel, lead_gavel.getUnlocalizedName());
GameRegistry.registerItem(diamond_gavel, diamond_gavel.getUnlocalizedName());
@ -5783,6 +5796,10 @@ public class ModItems {
GameRegistry.registerItem(t45_plate, t45_plate.getUnlocalizedName());
GameRegistry.registerItem(t45_legs, t45_legs.getUnlocalizedName());
GameRegistry.registerItem(t45_boots, t45_boots.getUnlocalizedName());
GameRegistry.registerItem(bj_helmet, bj_helmet.getUnlocalizedName());
GameRegistry.registerItem(bj_plate, bj_plate.getUnlocalizedName());
GameRegistry.registerItem(bj_legs, bj_legs.getUnlocalizedName());
GameRegistry.registerItem(bj_boots, bj_boots.getUnlocalizedName());
//Nobody will ever read this anyway, so it shouldn't matter.
GameRegistry.registerItem(chainsaw, chainsaw.getUnlocalizedName());

View File

@ -0,0 +1,33 @@
package com.hbm.items.armor;
import com.hbm.render.model.ModelArmorBJ;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.model.ModelBiped;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.ItemStack;
public class ArmorBJ extends ArmorFSBPowered {
public ArmorBJ(ArmorMaterial material, int layer, int slot, String texture, long maxPower, long chargeRate, long consumption) {
super(material, layer, slot, texture, maxPower, chargeRate, consumption);
}
@SideOnly(Side.CLIENT)
ModelArmorBJ[] models;
@Override
@SideOnly(Side.CLIENT)
public ModelBiped getArmorModel(EntityLivingBase entityLiving, ItemStack itemStack, int armorSlot) {
if(models == null) {
models = new ModelArmorBJ[4];
for(int i = 0; i < 4; i++)
models[i] = new ModelArmorBJ(i);
}
return models[armorSlot];
}
}

View File

@ -0,0 +1,122 @@
package com.hbm.items.armor;
import java.util.List;
import com.hbm.lib.Library;
import api.hbm.energy.IBatteryItem;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
public class ArmorFSBPowered extends ArmorFSB implements IBatteryItem {
public long maxPower = 1;
public long chargeRate;
public long consumption;
public ArmorFSBPowered(ArmorMaterial material, int layer, int slot, String texture, long maxPower, long chargeRate, long consumption) {
super(material, layer, slot, texture);
this.maxPower = maxPower;
this.chargeRate = chargeRate;
this.consumption = consumption;
this.setMaxDamage(1);
}
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean ext) {
list.add("Charge: " + Library.getShortNumber(getCharge(stack)) + " / " + Library.getShortNumber(maxPower));
super.addInformation(stack, player, list, ext);
}
@Override
public void chargeBattery(ItemStack stack, long i) {
if(stack.getItem() instanceof ArmorFSBPowered) {
if(stack.hasTagCompound()) {
stack.stackTagCompound.setLong("charge", stack.stackTagCompound.getLong("charge") + i);
} else {
stack.stackTagCompound = new NBTTagCompound();
stack.stackTagCompound.setLong("charge", i);
}
}
}
@Override
public void setCharge(ItemStack stack, long i) {
if(stack.getItem() instanceof ArmorFSBPowered) {
if(stack.hasTagCompound()) {
stack.stackTagCompound.setLong("charge", i);
} else {
stack.stackTagCompound = new NBTTagCompound();
stack.stackTagCompound.setLong("charge", i);
}
}
}
@Override
public void dischargeBattery(ItemStack stack, long i) {
if(stack.getItem() instanceof ArmorFSBPowered) {
if(stack.hasTagCompound()) {
stack.stackTagCompound.setLong("charge", stack.stackTagCompound.getLong("charge") - i);
} else {
stack.stackTagCompound = new NBTTagCompound();
stack.stackTagCompound.setLong("charge", this.maxPower - i);
}
if(stack.stackTagCompound.getLong("charge") < 0)
stack.stackTagCompound.setLong("charge", 0);
}
}
@Override
public long getCharge(ItemStack stack) {
if(stack.getItem() instanceof ArmorFSBPowered) {
if(stack.hasTagCompound()) {
return stack.stackTagCompound.getLong("charge");
} else {
stack.stackTagCompound = new NBTTagCompound();
stack.stackTagCompound.setLong("charge", ((ArmorFSBPowered)stack.getItem()).maxPower);
return stack.stackTagCompound.getLong("charge");
}
}
return 0;
}
@Override
public boolean showDurabilityBar(ItemStack stack) {
return getCharge(stack) < maxPower;
}
@Override
public double getDurabilityForDisplay(ItemStack stack) {
return 1 - (double)getCharge(stack) / (double)maxPower;
}
@Override
public long getMaxCharge() {
return maxPower;
}
@Override
public long getChargeRate() {
return chargeRate;
}
@Override
public long getDischargeRate() {
return 0;
}
@Override
public void setDamage(ItemStack stack, int damage)
{
this.dischargeBattery(stack, damage * consumption);
}
}

View File

@ -33,10 +33,14 @@ import net.minecraftforge.common.ISpecialArmor;
@Spaghetti("kill it")
public class ArmorT45 extends ItemArmor implements ISpecialArmor {
@SideOnly(Side.CLIENT)
private ModelT45Helmet helmet;
@SideOnly(Side.CLIENT)
private ModelT45Chest plate;
@SideOnly(Side.CLIENT)
private ModelT45Legs legs;
@SideOnly(Side.CLIENT)
private ModelT45Boots boots;
public ArmorT45(ArmorMaterial armorMaterial, int renderIndex, int armorType) {

View File

@ -95,6 +95,9 @@ public class ResourceManager {
public static final IModelCustom chemplant_fluid = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/chemplant_new_fluid.hmf"));
public static final IModelCustom chemplant_fluidcap = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/chemplant_new_fluidcap.hmf"));
//F6 TANKS
public static final IModelCustom tank = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/tank.obj"));
//Centrifuge
public static final IModelCustom centrifuge_new = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/centrifuge_new.obj"));
@ -312,6 +315,10 @@ public class ResourceManager {
public static final ResourceLocation chemplant_spinner_tex = new ResourceLocation(RefStrings.MODID, "textures/models/chemplant_spinner_new.png");
public static final ResourceLocation chemplant_piston_tex = new ResourceLocation(RefStrings.MODID, "textures/models/chemplant_piston_new.png");
public static final ResourceLocation chemplant_fluid_tex = new ResourceLocation(RefStrings.MODID, "textures/models/lavabase_small.png");
//F6 TANKS
public static final ResourceLocation uf6_tex = new ResourceLocation(RefStrings.MODID, "textures/models/UF6Tank.png");
public static final ResourceLocation puf6_tex = new ResourceLocation(RefStrings.MODID, "textures/models/PUF6Tank.png");
//Centrifuge
public static final ResourceLocation centrifuge_new_tex = new ResourceLocation(RefStrings.MODID, "textures/models/centrifuge_new.png");
@ -479,6 +486,8 @@ public class ResourceManager {
public static final IModelCustom thompson = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/weapons/thompson.obj"));
public static final IModelCustom grenade_frag = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/weapons/grenade_frag.obj"));
public static final IModelCustom armor_bj = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/armor/BJ.obj"));
////Texture Items
@ -558,6 +567,7 @@ public class ResourceManager {
public static final IModelCustom soyuz_launcher_support = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/launch_table/soyuz_launcher_support.obj"));
//Missile Parts
public static final IModelCustom missile_pad = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/missilePad.obj"));
public static final IModelCustom missile_assembly = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/missile_assembly.obj"));
public static final IModelCustom strut = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/strut.obj"));
public static final IModelCustom compact_launcher = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/compact_launcher.obj"));
@ -729,6 +739,7 @@ public class ResourceManager {
public static final ResourceLocation soyuz_launcher_support_tex = new ResourceLocation(RefStrings.MODID, "textures/models/soyuz_launcher/launcher_support.png");
//Missile Parts
public static final ResourceLocation missile_pad_tex = new ResourceLocation(RefStrings.MODID, "textures/models/missilePad.png");
public static final ResourceLocation missile_assembly_tex = new ResourceLocation(RefStrings.MODID, "textures/models/missile_assembly.png");
public static final ResourceLocation strut_tex = new ResourceLocation(RefStrings.MODID, "textures/models/strut.png");
public static final ResourceLocation compact_launcher_tex = new ResourceLocation(RefStrings.MODID, "textures/models/compact_launcher.png");

View File

@ -634,6 +634,146 @@ public class ItemRenderLibrary {
ResourceManager.mine_fat.renderAll();
GL11.glEnable(GL11.GL_CULL_FACE);
}});
renderers.put(Item.getItemFromBlock(ModBlocks.machine_forcefield), new ItemRenderBase() {
public void renderInventory() {
GL11.glTranslated(0, -4, 0);
GL11.glScaled(6, 6, 6);
}
public void renderCommon() {
bindTexture(ResourceManager.forcefield_base_tex); ResourceManager.radar_body.renderAll();
GL11.glTranslated(0, 1D, 0);
bindTexture(ResourceManager.forcefield_top_tex); ResourceManager.forcefield_top.renderAll();
}});
renderers.put(Item.getItemFromBlock(ModBlocks.machine_missile_assembly), new ItemRenderBase() {
public void renderInventory() {
GL11.glTranslated(0, -2.5, 0);
GL11.glScaled(10, 10, 10);
}
public void renderCommon() {
GL11.glDisable(GL11.GL_CULL_FACE);
bindTexture(ResourceManager.missile_assembly_tex); ResourceManager.missile_assembly.renderAll();
GL11.glEnable(GL11.GL_CULL_FACE);
}});
renderers.put(Item.getItemFromBlock(ModBlocks.launch_pad), new ItemRenderBase() {
public void renderInventory() {
GL11.glTranslated(0, -1, 0);
GL11.glScaled(3, 3, 3);
}
public void renderCommon() {
bindTexture(ResourceManager.missile_pad_tex); ResourceManager.missile_pad.renderAll();
}});
renderers.put(Item.getItemFromBlock(ModBlocks.compact_launcher), new ItemRenderBase() {
public void renderInventory() {
GL11.glTranslated(0, -4, 0);
GL11.glScaled(3.5, 3.5, 3.5);
}
public void renderCommon() {
GL11.glScaled(0.5, 0.5, 0.5);
bindTexture(ResourceManager.compact_launcher_tex); ResourceManager.compact_launcher.renderAll();
}});
renderers.put(Item.getItemFromBlock(ModBlocks.launch_table), new ItemRenderBase() {
public void renderInventory() {
GL11.glTranslated(0, -2, 0);
GL11.glScaled(2.5, 2.5, 2.5);
}
public void renderCommon() {
GL11.glScaled(0.5, 0.5, 0.5);
bindTexture(ResourceManager.launch_table_base_tex); ResourceManager.launch_table_base.renderAll();
bindTexture(ResourceManager.launch_table_small_pad_tex); ResourceManager.launch_table_small_pad.renderAll();
GL11.glTranslatef(0F, 0F, 2.5F);
for(int i = 0; i < 8; i++) {
GL11.glTranslatef(0F, 1F, 0.F);
if(i < 6) {
bindTexture(ResourceManager.launch_table_small_scaffold_base_tex); ResourceManager.launch_table_small_scaffold_base.renderAll();
}
if(i == 6) {
bindTexture(ResourceManager.launch_table_small_scaffold_connector_tex); ResourceManager.launch_table_small_scaffold_connector.renderAll();
}
if(i > 6) {
bindTexture(ResourceManager.launch_table_small_scaffold_base_tex); ResourceManager.launch_table_small_scaffold_empty.renderAll();
}
}
}});
renderers.put(Item.getItemFromBlock(ModBlocks.soyuz_capsule), new ItemRenderBase() {
public void renderInventory() {
GL11.glTranslated(0, -4, 0);
GL11.glScaled(5, 5, 5);
}
public void renderCommon() {
GL11.glShadeModel(GL11.GL_SMOOTH);
bindTexture(ResourceManager.soyuz_lander_tex); ResourceManager.soyuz_lander.renderPart("Capsule");
GL11.glShadeModel(GL11.GL_FLAT);
}});
renderers.put(Item.getItemFromBlock(ModBlocks.machine_radar), new ItemRenderBase() {
public void renderInventory() {
GL11.glTranslated(0, -4, 0);
GL11.glScaled(6, 6, 6);
}
public void renderCommon() {
GL11.glDisable(GL11.GL_CULL_FACE);
GL11.glRotated(90, 0, -1, 0);
bindTexture(ResourceManager.radar_body_tex); ResourceManager.radar_body.renderAll();
bindTexture(ResourceManager.radar_head_tex); ResourceManager.radar_head.renderAll();
GL11.glEnable(GL11.GL_CULL_FACE);
}});
renderers.put(Item.getItemFromBlock(ModBlocks.machine_uf6_tank), new ItemRenderBase() {
public void renderInventory() {
GL11.glTranslated(0, -4, 0);
GL11.glScaled(6, 6, 6);
}
public void renderCommon() {
GL11.glRotated(90, 0, -1, 0);
bindTexture(ResourceManager.uf6_tex); ResourceManager.tank.renderAll();
}});
renderers.put(Item.getItemFromBlock(ModBlocks.machine_puf6_tank), new ItemRenderBase() {
public void renderInventory() {
GL11.glTranslated(0, -4, 0);
GL11.glScaled(6, 6, 6);
}
public void renderCommon() {
GL11.glRotated(90, 0, -1, 0);
bindTexture(ResourceManager.puf6_tex); ResourceManager.tank.renderAll();
}});
renderers.put(Item.getItemFromBlock(ModBlocks.sat_dock), new ItemRenderBase() {
public void renderInventory() {
GL11.glScaled(3, 3, 3);
}
public void renderCommon() {
GL11.glRotated(90, 0, -1, 0);
bindTexture(ResourceManager.satdock_tex); ResourceManager.satDock.renderAll();
}});
renderers.put(Item.getItemFromBlock(ModBlocks.vault_door), new ItemRenderBase() {
public void renderInventory() {
GL11.glTranslated(0, -5, 0);
GL11.glScaled(3, 3, 3);
}
public void renderCommon() {
bindTexture(ResourceManager.vault_cog_tex); ResourceManager.vault_cog.renderAll();
bindTexture(ResourceManager.vault_label_101_tex); ResourceManager.vault_label.renderAll();
}});
renderers.put(Item.getItemFromBlock(ModBlocks.blast_door), new ItemRenderBase() {
public void renderInventory() {
GL11.glTranslated(0, -3, 0);
GL11.glScaled(3, 3, 3);
}
public void renderCommon() {
bindTexture(ResourceManager.blast_door_base_tex); ResourceManager.blast_door_base.renderAll();
bindTexture(ResourceManager.blast_door_tooth_tex); ResourceManager.blast_door_tooth.renderAll();
bindTexture(ResourceManager.blast_door_slider_tex); ResourceManager.blast_door_slider.renderAll();
bindTexture(ResourceManager.blast_door_block_tex); ResourceManager.blast_door_block.renderAll();
}});
}
private static void bindTexture(ResourceLocation res) {

View File

@ -0,0 +1,36 @@
package com.hbm.render.loader;
import org.lwjgl.opengl.GL11;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraftforge.client.model.IModelCustom;
public class ModelRendererObj {
public float rotationPointX;
public float rotationPointY;
public float rotationPointZ;
public float rotateAngleX;
public float rotateAngleY;
public float rotateAngleZ;
public float offsetX;
public float offsetY;
public float offsetZ;
String[] parts;
IModelCustom model;
public ModelRendererObj(IModelCustom model, String... parts) {
this.model = model;
this.parts = parts;
}
@SideOnly(Side.CLIENT)
public void render(float p_78785_1_) {
GL11.glTranslatef(this.offsetX, this.offsetY, this.offsetZ);
}
}

View File

@ -0,0 +1,92 @@
package com.hbm.render.model;
import org.lwjgl.opengl.GL11;
import com.hbm.main.ResourceManager;
import net.minecraft.client.Minecraft;
import net.minecraft.client.model.ModelBiped;
import net.minecraft.entity.Entity;
public class ModelArmorBJ extends ModelBiped {
int type;
public ModelArmorBJ(int type) {
this.type = type;
}
@Override
public void render(Entity par1Entity, float par2, float par3, float par4, float par5, float par6, float par7) {
setRotationAngles(par2, par3, par4, par5, par6, par7, par1Entity);
GL11.glPushMatrix();
Minecraft.getMinecraft().renderEngine.bindTexture(ResourceManager.launch_table_base_tex);
GL11.glRotated(180, 0, 0, 1);
GL11.glRotated(90, 0, 1, 0);
GL11.glTranslated(0, -1.5, 0);
if(type == 0) {
GL11.glPushMatrix();
GL11.glTranslated(0, 1.5, 0);
GL11.glRotated(-Math.toDegrees(this.bipedHead.rotateAngleY), 0, 1, 0);
GL11.glRotated(-Math.toDegrees(this.bipedHead.rotateAngleX), 0, 0, 1);
GL11.glTranslated(0, -1.5, 0);
ResourceManager.armor_bj.renderPart("Head");
GL11.glPopMatrix();
}
if(type == 1) {
GL11.glPushMatrix();
GL11.glTranslated(0, 1.5, 0);
GL11.glRotated(-Math.toDegrees(this.bipedBody.rotateAngleY), 0, 1, 0);
GL11.glRotated(-Math.toDegrees(this.bipedBody.rotateAngleX), 0, 0, 1);
GL11.glTranslated(0, -1.5, 0);
ResourceManager.armor_bj.renderPart("Body");
GL11.glPopMatrix();
double height = 22;
GL11.glPushMatrix();
GL11.glTranslated(0, 0.0625 * height, -0.25);
GL11.glRotated(-Math.toDegrees(this.bipedLeftArm.rotateAngleZ), 1, 0, 0);
GL11.glRotated(-Math.toDegrees(this.bipedLeftArm.rotateAngleY), 0, 1, 0);
GL11.glRotated(-Math.toDegrees(this.bipedLeftArm.rotateAngleX), 0, 0, 1);
GL11.glTranslated(0, -0.0625 * height, 0.25);
ResourceManager.armor_bj.renderPart("LeftArm");
GL11.glPopMatrix();
GL11.glPushMatrix();
GL11.glTranslated(0, 0.0625 * height, 0.25);
GL11.glRotated(-Math.toDegrees(this.bipedRightArm.rotateAngleZ), 1, 0, 0);
GL11.glRotated(-Math.toDegrees(this.bipedRightArm.rotateAngleY), 0, 1, 0);
GL11.glRotated(-Math.toDegrees(this.bipedRightArm.rotateAngleX), 0, 0, 1);
GL11.glTranslated(0, -0.0625 * height, -0.25);
ResourceManager.armor_bj.renderPart("RightArm");
GL11.glPopMatrix();
}
if(type == 2) {
GL11.glPushMatrix();
GL11.glTranslated(0, 0.75, 0);
GL11.glRotated(-Math.toDegrees(this.bipedLeftLeg.rotateAngleX), 0, 0, 1);
GL11.glTranslated(0, -0.75, 0);
ResourceManager.armor_bj.renderPart("LeftLeg");
GL11.glPopMatrix();
GL11.glPushMatrix();
GL11.glTranslated(0, 0.75, 0);
GL11.glRotated(-Math.toDegrees(this.bipedRightLeg.rotateAngleX), 0, 0, 1);
GL11.glTranslated(0, -0.75, 0);
ResourceManager.armor_bj.renderPart("RightLeg");
GL11.glPopMatrix();
}
if(type == 3) {
}
GL11.glPopMatrix();
}
}

View File

@ -2,27 +2,13 @@ package com.hbm.render.tileentity;
import org.lwjgl.opengl.GL11;
import com.hbm.lib.RefStrings;
import com.hbm.main.ResourceManager;
import com.hbm.tileentity.bomb.TileEntityLaunchPad;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.model.AdvancedModelLoader;
import net.minecraftforge.client.model.IModelCustom;
public class RenderLaunchPadTier1 extends TileEntitySpecialRenderer {
private static final ResourceLocation objTesterModelRL = new ResourceLocation(/*"/assets/" + */RefStrings.MODID, "models/missilePad.obj");
private IModelCustom padModel;
private ResourceLocation padTexture;
public RenderLaunchPadTier1()
{
padModel = AdvancedModelLoader.loadModel(objTesterModelRL);
padTexture = new ResourceLocation(RefStrings.MODID, "textures/models/missilePad.png");
}
@Override
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float f)
@ -31,22 +17,9 @@ public class RenderLaunchPadTier1 extends TileEntitySpecialRenderer {
GL11.glTranslated(x + 0.5D, y, z + 0.5D);
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glDisable(GL11.GL_CULL_FACE);
/*switch(tileEntity.getBlockMetadata())
{
case 5:
GL11.glRotatef(90, 0F, 1F, 0F); break;
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;
}*/
//GL11.glScalef(1.5F, 1.0F, 1.5F);
bindTexture(padTexture);
padModel.renderAll();
//GL11.glScalef(2/3F, 1.0F, 2/3F);
bindTexture(ResourceManager.missile_pad_tex);
ResourceManager.missile_pad.renderAll();
GL11.glDisable(GL11.GL_CULL_FACE);
int state = 0;

View File

@ -3,6 +3,7 @@ package com.hbm.render.tileentity;
import org.lwjgl.opengl.GL11;
import com.hbm.lib.RefStrings;
import com.hbm.main.ResourceManager;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.tileentity.TileEntity;
@ -12,16 +13,6 @@ import net.minecraftforge.client.model.IModelCustom;
public class RenderPuF6Tank extends TileEntitySpecialRenderer {
private static final ResourceLocation tankModel = new ResourceLocation(/*"/assets/" + */RefStrings.MODID, "models/tank.obj");
private IModelCustom tankModelC;
private ResourceLocation tankTexture;
public RenderPuF6Tank()
{
tankModelC = AdvancedModelLoader.loadModel(tankModel);
tankTexture = new ResourceLocation(RefStrings.MODID, "textures/models/PUF6Tank.png");
}
@Override
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float f)
{
@ -40,8 +31,8 @@ public class RenderPuF6Tank extends TileEntitySpecialRenderer {
GL11.glRotatef(0, 0F, 1F, 0F); break;
}
bindTexture(tankTexture);
tankModelC.renderAll();
bindTexture(ResourceManager.puf6_tex);
ResourceManager.tank.renderAll();
GL11.glPopMatrix();
}

View File

@ -3,6 +3,7 @@ package com.hbm.render.tileentity;
import org.lwjgl.opengl.GL11;
import com.hbm.lib.RefStrings;
import com.hbm.main.ResourceManager;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.tileentity.TileEntity;
@ -11,16 +12,6 @@ import net.minecraftforge.client.model.AdvancedModelLoader;
import net.minecraftforge.client.model.IModelCustom;
public class RenderUF6Tank extends TileEntitySpecialRenderer {
private static final ResourceLocation tankModel = new ResourceLocation(/*"/assets/" + */RefStrings.MODID, "models/tank.obj");
private IModelCustom tankModelC;
private ResourceLocation tankTexture;
public RenderUF6Tank()
{
tankModelC = AdvancedModelLoader.loadModel(tankModel);
tankTexture = new ResourceLocation(RefStrings.MODID, "textures/models/UF6Tank.png");
}
@Override
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float f)
@ -40,8 +31,8 @@ public class RenderUF6Tank extends TileEntitySpecialRenderer {
GL11.glRotatef(0, 0F, 1F, 0F); break;
}
bindTexture(tankTexture);
tankModelC.renderAll();
bindTexture(ResourceManager.uf6_tex);
ResourceManager.tank.renderAll();
GL11.glPopMatrix();
}

View File

@ -91,7 +91,14 @@ public class SoyuzPronter {
this.boosterside = boosterside;
}
}
/* TODO
* int list = GL11.glGenLists(1);
* GL11.glNewList(list, GL11.GL_COMPILE);
* //Render
* GL11.glEndList();
* GL11.glCallList(list);
*/
public static void prontSoyuz(int type) {

View File

@ -3,17 +3,22 @@ package com.hbm.tileentity.machine;
import java.util.List;
import com.google.common.collect.HashBiMap;
import com.hbm.handler.FluidTypeHandler.FluidType;
import com.hbm.interfaces.IConsumer;
import com.hbm.interfaces.IFluidAcceptor;
import com.hbm.interfaces.ISource;
import com.hbm.inventory.FluidTank;
import com.hbm.items.ModItems;
import com.hbm.lib.Library;
import com.hbm.tileentity.TileEntityMachineBase;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntityFurnace;
import scala.actors.threadpool.Arrays;
public class TileEntityMachineIGenerator extends TileEntityMachineBase implements ISource {
public class TileEntityMachineIGenerator extends TileEntityMachineBase implements ISource, IFluidAcceptor {
public long power;
public static final long maxPower = 1000000;
@ -23,11 +28,17 @@ public class TileEntityMachineIGenerator extends TileEntityMachineBase implement
public static final int maxTemperature = 1000;
public int torque;
public static final int maxTorque = 10000;
public float limiter = 0.0F; /// 0 - 1 ///
public IGenRTG[] pellets = new IGenRTG[12];
public FluidTank[] tanks;
public TileEntityMachineIGenerator() {
super(15);
tanks = new FluidTank[3];
tanks[0] = new FluidTank(FluidType.WATER, 8000, 0);
tanks[1] = new FluidTank(FluidType.HEATINGOIL, 16000, 1);
tanks[2] = new FluidTank(FluidType.LUBRICANT, 2000, 2);
}
@Override
@ -39,12 +50,25 @@ public class TileEntityMachineIGenerator extends TileEntityMachineBase implement
public void updateEntity() {
if(!worldObj.isRemote) {
tanks[0].loadTank(7, 8, slots);
tanks[1].loadTank(9, 10, slots);
tanks[1].setType(11, 12, slots);
tanks[2].loadTank(13, 14, slots);
loadFuel();
rtgAction();
pelletAction();
if(burnTime > 0)
if(burnTime > 0) {
burnTime --;
temperature += 100;
}
rtgAction();
rotorAction();
generatorAction();
this.power = Library.chargeItemsFromTE(slots, 6, power, maxPower);
NBTTagCompound data = new NBTTagCompound();
int[] rtgs = new int[pellets.length];
@ -57,9 +81,16 @@ public class TileEntityMachineIGenerator extends TileEntityMachineBase implement
}
data.setIntArray("rtgs", rtgs);
data.setInteger("temp", temperature);
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);
for(int i = 0; i < 3; i++)
tanks[i].updateTank(xCoord, yCoord, zCoord, this.worldObj.provider.dimensionId);
}
}
@ -80,8 +111,17 @@ public class TileEntityMachineIGenerator extends TileEntityMachineBase implement
}
}
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
@ -91,6 +131,8 @@ public class TileEntityMachineIGenerator extends TileEntityMachineBase implement
pushPellet();
if(meta == 1)
popPellet();
if(meta == 2)
setDialByAngle(value);
}
/**
@ -118,6 +160,20 @@ public class TileEntityMachineIGenerator extends TileEntityMachineBase implement
}
}
/**
* 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;
}
if(temperature > maxTemperature)
temperature = maxTemperature;
}
/**
* does the thing with the thermo elements
*/
@ -135,6 +191,43 @@ public class TileEntityMachineIGenerator extends TileEntityMachineBase implement
this.temperature -= pow;
this.power += pow;
if(power > maxPower)
power = maxPower;
}
/**
* Turns heat into rotational energy
*/
private void rotorAction() {
int conversion = getConversion();
this.torque += conversion;
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() {
this.power += this.torque;
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 * (tanks[0].getFill() > 0 ? 1 : 0.35));
}
/**
@ -203,6 +296,16 @@ public class TileEntityMachineIGenerator extends TileEntityMachineBase implement
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;
}
@Override
public void ffgeuaInit() {
@ -245,6 +348,48 @@ public class TileEntityMachineIGenerator extends TileEntityMachineBase implement
// TODO Auto-generated method stub
}
@Override
public void setFillstate(int fill, int index) {
tanks[index].setFill(fill);
}
@Override
public void setFluidFill(int fill, FluidType type) {
// TODO Auto-generated method stub
}
@Override
public void setType(FluidType type, int index) {
// TODO Auto-generated method stub
}
@Override
public List<FluidTank> getTanks() {
return Arrays.asList(tanks);
}
@Override
public int getFluidFill(FluidType type) {
for(int i = 0; i < 3; i++)
if(tanks[i].getTankType() == type)
return tanks[i].getFill();
return 0;
}
@Override
public int getMaxFluidFill(FluidType type) {
for(int i = 0; i < 3; i++)
if(tanks[i].getTankType() == type)
return tanks[i].getMaxFill();
return 0;
}
@Override
public void readFromNBT(NBTTagCompound nbt) {
@ -263,6 +408,7 @@ public class TileEntityMachineIGenerator extends TileEntityMachineBase implement
this.burnTime = nbt.getInteger("burn");
this.lastBurnTime = nbt.getInteger("lastBurn");
this.limiter = nbt.getFloat("limiter");
}
@Override
@ -280,6 +426,7 @@ public class TileEntityMachineIGenerator extends TileEntityMachineBase implement
nbt.setInteger("burn", burnTime);
nbt.setInteger("lastBurn", lastBurnTime);
nbt.setFloat("limiter", limiter);
}
private static HashBiMap<Item, IGenRTG> rtgPellets = HashBiMap.create();

View File

@ -178,18 +178,6 @@ public class TileEntityMachinePlasmaHeater extends TileEntityMachineBase impleme
tanks[1].writeToNBT(nbt, "fuel_2");
plasma.writeToNBT(nbt, "plasma");
}
@Override
public AxisAlignedBB getRenderBoundingBox() {
return TileEntity.INFINITE_EXTENT_AABB;
}
@Override
@SideOnly(Side.CLIENT)
public double getMaxRenderDistanceSquared()
{
return 65536.0D;
}
@Override
public int getMaxFluidFill(FluidType type) {
@ -267,4 +255,16 @@ public class TileEntityMachinePlasmaHeater extends TileEntityMachineBase impleme
public long getMaxPower() {
return maxPower;
}
@Override
public AxisAlignedBB getRenderBoundingBox() {
return TileEntity.INFINITE_EXTENT_AABB;
}
@Override
@SideOnly(Side.CLIENT)
public double getMaxRenderDistanceSquared()
{
return 65536.0D;
}
}