mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
more inventory 3D models, some igen work, tool abilities
This commit is contained in:
parent
982bf1d404
commit
0a9b63d1ca
@ -2427,8 +2427,10 @@ tile.yellow_barrel.name=Radioaktives Fass
|
|||||||
|
|
||||||
tool.ability.cnetrifuge=Auto-Zentrifuge
|
tool.ability.cnetrifuge=Auto-Zentrifuge
|
||||||
tool.ability.crystallizer=Auto-Kristallisierer
|
tool.ability.crystallizer=Auto-Kristallisierer
|
||||||
|
tool.ability.explosion=Explosion
|
||||||
tool.ability.hammer=AoE
|
tool.ability.hammer=AoE
|
||||||
tool.ability.luck=Glück
|
tool.ability.luck=Glück
|
||||||
|
tool.ability.mercury=Quecksilber-Berührung
|
||||||
tool.ability.recursion=Erzadern-Miner
|
tool.ability.recursion=Erzadern-Miner
|
||||||
tool.ability.shredder=Auto-Brecher
|
tool.ability.shredder=Auto-Brecher
|
||||||
tool.ability.silktouch=Behutsamkeit
|
tool.ability.silktouch=Behutsamkeit
|
||||||
|
|||||||
@ -2427,8 +2427,10 @@ tile.yellow_barrel.name=Radioactive Barrel
|
|||||||
|
|
||||||
tool.ability.centrifuge=Auto-Centrifuge
|
tool.ability.centrifuge=Auto-Centrifuge
|
||||||
tool.ability.crystallizer=Auto-Crystallizer
|
tool.ability.crystallizer=Auto-Crystallizer
|
||||||
|
tool.ability.explosion=Explosion
|
||||||
tool.ability.hammer=AoE
|
tool.ability.hammer=AoE
|
||||||
tool.ability.luck=Fortune
|
tool.ability.luck=Fortune
|
||||||
|
tool.ability.mercury=Mercury Touch
|
||||||
tool.ability.recursion=Vein Miner
|
tool.ability.recursion=Vein Miner
|
||||||
tool.ability.shredder=Auto-Shredder
|
tool.ability.shredder=Auto-Shredder
|
||||||
tool.ability.silktouch=Silk Touch
|
tool.ability.silktouch=Silk Touch
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 4.0 KiB After Width: | Height: | Size: 4.2 KiB |
@ -7,6 +7,8 @@ import java.util.List;
|
|||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import com.hbm.config.ToolConfig;
|
import com.hbm.config.ToolConfig;
|
||||||
|
import com.hbm.explosion.ExplosionNT;
|
||||||
|
import com.hbm.explosion.ExplosionNT.ExAttrib;
|
||||||
import com.hbm.inventory.CentrifugeRecipes;
|
import com.hbm.inventory.CentrifugeRecipes;
|
||||||
import com.hbm.inventory.CrystallizerRecipes;
|
import com.hbm.inventory.CrystallizerRecipes;
|
||||||
import com.hbm.inventory.ShredderRecipes;
|
import com.hbm.inventory.ShredderRecipes;
|
||||||
@ -392,4 +394,79 @@ public abstract class ToolAbility {
|
|||||||
return I18n.format(getName());
|
return I18n.format(getName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static class MercuryAbility extends ToolAbility {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDig(World world, int x, int y, int z, EntityPlayer player, Block block, int meta, IItemAbility tool) {
|
||||||
|
|
||||||
|
//a band-aid on a gaping wound
|
||||||
|
if(block == Blocks.lit_redstone_ore)
|
||||||
|
block = Blocks.redstone_ore;
|
||||||
|
|
||||||
|
int mercury = 0;
|
||||||
|
|
||||||
|
if(block == Blocks.redstone_ore)
|
||||||
|
mercury = player.getRNG().nextInt(5) + 4;
|
||||||
|
if(block == Blocks.redstone_block)
|
||||||
|
mercury = player.getRNG().nextInt(7) + 8;
|
||||||
|
|
||||||
|
if(mercury > 0) {
|
||||||
|
world.setBlockToAir(x, y, z);
|
||||||
|
world.spawnEntityInWorld(new EntityItem(world, x + 0.5, y + 0.5, z + 0.5, new ItemStack(ModItems.nugget_mercury, mercury)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getExtension() {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return "tool.ability.mercury";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getFullName() {
|
||||||
|
return I18n.format(getName());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class ExplosionAbility extends ToolAbility {
|
||||||
|
|
||||||
|
float strength;
|
||||||
|
|
||||||
|
public ExplosionAbility(float strength) {
|
||||||
|
this.strength = strength;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDig(World world, int x, int y, int z, EntityPlayer player, Block block, int meta, IItemAbility tool) {
|
||||||
|
|
||||||
|
ExplosionNT ex = new ExplosionNT(player.worldObj, player, x + 0.5, y + 0.5, z + 0.5, strength);
|
||||||
|
ex.addAttrib(ExAttrib.ALLDROP);
|
||||||
|
ex.addAttrib(ExAttrib.NOHURT);
|
||||||
|
ex.addAttrib(ExAttrib.NOPARTICLE);
|
||||||
|
ex.doExplosionA();
|
||||||
|
ex.doExplosionB(false);
|
||||||
|
|
||||||
|
player.worldObj.createExplosion(player, x + 0.5, y + 0.5, z + 0.5, 0.1F, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getExtension() {
|
||||||
|
return " (" + strength + ")";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return "tool.ability.explosion";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getFullName() {
|
||||||
|
return I18n.format(getName()) + getExtension();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@ -4,11 +4,14 @@ import org.lwjgl.opengl.GL11;
|
|||||||
|
|
||||||
import com.hbm.inventory.container.ContainerIGenerator;
|
import com.hbm.inventory.container.ContainerIGenerator;
|
||||||
import com.hbm.lib.RefStrings;
|
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;
|
||||||
import com.hbm.render.util.GaugeUtil.Gauge;
|
import com.hbm.render.util.GaugeUtil.Gauge;
|
||||||
import com.hbm.tileentity.machine.TileEntityMachineIGenerator;
|
import com.hbm.tileentity.machine.TileEntityMachineIGenerator;
|
||||||
|
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraft.client.audio.PositionedSoundRecord;
|
||||||
import net.minecraft.client.resources.I18n;
|
import net.minecraft.client.resources.I18n;
|
||||||
import net.minecraft.entity.player.InventoryPlayer;
|
import net.minecraft.entity.player.InventoryPlayer;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
@ -16,11 +19,11 @@ import net.minecraft.util.ResourceLocation;
|
|||||||
public class GUIIGenerator extends GuiInfoContainer {
|
public class GUIIGenerator extends GuiInfoContainer {
|
||||||
|
|
||||||
private static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/generators/gui_igen.png");
|
private static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/generators/gui_igen.png");
|
||||||
private TileEntityMachineIGenerator diFurnace;
|
private TileEntityMachineIGenerator igen;
|
||||||
|
|
||||||
public GUIIGenerator(InventoryPlayer invPlayer, TileEntityMachineIGenerator tedf) {
|
public GUIIGenerator(InventoryPlayer invPlayer, TileEntityMachineIGenerator tedf) {
|
||||||
super(new ContainerIGenerator(invPlayer, tedf));
|
super(new ContainerIGenerator(invPlayer, tedf));
|
||||||
diFurnace = tedf;
|
igen = tedf;
|
||||||
|
|
||||||
this.xSize = 188;
|
this.xSize = 188;
|
||||||
this.ySize = 222;
|
this.ySize = 222;
|
||||||
@ -30,10 +33,28 @@ public class GUIIGenerator extends GuiInfoContainer {
|
|||||||
public void drawScreen(int mouseX, int mouseY, float f) {
|
public void drawScreen(int mouseX, int mouseY, float f) {
|
||||||
super.drawScreen(mouseX, mouseY, f);
|
super.drawScreen(mouseX, mouseY, f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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
|
@Override
|
||||||
protected void drawGuiContainerForegroundLayer(int i, int j) {
|
protected void drawGuiContainerForegroundLayer(int i, int j) {
|
||||||
String name = this.diFurnace.hasCustomInventoryName() ? this.diFurnace.getInventoryName() : I18n.format(this.diFurnace.getInventoryName());
|
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(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(I18n.format("container.inventory"), 14, this.ySize - 96 + 2, 4210752);
|
||||||
@ -45,16 +66,17 @@ public class GUIIGenerator extends GuiInfoContainer {
|
|||||||
Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
|
Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
|
||||||
drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
|
drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
|
||||||
|
|
||||||
int[] pellets = new int[] {0,1,0,1,0,0,0,1,2,0,0,2};
|
for(int i = 0; i < igen.pellets.length; i++) {
|
||||||
|
|
||||||
for(int i = 0; i < pellets.length; i++) {
|
|
||||||
|
|
||||||
drawTexturedModalRect(guiLeft + 6, guiTop + 106 - 4 * i, 188, 9 * pellets[i], 14, 9);
|
if(igen.pellets[i] != null)
|
||||||
|
drawTexturedModalRect(guiLeft + 6, guiTop + 106 - 4 * i, 188, igen.pellets[i].offset, 14, 9);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GaugeUtil.renderGauge(Gauge.BOW_SMALL, guiLeft + 40, guiTop + 26, this.zLevel, igen.getSolidGauge());
|
||||||
|
|
||||||
GaugeUtil.renderGauge(Gauge.BAR_SMALL, guiLeft + 76, guiTop + 20, this.zLevel, Math.sin(System.currentTimeMillis() * 0.0025D) * 0.5 + 0.5);
|
GaugeUtil.renderGauge(Gauge.BAR_SMALL, guiLeft + 76, guiTop + 20, this.zLevel, igen.getTempGauge());
|
||||||
GaugeUtil.renderGauge(Gauge.BAR_SMALL, guiLeft + 76, guiTop + 56, this.zLevel, Math.sin(System.currentTimeMillis() * 0.0025D) * 0.5 + 0.5);
|
GaugeUtil.renderGauge(Gauge.BAR_SMALL, guiLeft + 76, guiTop + 56, this.zLevel, igen.getTorqueGauge());
|
||||||
GaugeUtil.renderGauge(Gauge.BAR_SMALL, guiLeft + 76, guiTop + 92, this.zLevel, Math.sin(System.currentTimeMillis() * 0.0025D) * 0.5 + 0.5);
|
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 + 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 + 62, this.zLevel, Math.sin(System.currentTimeMillis() * 0.0025D) * 0.5 + 0.5);
|
||||||
|
|||||||
@ -1638,6 +1638,8 @@ public class ModItems {
|
|||||||
public static Item drax;
|
public static Item drax;
|
||||||
public static Item drax_mk2;
|
public static Item drax_mk2;
|
||||||
public static Item drax_mk3;
|
public static Item drax_mk3;
|
||||||
|
public static Item chlorophyte_pickaxe;
|
||||||
|
public static Item mese_pickaxe;
|
||||||
|
|
||||||
public static Item matchstick;
|
public static Item matchstick;
|
||||||
public static Item balefire_and_steel;
|
public static Item balefire_and_steel;
|
||||||
@ -3790,6 +3792,14 @@ public class ModItems {
|
|||||||
.addBreakAbility(new ToolAbility.HammerAbility(3))
|
.addBreakAbility(new ToolAbility.HammerAbility(3))
|
||||||
.addBreakAbility(new ToolAbility.HammerAbility(4))
|
.addBreakAbility(new ToolAbility.HammerAbility(4))
|
||||||
.addBreakAbility(new ToolAbility.RecursionAbility(9)).setUnlocalizedName("drax_mk3").setTextureName(RefStrings.MODID + ":drax_mk3");
|
.addBreakAbility(new ToolAbility.RecursionAbility(9)).setUnlocalizedName("drax_mk3").setTextureName(RefStrings.MODID + ":drax_mk3");
|
||||||
|
chlorophyte_pickaxe = new ItemToolAbility(20F, -0.05, MainRegistry.tMatElec, EnumToolType.MINER)
|
||||||
|
.addBreakAbility(new ToolAbility.MercuryAbility()).setUnlocalizedName("chlorophyte_pickaxe").setTextureName(RefStrings.MODID + ":chlorophyte_pickaxe");
|
||||||
|
mese_pickaxe = new ItemToolAbilityPower(20F, -0.05, MainRegistry.tMatElec, EnumToolType.MINER, 2500000000L, 500000, 10000)
|
||||||
|
.addBreakAbility(new ToolAbility.ExplosionAbility(2.5F))
|
||||||
|
.addBreakAbility(new ToolAbility.ExplosionAbility(5F))
|
||||||
|
.addBreakAbility(new ToolAbility.ExplosionAbility(7.5F))
|
||||||
|
.addBreakAbility(new ToolAbility.ExplosionAbility(10F))
|
||||||
|
.setUnlocalizedName("mese_pickaxe").setTextureName(RefStrings.MODID + ":mese_pickaxe");
|
||||||
|
|
||||||
mask_of_infamy = new MaskOfInfamy(ArmorMaterial.IRON, 8, 0).setUnlocalizedName("mask_of_infamy").setMaxStackSize(1).setTextureName(RefStrings.MODID + ":mask_of_infamy");
|
mask_of_infamy = new MaskOfInfamy(ArmorMaterial.IRON, 8, 0).setUnlocalizedName("mask_of_infamy").setMaxStackSize(1).setTextureName(RefStrings.MODID + ":mask_of_infamy");
|
||||||
|
|
||||||
@ -5518,6 +5528,8 @@ public class ModItems {
|
|||||||
GameRegistry.registerItem(drax, drax.getUnlocalizedName());
|
GameRegistry.registerItem(drax, drax.getUnlocalizedName());
|
||||||
GameRegistry.registerItem(drax_mk2, drax_mk2.getUnlocalizedName());
|
GameRegistry.registerItem(drax_mk2, drax_mk2.getUnlocalizedName());
|
||||||
GameRegistry.registerItem(drax_mk3, drax_mk3.getUnlocalizedName());
|
GameRegistry.registerItem(drax_mk3, drax_mk3.getUnlocalizedName());
|
||||||
|
GameRegistry.registerItem(chlorophyte_pickaxe, chlorophyte_pickaxe.getUnlocalizedName());
|
||||||
|
GameRegistry.registerItem(mese_pickaxe, mese_pickaxe.getUnlocalizedName());
|
||||||
GameRegistry.registerItem(matchstick, matchstick.getUnlocalizedName());
|
GameRegistry.registerItem(matchstick, matchstick.getUnlocalizedName());
|
||||||
GameRegistry.registerItem(balefire_and_steel, balefire_and_steel.getUnlocalizedName());
|
GameRegistry.registerItem(balefire_and_steel, balefire_and_steel.getUnlocalizedName());
|
||||||
GameRegistry.registerItem(crowbar, crowbar.getUnlocalizedName());
|
GameRegistry.registerItem(crowbar, crowbar.getUnlocalizedName());
|
||||||
|
|||||||
@ -19,6 +19,7 @@ import net.minecraftforge.common.MinecraftForge;
|
|||||||
|
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Map.Entry;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
import com.hbm.blocks.ModBlocks;
|
import com.hbm.blocks.ModBlocks;
|
||||||
@ -188,6 +189,12 @@ public class ClientProxy extends ServerProxy {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void registerItemRenderer() {
|
public void registerItemRenderer() {
|
||||||
|
|
||||||
|
ItemRenderLibrary.init();
|
||||||
|
|
||||||
|
for(Entry<Item, ItemRenderBase> entry : ItemRenderLibrary.renderers.entrySet())
|
||||||
|
MinecraftForgeClient.registerItemRenderer(entry.getKey(), entry.getValue());
|
||||||
|
|
||||||
//test crap
|
//test crap
|
||||||
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(ModBlocks.test_container), new ItemRenderTestContainer());
|
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(ModBlocks.test_container), new ItemRenderTestContainer());
|
||||||
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(ModBlocks.test_bomb_advanced), new ItemRenderTestBombAdvanced());
|
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(ModBlocks.test_bomb_advanced), new ItemRenderTestBombAdvanced());
|
||||||
@ -296,8 +303,6 @@ public class ClientProxy extends ServerProxy {
|
|||||||
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(ModBlocks.steel_wall), new ItemRenderDecoBlock());
|
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(ModBlocks.steel_wall), new ItemRenderDecoBlock());
|
||||||
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(ModBlocks.steel_corner), new ItemRenderDecoBlock());
|
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(ModBlocks.steel_corner), new ItemRenderDecoBlock());
|
||||||
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(ModBlocks.steel_roof), new ItemRenderDecoBlock());
|
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(ModBlocks.steel_roof), new ItemRenderDecoBlock());
|
||||||
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(ModBlocks.machine_selenium), new ItemRendererMachine(2D));
|
|
||||||
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(ModBlocks.radiorec), new ItemRendererMachine(1D));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
57
src/main/java/com/hbm/render/item/ItemRenderBase.java
Normal file
57
src/main/java/com/hbm/render/item/ItemRenderBase.java
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
package com.hbm.render.item;
|
||||||
|
|
||||||
|
import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
|
import net.minecraft.client.renderer.RenderHelper;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraftforge.client.IItemRenderer;
|
||||||
|
|
||||||
|
public abstract class ItemRenderBase implements IItemRenderer {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean handleRenderType(ItemStack item, ItemRenderType type) {
|
||||||
|
switch(type) {
|
||||||
|
case EQUIPPED:
|
||||||
|
case EQUIPPED_FIRST_PERSON:
|
||||||
|
case ENTITY:
|
||||||
|
case INVENTORY:
|
||||||
|
return true;
|
||||||
|
default: return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) {
|
||||||
|
return type == ItemRenderType.ENTITY && (helper == ItemRendererHelper.ENTITY_BOBBING || helper == ItemRendererHelper.ENTITY_ROTATION);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
|
||||||
|
|
||||||
|
GL11.glPushMatrix();
|
||||||
|
if(type == ItemRenderType.INVENTORY) {
|
||||||
|
RenderHelper.enableGUIStandardItemLighting();
|
||||||
|
GL11.glTranslated(8, 10, 0);
|
||||||
|
GL11.glRotated(-30, 1, 0, 0);
|
||||||
|
GL11.glRotated(45, 0, 1, 0);
|
||||||
|
GL11.glScaled(-1, -1, -1);
|
||||||
|
renderInventory();
|
||||||
|
} else {
|
||||||
|
|
||||||
|
if(type != ItemRenderType.ENTITY)
|
||||||
|
GL11.glTranslated(0.5, 0.25, 0);
|
||||||
|
else
|
||||||
|
GL11.glScaled(1.5, 1.5, 1.5);
|
||||||
|
|
||||||
|
GL11.glScaled(0.25, 0.25, 0.25);
|
||||||
|
GL11.glRotated(90, 0, 1, 0);
|
||||||
|
renderNonInv();
|
||||||
|
}
|
||||||
|
renderCommon();
|
||||||
|
GL11.glPopMatrix();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void renderNonInv() { }
|
||||||
|
public void renderInventory() { }
|
||||||
|
public void renderCommon() { }
|
||||||
|
}
|
||||||
141
src/main/java/com/hbm/render/item/ItemRenderLibrary.java
Normal file
141
src/main/java/com/hbm/render/item/ItemRenderLibrary.java
Normal file
@ -0,0 +1,141 @@
|
|||||||
|
package com.hbm.render.item;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
|
||||||
|
import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
|
import com.hbm.blocks.ModBlocks;
|
||||||
|
import com.hbm.main.ResourceManager;
|
||||||
|
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraft.item.Item;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
|
||||||
|
public class ItemRenderLibrary {
|
||||||
|
|
||||||
|
public static HashMap<Item, ItemRenderBase> renderers = new HashMap();
|
||||||
|
|
||||||
|
public static void init() {
|
||||||
|
|
||||||
|
renderers.put(Item.getItemFromBlock(ModBlocks.machine_cyclotron), new ItemRenderBase() {
|
||||||
|
public void renderInventory() {
|
||||||
|
GL11.glScaled(2.25, 2.25, 2.25);
|
||||||
|
}
|
||||||
|
public void renderCommon() {
|
||||||
|
GL11.glShadeModel(GL11.GL_SMOOTH);
|
||||||
|
bindTexture(ResourceManager.cyclotron_tex); ResourceManager.cyclotron.renderPart("Body");
|
||||||
|
bindTexture(ResourceManager.cyclotron_ashes); ResourceManager.cyclotron.renderPart("B1");
|
||||||
|
bindTexture(ResourceManager.cyclotron_book); ResourceManager.cyclotron.renderPart("B2");
|
||||||
|
bindTexture(ResourceManager.cyclotron_gavel); ResourceManager.cyclotron.renderPart("B3");
|
||||||
|
bindTexture(ResourceManager.cyclotron_coin); ResourceManager.cyclotron.renderPart("B4");
|
||||||
|
GL11.glShadeModel(GL11.GL_FLAT);
|
||||||
|
}});
|
||||||
|
|
||||||
|
renderers.put(Item.getItemFromBlock(ModBlocks.machine_centrifuge), new ItemRenderBase() {
|
||||||
|
public void renderInventory() {
|
||||||
|
GL11.glTranslated(0, -4, 0);
|
||||||
|
GL11.glScaled(4.5, 4.5, 4.5);
|
||||||
|
}
|
||||||
|
public void renderCommon() {
|
||||||
|
bindTexture(ResourceManager.centrifuge_new_tex); ResourceManager.centrifuge_new.renderAll();
|
||||||
|
}});
|
||||||
|
|
||||||
|
renderers.put(Item.getItemFromBlock(ModBlocks.machine_gascent), new ItemRenderBase() {
|
||||||
|
public void renderInventory() {
|
||||||
|
GL11.glTranslated(0, -4, 0);
|
||||||
|
GL11.glScaled(4.5, 4.5, 4.5);
|
||||||
|
}
|
||||||
|
public void renderCommon() {
|
||||||
|
bindTexture(ResourceManager.centrifuge_gas_tex); ResourceManager.centrifuge_new.renderAll();
|
||||||
|
}});
|
||||||
|
|
||||||
|
renderers.put(Item.getItemFromBlock(ModBlocks.iter), new ItemRenderBase() {
|
||||||
|
public void renderInventory() {
|
||||||
|
GL11.glTranslated(0, -1, 0);
|
||||||
|
GL11.glScaled(4.5, 4.5, 4.5);
|
||||||
|
}
|
||||||
|
public void renderCommon() {
|
||||||
|
GL11.glScaled(0.25, 0.25, 0.25);
|
||||||
|
GL11.glShadeModel(GL11.GL_SMOOTH);
|
||||||
|
bindTexture(ResourceManager.iter_glass); ResourceManager.iter.renderPart("Windows");
|
||||||
|
bindTexture(ResourceManager.iter_motor); ResourceManager.iter.renderPart("Motors");
|
||||||
|
bindTexture(ResourceManager.iter_rails); ResourceManager.iter.renderPart("Rails");
|
||||||
|
bindTexture(ResourceManager.iter_toroidal); ResourceManager.iter.renderPart("Toroidal");
|
||||||
|
bindTexture(ResourceManager.iter_torus); ResourceManager.iter.renderPart("Torus");
|
||||||
|
bindTexture(ResourceManager.iter_solenoid); ResourceManager.iter.renderPart("Solenoid");
|
||||||
|
GL11.glShadeModel(GL11.GL_FLAT);
|
||||||
|
}});
|
||||||
|
|
||||||
|
renderers.put(Item.getItemFromBlock(ModBlocks.machine_press), new ItemRenderBase() {
|
||||||
|
public void renderInventory() {
|
||||||
|
GL11.glTranslated(0, -4, 0);
|
||||||
|
GL11.glScaled(4.5, 4.5, 4.5);
|
||||||
|
}
|
||||||
|
public void renderCommon() {
|
||||||
|
bindTexture(ResourceManager.press_body_tex); ResourceManager.press_body.renderAll();
|
||||||
|
GL11.glTranslated(0, 0.5, 0);
|
||||||
|
bindTexture(ResourceManager.press_head_tex); ResourceManager.press_head.renderAll();
|
||||||
|
}});
|
||||||
|
|
||||||
|
renderers.put(Item.getItemFromBlock(ModBlocks.machine_epress), new ItemRenderBase() {
|
||||||
|
public void renderInventory() {
|
||||||
|
GL11.glTranslated(0, -4, 0);
|
||||||
|
GL11.glScaled(4.5, 4.5, 4.5);
|
||||||
|
}
|
||||||
|
public void renderCommon() {
|
||||||
|
bindTexture(ResourceManager.epress_body_tex); ResourceManager.epress_body.renderAll();
|
||||||
|
GL11.glTranslated(0, 1.5, 0);
|
||||||
|
bindTexture(ResourceManager.epress_head_tex); ResourceManager.epress_head.renderAll();
|
||||||
|
}});
|
||||||
|
|
||||||
|
renderers.put(Item.getItemFromBlock(ModBlocks.machine_crystallizer), new ItemRenderBase() {
|
||||||
|
public void renderNonInv() {
|
||||||
|
GL11.glScaled(0.5, 0.5, 0.5);
|
||||||
|
}
|
||||||
|
public void renderInventory() {
|
||||||
|
GL11.glTranslated(0, -4, 0);
|
||||||
|
GL11.glScaled(1.75, 1.75, 1.75);
|
||||||
|
}
|
||||||
|
public void renderCommon() {
|
||||||
|
GL11.glShadeModel(GL11.GL_SMOOTH);
|
||||||
|
bindTexture(ResourceManager.crystallizer_tex); ResourceManager.crystallizer.renderPart("Body");
|
||||||
|
bindTexture(ResourceManager.crystallizer_window_tex); ResourceManager.crystallizer.renderPart("Windows");
|
||||||
|
bindTexture(ResourceManager.crystallizer_spinner_tex); ResourceManager.crystallizer.renderPart("Spinner");
|
||||||
|
GL11.glShadeModel(GL11.GL_FLAT);
|
||||||
|
}});
|
||||||
|
|
||||||
|
renderers.put(Item.getItemFromBlock(ModBlocks.machine_reactor), new ItemRenderBase() {
|
||||||
|
public void renderInventory() {
|
||||||
|
GL11.glTranslated(0, -4, 0);
|
||||||
|
GL11.glScaled(4.5, 4.5, 4.5);
|
||||||
|
}
|
||||||
|
public void renderCommon() {
|
||||||
|
GL11.glScaled(0.5, 0.5, 0.5);
|
||||||
|
GL11.glShadeModel(GL11.GL_SMOOTH);
|
||||||
|
GL11.glDisable(GL11.GL_CULL_FACE);
|
||||||
|
bindTexture(ResourceManager.breeder_tex); ResourceManager.breeder.renderAll();
|
||||||
|
GL11.glEnable(GL11.GL_CULL_FACE);
|
||||||
|
GL11.glShadeModel(GL11.GL_FLAT);
|
||||||
|
}});
|
||||||
|
|
||||||
|
renderers.put(Item.getItemFromBlock(ModBlocks.machine_large_turbine), new ItemRenderBase() {
|
||||||
|
public void renderInventory() {
|
||||||
|
GL11.glTranslated(0, -1, 0);
|
||||||
|
GL11.glScaled(2.5, 2.5, 2.5);
|
||||||
|
}
|
||||||
|
public void renderCommon() {
|
||||||
|
GL11.glRotated(90, 0, 1, 0);
|
||||||
|
GL11.glShadeModel(GL11.GL_SMOOTH);
|
||||||
|
GL11.glDisable(GL11.GL_CULL_FACE);
|
||||||
|
bindTexture(ResourceManager.turbine_tex); ResourceManager.turbine.renderPart("Body");
|
||||||
|
bindTexture(ResourceManager.turbofan_blades_tex); ResourceManager.turbine.renderPart("Blades");
|
||||||
|
GL11.glEnable(GL11.GL_CULL_FACE);
|
||||||
|
GL11.glShadeModel(GL11.GL_FLAT);
|
||||||
|
}});
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void bindTexture(ResourceLocation res) {
|
||||||
|
Minecraft.getMinecraft().renderEngine.bindTexture(res);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,124 +0,0 @@
|
|||||||
package com.hbm.render.item.block;
|
|
||||||
|
|
||||||
import org.lwjgl.opengl.GL11;
|
|
||||||
|
|
||||||
import com.hbm.blocks.ModBlocks;
|
|
||||||
import com.hbm.lib.RefStrings;
|
|
||||||
import com.hbm.main.ResourceManager;
|
|
||||||
import com.hbm.render.model.ModelBroadcaster;
|
|
||||||
|
|
||||||
import net.minecraft.client.Minecraft;
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
|
||||||
import net.minecraft.item.Item;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.util.ResourceLocation;
|
|
||||||
import net.minecraftforge.client.IItemRenderer;
|
|
||||||
|
|
||||||
public class ItemRendererMachine implements IItemRenderer {
|
|
||||||
|
|
||||||
///// THIS IS A TEST CLASS. CARVE THIS INTO A BASE CLASS FOR LESS CRAPPY BLOCK ITEM RENDERERS IN THE FUTURE ////
|
|
||||||
double scale = 1.0D;
|
|
||||||
private ModelBroadcaster broadcaster;
|
|
||||||
private static final ResourceLocation broadcasterTex = new ResourceLocation(RefStrings.MODID + ":" + "textures/models/ModelRadioReceiver.png");
|
|
||||||
|
|
||||||
public ItemRendererMachine(double scale) {
|
|
||||||
this.scale = scale;
|
|
||||||
this.broadcaster = new ModelBroadcaster();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean handleRenderType(ItemStack item, ItemRenderType type) {
|
|
||||||
switch(type) {
|
|
||||||
case EQUIPPED:
|
|
||||||
case EQUIPPED_FIRST_PERSON:
|
|
||||||
case ENTITY:
|
|
||||||
case INVENTORY:
|
|
||||||
return true;
|
|
||||||
default: return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) {
|
|
||||||
|
|
||||||
return type == ItemRenderType.ENTITY && (helper == ItemRendererHelper.ENTITY_ROTATION || helper == ItemRendererHelper.ENTITY_BOBBING);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
|
|
||||||
|
|
||||||
GL11.glPushMatrix();
|
|
||||||
|
|
||||||
EntityPlayer player = Minecraft.getMinecraft().thePlayer;
|
|
||||||
|
|
||||||
switch(type) {
|
|
||||||
|
|
||||||
case EQUIPPED_FIRST_PERSON:
|
|
||||||
|
|
||||||
GL11.glScaled(0.5, 0.5, 0.5);
|
|
||||||
GL11.glTranslated(1, 0.5, 0);
|
|
||||||
GL11.glRotated(180, 0, 1, 0);
|
|
||||||
|
|
||||||
break;
|
|
||||||
|
|
||||||
case EQUIPPED:
|
|
||||||
|
|
||||||
GL11.glTranslated(0.5, 0, 0);
|
|
||||||
GL11.glRotated(90, 0, 1, 0);
|
|
||||||
double scaleEq = 0.5;
|
|
||||||
GL11.glScaled(scaleEq, scaleEq, scaleEq);
|
|
||||||
|
|
||||||
break;
|
|
||||||
|
|
||||||
case ENTITY:
|
|
||||||
|
|
||||||
GL11.glScaled(0.5, 0.5, 0.5);
|
|
||||||
|
|
||||||
break;
|
|
||||||
|
|
||||||
case INVENTORY:
|
|
||||||
|
|
||||||
GL11.glRotated(180, 1, 0, 0);
|
|
||||||
int scale = 8;
|
|
||||||
GL11.glTranslated(8, -16, 0);
|
|
||||||
GL11.glScaled(scale, scale, scale);
|
|
||||||
|
|
||||||
//GL11.glRotated(25, 1, 0, 0);
|
|
||||||
//GL11.glRotated(45, 0, 1, 0);
|
|
||||||
|
|
||||||
break;
|
|
||||||
|
|
||||||
default: break;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
if(item.getItem() == Item.getItemFromBlock(ModBlocks.machine_selenium)) {
|
|
||||||
|
|
||||||
GL11.glDisable(GL11.GL_CULL_FACE);
|
|
||||||
Minecraft.getMinecraft().renderEngine.bindTexture(ResourceManager.selenium_body_tex);
|
|
||||||
ResourceManager.selenium_body.renderAll();
|
|
||||||
|
|
||||||
GL11.glTranslated(0.0D, 1.0D, 0.0D);
|
|
||||||
|
|
||||||
Minecraft.getMinecraft().renderEngine.bindTexture(ResourceManager.selenium_piston_tex);
|
|
||||||
for(int i = 0; i < 7; i++) {
|
|
||||||
ResourceManager.selenium_piston.renderAll();
|
|
||||||
GL11.glRotatef(360F/7F, 0, 0, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
Minecraft.getMinecraft().renderEngine.bindTexture(ResourceManager.selenium_rotor_tex);
|
|
||||||
ResourceManager.selenium_rotor.renderAll();
|
|
||||||
GL11.glEnable(GL11.GL_CULL_FACE);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(item.getItem() == Item.getItemFromBlock(ModBlocks.radiorec)) {
|
|
||||||
GL11.glTranslated(0, 1.5, 0);
|
|
||||||
GL11.glRotated(180, 1, 0, 0);
|
|
||||||
Minecraft.getMinecraft().renderEngine.bindTexture(broadcasterTex);
|
|
||||||
broadcaster.renderModel(0.0625F);
|
|
||||||
}
|
|
||||||
|
|
||||||
GL11.glPopMatrix();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -100,19 +100,19 @@ public abstract class TileEntityMachineBase extends TileEntity implements ISided
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack decrStackSize(int i, int j) {
|
public ItemStack decrStackSize(int slot, int amount) {
|
||||||
if(slots[i] != null)
|
if(slots[slot] != null)
|
||||||
{
|
{
|
||||||
if(slots[i].stackSize <= j)
|
if(slots[slot].stackSize <= amount)
|
||||||
{
|
{
|
||||||
ItemStack itemStack = slots[i];
|
ItemStack itemStack = slots[slot];
|
||||||
slots[i] = null;
|
slots[slot] = null;
|
||||||
return itemStack;
|
return itemStack;
|
||||||
}
|
}
|
||||||
ItemStack itemStack1 = slots[i].splitStack(j);
|
ItemStack itemStack1 = slots[slot].splitStack(amount);
|
||||||
if (slots[i].stackSize == 0)
|
if (slots[slot].stackSize == 0)
|
||||||
{
|
{
|
||||||
slots[i] = null;
|
slots[slot] = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return itemStack1;
|
return itemStack1;
|
||||||
|
|||||||
@ -2,11 +2,29 @@ package com.hbm.tileentity.machine;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.google.common.collect.HashBiMap;
|
||||||
import com.hbm.interfaces.IConsumer;
|
import com.hbm.interfaces.IConsumer;
|
||||||
import com.hbm.interfaces.ISource;
|
import com.hbm.interfaces.ISource;
|
||||||
|
import com.hbm.items.ModItems;
|
||||||
import com.hbm.tileentity.TileEntityMachineBase;
|
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;
|
||||||
|
|
||||||
public class TileEntityMachineIGenerator extends TileEntityMachineBase implements ISource {
|
public class TileEntityMachineIGenerator extends TileEntityMachineBase implements ISource {
|
||||||
|
|
||||||
|
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 IGenRTG[] pellets = new IGenRTG[12];
|
||||||
|
|
||||||
public TileEntityMachineIGenerator() {
|
public TileEntityMachineIGenerator() {
|
||||||
super(15);
|
super(15);
|
||||||
@ -22,9 +40,170 @@ public class TileEntityMachineIGenerator extends TileEntityMachineBase implement
|
|||||||
|
|
||||||
if(!worldObj.isRemote) {
|
if(!worldObj.isRemote) {
|
||||||
|
|
||||||
|
loadFuel();
|
||||||
|
rtgAction();
|
||||||
|
|
||||||
|
if(burnTime > 0)
|
||||||
|
burnTime --;
|
||||||
|
|
||||||
|
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.setShort("burn", (short) burnTime);
|
||||||
|
data.setShort("lastBurn", (short) lastBurnTime);
|
||||||
|
this.networkPack(data, 250);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@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.burnTime = nbt.getShort("burn");
|
||||||
|
this.lastBurnTime = nbt.getShort("lastBurn");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void handleButtonPacket(int value, int meta) {
|
||||||
|
|
||||||
|
if(meta == 0)
|
||||||
|
pushPellet();
|
||||||
|
if(meta == 1)
|
||||||
|
popPellet();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void ffgeuaInit() {
|
public void ffgeuaInit() {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
@ -66,4 +245,61 @@ public class TileEntityMachineIGenerator extends TileEntityMachineBase implement
|
|||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
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");
|
||||||
|
}
|
||||||
|
|
||||||
|
@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);
|
||||||
|
}
|
||||||
|
|
||||||
|
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);
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user