DFC emitter functionality (mostly), new shotgun shell textures

This commit is contained in:
HbmMods 2020-03-29 01:03:49 +01:00
parent 57d0185e73
commit dd4aefb2fd
26 changed files with 297 additions and 77 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 267 B

After

Width:  |  Height:  |  Size: 298 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 296 B

After

Width:  |  Height:  |  Size: 310 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 245 B

After

Width:  |  Height:  |  Size: 311 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 294 B

After

Width:  |  Height:  |  Size: 332 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 327 B

After

Width:  |  Height:  |  Size: 323 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 284 B

After

Width:  |  Height:  |  Size: 317 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 283 B

After

Width:  |  Height:  |  Size: 314 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 283 B

After

Width:  |  Height:  |  Size: 286 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 284 B

After

Width:  |  Height:  |  Size: 324 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 293 B

After

Width:  |  Height:  |  Size: 342 B

View File

@ -1,5 +1,7 @@
package com.hbm.entity.projectile;
import java.util.List;
import com.hbm.lib.Library;
import com.hbm.lib.ModDamageSource;
@ -8,6 +10,7 @@ import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
@ -56,14 +59,15 @@ public class EntityLaser extends Entity {
MovingObjectPosition pos = Library.rayTrace(player, range, 1);
if(pos.entityHit != null) {
pos.entityHit.attackEntityFrom(ModDamageSource.radiation, 2);
}
//worldObj.createExplosion(this, pos.hitVec.xCoord, pos.hitVec.yCoord, pos.hitVec.zCoord, 1, false);
worldObj.spawnParticle("cloud", pos.hitVec.xCoord, pos.hitVec.yCoord, pos.hitVec.zCoord, 0, 0, 0);
worldObj.playSound(pos.hitVec.xCoord, pos.hitVec.yCoord, pos.hitVec.zCoord, "random.fizz", 1, 1, true);
List<Entity> list = worldObj.getEntitiesWithinAABB(Entity.class, AxisAlignedBB.getBoundingBox(pos.hitVec.xCoord - 1, pos.hitVec.yCoord - 1, pos.hitVec.zCoord - 1, pos.hitVec.xCoord + 1, pos.hitVec.yCoord + 1, pos.hitVec.zCoord + 1));
for(Entity e : list)
e.attackEntityFrom(ModDamageSource.radiation, 5);
}
}

View File

@ -1,6 +1,5 @@
package com.hbm.inventory.container;
import com.hbm.inventory.SlotMachineOutput;
import com.hbm.tileentity.machine.TileEntityCoreEmitter;
import net.minecraft.entity.player.EntityPlayer;
@ -15,9 +14,6 @@ public class ContainerCoreEmitter extends Container {
public ContainerCoreEmitter(InventoryPlayer invPlayer, TileEntityCoreEmitter tedf) {
nukeBoy = tedf;
this.addSlotToContainer(new Slot(tedf, 0, 8, 17));
this.addSlotToContainer(new SlotMachineOutput(invPlayer.player, tedf, 1, 8, 53));
for(int i = 0; i < 3; i++)
{

View File

@ -4,13 +4,10 @@ import org.lwjgl.opengl.GL11;
import com.hbm.inventory.FluidTank;
import com.hbm.inventory.container.ContainerAMSLimiter;
import com.hbm.inventory.container.ContainerMachinePress;
import com.hbm.lib.RefStrings;
import com.hbm.tileentity.machine.TileEntityAMSLimiter;
import com.hbm.tileentity.machine.TileEntityMachinePress;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.util.ResourceLocation;

View File

@ -1,41 +1,88 @@
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.FluidTank;
import com.hbm.inventory.container.ContainerCoreEmitter;
import com.hbm.lib.Library;
import com.hbm.lib.RefStrings;
import com.hbm.packet.AuxButtonPacket;
import com.hbm.packet.PacketDispatcher;
import com.hbm.tileentity.machine.TileEntityCoreEmitter;
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 GUICoreEmitter extends GuiInfoContainer {
private static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/dfc/gui_emitter.png");
private TileEntityCoreEmitter press;
private TileEntityCoreEmitter emitter;
private GuiTextField field;
public GUICoreEmitter(InventoryPlayer invPlayer, TileEntityCoreEmitter tedf) {
super(new ContainerCoreEmitter(invPlayer, tedf));
press = tedf;
emitter = tedf;
this.xSize = 176;
this.ySize = 166;
}
public void initGui() {
super.initGui();
Keyboard.enableRepeatEvents(true);
this.field = new GuiTextField(this.fontRendererObj, guiLeft + 57, guiTop + 57, 29, 12);
this.field.setTextColor(-1);
this.field.setDisabledTextColour(-1);
this.field.setEnableBackgroundDrawing(false);
this.field.setMaxStringLength(5);
this.field.setText(String.valueOf(emitter.watts));
}
@Override
public void drawScreen(int mouseX, int mouseY, float f) {
super.drawScreen(mouseX, mouseY, f);
this.drawElectricityInfo(this, mouseX, mouseY, guiLeft + 26, guiTop + 69 - 52, 16, 52, press.power, press.maxPower);
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);
}
protected void mouseClicked(int x, int y, int i) {
super.mouseClicked(x, y, i);
this.field.mouseClicked(x, y, i);
if(guiLeft + 97 <= x && guiLeft + 97 + 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(emitter.xCoord, emitter.yCoord, emitter.zCoord, j, 0));
}
}
if(guiLeft + 133 <= x && guiLeft + 133 + 18 > x && guiTop + 52 < y && guiTop + 52 + 18 >= y) {
mc.getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 1.0F));
PacketDispatcher.wrapper.sendToServer(new AuxButtonPacket(emitter.xCoord, emitter.yCoord, emitter.zCoord, 0, 1));
}
}
@Override
protected void drawGuiContainerForegroundLayer( int i, int j) {
String name = this.press.hasCustomInventoryName() ? this.press.getInventoryName() : I18n.format(this.press.getInventoryName());
String name = this.emitter.hasCustomInventoryName() ? this.emitter.getInventoryName() : I18n.format(this.emitter.getInventoryName());
this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6, 4210752);
this.fontRendererObj.drawString("Output: " + Library.getShortNumber(emitter.joules) + "Spk", 50, 30, 0xFF7F7F);
this.fontRendererObj.drawString(I18n.format("container.inventory"), 8, this.ySize - 96 + 2, 4210752);
}
@ -44,5 +91,27 @@ public class GUICoreEmitter extends GuiInfoContainer {
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 + 53, guiTop + 53, 210, 4, 34, 16);
if(emitter.isOn)
drawTexturedModalRect(guiLeft + 133, guiTop + 52, 192, 0, 18, 18);
drawTexturedModalRect(guiLeft + 53, guiTop + 45, 210, 0, emitter.watts * 34 / 100, 4);
int i = (int) emitter.getPowerScaled(52);
drawTexturedModalRect(guiLeft + 26, guiTop + 69 - i, 176, 52 - i, 16, i);
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);
}
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_);
}
}
}

View File

@ -138,8 +138,6 @@ public class GUIMachineReactorSmall extends GuiInfoContainer {
if(diFurnace.tanks[2].getFill() > 0) {
int i = diFurnace.getSteamScaled(88);
//i = (int) Math.min(i, 160);
int offset = 234;
switch(diFurnace.tanks[2].getTankType()) {

View File

@ -10,7 +10,6 @@ import org.lwjgl.input.Keyboard;
import org.lwjgl.opengl.GL11;
import com.hbm.inventory.container.ContainerRadioRec;
import com.hbm.inventory.gui.GUIRadioRec.RadioButton;
import com.hbm.lib.RefStrings;
import com.hbm.packet.AuxButtonPacket;
import com.hbm.packet.PacketDispatcher;

View File

@ -1,34 +1,21 @@
package com.hbm.packet;
import com.hbm.explosion.ExplosionLarge;
import com.hbm.handler.FluidTypeHandler.FluidType;
import com.hbm.items.weapon.ItemMissile.PartSize;
import com.hbm.saveddata.SatelliteSaveStructure;
import com.hbm.saveddata.SatelliteSavedData;
import com.hbm.tileentity.bomb.TileEntityLaunchTable;
import com.hbm.tileentity.bomb.TileEntityTurretCIWS;
import com.hbm.tileentity.bomb.TileEntityTurretCheapo;
import com.hbm.tileentity.machine.TileEntityAMSBase;
import com.hbm.tileentity.machine.TileEntityAMSEmitter;
import com.hbm.tileentity.machine.TileEntityAMSLimiter;
import com.hbm.tileentity.machine.TileEntityCoreEmitter;
import com.hbm.tileentity.machine.TileEntityForceField;
import com.hbm.tileentity.machine.TileEntityMachineDiesel;
import com.hbm.tileentity.machine.TileEntityMachineMissileAssembly;
import com.hbm.tileentity.machine.TileEntityMachineReactorLarge;
import com.hbm.tileentity.machine.TileEntityMachineReactorSmall;
import com.hbm.tileentity.machine.TileEntityMachineSeleniumEngine;
import com.hbm.tileentity.machine.TileEntityRadioRec;
import com.hbm.tileentity.machine.TileEntityReactorControl;
import cpw.mods.fml.common.network.simpleimpl.IMessage;
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import io.netty.buffer.ByteBuf;
import net.minecraft.client.Minecraft;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.tileentity.TileEntity;
public class AuxButtonPacket implements IMessage {
@ -219,6 +206,17 @@ public class AuxButtonPacket implements IMessage {
launcher.padSize = PartSize.values()[m.value];
}
if (te instanceof TileEntityCoreEmitter) {
TileEntityCoreEmitter core = (TileEntityCoreEmitter)te;
if(m.id == 0) {
core.watts = m.value;
}
if(m.id == 1) {
core.isOn = !core.isOn;
}
}
//} catch (Exception x) { }
return null;

View File

@ -41,8 +41,11 @@ public class RenderLaser extends Render {
MovingObjectPosition pos = Library.rayTrace(player, 100, 1);
Vec3 skeleton = Vec3.createVectorHelper(pos.hitVec.xCoord - player.posX, pos.hitVec.yCoord - player.posY - player.getEyeHeight(), pos.hitVec.zCoord - player.posZ);
BeamPronter.prontHelix(skeleton, 0, 0, 0, EnumWaveType.SPIRAL, EnumBeamType.LINE, 0x0000ff, 0x8080ff, 0, (int)(skeleton.lengthVector() * 5), 0.2F);
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);
}
GL11.glPopMatrix();

View File

@ -1,17 +1,12 @@
package com.hbm.render.tileentity;
import java.util.Random;
import org.lwjgl.opengl.GL11;
import com.hbm.lib.RefStrings;
import com.hbm.main.ResourceManager;
import com.hbm.tileentity.machine.TileEntityAMSBase;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation;
public class RenderAMSBase extends TileEntitySpecialRenderer {

View File

@ -62,9 +62,9 @@ public class RenderAMSEmitter extends TileEntitySpecialRenderer {
TileEntityAMSEmitter emitter = (TileEntityAMSEmitter)tileEntity;
if(emitter.getWorldObj().getTileEntity(emitter.xCoord, emitter.yCoord - 9, emitter.zCoord) instanceof TileEntityAMSBase && !emitter.locked) {
if(emitter.getWorldObj().getTileEntity(emitter.xCoord, emitter.yCoord - 9, emitter.zCoord) instanceof TileEntityAMSBase && !emitter.locked || true) {
if(emitter.efficiency > 0) {
if(emitter.efficiency > 0 || true) {
double lastPosX = 0;
double lastPosZ = 0;

View File

@ -2,7 +2,6 @@ package com.hbm.render.tileentity;
import org.lwjgl.opengl.GL11;
import com.hbm.lib.RefStrings;
import com.hbm.main.ResourceManager;
import com.hbm.render.util.BeamPronter;
import com.hbm.render.util.BeamPronter.EnumBeamType;
@ -13,10 +12,7 @@ import com.hbm.tileentity.machine.TileEntityCoreReceiver;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.Vec3;
import net.minecraftforge.client.model.AdvancedModelLoader;
import net.minecraftforge.client.model.IModelCustom;
public class RenderCoreComponent extends TileEntitySpecialRenderer {
@ -54,8 +50,14 @@ public class RenderCoreComponent extends TileEntitySpecialRenderer {
if(tileEntity instanceof TileEntityCoreEmitter) {
bindTexture(ResourceManager.dfc_emitter_tex);
ResourceManager.dfc_emitter.renderAll();
BeamPronter.prontHelix(Vec3.createVectorHelper(0, 0, 6), 0, 0.5, 0.5, EnumWaveType.SPIRAL, EnumBeamType.LINE, 0xFF0000, 0xFF8000, (int)tileEntity.getWorldObj().getTotalWorldTime() % 360 * -50, 100, 0.25F);
GL11.glTranslated(0, 0.5, 0);
int range = ((TileEntityCoreEmitter)tileEntity).beam;
if(range > 0) {
BeamPronter.prontHelix(Vec3.createVectorHelper(0, 0, range), EnumWaveType.SPIRAL, EnumBeamType.SOLID, 0xFFFF00, 0xFFFF00, 0, 1, 0F, 2, 0.0625F);
BeamPronter.prontHelix(Vec3.createVectorHelper(0, 0, range), EnumWaveType.RANDOM, EnumBeamType.SOLID, 0xFF6000, 0xFF6000, (int)tileEntity.getWorldObj().getTotalWorldTime() % 100, range * 2, 0.125F, 4, 0.0625F);
BeamPronter.prontHelix(Vec3.createVectorHelper(0, 0, range), EnumWaveType.RANDOM, EnumBeamType.SOLID, 0xFF6000, 0xFF6000, (int)tileEntity.getWorldObj().getTotalWorldTime() % 100 + 1, range * 2, 0.125F, 4, 0.0625F);
}
}
if(tileEntity instanceof TileEntityCoreReceiver) {

View File

@ -115,9 +115,10 @@ public class RendererObjTester extends TileEntitySpecialRenderer {
bindTexture(new ResourceLocation(RefStrings.MODID, "textures/models/ModelCalStock.png"));*/
//stock.renderAll(1F/16F);
SoyuzPronter.prontSoyuz();
//SoyuzPronter.prontSoyuz();
//TomPronter.prontTom();
//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, 25, 0.25F);
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.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();

View File

@ -20,9 +20,19 @@ public class BeamPronter {
LINE
}
public static void prontHelix(Vec3 skeleton, double x, double y, double z, EnumWaveType wave, EnumBeamType beam, int outerColor, int innerColor, int start, int segments, float size) {
public static void prontHelix(Vec3 skeleton, EnumWaveType wave, EnumBeamType beam, int outerColor, int innerColor, int start, int segments, float size, int layers, float thickness) {
GL11.glPushMatrix();
float sYaw = (float)(Math.atan2(skeleton.xCoord, skeleton.zCoord) * 180F / Math.PI);
float sqrt = MathHelper.sqrt_double(skeleton.xCoord * skeleton.xCoord + skeleton.zCoord * skeleton.zCoord);
float sPitch = (float)(Math.atan2(skeleton.yCoord, (double)sqrt) * 180F / Math.PI);
GL11.glRotatef(180, 0, 1F, 0);
GL11.glRotatef(sYaw, 0, 1F, 0);
GL11.glRotatef(sPitch - 90, 1F, 0, 0);
GL11.glPushMatrix();
GL11.glDisable(GL11.GL_TEXTURE_2D);
GL11.glDisable(GL11.GL_LIGHTING);
@ -34,18 +44,13 @@ public class BeamPronter {
Tessellator tessellator = Tessellator.instance;
Vec3 unit = skeleton.normalize();
Vec3 unit = Vec3.createVectorHelper(0, 1, 0);
Random rand = new Random(start);
double length = skeleton.lengthVector();
double segLength = length / segments;
float sYaw = (float)(Math.atan2(skeleton.xCoord, skeleton.zCoord));
float sqrt = MathHelper.sqrt_double(skeleton.xCoord * skeleton.xCoord + skeleton.zCoord * skeleton.zCoord);
float sPitch = (float)(Math.atan2(skeleton.yCoord, (double)sqrt));
double lastX = x;
double lastY = y;
double lastZ = z;
double lastX = 0;
double lastY = 0;
double lastZ = 0;
for(int i = 0; i <= segments; i++) {
@ -58,8 +63,8 @@ public class BeamPronter {
spinner.rotateAroundY((float)Math.PI * 2 * rand.nextFloat());
}
spinner.rotateAroundX(sPitch + (float)Math.PI * 0.5F);
spinner.rotateAroundY(sYaw);
//spinner.rotateAroundX(sPitch + (float)Math.PI * 0.5F);
//spinner.rotateAroundY(sYaw);
double pX = unit.xCoord * segLength * i + spinner.xCoord;
double pY = unit.yCoord * segLength * i + spinner.yCoord;
@ -69,13 +74,49 @@ public class BeamPronter {
tessellator.startDrawing(3);
tessellator.setColorOpaque_I(outerColor);
tessellator.addVertex(pX + x, pY + y, pZ + z);
tessellator.addVertex(lastX + x, lastY + y, lastZ + z);
tessellator.addVertex(pX, pY, pZ);
tessellator.addVertex(lastX, lastY, lastZ);
tessellator.draw();
}
if(beam == EnumBeamType.SOLID && i > 0) {
float radius = thickness / layers;
for(int j = 1; j <= layers; j++) {
float inter = (float)(j - 1) / (float)(layers - 1);
int color = (int) (outerColor + (innerColor - outerColor) * inter);
tessellator.startDrawingQuads();
tessellator.setColorOpaque_I(color);
tessellator.addVertex(lastX + (radius * j), lastY, lastZ + (radius * j));
tessellator.addVertex(lastX + (radius * j), lastY, lastZ - (radius * j));
tessellator.addVertex(pX + (radius * j), pY, pZ - (radius * j));
tessellator.addVertex(pX + (radius * j), pY, pZ + (radius * j));
tessellator.draw();
tessellator.startDrawingQuads();
tessellator.setColorOpaque_I(color);
tessellator.addVertex(lastX - (radius * j), lastY, lastZ + (radius * j));
tessellator.addVertex(lastX - (radius * j), lastY, lastZ - (radius * j));
tessellator.addVertex(pX - (radius * j), pY, pZ - (radius * j));
tessellator.addVertex(pX - (radius * j), pY, pZ + (radius * j));
tessellator.draw();
tessellator.startDrawingQuads();
tessellator.setColorOpaque_I(color);
tessellator.addVertex(lastX + (radius * j), lastY, lastZ + (radius * j));
tessellator.addVertex(lastX - (radius * j), lastY, lastZ + (radius * j));
tessellator.addVertex(pX - (radius * j), pY, pZ + (radius * j));
tessellator.addVertex(pX + (radius * j), pY, pZ + (radius * j));
tessellator.draw();
tessellator.startDrawingQuads();
tessellator.setColorOpaque_I(color);
tessellator.addVertex(lastX + (radius * j), lastY, lastZ - (radius * j));
tessellator.addVertex(lastX - (radius * j), lastY, lastZ - (radius * j));
tessellator.addVertex(pX - (radius * j), pY, pZ - (radius * j));
tessellator.addVertex(pX + (radius * j), pY, pZ - (radius * j));
tessellator.draw();
}
}
lastX = pX;
@ -87,8 +128,8 @@ public class BeamPronter {
tessellator.startDrawing(3);
tessellator.setColorOpaque_I(innerColor);
tessellator.addVertex(x, y, z);
tessellator.addVertex(x + skeleton.xCoord, y + skeleton.yCoord, z + skeleton.zCoord);
tessellator.addVertex(0, 0, 0);
tessellator.addVertex(0, skeleton.lengthVector(), 0);
tessellator.draw();
}
@ -100,6 +141,8 @@ public class BeamPronter {
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glEnable(GL11.GL_TEXTURE_2D);
GL11.glPopMatrix();
GL11.glPopMatrix();
}
}

View File

@ -9,10 +9,8 @@ import com.hbm.handler.FluidTypeHandler.FluidType;
import com.hbm.interfaces.IConsumer;
import com.hbm.interfaces.IFluidAcceptor;
import com.hbm.interfaces.IFluidContainer;
import com.hbm.interfaces.IFluidSource;
import com.hbm.inventory.FluidTank;
import com.hbm.items.ModItems;
import com.hbm.items.special.ItemBattery;
import com.hbm.lib.Library;
import com.hbm.packet.AuxElectricityPacket;
import com.hbm.packet.AuxGaugePacket;

View File

@ -8,21 +8,35 @@ import com.hbm.interfaces.IConsumer;
import com.hbm.interfaces.IFluidAcceptor;
import com.hbm.interfaces.ILaserable;
import com.hbm.inventory.FluidTank;
import com.hbm.lib.ModDamageSource;
import com.hbm.tileentity.TileEntityMachineBase;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.entity.Entity;
import net.minecraft.init.Blocks;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.MathHelper;
import net.minecraftforge.common.util.ForgeDirection;
public class TileEntityCoreEmitter extends TileEntityMachineBase implements IConsumer, IFluidAcceptor, ILaserable {
public long power;
public static final long maxPower = 1000000000L;
public int watts;
public int beam;
public long joules;
public boolean isOn;
public FluidTank tank;
public long prev;
public static final int range = 50;
public TileEntityCoreEmitter() {
super(2);
super(0);
tank = new FluidTank(FluidType.CRYOGEL, 64000, 0);
}
@Override
@ -34,19 +48,110 @@ public class TileEntityCoreEmitter extends TileEntityMachineBase implements ICon
public void updateEntity() {
if (!worldObj.isRemote) {
watts = MathHelper.clamp_int(watts, 1, 100);
long demand = maxPower * watts / 2000;
//tank.setType(0, 1, slots);
//tank.updateTank(xCoord, yCoord, zCoord);
tank.updateTank(xCoord, yCoord, zCoord);
ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata());
int range = 50;
beam = 0;
for(int i = 1; i <= range; i++) {
Block b = worldObj.getBlock(xCoord + dir.offsetX, yCoord + dir.offsetY, zCoord + dir.offsetZ);
if(joules > 0 || prev > 0) {
if(tank.getFill() >= 20) {
tank.setFill(tank.getFill() - 20);
} else {
worldObj.setBlock(xCoord, yCoord, zCoord, Blocks.flowing_lava);
return;
}
}
if(isOn) {
if(power >= demand) {
power -= demand;
long add = watts;
joules += add;
}
prev = joules;
if(joules > 0) {
ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata());
for(int i = 1; i <= range; i++) {
beam = 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 ILaserable) {
((ILaserable)te).addEnergy(joules * 98 / 100);
break;
}
Block b = worldObj.getBlock(x, y, z);
if(b != Blocks.air) {
float hardness = b.getExplosionResistance(null);
if(hardness < 6000 && worldObj.rand.nextInt(20) == 0) {
worldObj.func_147480_a(x, y, z, false);
}
break;
}
}
joules = 0;
double blx = Math.min(xCoord, xCoord + dir.offsetX * beam) + 0.2;
double bux = Math.max(xCoord, xCoord + dir.offsetX * beam) + 0.8;
double bly = Math.min(yCoord, yCoord + dir.offsetY * beam) + 0.2;
double buy = Math.max(yCoord, yCoord + dir.offsetY * beam) + 0.8;
double blz = Math.min(zCoord, zCoord + dir.offsetZ * beam) + 0.2;
double buz = Math.max(zCoord, zCoord + dir.offsetZ * beam) + 0.8;
List<Entity> list = worldObj.getEntitiesWithinAABB(Entity.class, AxisAlignedBB.getBoundingBox(blx, bly, blz, bux, buy, buz));
for(Entity e : list) {
e.attackEntityFrom(ModDamageSource.amsCore, 5);
e.setFire(10);
}
}
} else {
joules = 0;
prev = 0;
}
this.updateGauge((int) power, 0, 50);
this.updateGauge(watts, 1, 50);
this.updateGauge((int) prev, 2, 50);
this.updateGauge(beam, 3, 50);
this.updateGauge(isOn ? 1 : 0, 4, 250);
}
}
public void processGauge(int val, int id) {
if(id == 0) power = val;
if(id == 1) watts = val;
if(id == 2) joules = val;
if(id == 3) beam = val;
if(id == 4) isOn = val == 1;
}
public long getPowerScaled(long i) {
return (power * i) / maxPower;
}
public int getWattsScaled(int i) {
return (watts * i) / 100;
}
@Override
public void setFluidFill(int i, FluidType type) {
@ -107,5 +212,17 @@ public class TileEntityCoreEmitter extends TileEntityMachineBase implements ICon
public void addEnergy(long energy) {
joules += energy;
}
@Override
public AxisAlignedBB getRenderBoundingBox() {
return TileEntity.INFINITE_EXTENT_AABB;
}
@Override
@SideOnly(Side.CLIENT)
public double getMaxRenderDistanceSquared()
{
return 65536.0D;
}
}