turret prototype GUI
BIN
src/main/java/assets/hbm/textures/blocks/turret_chekhov.png
Normal file
|
After Width: | Height: | Size: 6.8 KiB |
BIN
src/main/java/assets/hbm/textures/blocks/turret_jeremy.png
Normal file
|
After Width: | Height: | Size: 6.8 KiB |
BIN
src/main/java/assets/hbm/textures/blocks/turret_tauon.png
Normal file
|
After Width: | Height: | Size: 6.8 KiB |
|
Before Width: | Height: | Size: 653 B After Width: | Height: | Size: 538 B |
|
Before Width: | Height: | Size: 703 B After Width: | Height: | Size: 644 B |
|
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 387 B After Width: | Height: | Size: 257 B |
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.9 KiB |
@ -6,8 +6,9 @@ import com.hbm.blocks.fluid.*;
|
||||
import com.hbm.blocks.machine.*;
|
||||
import com.hbm.blocks.network.*;
|
||||
import com.hbm.blocks.test.*;
|
||||
import com.hbm.blocks.turret.*;
|
||||
import com.hbm.items.block.*;
|
||||
import com.hbm.items.bomb.ItemPrototypeBlock;
|
||||
import com.hbm.items.bomb.*;
|
||||
import com.hbm.items.special.ItemOreBlock;
|
||||
import com.hbm.lib.ModDamageSource;
|
||||
import com.hbm.lib.RefStrings;
|
||||
@ -794,8 +795,11 @@ public class ModBlocks {
|
||||
public static Block turret_cheapo;
|
||||
|
||||
public static Block turret_chekhov;
|
||||
public static final int guiID_chekhov = 104;
|
||||
public static Block turret_jeremy;
|
||||
public static final int guiID_jeremy = 105;
|
||||
public static Block turret_tauon;
|
||||
public static final int guiID_tauon = 106;
|
||||
|
||||
public static Block book_guide;
|
||||
|
||||
|
||||
@ -15,7 +15,7 @@ import net.minecraftforge.common.util.ForgeDirection;
|
||||
public class BlockCoalBurning extends BlockOutgas {
|
||||
|
||||
public BlockCoalBurning(Material mat) {
|
||||
super(mat, true, 1, true);
|
||||
super(mat, false, 1, false);
|
||||
this.setTickRandomly(true);
|
||||
}
|
||||
|
||||
@ -58,6 +58,17 @@ public class BlockCoalBurning extends BlockOutgas {
|
||||
super.breakBlock(world, x, y, z, block, i);
|
||||
|
||||
world.setBlock(x, y, z, Blocks.fire);
|
||||
|
||||
for(int ix = -2; ix <= 2; ix++) {
|
||||
for(int iy = -2; iy <= 2; iy++) {
|
||||
for(int iz = -2; iz <= 2; iz++) {
|
||||
|
||||
if(Math.abs(ix + iy + iz) < 5 && world.getBlock(x + ix, y + iy, z + iz) == Blocks.air) {
|
||||
world.setBlock(x + ix, y + iy, z + iz, this.getGas());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -36,7 +36,7 @@ public class BlockOutgas extends BlockOre {
|
||||
return rate;
|
||||
}
|
||||
|
||||
private Block getGas() {
|
||||
protected Block getGas() {
|
||||
|
||||
if(this == ModBlocks.ore_uranium || this == ModBlocks.ore_uranium_scorched ||
|
||||
this == ModBlocks.ore_gneiss_uranium || this == ModBlocks.ore_gneiss_uranium_scorched ||
|
||||
@ -110,4 +110,22 @@ public class BlockOutgas extends BlockOre {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, Block block, int i) {
|
||||
super.breakBlock(world, x, y, z, block, i);
|
||||
|
||||
if(this == ModBlocks.ancient_scrap) {
|
||||
for(int ix = -2; ix <= 2; ix++) {
|
||||
for(int iy = -2; iy <= 2; iy++) {
|
||||
for(int iz = -2; iz <= 2; iz++) {
|
||||
|
||||
if(Math.abs(ix + iy + iz) < 5 && world.getBlock(x + ix, y + iy, z + iz) == Blocks.air) {
|
||||
world.setBlock(x + ix, y + iy, z + iz, this.getGas());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
package com.hbm.blocks.bomb;
|
||||
package com.hbm.blocks.turret;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
@ -1,11 +1,10 @@
|
||||
package com.hbm.blocks.bomb;
|
||||
package com.hbm.blocks.turret;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.config.WeaponConfig;
|
||||
import com.hbm.entity.particle.EntityGasFlameFX;
|
||||
import com.hbm.lib.ModDamageSource;
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.tileentity.turret.TileEntityTurretCIWS;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
@ -1,4 +1,4 @@
|
||||
package com.hbm.blocks.bomb;
|
||||
package com.hbm.blocks.turret;
|
||||
|
||||
import com.hbm.entity.projectile.EntityBullet;
|
||||
import com.hbm.tileentity.turret.TileEntityTurretCheapo;
|
||||
@ -1,9 +1,15 @@
|
||||
package com.hbm.blocks.bomb;
|
||||
package com.hbm.blocks.turret;
|
||||
|
||||
import com.hbm.blocks.BlockDummyable;
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.tileentity.TileEntityProxyCombo;
|
||||
import com.hbm.tileentity.machine.TileEntityMachineCyclotron;
|
||||
import com.hbm.tileentity.turret.TileEntityTurretChekhov;
|
||||
|
||||
import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
@ -20,7 +26,7 @@ public class TurretChekhov extends BlockDummyable {
|
||||
|
||||
if(meta >= 12)
|
||||
return new TileEntityTurretChekhov();
|
||||
return null;
|
||||
return new TileEntityProxyCombo(true, true, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -43,4 +49,21 @@ public class TurretChekhov extends BlockDummyable {
|
||||
this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.5F, 1.0F);
|
||||
return AxisAlignedBB.getBoundingBox(x + this.minX, y + this.minY, z + this.minZ, x + this.maxX, y + this.maxY, z + this.maxZ);
|
||||
}
|
||||
|
||||
@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()) {
|
||||
int[] pos = this.findCore(world, x, y, z);
|
||||
|
||||
if(pos == null)
|
||||
return false;
|
||||
|
||||
FMLNetworkHandler.openGui(player, MainRegistry.instance, ModBlocks.guiID_chekhov, world, pos[0], pos[1], pos[2]);
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,4 +1,4 @@
|
||||
package com.hbm.blocks.bomb;
|
||||
package com.hbm.blocks.turret;
|
||||
|
||||
import com.hbm.entity.projectile.EntityFire;
|
||||
import com.hbm.tileentity.turret.TileEntityTurretFlamer;
|
||||
@ -1,4 +1,4 @@
|
||||
package com.hbm.blocks.bomb;
|
||||
package com.hbm.blocks.turret;
|
||||
|
||||
import com.hbm.entity.particle.EntityGasFlameFX;
|
||||
import com.hbm.entity.projectile.EntityBullet;
|
||||
@ -1,6 +1,7 @@
|
||||
package com.hbm.blocks.bomb;
|
||||
package com.hbm.blocks.turret;
|
||||
|
||||
import com.hbm.blocks.BlockDummyable;
|
||||
import com.hbm.tileentity.TileEntityProxyCombo;
|
||||
import com.hbm.tileentity.turret.TileEntityTurretJeremy;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
@ -20,7 +21,7 @@ public class TurretJeremy extends BlockDummyable {
|
||||
|
||||
if(meta >= 12)
|
||||
return new TileEntityTurretJeremy();
|
||||
return null;
|
||||
return new TileEntityProxyCombo(true, true, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -1,4 +1,4 @@
|
||||
package com.hbm.blocks.bomb;
|
||||
package com.hbm.blocks.turret;
|
||||
|
||||
import com.hbm.entity.projectile.EntityBullet;
|
||||
import com.hbm.tileentity.turret.TileEntityTurretLight;
|
||||
@ -1,4 +1,4 @@
|
||||
package com.hbm.blocks.bomb;
|
||||
package com.hbm.blocks.turret;
|
||||
|
||||
import com.hbm.entity.particle.EntityGasFlameFX;
|
||||
import com.hbm.entity.projectile.EntityRocket;
|
||||
@ -1,4 +1,4 @@
|
||||
package com.hbm.blocks.bomb;
|
||||
package com.hbm.blocks.turret;
|
||||
|
||||
import com.hbm.entity.particle.EntityGasFlameFX;
|
||||
import com.hbm.entity.projectile.EntityAAShell;
|
||||
@ -1,4 +1,4 @@
|
||||
package com.hbm.blocks.bomb;
|
||||
package com.hbm.blocks.turret;
|
||||
|
||||
import com.hbm.entity.projectile.EntityBullet;
|
||||
import com.hbm.tileentity.turret.TileEntityTurretTau;
|
||||
@ -1,7 +1,7 @@
|
||||
package com.hbm.blocks.bomb;
|
||||
package com.hbm.blocks.turret;
|
||||
|
||||
import com.hbm.blocks.BlockDummyable;
|
||||
import com.hbm.tileentity.turret.TileEntityTurretChekhov;
|
||||
import com.hbm.tileentity.TileEntityProxyCombo;
|
||||
import com.hbm.tileentity.turret.TileEntityTurretTauon;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
@ -21,7 +21,7 @@ public class TurretTauon extends BlockDummyable {
|
||||
|
||||
if(meta >= 12)
|
||||
return new TileEntityTurretTauon();
|
||||
return null;
|
||||
return new TileEntityProxyCombo(true, true, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -90,9 +90,9 @@ public class MineralRecipes {
|
||||
GameRegistry.addShapelessRecipe(new ItemStack(ModItems.ingot_schrabidium, 2), new Object[] { ModItems.billet_schrabidium, ModItems.billet_schrabidium, ModItems.billet_schrabidium });
|
||||
GameRegistry.addShapelessRecipe(new ItemStack(ModItems.ingot_solinium, 2), new Object[] { ModItems.billet_solinium, ModItems.billet_solinium, ModItems.billet_solinium });
|
||||
|
||||
GameRegistry.addShapelessRecipe(new ItemStack(ModItems.pellet_rtg), new Object[] { ModItems.billet_pu238, ModItems.billet_pu238, ModItems.billet_pu238 });
|
||||
GameRegistry.addShapelessRecipe(new ItemStack(ModItems.pellet_rtg_weak), new Object[] { ModItems.billet_u238, ModItems.billet_u238, ModItems.billet_pu238 });
|
||||
GameRegistry.addShapelessRecipe(new ItemStack(ModItems.pellet_rtg_polonium), new Object[] { ModItems.billet_polonium, ModItems.billet_polonium, ModItems.billet_polonium });
|
||||
GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(ModItems.pellet_rtg), new Object[] { ModItems.billet_pu238, ModItems.billet_pu238, ModItems.billet_pu238, "plateIron" }));
|
||||
GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(ModItems.pellet_rtg_weak), new Object[] { ModItems.billet_u238, ModItems.billet_u238, ModItems.billet_pu238, "plateIron" }));
|
||||
GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(ModItems.pellet_rtg_polonium), new Object[] { ModItems.billet_polonium, ModItems.billet_polonium, ModItems.billet_polonium, "plateIron" }));
|
||||
|
||||
GameRegistry.addRecipe(new ItemStack(Item.getItemFromBlock(ModBlocks.block_copper), 1), new Object[] { "###", "###", "###", '#', ModItems.ingot_copper });
|
||||
GameRegistry.addRecipe(new ItemStack(Item.getItemFromBlock(ModBlocks.block_fluorite), 1), new Object[] { "###", "###", "###", '#', ModItems.fluorite });
|
||||
|
||||
@ -7,7 +7,6 @@ import com.hbm.entity.mob.EntityRADBeast;
|
||||
import com.hbm.util.ContaminationUtil;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.Event.Result;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.ChatComponentText;
|
||||
|
||||
@ -8,6 +8,7 @@ import com.hbm.inventory.inv.InventoryLeadBox;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.tileentity.bomb.*;
|
||||
import com.hbm.tileentity.machine.*;
|
||||
import com.hbm.tileentity.turret.TileEntityTurretChekhov;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
@ -727,6 +728,13 @@ public class GUIHandler implements IGuiHandler {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
case ModBlocks.guiID_chekhov: {
|
||||
if(entity instanceof TileEntityTurretChekhov) {
|
||||
return new ContainerTurretChekhov(player.inventory, (TileEntityTurretChekhov) entity);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
// NON-TE CONTAINERS
|
||||
|
||||
@ -1443,6 +1451,13 @@ public class GUIHandler implements IGuiHandler {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
case ModBlocks.guiID_chekhov: {
|
||||
if(entity instanceof TileEntityTurretChekhov) {
|
||||
return new GUITurretChekhov(player.inventory, (TileEntityTurretChekhov) entity);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
// ITEM GUIS
|
||||
|
||||
|
||||
@ -0,0 +1,75 @@
|
||||
package com.hbm.inventory.container;
|
||||
|
||||
import com.hbm.tileentity.turret.TileEntityTurretChekhov;
|
||||
|
||||
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 ContainerTurretChekhov extends Container {
|
||||
|
||||
private TileEntityTurretChekhov turret;
|
||||
|
||||
public ContainerTurretChekhov(InventoryPlayer invPlayer, TileEntityTurretChekhov te) {
|
||||
turret = te;
|
||||
|
||||
this.addSlotToContainer(new Slot(te, 0, 98, 27));
|
||||
|
||||
for(int i = 0; i < 3; i++) {
|
||||
for(int j = 0; j < 3; j++) {
|
||||
this.addSlotToContainer(new Slot(te, 1 + i * 3 + j, 80 + j * 18, 63 + i * 18));
|
||||
}
|
||||
}
|
||||
|
||||
this.addSlotToContainer(new Slot(te, 10, 152, 99));
|
||||
|
||||
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 + (18 * 3) + 2));
|
||||
}
|
||||
}
|
||||
|
||||
for(int i = 0; i < 9; i++)
|
||||
{
|
||||
this.addSlotToContainer(new Slot(invPlayer, i, 8 + i * 18, 142 + (18 * 3) + 2));
|
||||
}
|
||||
}
|
||||
|
||||
@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 <= turret.getSizeInventory() - 1) {
|
||||
if(!this.mergeItemStack(var5, turret.getSizeInventory(), this.inventorySlots.size(), true)) {
|
||||
return null;
|
||||
}
|
||||
} else if(!this.mergeItemStack(var5, 0, turret.getSizeInventory(), false)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if(var5.stackSize == 0) {
|
||||
var4.putStack((ItemStack) null);
|
||||
} else {
|
||||
var4.onSlotChanged();
|
||||
}
|
||||
|
||||
var4.onPickupFromSlot(p_82846_1_, var5);
|
||||
}
|
||||
|
||||
return var3;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInteractWith(EntityPlayer player) {
|
||||
return turret.isUseableByPlayer(player);
|
||||
}
|
||||
}
|
||||
94
src/main/java/com/hbm/inventory/gui/GUITurretChekhov.java
Normal file
@ -0,0 +1,94 @@
|
||||
package com.hbm.inventory.gui;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.hbm.inventory.container.ContainerTurretChekhov;
|
||||
import com.hbm.lib.RefStrings;
|
||||
import com.hbm.packet.AuxButtonPacket;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
import com.hbm.tileentity.turret.TileEntityTurretChekhov;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.audio.PositionedSoundRecord;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public class GUITurretChekhov extends GuiContainer {
|
||||
|
||||
private static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/weapon/gui_turret_base.png");
|
||||
private TileEntityTurretChekhov turret;
|
||||
|
||||
public GUITurretChekhov(InventoryPlayer invPlayer, TileEntityTurretChekhov tedf) {
|
||||
super(new ContainerTurretChekhov(invPlayer, tedf));
|
||||
turret = tedf;
|
||||
|
||||
this.xSize = 176;
|
||||
this.ySize = 222;
|
||||
}
|
||||
|
||||
protected void mouseClicked(int x, int y, int i) {
|
||||
super.mouseClicked(x, y, i);
|
||||
|
||||
if(guiLeft + 115 <= x && guiLeft + 115 + 18 > x && guiTop + 26 < y && guiTop + 26 + 18 >= y) {
|
||||
|
||||
mc.getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 1.0F));
|
||||
PacketDispatcher.wrapper.sendToServer(new AuxButtonPacket(turret.xCoord, turret.yCoord, turret.zCoord, 0, 0));
|
||||
}
|
||||
|
||||
if(guiLeft + 8 <= x && guiLeft + 8 + 10 > x && guiTop + 30 < y && guiTop + 30 + 10 >= y) {
|
||||
|
||||
mc.getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 1.0F));
|
||||
PacketDispatcher.wrapper.sendToServer(new AuxButtonPacket(turret.xCoord, turret.yCoord, turret.zCoord, 0, 1));
|
||||
}
|
||||
|
||||
if(guiLeft + 22 <= x && guiLeft + 22 + 10 > x && guiTop + 30 < y && guiTop + 30 + 10 >= y) {
|
||||
|
||||
mc.getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 1.0F));
|
||||
PacketDispatcher.wrapper.sendToServer(new AuxButtonPacket(turret.xCoord, turret.yCoord, turret.zCoord, 0, 2));
|
||||
}
|
||||
|
||||
if(guiLeft + 36 <= x && guiLeft + 36 + 10 > x && guiTop + 30 < y && guiTop + 30 + 10 >= y) {
|
||||
|
||||
mc.getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 1.0F));
|
||||
PacketDispatcher.wrapper.sendToServer(new AuxButtonPacket(turret.xCoord, turret.yCoord, turret.zCoord, 0, 3));
|
||||
}
|
||||
|
||||
if(guiLeft + 50 <= x && guiLeft + 50 + 10 > x && guiTop + 30 < y && guiTop + 30 + 10 >= y) {
|
||||
|
||||
mc.getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 1.0F));
|
||||
PacketDispatcher.wrapper.sendToServer(new AuxButtonPacket(turret.xCoord, turret.yCoord, turret.zCoord, 0, 4));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int i, int j) {
|
||||
String name = this.turret.hasCustomInventoryName() ? this.turret.getInventoryName() : I18n.format(this.turret.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(turret.isOn)
|
||||
drawTexturedModalRect(guiLeft + 115, guiTop + 26, 176, 40, 18, 18);
|
||||
|
||||
if(turret.targetPlayers)
|
||||
drawTexturedModalRect(guiLeft + 8, guiTop + 30, 176, 0, 10, 10);
|
||||
|
||||
if(turret.targetAnimals)
|
||||
drawTexturedModalRect(guiLeft + 22, guiTop + 30, 176, 10, 10, 10);
|
||||
|
||||
if(turret.targetMobs)
|
||||
drawTexturedModalRect(guiLeft + 36, guiTop + 30, 176, 20, 10, 10);
|
||||
|
||||
if(turret.targetMachines)
|
||||
drawTexturedModalRect(guiLeft + 50, guiTop + 30, 176, 30, 10, 10);
|
||||
}
|
||||
}
|
||||
@ -1,7 +1,8 @@
|
||||
package com.hbm.items.machine;
|
||||
|
||||
import java.util.Arrays;
|
||||
import com.hbm.blocks.bomb.TurretBase;
|
||||
|
||||
import com.hbm.blocks.turret.TurretBase;
|
||||
import com.hbm.tileentity.turret.TileEntityTurretBase;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
||||
@ -2,7 +2,7 @@ package com.hbm.items.tool;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.blocks.bomb.TurretBase;
|
||||
import com.hbm.blocks.turret.TurretBase;
|
||||
import com.hbm.tileentity.turret.TileEntityTurretBase;
|
||||
import com.hbm.tileentity.turret.TileEntityTurretCheapo;
|
||||
|
||||
|
||||
@ -0,0 +1,50 @@
|
||||
package com.hbm.render.tileentity;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.hbm.handler.FluidTypeHandler.FluidType;
|
||||
import com.hbm.lib.Library;
|
||||
import com.hbm.main.ResourceManager;
|
||||
import com.hbm.tileentity.turret.TileEntityTurretBaseNT;
|
||||
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public abstract class RenderTurretBase extends TileEntitySpecialRenderer {
|
||||
|
||||
protected void renderConnectors(TileEntityTurretBaseNT turret, boolean power, boolean fluid, FluidType type) {
|
||||
|
||||
bindTexture(ResourceManager.turret_connector_tex);
|
||||
Vec3 pos = turret.getHorizontalOffset();
|
||||
int x = (int)(turret.xCoord + pos.xCoord);
|
||||
int y = turret.yCoord;
|
||||
int z = (int)(turret.zCoord + pos.zCoord);
|
||||
|
||||
checkPlug(turret.getWorldObj(), x - 2, y, z, true, false, type, 0, 0, 0);
|
||||
checkPlug(turret.getWorldObj(), x - 2, y, z - 1, true, false, type, 0, -1, 0);
|
||||
|
||||
checkPlug(turret.getWorldObj(), x - 1, y, z + 1, true, false, type, 0, -1, 90);
|
||||
checkPlug(turret.getWorldObj(), x, y, z + 1, true, false, type, 0, 0, 90);
|
||||
|
||||
checkPlug(turret.getWorldObj(), x + 1, y, z, true, false, type, 0, -1, 180);
|
||||
checkPlug(turret.getWorldObj(), x + 1, y, z - 1, true, false, type, 0, 0, 180);
|
||||
|
||||
checkPlug(turret.getWorldObj(), x, y, z - 2, true, false, type, 0, -1, 270);
|
||||
checkPlug(turret.getWorldObj(), x - 1, y, z - 2, true, false, type, 0, 0, 270);
|
||||
}
|
||||
|
||||
private void checkPlug(World world, int x, int y, int z, boolean power, boolean fluid, FluidType type, int ox, int oz, int rot) {
|
||||
|
||||
if( (power && Library.checkCableConnectables(world, x, y, z)) ||
|
||||
(fluid && Library.checkFluidConnectables(world, x, y, z, type)) ) {
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glRotated(rot, 0, 1, 0);
|
||||
GL11.glTranslated(ox, 0, oz);
|
||||
ResourceManager.turret_chekhov.renderPart("Connectors");
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -2,27 +2,31 @@ package com.hbm.render.tileentity;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.hbm.handler.FluidTypeHandler.FluidType;
|
||||
import com.hbm.main.ResourceManager;
|
||||
import com.hbm.tileentity.turret.TileEntityTurretChekhov;
|
||||
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.Vec3;
|
||||
|
||||
public class RenderTurretChekhov extends TileEntitySpecialRenderer {
|
||||
public class RenderTurretChekhov extends RenderTurretBase {
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity te, double x, double y, double z, float interp) {
|
||||
|
||||
TileEntityTurretChekhov turret = (TileEntityTurretChekhov)te;
|
||||
Vec3 pos = turret.getHorizontalOffset();
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(x + 1D, y, z + 1D);
|
||||
GL11.glTranslated(x + pos.xCoord, y, z + pos.zCoord);
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GL11.glEnable(GL11.GL_CULL_FACE);
|
||||
GL11.glShadeModel(GL11.GL_SMOOTH);
|
||||
|
||||
this.renderConnectors(turret, true, false, FluidType.NONE);
|
||||
|
||||
bindTexture(ResourceManager.turret_base_tex);
|
||||
ResourceManager.turret_chekhov.renderPart("Base");
|
||||
|
||||
TileEntityTurretChekhov turret = (TileEntityTurretChekhov)te;
|
||||
double yaw = -Math.toDegrees(turret.lastRotationYaw + (turret.rotationYaw - turret.lastRotationYaw) * interp) - 90D;
|
||||
double pitch = Math.toDegrees(turret.lastRotationPitch + (turret.rotationPitch - turret.lastRotationPitch) * interp);
|
||||
|
||||
|
||||
@ -2,27 +2,31 @@ package com.hbm.render.tileentity;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.hbm.handler.FluidTypeHandler.FluidType;
|
||||
import com.hbm.main.ResourceManager;
|
||||
import com.hbm.tileentity.turret.TileEntityTurretJeremy;
|
||||
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.Vec3;
|
||||
|
||||
public class RenderTurretJeremy extends TileEntitySpecialRenderer {
|
||||
public class RenderTurretJeremy extends RenderTurretBase {
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity te, double x, double y, double z, float interp) {
|
||||
|
||||
TileEntityTurretJeremy turret = (TileEntityTurretJeremy)te;
|
||||
Vec3 pos = turret.getHorizontalOffset();
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(x + 1D, y, z + 1D);
|
||||
GL11.glTranslated(x + pos.xCoord, y, z + pos.zCoord);
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GL11.glEnable(GL11.GL_CULL_FACE);
|
||||
GL11.glShadeModel(GL11.GL_SMOOTH);
|
||||
|
||||
this.renderConnectors(turret, true, false, FluidType.NONE);
|
||||
|
||||
bindTexture(ResourceManager.turret_base_tex);
|
||||
ResourceManager.turret_chekhov.renderPart("Base");
|
||||
|
||||
TileEntityTurretJeremy turret = (TileEntityTurretJeremy)te;
|
||||
double yaw = -Math.toDegrees(turret.lastRotationYaw + (turret.rotationYaw - turret.lastRotationYaw) * interp) - 90D;
|
||||
double pitch = Math.toDegrees(turret.lastRotationPitch + (turret.rotationPitch - turret.lastRotationPitch) * interp);
|
||||
|
||||
|
||||
@ -2,31 +2,35 @@ package com.hbm.render.tileentity;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.hbm.handler.FluidTypeHandler.FluidType;
|
||||
import com.hbm.main.ResourceManager;
|
||||
import com.hbm.render.util.BeamPronter;
|
||||
import com.hbm.render.util.BeamPronter.EnumBeamType;
|
||||
import com.hbm.render.util.BeamPronter.EnumWaveType;
|
||||
import com.hbm.tileentity.turret.TileEntityTurretTauon;
|
||||
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.Vec3;
|
||||
|
||||
public class RenderTurretTauon extends TileEntitySpecialRenderer {
|
||||
public class RenderTurretTauon extends RenderTurretBase {
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity te, double x, double y, double z, float interp) {
|
||||
|
||||
TileEntityTurretTauon turret = (TileEntityTurretTauon)te;
|
||||
Vec3 off = turret.getHorizontalOffset();
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(x + 1D, y, z + 1D);
|
||||
GL11.glTranslated(x + off.xCoord, y, z + off.zCoord);
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GL11.glEnable(GL11.GL_CULL_FACE);
|
||||
GL11.glShadeModel(GL11.GL_SMOOTH);
|
||||
|
||||
this.renderConnectors(turret, true, false, FluidType.NONE);
|
||||
|
||||
bindTexture(ResourceManager.turret_base_tex);
|
||||
ResourceManager.turret_chekhov.renderPart("Base");
|
||||
|
||||
TileEntityTurretTauon turret = (TileEntityTurretTauon)te;
|
||||
double yaw = -Math.toDegrees(turret.lastRotationYaw + (turret.rotationYaw - turret.lastRotationYaw) * interp) - 90D;
|
||||
double pitch = Math.toDegrees(turret.lastRotationPitch + (turret.rotationPitch - turret.lastRotationPitch) * interp);
|
||||
|
||||
@ -51,7 +55,7 @@ public class RenderTurretTauon extends TileEntitySpecialRenderer {
|
||||
}
|
||||
|
||||
GL11.glTranslated(0, 1.375, 0);
|
||||
GL11.glRotated((te.getWorldObj().getTotalWorldTime() + interp) * 15, -1, 0, 0);
|
||||
GL11.glRotated((te.getWorldObj().getTotalWorldTime() + interp) * 40, -1, 0, 0);
|
||||
GL11.glTranslated(0, -1.375, 0);
|
||||
ResourceManager.turret_tauon.renderPart("Rotor");
|
||||
|
||||
|
||||
@ -3,7 +3,7 @@ package com.hbm.tileentity.turret;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.blocks.bomb.TurretBase;
|
||||
import com.hbm.blocks.turret.TurretBase;
|
||||
import com.hbm.entity.logic.EntityBomber;
|
||||
import com.hbm.entity.missile.EntityMissileBaseAdvanced;
|
||||
import com.hbm.entity.missile.EntityMissileCustom;
|
||||
|
||||
@ -2,10 +2,11 @@ package com.hbm.tileentity.turret;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.blocks.BlockDummyable;
|
||||
import com.hbm.entity.logic.EntityBomber;
|
||||
import com.hbm.entity.missile.EntityMissileBase;
|
||||
import com.hbm.entity.missile.EntityMissileBaseAdvanced;
|
||||
import com.hbm.handler.BulletConfiguration;
|
||||
import com.hbm.interfaces.IConsumer;
|
||||
import com.hbm.lib.Library;
|
||||
import com.hbm.tileentity.TileEntityMachineBase;
|
||||
|
||||
@ -27,7 +28,7 @@ import net.minecraftforge.common.util.FakePlayer;
|
||||
* @author hbm
|
||||
*
|
||||
*/
|
||||
public abstract class TileEntityTurretBaseNT extends TileEntityMachineBase {
|
||||
public abstract class TileEntityTurretBaseNT extends TileEntityMachineBase implements IConsumer {
|
||||
|
||||
//this time we do all rotations in radians
|
||||
//what way are we facing?
|
||||
@ -42,6 +43,8 @@ public abstract class TileEntityTurretBaseNT extends TileEntityMachineBase {
|
||||
public boolean aligned = false;
|
||||
//how many ticks until the next check
|
||||
public int searchTimer;
|
||||
|
||||
public long power;
|
||||
|
||||
public boolean targetPlayers = false;
|
||||
public boolean targetAnimals = false;
|
||||
@ -72,35 +75,49 @@ public abstract class TileEntityTurretBaseNT extends TileEntityMachineBase {
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
|
||||
if(worldObj.isRemote) {
|
||||
this.lastRotationPitch = this.rotationPitch;
|
||||
this.lastRotationYaw = this.rotationYaw;
|
||||
}
|
||||
|
||||
this.aligned = false;
|
||||
|
||||
if(target != null) {
|
||||
if(!this.entityInLOS(this.target)) {
|
||||
this.target = null;
|
||||
}
|
||||
}
|
||||
|
||||
if(worldObj.isRemote) {
|
||||
this.lastRotationPitch = this.rotationPitch;
|
||||
this.lastRotationYaw = this.rotationYaw;
|
||||
}
|
||||
|
||||
if(target != null) {
|
||||
this.aligned = false;
|
||||
this.alignTurret();
|
||||
if(this.isOn) {
|
||||
|
||||
if(target != null)
|
||||
this.alignTurret();
|
||||
} else {
|
||||
this.aligned = false;
|
||||
|
||||
this.target = null;
|
||||
}
|
||||
|
||||
if(!worldObj.isRemote) {
|
||||
|
||||
searchTimer--;
|
||||
|
||||
if(searchTimer <= 0) {
|
||||
searchTimer = this.getDecetorInterval();
|
||||
this.seekNewTarget();
|
||||
if(this.isOn) {
|
||||
searchTimer--;
|
||||
|
||||
if(searchTimer <= 0) {
|
||||
searchTimer = this.getDecetorInterval();
|
||||
this.seekNewTarget();
|
||||
}
|
||||
} else {
|
||||
searchTimer = 0;
|
||||
}
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setInteger("target", this.target == null ? -1 : this.target.getEntityId());
|
||||
data.setLong("power", this.power);
|
||||
data.setBoolean("isOn", this.isOn);
|
||||
data.setBoolean("targetPlayers", this.targetPlayers);
|
||||
data.setBoolean("targetAnimals", this.targetAnimals);
|
||||
data.setBoolean("targetMobs", this.targetMobs);
|
||||
data.setBoolean("targetMachines", this.targetMachines);
|
||||
this.networkPack(data, 250);
|
||||
|
||||
} else {
|
||||
@ -118,8 +135,6 @@ public abstract class TileEntityTurretBaseNT extends TileEntityMachineBase {
|
||||
else
|
||||
this.lastRotationYaw -= Math.PI * 2;
|
||||
}
|
||||
|
||||
worldObj.spawnParticle("cloud", pos.xCoord, pos.yCoord, pos.zCoord, 0.0, 0.1, 0.0);
|
||||
|
||||
if(this.aligned)
|
||||
worldObj.spawnParticle("flame", pos.xCoord + vec.xCoord, pos.yCoord + vec.yCoord, pos.zCoord + vec.zCoord, vec.xCoord, vec.yCoord, vec.zCoord);
|
||||
@ -132,9 +147,29 @@ public abstract class TileEntityTurretBaseNT extends TileEntityMachineBase {
|
||||
public void networkUnpack(NBTTagCompound nbt) {
|
||||
|
||||
int t = nbt.getInteger("target");
|
||||
this.power = nbt.getLong("power");
|
||||
this.isOn = nbt.getBoolean("isOn");
|
||||
this.targetPlayers = nbt.getBoolean("targetPlayers");
|
||||
this.targetAnimals = nbt.getBoolean("targetAnimals");
|
||||
this.targetMobs = nbt.getBoolean("targetMobs");
|
||||
this.targetMachines = nbt.getBoolean("targetMachines");
|
||||
|
||||
if(t != -1)
|
||||
this.target = worldObj.getEntityByID(t);
|
||||
else
|
||||
this.target = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleButtonPacket(int value, int meta) {
|
||||
|
||||
switch(meta) {
|
||||
case 0:this.isOn = !this.isOn; break;
|
||||
case 1:this.targetPlayers = !this.targetPlayers; break;
|
||||
case 2:this.targetAnimals = !this.targetAnimals; break;
|
||||
case 3:this.targetMobs = !this.targetMobs; break;
|
||||
case 4:this.targetMachines = !this.targetMachines; break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -399,8 +434,25 @@ public abstract class TileEntityTurretBaseNT extends TileEntityMachineBase {
|
||||
* @return
|
||||
*/
|
||||
public Vec3 getTurretPos() {
|
||||
//TODO: account for multiblock rotation
|
||||
return Vec3.createVectorHelper(xCoord + 1, yCoord + getHeightOffset(), zCoord + 1);
|
||||
Vec3 offset = getHorizontalOffset();
|
||||
return Vec3.createVectorHelper(xCoord + offset.xCoord, yCoord + getHeightOffset(), zCoord + offset.zCoord);
|
||||
}
|
||||
|
||||
/**
|
||||
* The XZ offset for a standard 2x2 turret base
|
||||
* @return
|
||||
*/
|
||||
public Vec3 getHorizontalOffset() {
|
||||
int meta = this.getBlockMetadata() - BlockDummyable.offset;
|
||||
|
||||
if(meta == 2)
|
||||
return Vec3.createVectorHelper(1, 0, 1);
|
||||
if(meta == 4)
|
||||
return Vec3.createVectorHelper(1, 0, 0);
|
||||
if(meta == 5)
|
||||
return Vec3.createVectorHelper(0, 0, 1);
|
||||
|
||||
return Vec3.createVectorHelper(0, 0, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -417,14 +469,13 @@ public abstract class TileEntityTurretBaseNT extends TileEntityMachineBase {
|
||||
*/
|
||||
protected abstract List<BulletConfiguration> getAmmoList();
|
||||
|
||||
/*
|
||||
* the void
|
||||
*
|
||||
*
|
||||
* more stuff pending: the thing that makes the pew pew
|
||||
* probably a separate method that consumes or checks ammo
|
||||
* mayhaps some dangly bits that tie together the GUI with the AI chip's whitelist
|
||||
*/
|
||||
public void setPower(long i) {
|
||||
this.power = i;
|
||||
}
|
||||
|
||||
public long getPower() {
|
||||
return this.power;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getRenderBoundingBox() {
|
||||
|
||||
@ -31,4 +31,9 @@ public class TileEntityTurretChekhov extends TileEntityTurretBaseNT {
|
||||
public double getTurretElevation() {
|
||||
return 45D;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getMaxPower() {
|
||||
return 10000;
|
||||
}
|
||||
}
|
||||
|
||||
@ -25,4 +25,9 @@ public class TileEntityTurretJeremy extends TileEntityTurretBaseNT {
|
||||
public double getTurretDepression() {
|
||||
return 35D;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getMaxPower() {
|
||||
return 10000;
|
||||
}
|
||||
}
|
||||
|
||||
@ -40,4 +40,9 @@ public class TileEntityTurretTauon extends TileEntityTurretBaseNT {
|
||||
public double getTurretDepression() {
|
||||
return 35D;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getMaxPower() {
|
||||
return 10000;
|
||||
}
|
||||
}
|
||||
|
||||