mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
DFC stabilizer, finishing touch on all outer blocks
This commit is contained in:
parent
06ce200ee0
commit
8973fb0ed1
Binary file not shown.
|
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.8 KiB |
BIN
assets/hbm/textures/gui/dfc/gui_stabilizer.png
Normal file
BIN
assets/hbm/textures/gui/dfc/gui_stabilizer.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.6 KiB |
BIN
assets/hbm/textures/models/core_stabilizer.png
Normal file
BIN
assets/hbm/textures/models/core_stabilizer.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 391 B |
@ -470,6 +470,8 @@ public class ModBlocks {
|
||||
public static final int guiID_dfc_injector = 90;
|
||||
public static Block dfc_receiver;
|
||||
public static final int guiID_dfc_receiver = 88;
|
||||
public static Block dfc_stabilizer;
|
||||
public static final int guiID_dfc_stabilizer = 91;
|
||||
public static Block dfc_core;
|
||||
public static final int guiID_dfc_core = 89;
|
||||
|
||||
@ -1083,6 +1085,7 @@ public class ModBlocks {
|
||||
dfc_emitter = new CoreComponent(Material.iron).setBlockName("dfc_emitter").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":dfc_emitter");
|
||||
dfc_injector = new CoreComponent(Material.iron).setBlockName("dfc_injector").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":dfc_injector");
|
||||
dfc_receiver = new CoreComponent(Material.iron).setBlockName("dfc_receiver").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":dfc_receiver");
|
||||
dfc_stabilizer = new CoreComponent(Material.iron).setBlockName("dfc_stabilizer").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":dfc_stabilizer");
|
||||
dfc_core = new CoreCore(Material.iron).setBlockName("dfc_core").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":dfc_core");
|
||||
|
||||
seal_frame = new BlockGeneric(Material.iron).setBlockName("seal_frame").setHardness(10.0F).setResistance(100.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":seal_frame");
|
||||
@ -1737,6 +1740,7 @@ public class ModBlocks {
|
||||
GameRegistry.registerBlock(dfc_emitter, dfc_emitter.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(dfc_injector, dfc_injector.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(dfc_receiver, dfc_receiver.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(dfc_stabilizer, dfc_stabilizer.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(dfc_core, dfc_core.getUnlocalizedName());
|
||||
|
||||
//Missile Blocks
|
||||
|
||||
@ -5,6 +5,7 @@ import com.hbm.main.MainRegistry;
|
||||
import com.hbm.tileentity.machine.TileEntityCoreEmitter;
|
||||
import com.hbm.tileentity.machine.TileEntityCoreInjector;
|
||||
import com.hbm.tileentity.machine.TileEntityCoreReceiver;
|
||||
import com.hbm.tileentity.machine.TileEntityCoreStabilizer;
|
||||
|
||||
import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
@ -31,6 +32,8 @@ public class CoreComponent extends BlockContainer {
|
||||
return new TileEntityCoreReceiver();
|
||||
if(this == ModBlocks.dfc_injector)
|
||||
return new TileEntityCoreInjector();
|
||||
if(this == ModBlocks.dfc_stabilizer)
|
||||
return new TileEntityCoreStabilizer();
|
||||
|
||||
return null;
|
||||
}
|
||||
@ -72,6 +75,9 @@ public class CoreComponent extends BlockContainer {
|
||||
if(this == ModBlocks.dfc_injector)
|
||||
FMLNetworkHandler.openGui(player, MainRegistry.instance, ModBlocks.guiID_dfc_injector, world, x, y, z);
|
||||
|
||||
if(this == ModBlocks.dfc_stabilizer)
|
||||
FMLNetworkHandler.openGui(player, MainRegistry.instance, ModBlocks.guiID_dfc_stabilizer, world, x, y, z);
|
||||
|
||||
return true;
|
||||
|
||||
} else {
|
||||
|
||||
@ -804,6 +804,24 @@ public class GUIHandler implements IGuiHandler {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
case ModBlocks.guiID_dfc_core:
|
||||
{
|
||||
if(entity instanceof TileEntityCore)
|
||||
{
|
||||
return new ContainerCore(player.inventory, (TileEntityCore) entity);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
case ModBlocks.guiID_dfc_stabilizer:
|
||||
{
|
||||
if(entity instanceof TileEntityCoreStabilizer)
|
||||
{
|
||||
return new ContainerCoreStabilizer(player.inventory, (TileEntityCoreStabilizer) entity);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
//NON-TE CONTAINERS
|
||||
@ -1607,6 +1625,24 @@ public class GUIHandler implements IGuiHandler {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
case ModBlocks.guiID_dfc_core:
|
||||
{
|
||||
if(entity instanceof TileEntityCore)
|
||||
{
|
||||
return new GUICore(player.inventory, (TileEntityCore) entity);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
case ModBlocks.guiID_dfc_stabilizer:
|
||||
{
|
||||
if(entity instanceof TileEntityCoreStabilizer)
|
||||
{
|
||||
return new GUICoreStabilizer(player.inventory, (TileEntityCoreStabilizer) entity);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
//CLIENTONLY GUIS
|
||||
|
||||
72
com/hbm/inventory/container/ContainerCore.java
Normal file
72
com/hbm/inventory/container/ContainerCore.java
Normal file
@ -0,0 +1,72 @@
|
||||
package com.hbm.inventory.container;
|
||||
|
||||
import com.hbm.tileentity.machine.TileEntityCore;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class ContainerCore extends Container {
|
||||
|
||||
private TileEntityCore nukeBoy;
|
||||
|
||||
public ContainerCore(InventoryPlayer invPlayer, TileEntityCore tedf) {
|
||||
|
||||
nukeBoy = tedf;
|
||||
|
||||
this.addSlotToContainer(new Slot(tedf, 0, 62, 53));
|
||||
this.addSlotToContainer(new Slot(tedf, 1, 80, 53));
|
||||
this.addSlotToContainer(new Slot(tedf, 2, 98, 53));
|
||||
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
||||
for(int i = 0; i < 9; i++)
|
||||
{
|
||||
this.addSlotToContainer(new Slot(invPlayer, i, 8 + i * 18, 142));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack transferStackInSlot(EntityPlayer p_82846_1_, int par2)
|
||||
{
|
||||
ItemStack var3 = null;
|
||||
Slot var4 = (Slot) this.inventorySlots.get(par2);
|
||||
|
||||
if (var4 != null && var4.getHasStack())
|
||||
{
|
||||
ItemStack var5 = var4.getStack();
|
||||
var3 = var5.copy();
|
||||
|
||||
if (par2 <= 2) {
|
||||
if (!this.mergeItemStack(var5, 3, this.inventorySlots.size(), true))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
if (var5.stackSize == 0)
|
||||
{
|
||||
var4.putStack((ItemStack) null);
|
||||
}
|
||||
else
|
||||
{
|
||||
var4.onSlotChanged();
|
||||
}
|
||||
}
|
||||
|
||||
return var3;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInteractWith(EntityPlayer player) {
|
||||
return nukeBoy.isUseableByPlayer(player);
|
||||
}
|
||||
}
|
||||
36
com/hbm/inventory/container/ContainerCoreStabilizer.java
Normal file
36
com/hbm/inventory/container/ContainerCoreStabilizer.java
Normal file
@ -0,0 +1,36 @@
|
||||
package com.hbm.inventory.container;
|
||||
|
||||
import com.hbm.tileentity.machine.TileEntityCoreStabilizer;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.Slot;
|
||||
|
||||
public class ContainerCoreStabilizer extends Container {
|
||||
|
||||
private TileEntityCoreStabilizer nukeBoy;
|
||||
|
||||
public ContainerCoreStabilizer(InventoryPlayer invPlayer, TileEntityCoreStabilizer tedf) {
|
||||
|
||||
nukeBoy = tedf;
|
||||
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
||||
for(int i = 0; i < 9; i++)
|
||||
{
|
||||
this.addSlotToContainer(new Slot(invPlayer, i, 8 + i * 18, 142));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInteractWith(EntityPlayer player) {
|
||||
return nukeBoy.isUseableByPlayer(player);
|
||||
}
|
||||
}
|
||||
64
com/hbm/inventory/gui/GUICore.java
Normal file
64
com/hbm/inventory/gui/GUICore.java
Normal file
@ -0,0 +1,64 @@
|
||||
package com.hbm.inventory.gui;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.hbm.inventory.FluidTank;
|
||||
import com.hbm.inventory.container.ContainerCore;
|
||||
import com.hbm.lib.RefStrings;
|
||||
import com.hbm.tileentity.machine.TileEntityCore;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public class GUICore extends GuiInfoContainer {
|
||||
|
||||
private static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/dfc/gui_core.png");
|
||||
private TileEntityCore core;
|
||||
|
||||
public GUICore(InventoryPlayer invPlayer, TileEntityCore tedf) {
|
||||
super(new ContainerCore(invPlayer, tedf));
|
||||
core = tedf;
|
||||
|
||||
this.xSize = 176;
|
||||
this.ySize = 166;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen(int mouseX, int mouseY, float f) {
|
||||
super.drawScreen(mouseX, mouseY, f);
|
||||
|
||||
core.tanks[0].renderTankInfo(this, mouseX, mouseY, guiLeft + 26, guiTop + 17, 16, 52);
|
||||
core.tanks[1].renderTankInfo(this, mouseX, mouseY, guiLeft + 134, guiTop + 17, 16, 52);
|
||||
|
||||
String[] text = new String[] { "Restriction Field: " + core.field + "%" };
|
||||
this.drawCustomInfoStat(mouseX, mouseY, guiLeft + 8, guiTop + 17, 16, 52, mouseX, mouseY, text);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer( int i, int j) {
|
||||
|
||||
String name = this.core.hasCustomInventoryName() ? this.core.getInventoryName() : I18n.format(this.core.getInventoryName());
|
||||
this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6, 4210752);
|
||||
this.fontRendererObj.drawString(I18n.format("container.inventory"), 8, this.ySize - 96 + 2, 4210752);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) {
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
|
||||
drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
|
||||
|
||||
int i = core.getFieldScaled(52);
|
||||
drawTexturedModalRect(guiLeft + 8, guiTop + 69 - i, 176, 52 - i, 16, i);
|
||||
|
||||
int j = core.getHeatScaled(52);
|
||||
drawTexturedModalRect(guiLeft + 152, guiTop + 69 - j, 192, 52 - j, 16, j);
|
||||
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture(core.tanks[0].getSheet());
|
||||
core.tanks[0].renderTank(this, guiLeft + 26, guiTop + 69, core.tanks[0].getTankType().textureX() * FluidTank.x, core.tanks[0].getTankType().textureY() * FluidTank.y, 16, 52);
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture(core.tanks[1].getSheet());
|
||||
core.tanks[1].renderTank(this, guiLeft + 134, guiTop + 69, core.tanks[1].getTankType().textureX() * FluidTank.x, core.tanks[1].getTankType().textureY() * FluidTank.y, 16, 52);
|
||||
}
|
||||
}
|
||||
102
com/hbm/inventory/gui/GUICoreStabilizer.java
Normal file
102
com/hbm/inventory/gui/GUICoreStabilizer.java
Normal file
@ -0,0 +1,102 @@
|
||||
package com.hbm.inventory.gui;
|
||||
|
||||
import org.apache.commons.lang3.math.NumberUtils;
|
||||
import org.lwjgl.input.Keyboard;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.hbm.inventory.container.ContainerCoreStabilizer;
|
||||
import com.hbm.lib.RefStrings;
|
||||
import com.hbm.packet.AuxButtonPacket;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
import com.hbm.tileentity.machine.TileEntityCoreStabilizer;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.audio.PositionedSoundRecord;
|
||||
import net.minecraft.client.gui.GuiTextField;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public class GUICoreStabilizer extends GuiInfoContainer {
|
||||
|
||||
private static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/dfc/gui_stabilizer.png");
|
||||
private TileEntityCoreStabilizer stabilizer;
|
||||
private GuiTextField field;
|
||||
|
||||
public GUICoreStabilizer(InventoryPlayer invPlayer, TileEntityCoreStabilizer tedf) {
|
||||
super(new ContainerCoreStabilizer(invPlayer, tedf));
|
||||
stabilizer = tedf;
|
||||
|
||||
this.xSize = 176;
|
||||
this.ySize = 166;
|
||||
}
|
||||
|
||||
public void initGui() {
|
||||
|
||||
super.initGui();
|
||||
|
||||
Keyboard.enableRepeatEvents(true);
|
||||
this.field = new GuiTextField(this.fontRendererObj, guiLeft + 75, guiTop + 57, 29, 12);
|
||||
this.field.setTextColor(-1);
|
||||
this.field.setDisabledTextColour(-1);
|
||||
this.field.setEnableBackgroundDrawing(false);
|
||||
this.field.setMaxStringLength(3);
|
||||
this.field.setText(String.valueOf(stabilizer.watts));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen(int mouseX, int mouseY, float f) {
|
||||
super.drawScreen(mouseX, mouseY, f);
|
||||
|
||||
this.drawElectricityInfo(this, mouseX, mouseY, guiLeft + 35, guiTop + 17, 16, 52, stabilizer.power, stabilizer.maxPower);
|
||||
}
|
||||
|
||||
protected void mouseClicked(int x, int y, int i) {
|
||||
super.mouseClicked(x, y, i);
|
||||
this.field.mouseClicked(x, y, i);
|
||||
|
||||
if(guiLeft + 124 <= x && guiLeft + 124 + 18 > x && guiTop + 52 < y && guiTop + 52 + 18 >= y) {
|
||||
|
||||
if(NumberUtils.isNumber(field.getText())) {
|
||||
int j = MathHelper.clamp_int(Integer.parseInt(field.getText()), 1, 100);
|
||||
field.setText(j + "");
|
||||
mc.getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 1.0F));
|
||||
PacketDispatcher.wrapper.sendToServer(new AuxButtonPacket(stabilizer.xCoord, stabilizer.yCoord, stabilizer.zCoord, j, 0));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer( int i, int j) {
|
||||
String name = this.stabilizer.hasCustomInventoryName() ? this.stabilizer.getInventoryName() : I18n.format(this.stabilizer.getInventoryName());
|
||||
this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6, 4210752);
|
||||
|
||||
this.fontRendererObj.drawString(I18n.format("container.inventory"), 8, this.ySize - 96 + 2, 4210752);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) {
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
|
||||
drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
|
||||
|
||||
if(field.isFocused())
|
||||
drawTexturedModalRect(guiLeft + 71, guiTop + 53, 192, 4, 34, 16);
|
||||
|
||||
drawTexturedModalRect(guiLeft + 71, guiTop + 45, 192, 0, stabilizer.watts * 34 / 100, 4);
|
||||
|
||||
int i = (int) stabilizer.getPowerScaled(52);
|
||||
drawTexturedModalRect(guiLeft + 35, guiTop + 69 - i, 176, 52 - i, 16, i);
|
||||
|
||||
this.field.drawTextBox();
|
||||
}
|
||||
|
||||
protected void keyTyped(char p_73869_1_, int p_73869_2_)
|
||||
{
|
||||
if (this.field.textboxKeyTyped(p_73869_1_, p_73869_2_)) { }
|
||||
else {
|
||||
super.keyTyped(p_73869_1_, p_73869_2_);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -345,6 +345,7 @@ public class ClientProxy extends ServerProxy
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityCoreEmitter.class, new RenderCoreComponent());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityCoreReceiver.class, new RenderCoreComponent());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityCoreInjector.class, new RenderCoreComponent());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityCoreStabilizer.class, new RenderCoreComponent());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityCore.class, new RenderCore());
|
||||
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityMissileCustom.class, new RenderMissileCustom());
|
||||
|
||||
@ -521,6 +521,7 @@ public class MainRegistry
|
||||
GameRegistry.registerTileEntity(TileEntityCoreEmitter.class, "tileentity_v0_emitter");
|
||||
GameRegistry.registerTileEntity(TileEntityCoreReceiver.class, "tileentity_v0_receiver");
|
||||
GameRegistry.registerTileEntity(TileEntityCoreInjector.class, "tileentity_v0_injector");
|
||||
GameRegistry.registerTileEntity(TileEntityCoreStabilizer.class, "tileentity_v0_stabilizer");
|
||||
GameRegistry.registerTileEntity(TileEntityCore.class, "tileentity_v0");
|
||||
GameRegistry.registerTileEntity(TileEntityMachineArcFurnace.class, "tileentity_arc_furnace");
|
||||
GameRegistry.registerTileEntity(TileEntityMachineAmgen.class, "tileentity_amgen");
|
||||
|
||||
@ -216,6 +216,7 @@ public class ResourceManager {
|
||||
public static final ResourceLocation dfc_emitter_tex = new ResourceLocation(RefStrings.MODID, "textures/models/core_emitter.png");
|
||||
public static final ResourceLocation dfc_receiver_tex = new ResourceLocation(RefStrings.MODID, "textures/models/core_receiver.png");
|
||||
public static final ResourceLocation dfc_injector_tex = new ResourceLocation(RefStrings.MODID, "textures/models/core_injector.png");
|
||||
public static final ResourceLocation dfc_stabilizer_tex = new ResourceLocation(RefStrings.MODID, "textures/models/core_stabilizer.png");
|
||||
|
||||
//Radgen
|
||||
public static final ResourceLocation radgen_body_tex = new ResourceLocation(RefStrings.MODID, "textures/models/rad_gen_body.png");
|
||||
|
||||
@ -4,6 +4,7 @@ import com.hbm.handler.FluidTypeHandler.FluidType;
|
||||
import com.hbm.items.weapon.ItemMissile.PartSize;
|
||||
import com.hbm.tileentity.bomb.TileEntityLaunchTable;
|
||||
import com.hbm.tileentity.machine.TileEntityCoreEmitter;
|
||||
import com.hbm.tileentity.machine.TileEntityCoreStabilizer;
|
||||
import com.hbm.tileentity.machine.TileEntityForceField;
|
||||
import com.hbm.tileentity.machine.TileEntityMachineMissileAssembly;
|
||||
import com.hbm.tileentity.machine.TileEntityMachineReactorLarge;
|
||||
@ -217,6 +218,14 @@ public class AuxButtonPacket implements IMessage {
|
||||
}
|
||||
}
|
||||
|
||||
if (te instanceof TileEntityCoreStabilizer) {
|
||||
TileEntityCoreStabilizer core = (TileEntityCoreStabilizer)te;
|
||||
|
||||
if(m.id == 0) {
|
||||
core.watts = m.value;
|
||||
}
|
||||
}
|
||||
|
||||
//} catch (Exception x) { }
|
||||
|
||||
return null;
|
||||
|
||||
@ -9,6 +9,7 @@ import com.hbm.render.util.BeamPronter.EnumWaveType;
|
||||
import com.hbm.tileentity.machine.TileEntityCoreEmitter;
|
||||
import com.hbm.tileentity.machine.TileEntityCoreInjector;
|
||||
import com.hbm.tileentity.machine.TileEntityCoreReceiver;
|
||||
import com.hbm.tileentity.machine.TileEntityCoreStabilizer;
|
||||
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
@ -70,11 +71,31 @@ public class RenderCoreComponent extends TileEntitySpecialRenderer {
|
||||
ResourceManager.dfc_injector.renderAll();
|
||||
|
||||
GL11.glTranslated(0, 0.5, 0);
|
||||
int range = ((TileEntityCoreInjector)tileEntity).beam;
|
||||
TileEntityCoreInjector injector = (TileEntityCoreInjector)tileEntity;
|
||||
int range = injector.beam;
|
||||
|
||||
if(range > 0) {
|
||||
BeamPronter.prontBeam(Vec3.createVectorHelper(0, 0, range), EnumWaveType.RANDOM, EnumBeamType.LINE, 0x0000ff, 0x8080ff, (int)tileEntity.getWorldObj().getTotalWorldTime() % 1000, range, 0.0625F, 0, 0);
|
||||
BeamPronter.prontBeam(Vec3.createVectorHelper(0, 0, range), EnumWaveType.RANDOM, EnumBeamType.LINE, 0x0000ff, 0x8080ff, (int)tileEntity.getWorldObj().getTotalWorldTime() % 1000 + 1, range, 0.0625F, 0, 0);
|
||||
|
||||
if(injector.tanks[0].getFill() > 0)
|
||||
BeamPronter.prontBeam(Vec3.createVectorHelper(0, 0, range), EnumWaveType.RANDOM, EnumBeamType.LINE, injector.tanks[0].getTankType().getColor(), 0x808080, (int)tileEntity.getWorldObj().getTotalWorldTime() % 1000, range, 0.0625F, 0, 0);
|
||||
if(injector.tanks[1].getFill() > 0)
|
||||
BeamPronter.prontBeam(Vec3.createVectorHelper(0, 0, range), EnumWaveType.RANDOM, EnumBeamType.LINE, injector.tanks[1].getTankType().getColor(), 0x808080, (int)tileEntity.getWorldObj().getTotalWorldTime() % 1000 + 1, range, 0.0625F, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
if(tileEntity instanceof TileEntityCoreStabilizer) {
|
||||
bindTexture(ResourceManager.dfc_stabilizer_tex);
|
||||
ResourceManager.dfc_injector.renderAll();
|
||||
|
||||
|
||||
GL11.glTranslated(0, 0.5, 0);
|
||||
TileEntityCoreStabilizer stabilizer = (TileEntityCoreStabilizer)tileEntity;
|
||||
int range = stabilizer.beam;
|
||||
|
||||
if(range > 0) {
|
||||
BeamPronter.prontBeam(Vec3.createVectorHelper(0, 0, range), EnumWaveType.SPIRAL, EnumBeamType.LINE, 0xffa200, 0xffd000, (int)tileEntity.getWorldObj().getTotalWorldTime() * -25 % 360, range * 3, 0.125F, 0, 0);
|
||||
BeamPronter.prontBeam(Vec3.createVectorHelper(0, 0, range), EnumWaveType.SPIRAL, EnumBeamType.LINE, 0xffa200, 0xffd000, (int)tileEntity.getWorldObj().getTotalWorldTime() * -15 % 360 + 180, range * 3, 0.125F, 0, 0);
|
||||
BeamPronter.prontBeam(Vec3.createVectorHelper(0, 0, range), EnumWaveType.SPIRAL, EnumBeamType.LINE, 0xffa200, 0xffd000, (int)tileEntity.getWorldObj().getTotalWorldTime() * -5 % 360 + 180, range * 3, 0.125F, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -4,6 +4,8 @@ import com.hbm.handler.FluidTypeHandler.FluidType;
|
||||
import com.hbm.inventory.FluidTank;
|
||||
import com.hbm.tileentity.TileEntityMachineBase;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
public class TileEntityCore extends TileEntityMachineBase {
|
||||
|
||||
public int field;
|
||||
@ -26,6 +28,36 @@ public class TileEntityCore extends TileEntityMachineBase {
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
|
||||
if(!worldObj.isRemote) {
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setInteger("tank0", tanks[0].getTankType().ordinal());
|
||||
data.setInteger("tank1", tanks[1].getTankType().ordinal());
|
||||
data.setInteger("fill0", tanks[0].getFill());
|
||||
data.setInteger("fill1", tanks[1].getFill());
|
||||
data.setInteger("field", field);
|
||||
data.setInteger("heat", heat);
|
||||
networkPack(data, 250);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void networkUnpack(NBTTagCompound data) {
|
||||
|
||||
tanks[0].setTankType(FluidType.getEnum(data.getInteger("tank0")));
|
||||
tanks[1].setTankType(FluidType.getEnum(data.getInteger("tank1")));
|
||||
tanks[0].setFill(data.getInteger("fill0"));
|
||||
tanks[1].setFill(data.getInteger("fill1"));
|
||||
field = data.getInteger("field");
|
||||
heat = data.getInteger("heat");
|
||||
}
|
||||
|
||||
public int getFieldScaled(int i) {
|
||||
return (field * i) / 100;
|
||||
}
|
||||
|
||||
public int getHeatScaled(int i) {
|
||||
return (heat * i) / 100;
|
||||
}
|
||||
|
||||
public long burn(long joules) {
|
||||
|
||||
@ -10,6 +10,7 @@ import com.hbm.tileentity.TileEntityMachineBase;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
@ -80,6 +81,9 @@ public class TileEntityCoreInjector extends TileEntityMachineBase implements IFl
|
||||
beam = i;
|
||||
break;
|
||||
}
|
||||
|
||||
if(worldObj.getBlock(x, y, z) != Blocks.air)
|
||||
break;
|
||||
}
|
||||
|
||||
this.markDirty();
|
||||
|
||||
134
com/hbm/tileentity/machine/TileEntityCoreStabilizer.java
Normal file
134
com/hbm/tileentity/machine/TileEntityCoreStabilizer.java
Normal file
@ -0,0 +1,134 @@
|
||||
package com.hbm.tileentity.machine;
|
||||
|
||||
import com.hbm.interfaces.IConsumer;
|
||||
import com.hbm.tileentity.TileEntityMachineBase;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class TileEntityCoreStabilizer extends TileEntityMachineBase implements IConsumer {
|
||||
|
||||
public long power;
|
||||
public static final long maxPower = 2500000000L;
|
||||
public int watts;
|
||||
public int beam;
|
||||
|
||||
public static final int range = 15;
|
||||
|
||||
public TileEntityCoreStabilizer() {
|
||||
super(1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "container.dfcStabilizer";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
|
||||
if(!worldObj.isRemote) {
|
||||
|
||||
watts = MathHelper.clamp_int(watts, 1, 100);
|
||||
int demand = (int) Math.pow(watts, 4);
|
||||
|
||||
beam = 0;
|
||||
|
||||
if(power >= demand) {
|
||||
|
||||
ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata());
|
||||
for(int i = 1; i <= range; i++) {
|
||||
|
||||
int x = xCoord + dir.offsetX * i;
|
||||
int y = yCoord + dir.offsetY * i;
|
||||
int z = zCoord + dir.offsetZ * i;
|
||||
|
||||
TileEntity te = worldObj.getTileEntity(x, y, z);
|
||||
|
||||
if(te instanceof TileEntityCore) {
|
||||
|
||||
TileEntityCore core = (TileEntityCore)te;
|
||||
core.field = watts;
|
||||
this.power -= demand;
|
||||
beam = i;
|
||||
break;
|
||||
}
|
||||
|
||||
if(worldObj.getBlock(x, y, z) != Blocks.air)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setLong("power", power);
|
||||
data.setInteger("watts", watts);
|
||||
data.setInteger("beam", beam);
|
||||
this.networkPack(data, 250);
|
||||
}
|
||||
}
|
||||
|
||||
public void networkUnpack(NBTTagCompound data) {
|
||||
|
||||
power = data.getLong("power");
|
||||
watts = data.getInteger("watts");
|
||||
beam = data.getInteger("beam");
|
||||
}
|
||||
|
||||
public long getPowerScaled(long i) {
|
||||
return (power * i) / maxPower;
|
||||
}
|
||||
|
||||
public int getWattsScaled(int i) {
|
||||
return (watts * i) / 100;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPower(long i) {
|
||||
this.power = i;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getPower() {
|
||||
return this.power;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getMaxPower() {
|
||||
return this.maxPower;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getRenderBoundingBox() {
|
||||
return TileEntity.INFINITE_EXTENT_AABB;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public double getMaxRenderDistanceSquared()
|
||||
{
|
||||
return 65536.0D;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbt) {
|
||||
super.readFromNBT(nbt);
|
||||
|
||||
power = nbt.getLong("power");
|
||||
watts = nbt.getInteger("watts");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound nbt) {
|
||||
super.writeToNBT(nbt);
|
||||
|
||||
nbt.setLong("power", power);
|
||||
nbt.setInteger("watts", watts);
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user