soyuz launcher progress

This commit is contained in:
HbmMods 2020-04-13 13:10:21 +02:00
parent 08e95f651a
commit 385cf34f07
6 changed files with 78 additions and 164 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 245 B

View File

@ -68,8 +68,8 @@ public class ContainerSoyuzLauncher extends Container {
ItemStack var5 = var4.getStack();
var3 = var5.copy();
if (par2 <= 1) {
if (!this.mergeItemStack(var5, 2, this.inventorySlots.size(), true))
if (par2 <= 27) {
if (!this.mergeItemStack(var5, 9, this.inventorySlots.size(), true))
{
return null;
}

View File

@ -2,11 +2,15 @@ package com.hbm.inventory.gui;
import org.lwjgl.opengl.GL11;
import com.hbm.inventory.FluidTank;
import com.hbm.inventory.container.ContainerSoyuzLauncher;
import com.hbm.lib.RefStrings;
import com.hbm.packet.AuxButtonPacket;
import com.hbm.packet.PacketDispatcher;
import com.hbm.tileentity.machine.TileEntitySoyuzLauncher;
import net.minecraft.client.Minecraft;
import net.minecraft.client.audio.PositionedSoundRecord;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.util.ResourceLocation;
@ -28,41 +32,28 @@ public class GUISoyuzLauncher extends GuiInfoContainer {
public void drawScreen(int mouseX, int mouseY, float f) {
super.drawScreen(mouseX, mouseY, f);
/*launcher.tanks[0].renderTankInfo(this, mouseX, mouseY, guiLeft + 116, guiTop + 88 - 52, 16, 52);
launcher.tanks[1].renderTankInfo(this, mouseX, mouseY, guiLeft + 134, guiTop + 88 - 52, 16, 52);
this.drawCustomInfo(this, mouseX, mouseY, guiLeft + 152, guiTop + 88 - 52, 16, 52, new String[] { "Solid Fuel: " + launcher.solid + "l" });
this.drawElectricityInfo(this, mouseX, mouseY, guiLeft + 134, guiTop + 113, 34, 6, launcher.power, launcher.maxPower);
this.drawCustomInfo(this, mouseX, mouseY, guiLeft + 7, guiTop + 98, 18, 18, new String[] { "Size 10 & 10/15" });
this.drawCustomInfo(this, mouseX, mouseY, guiLeft + 25, guiTop + 98, 18, 18, new String[] { "Size 15 & 15/20" });
this.drawCustomInfo(this, mouseX, mouseY, guiLeft + 43, guiTop + 98, 18, 18, new String[] { "Size 20" });
launcher.tanks[0].renderTankInfo(this, mouseX, mouseY, guiLeft + 8, guiTop + 36, 16, 52);
launcher.tanks[1].renderTankInfo(this, mouseX, mouseY, guiLeft + 26, guiTop + 36, 16, 52);
this.drawElectricityInfo(this, mouseX, mouseY, guiLeft + 49, guiTop + 72, 6, 34, launcher.power, launcher.maxPower);
String[] text = new String[] { "Acepts custom missiles", "of all sizes, as long as the", "correct size setting is selected." };
this.drawCustomInfoStat(mouseX, mouseY, guiLeft - 16, guiTop + 36, 16, 16, guiLeft - 8, guiTop + 36 + 16, text);
String[] text1 = new String[] { "Detonator can only trigger center block." };
this.drawCustomInfoStat(mouseX, mouseY, guiLeft - 16, guiTop + 36 + 16, 16, 16, guiLeft - 8, guiTop + 36 + 16, text1);*/
//this.drawCustomInfoStat(mouseX, mouseY, guiLeft + 43, guiTop + 17, 18, 18, mouseX, mouseY, new String[]{"The Soyuz goes here"} );
//this.drawCustomInfoStat(mouseX, mouseY, guiLeft + 43, guiTop + 35, 18, 18, mouseX, mouseY, new String[]{"Designator for cargo mode"} );
}
protected void mouseClicked(int x, int y, int i) {
super.mouseClicked(x, y, i);
/*if(guiLeft + 7 <= x && guiLeft + 7 + 18 > x && guiTop + 98 < y && guiTop + 98 + 18 >= y) {
if(guiLeft + 88 <= x && guiLeft + 88 + 18 > x && guiTop + 17 < y && guiTop + 17 + 18 >= y) {
mc.getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 1.0F));
PacketDispatcher.wrapper.sendToServer(new AuxButtonPacket(launcher.xCoord, launcher.yCoord, launcher.zCoord, PartSize.SIZE_10.ordinal(), 0));
PacketDispatcher.wrapper.sendToServer(new AuxButtonPacket(launcher.xCoord, launcher.yCoord, launcher.zCoord, 0, 0));
}
if(guiLeft + 25 <= x && guiLeft + 25 + 18 > x && guiTop + 98 < y && guiTop + 98 + 18 >= y) {
if(guiLeft + 88 <= x && guiLeft + 88 + 18 > x && guiTop + 35 < y && guiTop + 35 + 18 >= y) {
mc.getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 1.0F));
PacketDispatcher.wrapper.sendToServer(new AuxButtonPacket(launcher.xCoord, launcher.yCoord, launcher.zCoord, PartSize.SIZE_15.ordinal(), 0));
PacketDispatcher.wrapper.sendToServer(new AuxButtonPacket(launcher.xCoord, launcher.yCoord, launcher.zCoord, 1, 0));
}
if(guiLeft + 43 <= x && guiLeft + 43 + 18 > x && guiTop + 98 < y && guiTop + 98 + 18 >= y) {
mc.getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 1.0F));
PacketDispatcher.wrapper.sendToServer(new AuxButtonPacket(launcher.xCoord, launcher.yCoord, launcher.zCoord, PartSize.SIZE_20.ordinal(), 0));
}*/
}
@Override
@ -78,5 +69,20 @@ public class GUISoyuzLauncher extends GuiInfoContainer {
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
int i = (int)launcher.getPowerScaled(34);
drawTexturedModalRect(guiLeft + 49, guiTop + 106 - i, 194, 52 - i, 6, i);
drawTexturedModalRect(guiLeft + 61, guiTop + 17, 176 + (launcher.hasRocket() ? 18 : 0), 0, 18, 18);
int j = launcher.designator();
if(j > 0)
drawTexturedModalRect(guiLeft + 61, guiTop + 35, 192 + (j - 1), 0, 18, 18);
Minecraft.getMinecraft().getTextureManager().bindTexture(launcher.tanks[0].getSheet());
launcher.tanks[0].renderTank(this, guiLeft + 8, guiTop + 88, launcher.tanks[0].getTankType().textureX() * FluidTank.x, launcher.tanks[0].getTankType().textureY() * FluidTank.y, 16, 52);
Minecraft.getMinecraft().getTextureManager().bindTexture(launcher.tanks[1].getSheet());
launcher.tanks[1].renderTank(this, guiLeft + 26, guiTop + 88, launcher.tanks[1].getTankType().textureX() * FluidTank.x, launcher.tanks[1].getTankType().textureY() * FluidTank.y, 16, 52);
}
}

View File

@ -1024,6 +1024,7 @@ public class ModItems {
public static Item missile_custom;
public static Item missile_carrier;
public static Item missile_soyuz;
public static Item sat_mapper;
public static Item sat_scanner;
public static Item sat_radar;
@ -2570,6 +2571,7 @@ public class ModItems {
missile_schrabidium = new Item().setUnlocalizedName("missile_schrabidium").setMaxStackSize(1).setCreativeTab(MainRegistry.missileTab).setTextureName(RefStrings.MODID + ":missile_schrabidium");
missile_emp = new Item().setUnlocalizedName("missile_emp").setMaxStackSize(1).setCreativeTab(MainRegistry.missileTab).setTextureName(RefStrings.MODID + ":missile_emp");
missile_carrier = new Item().setUnlocalizedName("missile_carrier").setMaxStackSize(1).setCreativeTab(MainRegistry.missileTab).setTextureName(RefStrings.MODID + ":missile_carrier");
missile_soyuz = new Item().setUnlocalizedName("missile_soyuz").setMaxStackSize(1).setCreativeTab(MainRegistry.missileTab).setTextureName(RefStrings.MODID + ":soyuz");
missile_custom = new ItemCustomMissile().setUnlocalizedName("missile_custom").setMaxStackSize(1).setCreativeTab(null).setTextureName(RefStrings.MODID + ":missile_custom");
sat_mapper = new ItemSatChip().setUnlocalizedName("sat_mapper").setMaxStackSize(1).setCreativeTab(MainRegistry.missileTab).setTextureName(RefStrings.MODID + ":sat_mapper");
sat_scanner = new ItemSatChip().setUnlocalizedName("sat_scanner").setMaxStackSize(1).setCreativeTab(MainRegistry.missileTab).setTextureName(RefStrings.MODID + ":sat_scanner");
@ -4436,6 +4438,7 @@ public class ModItems {
GameRegistry.registerItem(missile_schrabidium, missile_schrabidium.getUnlocalizedName());
GameRegistry.registerItem(missile_emp, missile_emp.getUnlocalizedName());
GameRegistry.registerItem(missile_carrier, missile_carrier.getUnlocalizedName());
GameRegistry.registerItem(missile_soyuz, missile_soyuz.getUnlocalizedName());
GameRegistry.registerItem(missile_custom, missile_custom.getUnlocalizedName());
//Missile Parts

View File

@ -3,8 +3,7 @@ package com.hbm.render.tileentity;
import org.lwjgl.opengl.GL11;
import com.hbm.lib.RefStrings;
import com.hbm.render.util.DiamondPronter;
import com.hbm.render.util.EnumSymbol;
import com.hbm.render.util.SoyuzPronter;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.tileentity.TileEntity;
@ -30,7 +29,7 @@ public class RendererObjTester extends TileEntitySpecialRenderer {
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float f)
{
GL11.glPushMatrix();
GL11.glTranslated(x + 0.5, y + 0.5, z + 0.5);
GL11.glTranslated(x + 0.5, y, z + 0.5);
GL11.glEnable(GL11.GL_LIGHTING);
/*switch(tileEntity.getBlockMetadata())
{
@ -105,13 +104,13 @@ 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.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);
DiamondPronter.pront(1, 2, 3, EnumSymbol.OXIDIZER);
//DiamondPronter.pront(1, 2, 3, EnumSymbol.OXIDIZER);
GL11.glPopMatrix();
}

View File

@ -3,21 +3,20 @@ package com.hbm.tileentity.machine;
import java.util.ArrayList;
import java.util.List;
import com.hbm.entity.missile.EntityMissileCustom;
import com.hbm.handler.MissileStruct;
import com.hbm.handler.FluidTypeHandler.FluidType;
import com.hbm.interfaces.IConsumer;
import com.hbm.interfaces.IFluidAcceptor;
import com.hbm.interfaces.IFluidContainer;
import com.hbm.inventory.FluidTank;
import com.hbm.items.ModItems;
import com.hbm.lib.Library;
import com.hbm.main.MainRegistry;
import com.hbm.packet.AuxElectricityPacket;
import com.hbm.packet.PacketDispatcher;
import com.hbm.tileentity.TileEntityMachineBase;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.ISidedInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
@ -25,13 +24,12 @@ import net.minecraft.nbt.NBTTagList;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
public class TileEntitySoyuzLauncher extends TileEntity implements ISidedInventory, IConsumer, IFluidContainer, IFluidAcceptor {
private ItemStack slots[];
public class TileEntitySoyuzLauncher extends TileEntityMachineBase implements ISidedInventory, IConsumer, IFluidContainer, IFluidAcceptor {
public long power;
public static final long maxPower = 100000;
public static final long maxPower = 1000000;
public FluidTank[] tanks;
public byte mode;
public MissileStruct load;
@ -40,104 +38,15 @@ public class TileEntitySoyuzLauncher extends TileEntity implements ISidedInvento
private String customName;
public TileEntitySoyuzLauncher() {
slots = new ItemStack[27];
super(27);
tanks = new FluidTank[2];
tanks[0] = new FluidTank(FluidType.KEROSENE, 100000, 0);
tanks[1] = new FluidTank(FluidType.ACID, 100000, 1);
tanks[0] = new FluidTank(FluidType.KEROSENE, 128000, 0);
tanks[1] = new FluidTank(FluidType.ACID, 128000, 1);
}
@Override
public int getSizeInventory() {
return slots.length;
}
@Override
public ItemStack getStackInSlot(int i) {
return slots[i];
}
@Override
public ItemStack getStackInSlotOnClosing(int i) {
if (slots[i] != null) {
ItemStack itemStack = slots[i];
slots[i] = null;
return itemStack;
} else {
return null;
}
}
@Override
public void setInventorySlotContents(int i, ItemStack itemStack) {
slots[i] = itemStack;
if (itemStack != null && itemStack.stackSize > getInventoryStackLimit()) {
itemStack.stackSize = getInventoryStackLimit();
}
}
@Override
public String getInventoryName() {
return this.hasCustomInventoryName() ? this.customName : "container.launchTable";
}
@Override
public boolean hasCustomInventoryName() {
return this.customName != null && this.customName.length() > 0;
}
public void setCustomName(String name) {
this.customName = name;
}
@Override
public int getInventoryStackLimit() {
return 64;
}
@Override
public boolean isUseableByPlayer(EntityPlayer player) {
if (worldObj.getTileEntity(xCoord, yCoord, zCoord) != this) {
return false;
} else {
return player.getDistanceSq(xCoord + 0.5D, yCoord + 0.5D, zCoord + 0.5D) <= 64;
}
}
// You scrubs aren't needed for anything (right now)
@Override
public void openInventory() {
}
@Override
public void closeInventory() {
}
@Override
public boolean isItemValidForSlot(int i, ItemStack stack) {
return false;
}
@Override
public ItemStack decrStackSize(int i, int j) {
if (slots[i] != null) {
if (slots[i].stackSize <= j) {
ItemStack itemStack = slots[i];
slots[i] = null;
return itemStack;
}
ItemStack itemStack1 = slots[i].splitStack(j);
if (slots[i].stackSize == 0) {
slots[i] = null;
}
return itemStack1;
} else {
return null;
}
}
public long getPowerScaled(long i) {
return (power * i) / maxPower;
public String getName() {
return "container.soyuzLauncher";
}
@Override
@ -145,32 +54,42 @@ public class TileEntitySoyuzLauncher extends TileEntity implements ISidedInvento
if (!worldObj.isRemote) {
tanks[0].loadTank(2, 3, slots);
tanks[1].loadTank(2, 3, slots);
tanks[0].loadTank(4, 5, slots);
tanks[1].loadTank(6, 7, slots);
for (int i = 0; i < 2; i++)
tanks[i].updateTank(xCoord, yCoord, zCoord, worldObj.provider.dimensionId);
power = Library.chargeTEFromItems(slots, 5, power, maxPower);
PacketDispatcher.wrapper.sendToAll(new AuxElectricityPacket(xCoord, yCoord, zCoord, power));
} else {
List<Entity> entities = worldObj.getEntitiesWithinAABBExcludingEntity(null, AxisAlignedBB.getBoundingBox(xCoord - 0.5, yCoord, zCoord - 0.5, xCoord + 1.5, yCoord + 10, zCoord + 1.5));
for(Entity e : entities) {
if(e instanceof EntityMissileCustom) {
for(int i = 0; i < 15; i++)
MainRegistry.proxy.spawnParticle(xCoord + 0.5, yCoord + 0.25, zCoord + 0.5, "largelaunchsmoke", null);
break;
}
}
NBTTagCompound data = new NBTTagCompound();
data.setLong("power", power);
data.setByte("mode", mode);
networkPack(data, 50);
}
}
public void networkUnpack(NBTTagCompound data) {
power = data.getLong("power");
mode = data.getByte("mode");
}
public long getPowerScaled(long i) {
return (power * i) / maxPower;
}
public boolean hasRocket() {
return slots[0] != null && slots[0].getItem() == ModItems.missile_soyuz;
}
public int designator() {
if(mode == 0)
return 0;
if(slots[1] != null && (slots[1].getItem() == ModItems.designator || slots[1].getItem() == ModItems.designator_range || slots[1].getItem() == ModItems.designator_manual) && slots[1].hasTagCompound())
return 2;
return 1;
}
@Override
public void readFromNBT(NBTTagCompound nbt) {
@ -180,6 +99,7 @@ public class TileEntitySoyuzLauncher extends TileEntity implements ISidedInvento
tanks[0].readFromNBT(nbt, "fuel");
tanks[1].readFromNBT(nbt, "oxidizer");
power = nbt.getLong("power");
mode = nbt.getByte("mode");
slots = new ItemStack[getSizeInventory()];
@ -201,6 +121,7 @@ public class TileEntitySoyuzLauncher extends TileEntity implements ISidedInvento
tanks[0].writeToNBT(nbt, "fuel");
tanks[1].writeToNBT(nbt, "oxidizer");
nbt.setLong("power", power);
nbt.setByte("mode", mode);
for (int i = 0; i < slots.length; i++) {
if (slots[i] != null) {
@ -213,21 +134,6 @@ public class TileEntitySoyuzLauncher extends TileEntity implements ISidedInvento
nbt.setTag("items", list);
}
@Override
public int[] getAccessibleSlotsFromSide(int p_94128_1_) {
return access;
}
@Override
public boolean canInsertItem(int i, ItemStack itemStack, int j) {
return this.isItemValidForSlot(i, itemStack);
}
@Override
public boolean canExtractItem(int i, ItemStack itemStack, int j) {
return false;
}
@Override
public int getMaxFluidFill(FluidType type) {
if (type.name().equals(tanks[0].getTankType().name()))