new ammo textures, injector functionality, core model
@ -555,9 +555,12 @@ tile.ams_base.name=AMS-Basis [WIP]
|
||||
container.amsBase=AMS-Basis [WIP]
|
||||
|
||||
tile.dfc_emitter.name=DFC-Emitter
|
||||
container.dfcEmitter=DFC-Emitter
|
||||
tile.dfc_receiver.name=DFC-Receiver
|
||||
container.dfcReceiver=DFC-Receiver
|
||||
tile.dfc_injector.name=DFC-Brennstoffinjektor
|
||||
tile.dfc_core.name=Dunkler Fusionskern
|
||||
container.dfcCore.name=Dunkler Fusionskern
|
||||
|
||||
item.template_folder.name=Produktionsvorlagen-Zeichenmappe
|
||||
item.fluid_identifier.name=Flüssigkeits-Kennzeichnung
|
||||
|
||||
@ -555,9 +555,12 @@ tile.ams_base.name=AMS Base [WIP]
|
||||
container.amsBase=AMS Base [WIP]
|
||||
|
||||
tile.dfc_emitter.name=DFC Emitter
|
||||
container.dfcEmitter=DFC Emitter
|
||||
tile.dfc_receiver.name=DFC Receiver
|
||||
container.dfcReceiver=DFC Receiver
|
||||
tile.dfc_injector.name=DFC Fuel Injector
|
||||
tile.dfc_core.name=Dark Fusion Core
|
||||
container.dfcCore.name=Dark Fusion Core
|
||||
|
||||
item.template_folder.name=Machine Template Folder
|
||||
item.fluid_identifier.name=Fluid Identifier
|
||||
|
||||
BIN
assets/hbm/textures/blocks/dfc_core.png
Normal file
|
After Width: | Height: | Size: 170 B |
BIN
assets/hbm/textures/gui/dfc/gui_injector.png
Normal file
|
After Width: | Height: | Size: 4.2 KiB |
|
Before Width: | Height: | Size: 333 B After Width: | Height: | Size: 349 B |
|
Before Width: | Height: | Size: 211 B After Width: | Height: | Size: 218 B |
|
Before Width: | Height: | Size: 255 B After Width: | Height: | Size: 239 B |
|
Before Width: | Height: | Size: 178 B After Width: | Height: | Size: 318 B |
|
Before Width: | Height: | Size: 182 B After Width: | Height: | Size: 337 B |
|
Before Width: | Height: | Size: 229 B After Width: | Height: | Size: 348 B |
|
Before Width: | Height: | Size: 227 B After Width: | Height: | Size: 369 B |
|
Before Width: | Height: | Size: 185 B After Width: | Height: | Size: 331 B |
|
Before Width: | Height: | Size: 234 B After Width: | Height: | Size: 384 B |
|
Before Width: | Height: | Size: 250 B After Width: | Height: | Size: 362 B |
|
Before Width: | Height: | Size: 225 B After Width: | Height: | Size: 349 B |
|
Before Width: | Height: | Size: 235 B After Width: | Height: | Size: 382 B |
|
Before Width: | Height: | Size: 199 B After Width: | Height: | Size: 221 B |
|
Before Width: | Height: | Size: 225 B After Width: | Height: | Size: 230 B |
|
Before Width: | Height: | Size: 266 B After Width: | Height: | Size: 264 B |
|
Before Width: | Height: | Size: 246 B After Width: | Height: | Size: 266 B |
|
Before Width: | Height: | Size: 170 B After Width: | Height: | Size: 321 B |
|
Before Width: | Height: | Size: 208 B After Width: | Height: | Size: 337 B |
|
Before Width: | Height: | Size: 207 B After Width: | Height: | Size: 340 B |
|
Before Width: | Height: | Size: 304 B After Width: | Height: | Size: 392 B |
|
Before Width: | Height: | Size: 263 B After Width: | Height: | Size: 301 B |
@ -467,8 +467,11 @@ public class ModBlocks {
|
||||
public static Block dfc_emitter;
|
||||
public static final int guiID_dfc_emitter = 87;
|
||||
public static Block dfc_injector;
|
||||
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_core;
|
||||
public static final int guiID_dfc_core = 89;
|
||||
|
||||
public static Block machine_converter_he_rf;
|
||||
public static final int guiID_converter_he_rf = 28;
|
||||
|
||||
@ -66,6 +66,12 @@ public class CoreComponent extends BlockContainer {
|
||||
if(this == ModBlocks.dfc_emitter)
|
||||
FMLNetworkHandler.openGui(player, MainRegistry.instance, ModBlocks.guiID_dfc_emitter, world, x, y, z);
|
||||
|
||||
if(this == ModBlocks.dfc_receiver)
|
||||
FMLNetworkHandler.openGui(player, MainRegistry.instance, ModBlocks.guiID_dfc_receiver, world, x, y, z);
|
||||
|
||||
if(this == ModBlocks.dfc_injector)
|
||||
FMLNetworkHandler.openGui(player, MainRegistry.instance, ModBlocks.guiID_dfc_injector, world, x, y, z);
|
||||
|
||||
return true;
|
||||
|
||||
} else {
|
||||
|
||||
@ -1,9 +1,13 @@
|
||||
package com.hbm.blocks.machine;
|
||||
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.tileentity.machine.TileEntityCore;
|
||||
|
||||
import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
@ -32,5 +36,20 @@ public class CoreCore extends BlockContainer {
|
||||
public boolean renderAsNormalBlock() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
||||
|
||||
if(world.isRemote) {
|
||||
return true;
|
||||
} else if(!player.isSneaking()) {
|
||||
|
||||
FMLNetworkHandler.openGui(player, MainRegistry.instance, ModBlocks.guiID_dfc_core, world, x, y, z);
|
||||
return true;
|
||||
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -786,6 +786,24 @@ public class GUIHandler implements IGuiHandler {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
case ModBlocks.guiID_dfc_receiver:
|
||||
{
|
||||
if(entity instanceof TileEntityCoreReceiver)
|
||||
{
|
||||
return new ContainerCoreReceiver(player.inventory, (TileEntityCoreReceiver) entity);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
case ModBlocks.guiID_dfc_injector:
|
||||
{
|
||||
if(entity instanceof TileEntityCoreInjector)
|
||||
{
|
||||
return new ContainerCoreInjector(player.inventory, (TileEntityCoreInjector) entity);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
//NON-TE CONTAINERS
|
||||
@ -1571,6 +1589,24 @@ public class GUIHandler implements IGuiHandler {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
case ModBlocks.guiID_dfc_receiver:
|
||||
{
|
||||
if(entity instanceof TileEntityCoreReceiver)
|
||||
{
|
||||
return new GUICoreReceiver(player.inventory, (TileEntityCoreReceiver) entity);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
case ModBlocks.guiID_dfc_injector:
|
||||
{
|
||||
if(entity instanceof TileEntityCoreInjector)
|
||||
{
|
||||
return new GUICoreInjector(player.inventory, (TileEntityCoreInjector) entity);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
//CLIENTONLY GUIS
|
||||
|
||||
74
com/hbm/inventory/container/ContainerCoreInjector.java
Normal file
@ -0,0 +1,74 @@
|
||||
package com.hbm.inventory.container;
|
||||
|
||||
import com.hbm.inventory.SlotMachineOutput;
|
||||
import com.hbm.tileentity.machine.TileEntityCoreInjector;
|
||||
|
||||
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 ContainerCoreInjector extends Container {
|
||||
|
||||
private TileEntityCoreInjector nukeBoy;
|
||||
|
||||
public ContainerCoreInjector(InventoryPlayer invPlayer, TileEntityCoreInjector tedf) {
|
||||
|
||||
nukeBoy = tedf;
|
||||
|
||||
this.addSlotToContainer(new Slot(tedf, 0, 26, 17));
|
||||
this.addSlotToContainer(new SlotMachineOutput(invPlayer.player, tedf, 1, 26, 53));
|
||||
this.addSlotToContainer(new Slot(tedf, 2, 134, 17));
|
||||
this.addSlotToContainer(new SlotMachineOutput(invPlayer.player, tedf, 3, 134, 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 <= 3) {
|
||||
if (!this.mergeItemStack(var5, 4, 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/ContainerCoreReceiver.java
Normal file
@ -0,0 +1,36 @@
|
||||
package com.hbm.inventory.container;
|
||||
|
||||
import com.hbm.tileentity.machine.TileEntityCoreReceiver;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.Slot;
|
||||
|
||||
public class ContainerCoreReceiver extends Container {
|
||||
|
||||
private TileEntityCoreReceiver te;
|
||||
|
||||
public ContainerCoreReceiver(InventoryPlayer invPlayer, TileEntityCoreReceiver te) {
|
||||
|
||||
this.te = te;
|
||||
|
||||
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 te.isUseableByPlayer(player);
|
||||
}
|
||||
}
|
||||
@ -43,14 +43,13 @@ public class GUICoreEmitter extends GuiInfoContainer {
|
||||
this.field.setTextColor(-1);
|
||||
this.field.setDisabledTextColour(-1);
|
||||
this.field.setEnableBackgroundDrawing(false);
|
||||
this.field.setMaxStringLength(5);
|
||||
this.field.setMaxStringLength(3);
|
||||
this.field.setText(String.valueOf(emitter.watts));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen(int mouseX, int mouseY, float f) {
|
||||
super.drawScreen(mouseX, mouseY, f);
|
||||
this.field.drawTextBox();
|
||||
|
||||
emitter.tank.renderTankInfo(this, mouseX, mouseY, guiLeft + 8, guiTop + 17, 16, 52);
|
||||
this.drawElectricityInfo(this, mouseX, mouseY, guiLeft + 26, guiTop + 17, 16, 52, emitter.power, emitter.maxPower);
|
||||
@ -102,6 +101,8 @@ public class GUICoreEmitter extends GuiInfoContainer {
|
||||
|
||||
int i = (int) emitter.getPowerScaled(52);
|
||||
drawTexturedModalRect(guiLeft + 26, guiTop + 69 - i, 176, 52 - i, 16, i);
|
||||
|
||||
this.field.drawTextBox();
|
||||
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture(emitter.tank.getSheet());
|
||||
emitter.tank.renderTank(this, guiLeft + 8, guiTop + 69, emitter.tank.getTankType().textureX() * FluidTank.x, emitter.tank.getTankType().textureY() * FluidTank.y, 16, 52);
|
||||
|
||||
55
com/hbm/inventory/gui/GUICoreInjector.java
Normal file
@ -0,0 +1,55 @@
|
||||
package com.hbm.inventory.gui;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.hbm.inventory.FluidTank;
|
||||
import com.hbm.inventory.container.ContainerCoreInjector;
|
||||
import com.hbm.lib.RefStrings;
|
||||
import com.hbm.tileentity.machine.TileEntityCoreInjector;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public class GUICoreInjector extends GuiInfoContainer {
|
||||
|
||||
private static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/dfc/gui_injector.png");
|
||||
private TileEntityCoreInjector injector;
|
||||
|
||||
public GUICoreInjector(InventoryPlayer invPlayer, TileEntityCoreInjector tedf) {
|
||||
super(new ContainerCoreInjector(invPlayer, tedf));
|
||||
injector = tedf;
|
||||
|
||||
this.xSize = 176;
|
||||
this.ySize = 166;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen(int mouseX, int mouseY, float f) {
|
||||
super.drawScreen(mouseX, mouseY, f);
|
||||
|
||||
injector.tanks[0].renderTankInfo(this, mouseX, mouseY, guiLeft + 44, guiTop + 17, 16, 52);
|
||||
injector.tanks[1].renderTankInfo(this, mouseX, mouseY, guiLeft + 116, guiTop + 17, 16, 52);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer( int i, int j) {
|
||||
|
||||
String name = this.injector.hasCustomInventoryName() ? this.injector.getInventoryName() : I18n.format(this.injector.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);
|
||||
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture(injector.tanks[0].getSheet());
|
||||
injector.tanks[0].renderTank(this, guiLeft + 44, guiTop + 69, injector.tanks[0].getTankType().textureX() * FluidTank.x, injector.tanks[0].getTankType().textureY() * FluidTank.y, 16, 52);
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture(injector.tanks[1].getSheet());
|
||||
injector.tanks[1].renderTank(this, guiLeft + 116, guiTop + 69, injector.tanks[1].getTankType().textureX() * FluidTank.x, injector.tanks[1].getTankType().textureY() * FluidTank.y, 16, 52);
|
||||
}
|
||||
}
|
||||
57
com/hbm/inventory/gui/GUICoreReceiver.java
Normal file
@ -0,0 +1,57 @@
|
||||
package com.hbm.inventory.gui;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.hbm.inventory.FluidTank;
|
||||
import com.hbm.inventory.container.ContainerCoreReceiver;
|
||||
import com.hbm.lib.Library;
|
||||
import com.hbm.lib.RefStrings;
|
||||
import com.hbm.tileentity.machine.TileEntityCoreReceiver;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public class GUICoreReceiver extends GuiInfoContainer {
|
||||
|
||||
private static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/dfc/gui_receiver.png");
|
||||
private TileEntityCoreReceiver receiver;
|
||||
|
||||
public GUICoreReceiver(InventoryPlayer invPlayer, TileEntityCoreReceiver tedf) {
|
||||
super(new ContainerCoreReceiver(invPlayer, tedf));
|
||||
receiver = tedf;
|
||||
|
||||
this.xSize = 176;
|
||||
this.ySize = 166;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen(int mouseX, int mouseY, float f) {
|
||||
super.drawScreen(mouseX, mouseY, f);
|
||||
|
||||
receiver.tank.renderTankInfo(this, mouseX, mouseY, guiLeft + 8, guiTop + 17, 16, 52);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer( int i, int j) {
|
||||
String name = this.receiver.hasCustomInventoryName() ? this.receiver.getInventoryName() : I18n.format(this.receiver.getInventoryName());
|
||||
this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6, 4210752);
|
||||
|
||||
this.fontRendererObj.drawString("Input:", 40, 25, 0xFF7F7F);
|
||||
this.fontRendererObj.drawString(Library.getShortNumber(receiver.joules) + "Spk", 50, 35, 0xFF7F7F);
|
||||
this.fontRendererObj.drawString(Library.getShortNumber(receiver.joules * 5000) + "HE", 50, 45, 0xFF7F7F);
|
||||
|
||||
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);
|
||||
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture(receiver.tank.getSheet());
|
||||
receiver.tank.renderTank(this, guiLeft + 8, guiTop + 69, receiver.tank.getTankType().textureX() * FluidTank.x, receiver.tank.getTankType().textureY() * FluidTank.y, 16, 52);
|
||||
}
|
||||
}
|
||||
@ -90,7 +90,7 @@ public class ItemAmmo extends Item {
|
||||
if(this == ModItems.ammo_44_star) {
|
||||
list.add(EnumChatFormatting.BLUE + "+ Highly increased damage");
|
||||
list.add(EnumChatFormatting.YELLOW + "* Starmetal");
|
||||
list.add(EnumChatFormatting.RED + "- Highly decreased damage");
|
||||
list.add(EnumChatFormatting.RED + "- Highly increased wear");
|
||||
}
|
||||
|
||||
//5mm
|
||||
|
||||
@ -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(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(TileEntityCore.class, "tileentity_v0");
|
||||
GameRegistry.registerTileEntity(TileEntityMachineArcFurnace.class, "tileentity_arc_furnace");
|
||||
GameRegistry.registerTileEntity(TileEntityMachineAmgen.class, "tileentity_amgen");
|
||||
GameRegistry.registerTileEntity(TileEntityGeysir.class, "tileentity_geysir");
|
||||
|
||||
@ -42,8 +42,8 @@ public class RenderLaser extends Render {
|
||||
int init = (int) -(System.currentTimeMillis() % 360);
|
||||
|
||||
//BeamPronter.prontHelix(skeleton, 0, 0, 0, EnumWaveType.SPIRAL, EnumBeamType.LINE, 0x0000ff, 0x8080ff, 0, (int)(skeleton.lengthVector() * 5), 0.2F);
|
||||
BeamPronter.prontHelix(skeleton, EnumWaveType.SPIRAL, EnumBeamType.SOLID, 0xff5000, 0xff5000, init, (int) skeleton.lengthVector() + 1, 0.1F, 4, 0.05F);
|
||||
BeamPronter.prontHelix(skeleton, EnumWaveType.SPIRAL, EnumBeamType.SOLID, 0xff3000, 0xff3000, init, 1, 0F, 4, 0.05F);
|
||||
BeamPronter.prontBeam(skeleton, EnumWaveType.SPIRAL, EnumBeamType.SOLID, 0xff5000, 0xff5000, init, (int) skeleton.lengthVector() + 1, 0.1F, 4, 0.05F);
|
||||
BeamPronter.prontBeam(skeleton, EnumWaveType.SPIRAL, EnumBeamType.SOLID, 0xff3000, 0xff3000, init, 1, 0F, 4, 0.05F);
|
||||
}
|
||||
|
||||
GL11.glPopMatrix();
|
||||
|
||||
215
com/hbm/render/tileentity/RenderCore.java
Normal file
@ -0,0 +1,215 @@
|
||||
package com.hbm.render.tileentity;
|
||||
|
||||
import java.nio.FloatBuffer;
|
||||
import java.util.Random;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.hbm.main.ResourceManager;
|
||||
import com.hbm.render.util.RenderSparks;
|
||||
import com.hbm.tileentity.machine.TileEntityCore;
|
||||
|
||||
import net.minecraft.client.renderer.GLAllocation;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class RenderCore extends TileEntitySpecialRenderer {
|
||||
|
||||
private static final ResourceLocation sky = new ResourceLocation("textures/environment/end_sky.png");
|
||||
private static final ResourceLocation portal = new ResourceLocation("textures/entity/end_portal.png");
|
||||
private static final Random random = new Random(31100L);
|
||||
FloatBuffer buffer = GLAllocation.createDirectFloatBuffer(16);
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float f) {
|
||||
|
||||
TileEntityCore core = (TileEntityCore)tileEntity;
|
||||
renderStandby(x, y, z);
|
||||
}
|
||||
|
||||
public void renderStandby(double x, double y, double z) {
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(x + 0.5, y + 0.5, z + 0.5);
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glEnable(GL11.GL_CULL_FACE);
|
||||
GL11.glDisable(GL11.GL_TEXTURE_2D);
|
||||
|
||||
GL11.glScalef(0.25F, 0.25F, 0.25F);
|
||||
GL11.glColor3f(0.5F, 0.5F, 0.5F);
|
||||
ResourceManager.sphere_uv.renderAll();
|
||||
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE);
|
||||
GL11.glScalef(1.25F, 1.25F, 1.25F);
|
||||
GL11.glColor3f(0.1F, 0.1F, 0.1F);
|
||||
ResourceManager.sphere_uv.renderAll();
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
|
||||
GL11.glEnable(GL11.GL_TEXTURE_2D);
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
|
||||
if((System.currentTimeMillis() / 100) % 10 == 0) {
|
||||
for(int i = 0; i < 3; i++) {
|
||||
RenderSparks.renderSpark((int) System.currentTimeMillis() / 100 + i * 10000, 0, 0, 0, 1.5F, 5, 10, 0xFFFF00, 0xFFFFFF);
|
||||
RenderSparks.renderSpark((int) System.currentTimeMillis() / 50 + i * 10000, 0, 0, 0, 1.5F, 5, 10, 0xFFFF00, 0xFFFFFF);
|
||||
}
|
||||
}
|
||||
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
public void renderVoid(TileEntity tile, double x, double y, double z) {
|
||||
|
||||
World world = tile.getWorldObj();
|
||||
GL11.glPushMatrix();
|
||||
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
|
||||
random.setSeed(31110L);
|
||||
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
|
||||
GL11.glTexGeni(GL11.GL_S, GL11.GL_TEXTURE_GEN_MODE, GL11.GL_EYE_LINEAR);
|
||||
GL11.glTexGeni(GL11.GL_T, GL11.GL_TEXTURE_GEN_MODE, GL11.GL_EYE_LINEAR);
|
||||
GL11.glTexGeni(GL11.GL_R, GL11.GL_TEXTURE_GEN_MODE, GL11.GL_EYE_LINEAR);
|
||||
GL11.glTexGeni(GL11.GL_Q, GL11.GL_TEXTURE_GEN_MODE, GL11.GL_EYE_LINEAR);
|
||||
GL11.glEnable(GL11.GL_TEXTURE_GEN_S);
|
||||
GL11.glEnable(GL11.GL_TEXTURE_GEN_T);
|
||||
GL11.glEnable(GL11.GL_TEXTURE_GEN_R);
|
||||
GL11.glEnable(GL11.GL_TEXTURE_GEN_Q);
|
||||
GL11.glMatrixMode(GL11.GL_TEXTURE);
|
||||
GL11.glPushMatrix();
|
||||
GL11.glLoadIdentity();
|
||||
float f100 = world.getTotalWorldTime() % 500L / 500F;
|
||||
GL11.glTranslatef(random.nextFloat(), f100, random.nextFloat());
|
||||
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
|
||||
final int end = 10;
|
||||
for (int i = 0; i < end; ++i) {
|
||||
float f5 = end - i;
|
||||
float f7 = 1.0F / (f5 + 1.0F);
|
||||
|
||||
if (i == 0) {
|
||||
this.bindTexture(sky);
|
||||
f7 = 0.0F;
|
||||
f5 = 65.0F;
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
}
|
||||
|
||||
if (i == 1) {
|
||||
this.bindTexture(portal);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_ONE, GL11.GL_ONE);
|
||||
}
|
||||
|
||||
GL11.glTranslatef(random.nextFloat() * (1 - f7), random.nextFloat() * (1 - f7), random.nextFloat() * (1 - f7));
|
||||
float scale = 0.9F;
|
||||
GL11.glScalef(scale, scale, scale);
|
||||
float ang = 360 / end;
|
||||
GL11.glRotatef(ang * i + ang * random.nextFloat(), 0.0F, 0.0F, 1.0F);
|
||||
|
||||
float f11 = (float) random.nextDouble() * 0.5F + 0.9F;
|
||||
float f12 = (float) random.nextDouble() * 0.5F + 0.1F;
|
||||
float f13 = (float) random.nextDouble() * 0.5F + 0.9F;
|
||||
if (i == 0) {
|
||||
f13 = 1.0F;
|
||||
f12 = 1.0F;
|
||||
f11 = 1.0F;
|
||||
}
|
||||
f13 *= f7;
|
||||
f12 *= f7;
|
||||
f11 *= f7;
|
||||
|
||||
GL11.glTexGen(GL11.GL_S, GL11.GL_EYE_PLANE, this.func_147525_a(1, 0, 0, 0));
|
||||
GL11.glTexGen(GL11.GL_T, GL11.GL_EYE_PLANE, this.func_147525_a(0, 0, 1, 0));
|
||||
GL11.glTexGen(GL11.GL_R, GL11.GL_EYE_PLANE, this.func_147525_a(0, 0, 0, 1));
|
||||
GL11.glTexGen(GL11.GL_Q, GL11.GL_EYE_PLANE, this.func_147525_a(0, 1, 0, 0));
|
||||
|
||||
GL11.glRotatef(180, 0, 0, 1);
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setColorOpaque_F(f11, f12, f13);
|
||||
tessellator.setBrightness(0xF000F0);
|
||||
tessellator.addVertex(x + 0.0, y + 0.0, z + 1.0);
|
||||
tessellator.addVertex(x + 0.0, y + 0.0, z + 0.0);
|
||||
tessellator.addVertex(x + 1.0, y + 0.0, z + 0.0);
|
||||
tessellator.addVertex(x + 1.0, y + 0.0, z + 1.0);
|
||||
tessellator.draw();
|
||||
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setColorOpaque_F(f11, f12, f13);
|
||||
tessellator.setBrightness(0xF000F0);
|
||||
tessellator.addVertex(x + 1.0, y + 1.0, z + 1.0);
|
||||
tessellator.addVertex(x + 1.0, y + 1.0, z + 0.0);
|
||||
tessellator.addVertex(x + 0.0, y + 1.0, z + 0.0);
|
||||
tessellator.addVertex(x + 0.0, y + 1.0, z + 1.0);
|
||||
tessellator.draw();
|
||||
|
||||
GL11.glTexGen(GL11.GL_S, GL11.GL_EYE_PLANE, this.func_147525_a(0, 1, 0, 0));
|
||||
GL11.glTexGen(GL11.GL_T, GL11.GL_EYE_PLANE, this.func_147525_a(1, 0, 0, 0));
|
||||
GL11.glTexGen(GL11.GL_R, GL11.GL_EYE_PLANE, this.func_147525_a(0, 0, 0, 1));
|
||||
GL11.glTexGen(GL11.GL_Q, GL11.GL_EYE_PLANE, this.func_147525_a(0, 0, 1, 0));
|
||||
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setColorOpaque_F(f11, f12, f13);
|
||||
tessellator.setBrightness(0xF000F0);
|
||||
tessellator.addVertex(x + 0.0, y + 0.0, z + 0.0);
|
||||
tessellator.addVertex(x + 0.0, y + 1.0, z + 0.0);
|
||||
tessellator.addVertex(x + 1.0, y + 1.0, z + 0.0);
|
||||
tessellator.addVertex(x + 1.0, y + 0.0, z + 0.0);
|
||||
|
||||
tessellator.addVertex(x + 1.0, y + 0.0, z + 1.0);
|
||||
tessellator.addVertex(x + 1.0, y + 1.0, z + 1.0);
|
||||
tessellator.addVertex(x + 0.0, y + 1.0, z + 1.0);
|
||||
tessellator.addVertex(x + 0.0, y + 0.0, z + 1.0);
|
||||
tessellator.draw();
|
||||
|
||||
GL11.glTexGen(GL11.GL_S, GL11.GL_EYE_PLANE, this.func_147525_a(0, 1, 0, 0));
|
||||
GL11.glTexGen(GL11.GL_T, GL11.GL_EYE_PLANE, this.func_147525_a(0, 0, 1, 0));
|
||||
GL11.glTexGen(GL11.GL_R, GL11.GL_EYE_PLANE, this.func_147525_a(0, 0, 0, 1));
|
||||
GL11.glTexGen(GL11.GL_Q, GL11.GL_EYE_PLANE, this.func_147525_a(1, 0, 0, 0));
|
||||
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setColorOpaque_F(f11, f12, f13);
|
||||
tessellator.setBrightness(0xF000F0);
|
||||
tessellator.addVertex(x + 0.0, y + 0.0, z + 1.0);
|
||||
tessellator.addVertex(x + 0.0, y + 1.0, z + 1.0);
|
||||
tessellator.addVertex(x + 0.0, y + 1.0, z + 0.0);
|
||||
tessellator.addVertex(x + 0.0, y + 0.0, z + 0.0);
|
||||
tessellator.draw();
|
||||
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setColorOpaque_F(f11, f12, f13);
|
||||
tessellator.setBrightness(0xF000F0);
|
||||
tessellator.addVertex(x + 1.0, y + 0.0, z + 0.0);
|
||||
tessellator.addVertex(x + 1.0, y + 1.0, z + 0.0);
|
||||
tessellator.addVertex(x + 1.0, y + 1.0, z + 1.0);
|
||||
tessellator.addVertex(x + 1.0, y + 0.0, z + 1.0);
|
||||
tessellator.draw();
|
||||
}
|
||||
|
||||
GL11.glPopMatrix();
|
||||
GL11.glMatrixMode(GL11.GL_MODELVIEW);
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
GL11.glDisable(GL11.GL_TEXTURE_GEN_S);
|
||||
GL11.glDisable(GL11.GL_TEXTURE_GEN_T);
|
||||
GL11.glDisable(GL11.GL_TEXTURE_GEN_R);
|
||||
GL11.glDisable(GL11.GL_TEXTURE_GEN_Q);
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
private FloatBuffer func_147525_a(float x, float y, float z, float w) {
|
||||
|
||||
this.buffer.clear();
|
||||
this.buffer.put(x).put(y).put(z).put(w);
|
||||
this.buffer.flip();
|
||||
return this.buffer;
|
||||
}
|
||||
|
||||
}
|
||||
@ -54,9 +54,9 @@ public class RenderCoreComponent extends TileEntitySpecialRenderer {
|
||||
int range = ((TileEntityCoreEmitter)tileEntity).beam;
|
||||
|
||||
if(range > 0) {
|
||||
BeamPronter.prontHelix(Vec3.createVectorHelper(0, 0, range), EnumWaveType.SPIRAL, EnumBeamType.SOLID, 0x404000, 0x404000, 0, 1, 0F, 2, 0.0625F);
|
||||
BeamPronter.prontHelix(Vec3.createVectorHelper(0, 0, range), EnumWaveType.RANDOM, EnumBeamType.SOLID, 0x401500, 0x401500, (int)tileEntity.getWorldObj().getTotalWorldTime() % 1000, range * 2, 0.125F, 4, 0.0625F);
|
||||
BeamPronter.prontHelix(Vec3.createVectorHelper(0, 0, range), EnumWaveType.RANDOM, EnumBeamType.SOLID, 0x401500, 0x401500, (int)tileEntity.getWorldObj().getTotalWorldTime() % 1000 + 1, range * 2, 0.125F, 4, 0.0625F);
|
||||
BeamPronter.prontBeam(Vec3.createVectorHelper(0, 0, range), EnumWaveType.SPIRAL, EnumBeamType.SOLID, 0x404000, 0x404000, 0, 1, 0F, 2, 0.0625F);
|
||||
BeamPronter.prontBeam(Vec3.createVectorHelper(0, 0, range), EnumWaveType.RANDOM, EnumBeamType.SOLID, 0x401500, 0x401500, (int)tileEntity.getWorldObj().getTotalWorldTime() % 1000, range * 2, 0.125F, 4, 0.0625F);
|
||||
BeamPronter.prontBeam(Vec3.createVectorHelper(0, 0, range), EnumWaveType.RANDOM, EnumBeamType.SOLID, 0x401500, 0x401500, (int)tileEntity.getWorldObj().getTotalWorldTime() % 1000 + 1, range * 2, 0.125F, 4, 0.0625F);
|
||||
}
|
||||
}
|
||||
|
||||
@ -68,6 +68,14 @@ public class RenderCoreComponent extends TileEntitySpecialRenderer {
|
||||
if(tileEntity instanceof TileEntityCoreInjector) {
|
||||
bindTexture(ResourceManager.dfc_injector_tex);
|
||||
ResourceManager.dfc_injector.renderAll();
|
||||
|
||||
GL11.glTranslated(0, 0.5, 0);
|
||||
int range = ((TileEntityCoreInjector)tileEntity).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);
|
||||
}
|
||||
}
|
||||
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
|
||||
@ -108,8 +108,8 @@ public class RendererObjTester extends TileEntitySpecialRenderer {
|
||||
|
||||
//SoyuzPronter.prontSoyuz();
|
||||
//TomPronter.prontTom();
|
||||
BeamPronter.prontHelix(Vec3.createVectorHelper(5, 5, 5), EnumWaveType.SPIRAL, EnumBeamType.SOLID, 0xff8000, 0xff8000, (int)tileEntity.getWorldObj().getTotalWorldTime() % 360 * 25, 25, 0.1F, 4, 0.05F);
|
||||
BeamPronter.prontHelix(Vec3.createVectorHelper(5, 5, 5), EnumWaveType.SPIRAL, EnumBeamType.SOLID, 0xffff00, 0xffff00, (int)tileEntity.getWorldObj().getTotalWorldTime() % 360 * 25, 1, 0F, 4, 0.05F);
|
||||
BeamPronter.prontBeam(Vec3.createVectorHelper(5, 5, 5), EnumWaveType.SPIRAL, EnumBeamType.SOLID, 0xff8000, 0xff8000, (int)tileEntity.getWorldObj().getTotalWorldTime() % 360 * 25, 25, 0.1F, 4, 0.05F);
|
||||
BeamPronter.prontBeam(Vec3.createVectorHelper(5, 5, 5), EnumWaveType.SPIRAL, EnumBeamType.SOLID, 0xffff00, 0xffff00, (int)tileEntity.getWorldObj().getTotalWorldTime() % 360 * 25, 1, 0F, 4, 0.05F);
|
||||
//BeamPronter.prontHelix(Vec3.createVectorHelper(0, 5, 0), 0.5, 0.5, 0.5, EnumWaveType.SPIRAL, EnumBeamType.LINE, 0x0000ff, 0xffff00, (int)tileEntity.getWorldObj().getTotalWorldTime() % 360 * 25 + 180, 25, 0.25F);
|
||||
|
||||
GL11.glPopMatrix();
|
||||
|
||||
@ -20,7 +20,7 @@ public class BeamPronter {
|
||||
LINE
|
||||
}
|
||||
|
||||
public static void prontHelix(Vec3 skeleton, EnumWaveType wave, EnumBeamType beam, int outerColor, int innerColor, int start, int segments, float size, int layers, float thickness) {
|
||||
public static void prontBeam(Vec3 skeleton, EnumWaveType wave, EnumBeamType beam, int outerColor, int innerColor, int start, int segments, float size, int layers, float thickness) {
|
||||
|
||||
GL11.glPushMatrix();
|
||||
|
||||
|
||||
62
com/hbm/render/util/RenderSparks.java
Normal file
@ -0,0 +1,62 @@
|
||||
package com.hbm.render.util;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.util.Vec3;
|
||||
|
||||
public class RenderSparks {
|
||||
|
||||
public static void renderSpark(int seed, double x, double y, double z, float length, int min, int max, int color1, int color2) {
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glDisable(GL11.GL_TEXTURE_2D);
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glLineWidth(3F);
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
|
||||
Random rand = new Random(seed);
|
||||
Vec3 vec = Vec3.createVectorHelper(rand.nextDouble() - 0.5, rand.nextDouble() - 0.5, rand.nextDouble() - 0.5);
|
||||
vec = vec.normalize();
|
||||
|
||||
double prevX;
|
||||
double prevY;
|
||||
double prevZ;
|
||||
|
||||
for(int i = 0; i < min + rand.nextInt(max); i++) {
|
||||
|
||||
prevX = x;
|
||||
prevY = y;
|
||||
prevZ = z;
|
||||
|
||||
Vec3 dir = vec.normalize();
|
||||
dir.xCoord *= length * rand.nextFloat();
|
||||
dir.yCoord *= length * rand.nextFloat();
|
||||
dir.zCoord *= length * rand.nextFloat();
|
||||
|
||||
x = prevX + dir.xCoord;
|
||||
y = prevY + dir.yCoord;
|
||||
z = prevZ + dir.zCoord;
|
||||
|
||||
GL11.glLineWidth(5F);
|
||||
tessellator.startDrawing(3);
|
||||
tessellator.setColorOpaque_I(color1);
|
||||
tessellator.addVertex(prevX, prevY, prevZ);
|
||||
tessellator.addVertex(x, y, z);
|
||||
tessellator.draw();
|
||||
GL11.glLineWidth(2F);
|
||||
tessellator.startDrawing(3);
|
||||
tessellator.setColorOpaque_I(color2);
|
||||
tessellator.addVertex(prevX, prevY, prevZ);
|
||||
tessellator.addVertex(x, y, z);
|
||||
tessellator.draw();
|
||||
}
|
||||
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GL11.glEnable(GL11.GL_TEXTURE_2D);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,11 +1,21 @@
|
||||
package com.hbm.tileentity.machine;
|
||||
|
||||
import com.hbm.handler.FluidTypeHandler.FluidType;
|
||||
import com.hbm.inventory.FluidTank;
|
||||
import com.hbm.tileentity.TileEntityMachineBase;
|
||||
|
||||
public class TileEntityCore extends TileEntityMachineBase {
|
||||
|
||||
public int field;
|
||||
public int heat;
|
||||
public int color;
|
||||
public FluidTank[] tanks;
|
||||
|
||||
public TileEntityCore() {
|
||||
super(3);
|
||||
tanks = new FluidTank[2];
|
||||
tanks[0] = new FluidTank(FluidType.DEUTERIUM, 128000, 0);
|
||||
tanks[1] = new FluidTank(FluidType.TRITIUM, 128000, 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -17,5 +27,39 @@ public class TileEntityCore extends TileEntityMachineBase {
|
||||
public void updateEntity() {
|
||||
|
||||
}
|
||||
|
||||
public long burn(long joules) {
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
public float getFuelEfficiency(FluidType type) {
|
||||
|
||||
switch(type) {
|
||||
|
||||
case HYDROGEN:
|
||||
return 1.0F;
|
||||
case DEUTERIUM:
|
||||
return 1.5F;
|
||||
case TRITIUM:
|
||||
return 1.7F;
|
||||
case OXYGEN:
|
||||
return 1.2F;
|
||||
case ACID:
|
||||
return 1.4F;
|
||||
case XENON:
|
||||
return 1.5F;
|
||||
case SAS3:
|
||||
return 2.0F;
|
||||
case BALEFIRE:
|
||||
return 2.5F;
|
||||
case AMAT:
|
||||
return 2.2F;
|
||||
case ASCHRAB:
|
||||
return 2.7F;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -80,6 +80,9 @@ public class TileEntityCoreEmitter extends TileEntityMachineBase implements ICon
|
||||
prev = joules;
|
||||
|
||||
if(joules > 0) {
|
||||
|
||||
long out = joules * 98 / 100;
|
||||
|
||||
ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata());
|
||||
for(int i = 1; i <= range; i++) {
|
||||
|
||||
@ -93,10 +96,15 @@ public class TileEntityCoreEmitter extends TileEntityMachineBase implements ICon
|
||||
|
||||
if(te instanceof ILaserable) {
|
||||
|
||||
((ILaserable)te).addEnergy(joules * 98 / 100, dir);
|
||||
((ILaserable)te).addEnergy(out * 98 / 100, dir);
|
||||
break;
|
||||
}
|
||||
|
||||
if(te instanceof TileEntityCore) {
|
||||
((TileEntityCore)te).burn(out);
|
||||
continue;
|
||||
}
|
||||
|
||||
Block b = worldObj.getBlock(x, y, z);
|
||||
|
||||
if(b != Blocks.air) {
|
||||
@ -131,6 +139,8 @@ public class TileEntityCoreEmitter extends TileEntityMachineBase implements ICon
|
||||
joules = 0;
|
||||
prev = 0;
|
||||
}
|
||||
|
||||
this.markDirty();
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setLong("power", power);
|
||||
@ -233,5 +243,29 @@ public class TileEntityCoreEmitter extends TileEntityMachineBase implements ICon
|
||||
{
|
||||
return 65536.0D;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbt) {
|
||||
super.readFromNBT(nbt);
|
||||
|
||||
power = nbt.getLong("power");
|
||||
watts = nbt.getInteger("watts");
|
||||
joules = nbt.getLong("joules");
|
||||
prev = nbt.getLong("prev");
|
||||
isOn = nbt.getBoolean("isOn");
|
||||
tank.readFromNBT(nbt, "tank");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound nbt) {
|
||||
super.writeToNBT(nbt);
|
||||
|
||||
nbt.setLong("power", power);
|
||||
nbt.setInteger("watts", watts);
|
||||
nbt.setLong("joules", joules);
|
||||
nbt.setLong("prev", prev);
|
||||
nbt.setBoolean("isOn", isOn);
|
||||
tank.writeToNBT(nbt, "tank");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,7 +1,177 @@
|
||||
package com.hbm.tileentity.machine;
|
||||
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class TileEntityCoreInjector extends TileEntity {
|
||||
import com.hbm.handler.FluidTypeHandler.FluidType;
|
||||
import com.hbm.interfaces.IFluidAcceptor;
|
||||
import com.hbm.inventory.FluidTank;
|
||||
import com.hbm.tileentity.TileEntityMachineBase;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class TileEntityCoreInjector extends TileEntityMachineBase implements IFluidAcceptor {
|
||||
|
||||
public FluidTank[] tanks;
|
||||
public static final int range = 15;
|
||||
public int beam;
|
||||
|
||||
public TileEntityCoreInjector() {
|
||||
super(4);
|
||||
tanks = new FluidTank[2];
|
||||
tanks[0] = new FluidTank(FluidType.DEUTERIUM, 128000, 0);
|
||||
tanks[1] = new FluidTank(FluidType.TRITIUM, 128000, 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "container.dfcInjector";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
|
||||
if(!worldObj.isRemote) {
|
||||
|
||||
tanks[0].setType(0, 1, slots);
|
||||
tanks[1].setType(2, 3, slots);
|
||||
|
||||
beam = 0;
|
||||
|
||||
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;
|
||||
|
||||
for(int t = 0; t < 2; t++) {
|
||||
|
||||
if(core.tanks[t].getTankType() == tanks[t].getTankType()) {
|
||||
|
||||
int f = Math.min(tanks[t].getFill(), core.tanks[t].getMaxFill() - core.tanks[t].getFill());
|
||||
|
||||
tanks[t].setFill(tanks[t].getFill() - f);
|
||||
core.tanks[t].setFill(core.tanks[t].getFill() + f);
|
||||
core.markDirty();
|
||||
|
||||
} else if(core.tanks[t].getFill() == 0) {
|
||||
|
||||
core.tanks[t].setTankType(tanks[t].getTankType());
|
||||
int f = Math.min(tanks[t].getFill(), core.tanks[t].getMaxFill() - core.tanks[t].getFill());
|
||||
|
||||
tanks[t].setFill(tanks[t].getFill() - f);
|
||||
core.tanks[t].setFill(core.tanks[t].getFill() + f);
|
||||
core.markDirty();
|
||||
}
|
||||
}
|
||||
|
||||
beam = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
this.markDirty();
|
||||
|
||||
tanks[0].updateTank(xCoord, yCoord, zCoord);
|
||||
tanks[1].updateTank(xCoord, yCoord, zCoord);
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setInteger("beam", beam);
|
||||
this.networkPack(data, 250);
|
||||
}
|
||||
}
|
||||
|
||||
public void networkUnpack(NBTTagCompound data) {
|
||||
beam = data.getInteger("beam");
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxFluidFill(FluidType type) {
|
||||
if (type.name().equals(tanks[0].getTankType().name()))
|
||||
return tanks[0].getMaxFill();
|
||||
else if (type.name().equals(tanks[1].getTankType().name()))
|
||||
return tanks[1].getMaxFill();
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFluidFill(int i, FluidType type) {
|
||||
if (type.name().equals(tanks[0].getTankType().name()))
|
||||
tanks[0].setFill(i);
|
||||
else if (type.name().equals(tanks[1].getTankType().name()))
|
||||
tanks[1].setFill(i);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFluidFill(FluidType type) {
|
||||
if (type.name().equals(tanks[0].getTankType().name()))
|
||||
return tanks[0].getFill();
|
||||
else if (type.name().equals(tanks[1].getTankType().name()))
|
||||
return tanks[1].getFill();
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFillstate(int fill, int index) {
|
||||
if (index < 2 && tanks[index] != null)
|
||||
tanks[index].setFill(fill);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setType(FluidType type, int index) {
|
||||
if (index < 2 && tanks[index] != null)
|
||||
tanks[index].setTankType(type);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<FluidTank> getTanks() {
|
||||
List<FluidTank> list = new ArrayList();
|
||||
list.add(tanks[0]);
|
||||
list.add(tanks[1]);
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
@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);
|
||||
|
||||
tanks[0].readFromNBT(nbt, "fuel1");
|
||||
tanks[1].readFromNBT(nbt, "fuel2");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound nbt) {
|
||||
super.writeToNBT(nbt);
|
||||
|
||||
tanks[0].writeToNBT(nbt, "fuel1");
|
||||
tanks[1].writeToNBT(nbt, "fuel2");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -15,6 +15,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;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
@ -55,6 +56,10 @@ public class TileEntityCoreReceiver extends TileEntityMachineBase implements ISo
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setLong("joules", joules);
|
||||
this.networkPack(data, 50);
|
||||
|
||||
joules = 0;
|
||||
|
||||
@ -72,6 +77,11 @@ public class TileEntityCoreReceiver extends TileEntityMachineBase implements ISo
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void networkUnpack(NBTTagCompound data) {
|
||||
|
||||
joules = data.getLong("joules");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void ffgeua(int x, int y, int z, boolean newTact) {
|
||||
@ -182,4 +192,22 @@ public class TileEntityCoreReceiver extends TileEntityMachineBase implements ISo
|
||||
{
|
||||
return 65536.0D;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbt) {
|
||||
super.readFromNBT(nbt);
|
||||
|
||||
power = nbt.getLong("power");
|
||||
joules = nbt.getLong("joules");
|
||||
tank.readFromNBT(nbt, "tank");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound nbt) {
|
||||
super.writeToNBT(nbt);
|
||||
|
||||
nbt.setLong("power", power);
|
||||
nbt.setLong("joules", joules);
|
||||
tank.writeToNBT(nbt, "tank");
|
||||
}
|
||||
}
|
||||
|
||||