mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
launch pad condensation for LOXY rockets
This commit is contained in:
parent
82ec052d27
commit
786ced191b
@ -66,6 +66,8 @@
|
||||
* Retextured the fallout effect, fallout no longer has large snowflakes and the color now matches the crater better
|
||||
* High-yield mini nukes no longer create chunk radiation, since they use the MK5 which already has AoE radiation, this prevents dead grass from spawning that makes the crater look uglier
|
||||
* Balefire spread is now limited to prevent densely vegetated biomes from lagging to hell
|
||||
* The bricked furnace now makes charcoal twice as fast
|
||||
* Combination ovens no longer need two welded copper plates and instead only cast plates, therefore no longer being post-arc welder. This should make it more affordable and useful in the initial earlygame where things like automatic wood farms are most important.
|
||||
|
||||
## Fixed
|
||||
* Fixed dupe caused by shift-clicking ashes out of the bricked furnace
|
||||
|
||||
@ -198,10 +198,6 @@ public class BlockVolcano extends BlockContainer implements ITooltipProvider, IB
|
||||
}
|
||||
}
|
||||
|
||||
/* TODO */
|
||||
private boolean doesPyroclastic() { return false; }
|
||||
private double getPyroclasticRange() { return 0D; }
|
||||
|
||||
/** Causes two magma explosions, one from bedrock to the core and one from the core to 15 blocks above. */
|
||||
private void blastMagmaChannel() {
|
||||
ExplosionNT explosion = new ExplosionNT(worldObj, null, xCoord + 0.5, yCoord + worldObj.rand.nextInt(15) + 1.5, zCoord + 0.5, 7);
|
||||
|
||||
@ -1,131 +1,74 @@
|
||||
package com.hbm.blocks.bomb;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.blocks.BlockDummyable;
|
||||
import com.hbm.interfaces.IBomb;
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.tileentity.bomb.TileEntityLaunchPad;
|
||||
|
||||
import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class LaunchPad extends BlockContainer implements IBomb {
|
||||
public class LaunchPad extends BlockDummyable implements IBomb {
|
||||
|
||||
public static boolean keepInventory = false;
|
||||
private final static Random field_149933_a = new Random();
|
||||
|
||||
public LaunchPad(Material p_i45386_1_) {
|
||||
super(p_i45386_1_);
|
||||
public LaunchPad(Material mat) {
|
||||
super(mat);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) {
|
||||
return new TileEntityLaunchPad();
|
||||
public TileEntity createNewTileEntity(World world, int meta) {
|
||||
if(meta >= 12) return new TileEntityLaunchPad();
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World p_149749_1_, int p_149749_2_, int p_149749_3_, int p_149749_4_, Block p_149749_5_, int p_149749_6_) {
|
||||
if(!keepInventory) {
|
||||
TileEntityLaunchPad tileentityfurnace = (TileEntityLaunchPad) p_149749_1_.getTileEntity(p_149749_2_, p_149749_3_, p_149749_4_);
|
||||
|
||||
if(tileentityfurnace != null) {
|
||||
for(int i1 = 0; i1 < tileentityfurnace.getSizeInventory(); ++i1) {
|
||||
ItemStack itemstack = tileentityfurnace.getStackInSlot(i1);
|
||||
|
||||
if(itemstack != null) {
|
||||
float f = LaunchPad.field_149933_a.nextFloat() * 0.8F + 0.1F;
|
||||
float f1 = LaunchPad.field_149933_a.nextFloat() * 0.8F + 0.1F;
|
||||
float f2 = LaunchPad.field_149933_a.nextFloat() * 0.8F + 0.1F;
|
||||
|
||||
while(itemstack.stackSize > 0) {
|
||||
int j1 = LaunchPad.field_149933_a.nextInt(21) + 10;
|
||||
|
||||
if(j1 > itemstack.stackSize) {
|
||||
j1 = itemstack.stackSize;
|
||||
}
|
||||
|
||||
itemstack.stackSize -= j1;
|
||||
EntityItem entityitem = new EntityItem(p_149749_1_, p_149749_2_ + f, p_149749_3_ + f1, p_149749_4_ + f2, new ItemStack(itemstack.getItem(), j1, itemstack.getItemDamage()));
|
||||
|
||||
if(itemstack.hasTagCompound()) {
|
||||
entityitem.getEntityItem().setTagCompound((NBTTagCompound) itemstack.getTagCompound().copy());
|
||||
}
|
||||
|
||||
float f3 = 0.05F;
|
||||
entityitem.motionX = (float) LaunchPad.field_149933_a.nextGaussian() * f3;
|
||||
entityitem.motionY = (float) LaunchPad.field_149933_a.nextGaussian() * f3 + 0.2F;
|
||||
entityitem.motionZ = (float) LaunchPad.field_149933_a.nextGaussian() * f3;
|
||||
p_149749_1_.spawnEntityInWorld(entityitem);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
p_149749_1_.func_147453_f(p_149749_2_, p_149749_3_, p_149749_4_, p_149749_5_);
|
||||
}
|
||||
}
|
||||
|
||||
super.breakBlock(p_149749_1_, p_149749_2_, p_149749_3_, p_149749_4_, p_149749_5_, p_149749_6_);
|
||||
}
|
||||
|
||||
|
||||
@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()) {
|
||||
TileEntityLaunchPad entity = (TileEntityLaunchPad) world.getTileEntity(x, y, z);
|
||||
if(entity != null) {
|
||||
FMLNetworkHandler.openGui(player, MainRegistry.instance, 0, world, x, y, z);
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
return this.standardOpenBehavior(world, x, y, z, player, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNeighborBlockChange(World p_149695_1_, int x, int y, int z, Block p_149695_5_) {
|
||||
if(p_149695_1_.isBlockIndirectlyGettingPowered(x, y, z) && !p_149695_1_.isRemote) {
|
||||
this.explode(p_149695_1_, x, y, z);
|
||||
}
|
||||
public int[] getDimensions() {
|
||||
return new int[] {0, 0, 1, 1, 1, 1};
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public Item getItem(World p_149694_1_, int p_149694_2_, int p_149694_3_, int p_149694_4_) {
|
||||
return Item.getItemFromBlock(ModBlocks.launch_pad);
|
||||
public int getOffset() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BombReturnCode explode(World world, int x, int y, int z) {
|
||||
TileEntityLaunchPad entity = (TileEntityLaunchPad) world.getTileEntity(x, y, z);
|
||||
return entity.launchFromDesignator();
|
||||
|
||||
if(!world.isRemote) {
|
||||
|
||||
int[] corePos = findCore(world, x, y, z);
|
||||
if(corePos != null){
|
||||
TileEntity core = world.getTileEntity(corePos[0], corePos[1], corePos[2]);
|
||||
if(core instanceof TileEntityLaunchPad){
|
||||
TileEntityLaunchPad entity = (TileEntityLaunchPad)core;
|
||||
return entity.launchFromDesignator();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return BombReturnCode.UNDEFINED;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNeighborBlockChange(World world, int x, int y, int z, Block blockIn){
|
||||
|
||||
if(!world.isRemote){
|
||||
|
||||
int[] corePos = findCore(world, x, y, z);
|
||||
if(corePos != null){
|
||||
TileEntity core = world.getTileEntity(corePos[0], corePos[1], corePos[2]);
|
||||
if(core instanceof TileEntityLaunchPad){
|
||||
TileEntityLaunchPad launchpad = (TileEntityLaunchPad)core;
|
||||
launchpad.updateRedstonePower(x, y, z);
|
||||
}
|
||||
}
|
||||
}
|
||||
super.onNeighborBlockChange( world, x, y, z, blockIn);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -64,8 +64,8 @@ public class LaunchPadLarge extends BlockDummyable implements IBomb {
|
||||
if(corePos != null){
|
||||
TileEntity core = world.getTileEntity(corePos[0], corePos[1], corePos[2]);
|
||||
if(core instanceof TileEntityLaunchPadLarge){
|
||||
TileEntityLaunchPadLarge door = (TileEntityLaunchPadLarge)core;
|
||||
door.updateRedstonePower(x, y, z);
|
||||
TileEntityLaunchPadLarge launchpad = (TileEntityLaunchPadLarge)core;
|
||||
launchpad.updateRedstonePower(x, y, z);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -13,7 +13,6 @@ import com.hbm.lib.HbmCollection.EnumGunManufacturer;
|
||||
import com.hbm.particle.SpentCasing;
|
||||
import com.hbm.particle.SpentCasing.CasingType;
|
||||
import com.hbm.render.anim.BusAnimation;
|
||||
import com.hbm.render.anim.BusAnimationKeyframe;
|
||||
import com.hbm.render.anim.BusAnimationSequence;
|
||||
import com.hbm.render.anim.HbmAnimations.AnimType;
|
||||
import com.hbm.render.util.RenderScreenOverlay.Crosshair;
|
||||
|
||||
@ -12,7 +12,6 @@ import com.hbm.lib.HbmCollection.EnumGunManufacturer;
|
||||
import com.hbm.particle.SpentCasing;
|
||||
import com.hbm.particle.SpentCasing.CasingType;
|
||||
import com.hbm.render.anim.BusAnimation;
|
||||
import com.hbm.render.anim.BusAnimationKeyframe;
|
||||
import com.hbm.render.anim.BusAnimationSequence;
|
||||
import com.hbm.render.anim.HbmAnimations.AnimType;
|
||||
import com.hbm.render.util.RenderScreenOverlay.Crosshair;
|
||||
|
||||
@ -20,7 +20,6 @@ import com.hbm.particle.SpentCasing;
|
||||
import com.hbm.particle.SpentCasing.CasingType;
|
||||
import com.hbm.potion.HbmPotion;
|
||||
import com.hbm.render.anim.BusAnimation;
|
||||
import com.hbm.render.anim.BusAnimationKeyframe;
|
||||
import com.hbm.render.anim.BusAnimationSequence;
|
||||
import com.hbm.render.anim.HbmAnimations.AnimType;
|
||||
import com.hbm.render.util.RenderScreenOverlay.Crosshair;
|
||||
|
||||
@ -18,7 +18,6 @@ import com.hbm.particle.SpentCasing;
|
||||
import com.hbm.particle.SpentCasing.CasingType;
|
||||
import com.hbm.potion.HbmPotion;
|
||||
import com.hbm.render.anim.BusAnimation;
|
||||
import com.hbm.render.anim.BusAnimationKeyframe;
|
||||
import com.hbm.render.anim.BusAnimationSequence;
|
||||
import com.hbm.render.anim.HbmAnimations.AnimType;
|
||||
import com.hbm.render.util.RenderScreenOverlay.Crosshair;
|
||||
|
||||
@ -14,7 +14,6 @@ import com.hbm.packet.AuxParticlePacketNT;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
import com.hbm.potion.HbmPotion;
|
||||
import com.hbm.render.anim.BusAnimation;
|
||||
import com.hbm.render.anim.BusAnimationKeyframe;
|
||||
import com.hbm.render.anim.BusAnimationSequence;
|
||||
import com.hbm.render.anim.HbmAnimations.AnimType;
|
||||
import com.hbm.render.util.RenderScreenOverlay.Crosshair;
|
||||
|
||||
@ -15,7 +15,6 @@ import com.hbm.particle.SpentCasing;
|
||||
import com.hbm.particle.SpentCasing.CasingType;
|
||||
import com.hbm.potion.HbmPotion;
|
||||
import com.hbm.render.anim.BusAnimation;
|
||||
import com.hbm.render.anim.BusAnimationKeyframe;
|
||||
import com.hbm.render.anim.BusAnimationSequence;
|
||||
import com.hbm.render.anim.HbmAnimations.AnimType;
|
||||
import com.hbm.render.util.RenderScreenOverlay.Crosshair;
|
||||
|
||||
@ -9,7 +9,6 @@ import com.hbm.inventory.RecipesCommon.ComparableStack;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.lib.HbmCollection.EnumGunManufacturer;
|
||||
import com.hbm.render.anim.BusAnimation;
|
||||
import com.hbm.render.anim.BusAnimationKeyframe;
|
||||
import com.hbm.render.anim.BusAnimationSequence;
|
||||
import com.hbm.render.anim.HbmAnimations.AnimType;
|
||||
import com.hbm.render.util.RenderScreenOverlay.Crosshair;
|
||||
|
||||
@ -13,7 +13,6 @@ import com.hbm.items.ModItems;
|
||||
import com.hbm.items.ItemAmmoEnums.AmmoRocket;
|
||||
import com.hbm.lib.HbmCollection.EnumGunManufacturer;
|
||||
import com.hbm.render.anim.BusAnimation;
|
||||
import com.hbm.render.anim.BusAnimationKeyframe;
|
||||
import com.hbm.render.anim.BusAnimationSequence;
|
||||
import com.hbm.render.anim.HbmAnimations.AnimType;
|
||||
import com.hbm.render.util.RenderScreenOverlay.Crosshair;
|
||||
|
||||
@ -1,65 +0,0 @@
|
||||
package com.hbm.inventory.container;
|
||||
|
||||
import com.hbm.tileentity.bomb.TileEntityLaunchPad;
|
||||
|
||||
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 ContainerLaunchPadTier1 extends Container {
|
||||
|
||||
private TileEntityLaunchPad diFurnace;
|
||||
|
||||
public ContainerLaunchPadTier1(InventoryPlayer invPlayer, TileEntityLaunchPad tedf) {
|
||||
|
||||
diFurnace = tedf;
|
||||
|
||||
this.addSlotToContainer(new Slot(tedf, 0, 26, 17));
|
||||
this.addSlotToContainer(new Slot(tedf, 1, 80, 17));
|
||||
this.addSlotToContainer(new Slot(tedf, 2, 134, 17));
|
||||
|
||||
for(int i = 0; i < 3; i++) {
|
||||
for(int j = 0; j < 9; j++) {
|
||||
this.addSlotToContainer(new Slot(invPlayer, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
|
||||
}
|
||||
}
|
||||
|
||||
for(int i = 0; i < 9; i++) {
|
||||
this.addSlotToContainer(new Slot(invPlayer, i, 8 + i * 18, 142));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack transferStackInSlot(EntityPlayer p_82846_1_, int par2) {
|
||||
ItemStack var3 = null;
|
||||
Slot var4 = (Slot) this.inventorySlots.get(par2);
|
||||
|
||||
if(var4 != null && var4.getHasStack()) {
|
||||
ItemStack var5 = var4.getStack();
|
||||
var3 = var5.copy();
|
||||
|
||||
if(par2 <= 2) {
|
||||
if(!this.mergeItemStack(var5, 3, this.inventorySlots.size(), true)) {
|
||||
return null;
|
||||
}
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
|
||||
if(var5.stackSize == 0) {
|
||||
var4.putStack((ItemStack) null);
|
||||
} else {
|
||||
var4.onSlotChanged();
|
||||
}
|
||||
}
|
||||
|
||||
return var3;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInteractWith(EntityPlayer player) {
|
||||
return diFurnace.isUseableByPlayer(player);
|
||||
}
|
||||
}
|
||||
@ -1,64 +0,0 @@
|
||||
package com.hbm.inventory.gui;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.hbm.inventory.container.ContainerLaunchPadTier1;
|
||||
import com.hbm.lib.RefStrings;
|
||||
import com.hbm.tileentity.bomb.TileEntityLaunchPad;
|
||||
|
||||
public class GUILaunchPadTier1 extends GuiInfoContainer {
|
||||
|
||||
private static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/weapon/gui_launch_pad.png");
|
||||
private TileEntityLaunchPad diFurnace;
|
||||
|
||||
public GUILaunchPadTier1(InventoryPlayer invPlayer, TileEntityLaunchPad tedf) {
|
||||
super(new ContainerLaunchPadTier1(invPlayer, tedf));
|
||||
diFurnace = tedf;
|
||||
|
||||
this.xSize = 176;
|
||||
this.ySize = 166;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen(int mouseX, int mouseY, float f) {
|
||||
super.drawScreen(mouseX, mouseY, f);
|
||||
|
||||
this.drawElectricityInfo(this, mouseX, mouseY, guiLeft + 8, guiTop + 53, 160, 16, diFurnace.power, diFurnace.maxPower);
|
||||
|
||||
String[] text = new String[] { "First Slot:",
|
||||
" -Missile (no custom ones!)",
|
||||
" -Carrier Rocket" };
|
||||
this.drawCustomInfoStat(mouseX, mouseY, guiLeft - 16, guiTop + 36, 16, 16, guiLeft - 8, guiTop + 36 + 16, text);
|
||||
|
||||
String[] text1 = new String[] { "Second Slot:",
|
||||
" -Target designator for missiles",
|
||||
" -Satellite payload for the carrier rocket" };
|
||||
this.drawCustomInfoStat(mouseX, mouseY, guiLeft - 16, guiTop + 36 + 16, 16, 16, guiLeft - 8, guiTop + 36 + 16, text1);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int i, int j) {
|
||||
String name = this.diFurnace.hasCustomInventoryName() ? this.diFurnace.getInventoryName() : I18n.format(this.diFurnace.getInventoryName());
|
||||
|
||||
this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6, 4210752);
|
||||
this.fontRendererObj.drawString(I18n.format("container.inventory"), 8, this.ySize - 96 + 2, 4210752);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) {
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
|
||||
drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
|
||||
|
||||
int j1 = (int)diFurnace.getPowerScaled(160);
|
||||
drawTexturedModalRect(guiLeft + 8, guiTop + 53, 8, 166, j1, 16);
|
||||
|
||||
this.drawInfoPanel(guiLeft - 16, guiTop + 36, 16, 16, 2);
|
||||
this.drawInfoPanel(guiLeft - 16, guiTop + 36 + 16, 16, 16, 3);
|
||||
}
|
||||
}
|
||||
@ -312,7 +312,7 @@ public class AnvilRecipes {
|
||||
new AStack[] {
|
||||
new ComparableStack(Blocks.stonebrick, 8),
|
||||
new OreDictStack(KEY_LOG, 16),
|
||||
new OreDictStack(CU.plateWelded(), 2),
|
||||
new OreDictStack(CU.plateCast(), 2),
|
||||
new OreDictStack(KEY_BRICK, 16)
|
||||
}, new AnvilOutput(new ItemStack(ModBlocks.furnace_combination))).setTier(2));
|
||||
|
||||
|
||||
@ -8,7 +8,6 @@ import com.hbm.main.MainRegistry;
|
||||
import com.hbm.packet.AuxParticlePacketNT;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
import com.hbm.render.anim.BusAnimation;
|
||||
import com.hbm.render.anim.BusAnimationKeyframe;
|
||||
import com.hbm.render.anim.BusAnimationSequence;
|
||||
import com.hbm.util.EntityDamageUtil;
|
||||
|
||||
|
||||
@ -2,7 +2,6 @@ package com.hbm.items.weapon;
|
||||
|
||||
import com.hbm.handler.GunConfiguration;
|
||||
import com.hbm.render.anim.BusAnimation;
|
||||
import com.hbm.render.anim.BusAnimationKeyframe;
|
||||
import com.hbm.render.anim.BusAnimationSequence;
|
||||
import com.hbm.render.anim.HbmAnimations.AnimType;
|
||||
|
||||
|
||||
@ -5,7 +5,6 @@ import java.util.List;
|
||||
|
||||
import com.hbm.handler.GunConfiguration;
|
||||
import com.hbm.render.anim.BusAnimation;
|
||||
import com.hbm.render.anim.BusAnimationKeyframe;
|
||||
import com.hbm.render.anim.BusAnimationSequence;
|
||||
import com.hbm.render.anim.HbmAnimations.AnimType;
|
||||
|
||||
|
||||
@ -2,7 +2,6 @@ package com.hbm.items.weapon;
|
||||
|
||||
import com.hbm.handler.GunConfiguration;
|
||||
import com.hbm.render.anim.BusAnimation;
|
||||
import com.hbm.render.anim.BusAnimationKeyframe;
|
||||
import com.hbm.render.anim.BusAnimationSequence;
|
||||
import com.hbm.render.anim.HbmAnimations.AnimType;
|
||||
|
||||
|
||||
@ -5,7 +5,6 @@ import java.util.List;
|
||||
|
||||
import com.hbm.handler.GunConfiguration;
|
||||
import com.hbm.render.anim.BusAnimation;
|
||||
import com.hbm.render.anim.BusAnimationKeyframe;
|
||||
import com.hbm.render.anim.BusAnimationSequence;
|
||||
import com.hbm.render.anim.HbmAnimations.AnimType;
|
||||
|
||||
|
||||
@ -17,7 +17,6 @@ import net.minecraft.init.Items;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.WeightedRandomChestContent;
|
||||
import net.minecraft.world.ChunkCoordIntPair;
|
||||
|
||||
public class HbmChestContents {
|
||||
|
||||
|
||||
@ -1715,6 +1715,9 @@ public class ClientProxy extends ServerProxy {
|
||||
fx.setBaseScale(data.getFloat("base"));
|
||||
fx.setMaxScale(data.getFloat("max"));
|
||||
fx.setLife(data.getInteger("life") / (particleSetting + 1));
|
||||
if(data.hasKey("noWind")) fx.noWind();
|
||||
if(data.hasKey("strafe")) fx.setStrafe(data.getFloat("strafe"));
|
||||
if(data.hasKey("alpha")) fx.alphaMod(data.getFloat("alpha"));
|
||||
|
||||
if(data.hasKey("color")) {
|
||||
Color color = new Color(data.getInteger("color"));
|
||||
|
||||
@ -41,7 +41,7 @@ import com.hbm.packet.PacketDispatcher;
|
||||
import com.hbm.potion.HbmPotion;
|
||||
import com.hbm.saveddata.satellites.Satellite;
|
||||
import com.hbm.tileentity.TileMappings;
|
||||
import com.hbm.tileentity.bomb.TileEntityLaunchPad;
|
||||
import com.hbm.tileentity.bomb.TileEntityLaunchPadBase;
|
||||
import com.hbm.tileentity.bomb.TileEntityNukeCustom;
|
||||
import com.hbm.tileentity.machine.TileEntityNukeFurnace;
|
||||
import com.hbm.tileentity.machine.rbmk.RBMKDials;
|
||||
@ -332,7 +332,7 @@ public class MainRegistry {
|
||||
|
||||
TileMappings.writeMappings();
|
||||
MachineDynConfig.initialize();
|
||||
TileEntityLaunchPad.registerLaunchables();
|
||||
TileEntityLaunchPadBase.registerLaunchables();
|
||||
|
||||
for(Entry<Class<? extends TileEntity>, String[]> e : TileMappings.map.entrySet()) {
|
||||
|
||||
|
||||
@ -15,6 +15,9 @@ public class ParticleCoolingTower extends EntityFX {
|
||||
private float baseScale = 1.0F;
|
||||
private float maxScale = 1.0F;
|
||||
private float lift = 0.3F;
|
||||
private float strafe = 0.075F;
|
||||
private boolean windDir = true;
|
||||
private float alphaMod = 0.25F;
|
||||
|
||||
public ParticleCoolingTower(TextureManager texman, World world, double x, double y, double z) {
|
||||
super(world, x, y, z);
|
||||
@ -23,21 +26,13 @@ public class ParticleCoolingTower extends EntityFX {
|
||||
this.noClip = true;
|
||||
}
|
||||
|
||||
public void setBaseScale(float f) {
|
||||
this.baseScale = f;
|
||||
}
|
||||
|
||||
public void setMaxScale(float f) {
|
||||
this.maxScale = f;
|
||||
}
|
||||
|
||||
public void setLift(float f) {
|
||||
this.lift = f;
|
||||
}
|
||||
|
||||
public void setLife(int i) {
|
||||
this.particleMaxAge = i;
|
||||
}
|
||||
public void setBaseScale(float f) { this.baseScale = f; }
|
||||
public void setMaxScale(float f) { this.maxScale = f; }
|
||||
public void setLift(float f) { this.lift = f; }
|
||||
public void setLife(int i) { this.particleMaxAge = i; }
|
||||
public void setStrafe(float f) { this.strafe = f; }
|
||||
public void noWind() { this.windDir = false; }
|
||||
public void alphaMod(float mod) { this.alphaMod = mod; }
|
||||
|
||||
public void onUpdate() {
|
||||
|
||||
@ -47,20 +42,25 @@ public class ParticleCoolingTower extends EntityFX {
|
||||
|
||||
float ageScale = (float) this.particleAge / (float) this.particleMaxAge;
|
||||
|
||||
this.particleAlpha = 0.25F - ageScale * 0.25F;
|
||||
this.particleAlpha = alphaMod - ageScale * alphaMod;
|
||||
this.particleScale = baseScale + (float)Math.pow((maxScale * ageScale - baseScale), 2);
|
||||
|
||||
this.particleAge++;
|
||||
|
||||
if(this.motionY < this.lift) {
|
||||
|
||||
if(lift > 0 && this.motionY < this.lift) {
|
||||
this.motionY += 0.01F;
|
||||
}
|
||||
if(lift < 0 && this.motionY > this.lift) {
|
||||
this.motionY -= 0.01F;
|
||||
}
|
||||
|
||||
this.motionX += rand.nextGaussian() * 0.075D * ageScale;
|
||||
this.motionZ += rand.nextGaussian() * 0.075D * ageScale;
|
||||
this.motionX += rand.nextGaussian() * strafe * ageScale;
|
||||
this.motionZ += rand.nextGaussian() * strafe * ageScale;
|
||||
|
||||
this.motionX += 0.02 * ageScale;
|
||||
this.motionX -= 0.01 * ageScale;
|
||||
if(windDir) {
|
||||
this.motionX += 0.02 * ageScale;
|
||||
this.motionZ -= 0.01 * ageScale;
|
||||
}
|
||||
|
||||
if(this.particleAge == this.particleMaxAge) {
|
||||
this.setDead();
|
||||
|
||||
@ -4,6 +4,7 @@ import java.util.function.Consumer;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.hbm.blocks.BlockDummyable;
|
||||
import com.hbm.inventory.RecipesCommon.ComparableStack;
|
||||
import com.hbm.main.ResourceManager;
|
||||
import com.hbm.render.item.ItemRenderMissileGeneric;
|
||||
@ -21,13 +22,18 @@ public class RenderLaunchPad extends TileEntitySpecialRenderer {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(x + 0.5D, y, z + 0.5D);
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GL11.glDisable(GL11.GL_CULL_FACE);
|
||||
GL11.glEnable(GL11.GL_CULL_FACE);
|
||||
|
||||
switch(tileEntity.getBlockMetadata() - BlockDummyable.offset) {
|
||||
case 2: GL11.glRotatef(90, 0F, 1F, 0F); break;
|
||||
case 4: GL11.glRotatef(180, 0F, 1F, 0F); break;
|
||||
case 3: GL11.glRotatef(270, 0F, 1F, 0F); break;
|
||||
case 5: GL11.glRotatef(0, 0F, 1F, 0F); break;
|
||||
}
|
||||
|
||||
bindTexture(ResourceManager.missile_pad_tex);
|
||||
ResourceManager.missile_pad.renderAll();
|
||||
|
||||
GL11.glDisable(GL11.GL_CULL_FACE);
|
||||
|
||||
if(tileEntity instanceof TileEntityLaunchPad) {
|
||||
ItemStack toRender = ((TileEntityLaunchPad) tileEntity).toRender;
|
||||
|
||||
|
||||
@ -1,230 +1,65 @@
|
||||
package com.hbm.tileentity.bomb;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.logging.log4j.Level;
|
||||
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.blocks.bomb.LaunchPad;
|
||||
import com.hbm.config.GeneralConfig;
|
||||
import com.hbm.entity.missile.EntityCarrier;
|
||||
import com.hbm.entity.missile.EntityMissileAntiBallistic;
|
||||
import com.hbm.entity.missile.EntityMissileBaseNT;
|
||||
import com.hbm.entity.missile.EntityMissileDoomsday;
|
||||
import com.hbm.entity.missile.EntityMissileShuttle;
|
||||
import com.hbm.entity.missile.EntityMissileStealth;
|
||||
import com.hbm.entity.missile.EntityMissileTier0.*;
|
||||
import com.hbm.entity.missile.EntityMissileTier1.*;
|
||||
import com.hbm.entity.missile.EntityMissileTier2.*;
|
||||
import com.hbm.entity.missile.EntityMissileTier3.*;
|
||||
import com.hbm.entity.missile.EntityMissileTier4.*;
|
||||
import com.hbm.interfaces.IBomb.BombReturnCode;
|
||||
import com.hbm.inventory.RecipesCommon.ComparableStack;
|
||||
import com.hbm.inventory.container.ContainerLaunchPadTier1;
|
||||
import com.hbm.inventory.gui.GUILaunchPadTier1;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.lib.Library;
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.tileentity.IGUIProvider;
|
||||
import com.hbm.tileentity.IRadarCommandReceiver;
|
||||
import com.hbm.tileentity.TileEntityMachineBase;
|
||||
|
||||
import api.hbm.energy.IEnergyUser;
|
||||
import api.hbm.item.IDesignatorItem;
|
||||
import cpw.mods.fml.common.Optional;
|
||||
import api.hbm.fluid.IFluidStandardReceiver;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import li.cil.oc.api.machine.Arguments;
|
||||
import li.cil.oc.api.machine.Callback;
|
||||
import li.cil.oc.api.machine.Context;
|
||||
import li.cil.oc.api.network.SimpleComponent;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
@Optional.InterfaceList({@Optional.Interface(iface = "li.cil.oc.api.network.SimpleComponent", modid = "OpenComputers")})
|
||||
public class TileEntityLaunchPad extends TileEntityMachineBase implements IEnergyUser, SimpleComponent, IGUIProvider, IRadarCommandReceiver {
|
||||
|
||||
/** Automatic instantiation of generic missiles, i.e. everything that both extends EntityMissileBaseNT and needs a designator */
|
||||
public static final HashMap<ComparableStack, Class<? extends EntityMissileBaseNT>> missiles = new HashMap();
|
||||
|
||||
public static void registerLaunchables() {
|
||||
public class TileEntityLaunchPad extends TileEntityLaunchPadBase implements IEnergyUser, IFluidStandardReceiver {
|
||||
|
||||
//Tier 0
|
||||
missiles.put(new ComparableStack(ModItems.missile_micro), EntityMissileMicro.class);
|
||||
missiles.put(new ComparableStack(ModItems.missile_schrabidium), EntityMissileSchrabidium.class);
|
||||
missiles.put(new ComparableStack(ModItems.missile_bhole), EntityMissileBHole.class);
|
||||
missiles.put(new ComparableStack(ModItems.missile_taint), EntityMissileTaint.class);
|
||||
missiles.put(new ComparableStack(ModItems.missile_emp), EntityMissileEMP.class);
|
||||
//Tier 1
|
||||
missiles.put(new ComparableStack(ModItems.missile_generic), EntityMissileGeneric.class);
|
||||
missiles.put(new ComparableStack(ModItems.missile_decoy), EntityMissileDecoy.class);
|
||||
missiles.put(new ComparableStack(ModItems.missile_incendiary), EntityMissileIncendiary.class);
|
||||
missiles.put(new ComparableStack(ModItems.missile_cluster), EntityMissileCluster.class);
|
||||
missiles.put(new ComparableStack(ModItems.missile_buster), EntityMissileBunkerBuster.class);
|
||||
//Tier 2
|
||||
missiles.put(new ComparableStack(ModItems.missile_strong), EntityMissileStrong.class);
|
||||
missiles.put(new ComparableStack(ModItems.missile_incendiary_strong), EntityMissileIncendiaryStrong.class);
|
||||
missiles.put(new ComparableStack(ModItems.missile_cluster_strong), EntityMissileClusterStrong.class);
|
||||
missiles.put(new ComparableStack(ModItems.missile_buster_strong), EntityMissileBusterStrong.class);
|
||||
missiles.put(new ComparableStack(ModItems.missile_emp_strong), EntityMissileEMPStrong.class);
|
||||
//Tier 3
|
||||
missiles.put(new ComparableStack(ModItems.missile_burst), EntityMissileBurst.class);
|
||||
missiles.put(new ComparableStack(ModItems.missile_inferno), EntityMissileInferno.class);
|
||||
missiles.put(new ComparableStack(ModItems.missile_rain), EntityMissileRain.class);
|
||||
missiles.put(new ComparableStack(ModItems.missile_drill), EntityMissileDrill.class);
|
||||
missiles.put(new ComparableStack(ModItems.missile_shuttle), EntityMissileShuttle.class);
|
||||
//Tier 4
|
||||
missiles.put(new ComparableStack(ModItems.missile_nuclear), EntityMissileNuclear.class);
|
||||
missiles.put(new ComparableStack(ModItems.missile_nuclear_cluster), EntityMissileMirv.class);
|
||||
missiles.put(new ComparableStack(ModItems.missile_volcano), EntityMissileVolcano.class);
|
||||
|
||||
missiles.put(new ComparableStack(ModItems.missile_doomsday), EntityMissileDoomsday.class);
|
||||
missiles.put(new ComparableStack(ModItems.missile_stealth), EntityMissileStealth.class);
|
||||
}
|
||||
|
||||
public ItemStack toRender;
|
||||
@Override public boolean isReadyForLaunch() { return delay <= 0; }
|
||||
@Override public double getLaunchOffset() { return 2D; }
|
||||
|
||||
public long power;
|
||||
public final long maxPower = 100000;
|
||||
|
||||
private static final int[] slots_bottom = new int[] {0, 1, 2};
|
||||
private static final int[] slots_side = new int[] {0};
|
||||
|
||||
public TileEntityLaunchPad() {
|
||||
super(3);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "container.launchPad";
|
||||
}
|
||||
public int delay = 0;
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
|
||||
if(!worldObj.isRemote) {
|
||||
|
||||
power = Library.chargeTEFromItems(slots, 2, power, maxPower);
|
||||
this.updateConnections();
|
||||
if(this.delay > 0) delay--;
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setLong("power", power);
|
||||
if(slots[0] != null) {
|
||||
data.setInteger("id", Item.getIdFromItem(slots[0].getItem()));
|
||||
data.setShort("meta", (short) slots[0].getItemDamage());
|
||||
}
|
||||
networkPack(data, 250);
|
||||
} else {
|
||||
|
||||
|
||||
List<EntityMissileBaseNT> entities = worldObj.getEntitiesWithinAABB(EntityMissileBaseNT.class, AxisAlignedBB.getBoundingBox(xCoord - 0.5, yCoord, zCoord - 0.5, xCoord + 1.5, yCoord + 10, zCoord + 1.5));
|
||||
|
||||
if(!entities.isEmpty()) {
|
||||
|
||||
for(int i = 0; i < 15; i++) {
|
||||
|
||||
boolean dir = worldObj.rand.nextBoolean();
|
||||
float moX = (float) (dir ? 0 : worldObj.rand.nextGaussian() * 0.5F);
|
||||
float moZ = (float) (!dir ? 0 : worldObj.rand.nextGaussian() * 0.5F);
|
||||
|
||||
MainRegistry.proxy.spawnParticle(xCoord + 0.5, yCoord + 0.25, zCoord + 0.5, "launchsmoke", new float[] { moX, 0, moZ });
|
||||
}
|
||||
if(!this.isMissileValid() || !this.hasFuel()) {
|
||||
this.delay = 100;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void networkUnpack(NBTTagCompound nbt) {
|
||||
this.power = nbt.getLong("power");
|
||||
|
||||
if(nbt.hasKey("id")) {
|
||||
this.toRender = new ItemStack(Item.getItemById(nbt.getInteger("id")), 1, nbt.getShort("meta"));
|
||||
} else {
|
||||
this.toRender = null;
|
||||
}
|
||||
}
|
||||
|
||||
private void updateConnections() {
|
||||
this.trySubscribe(worldObj, xCoord + 1, yCoord, zCoord, Library.POS_X);
|
||||
this.trySubscribe(worldObj, xCoord - 1, yCoord, zCoord, Library.NEG_X);
|
||||
this.trySubscribe(worldObj, xCoord, yCoord, zCoord + 1, Library.POS_Z);
|
||||
this.trySubscribe(worldObj, xCoord, yCoord, zCoord - 1, Library.NEG_Z);
|
||||
this.trySubscribe(worldObj, xCoord, yCoord - 1, zCoord, Library.NEG_Y);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int i, ItemStack itemStack) {
|
||||
return true;
|
||||
super.updateEntity();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbt) {
|
||||
super.readFromNBT(nbt);
|
||||
power = nbt.getLong("power");
|
||||
|
||||
if(slots == null || slots.length != 3) slots = new ItemStack[3];
|
||||
|
||||
this.delay = nbt.getInteger("delay");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound nbt) {
|
||||
super.writeToNBT(nbt);
|
||||
nbt.setLong("power", power);
|
||||
|
||||
nbt.setInteger("delay", delay);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getAccessibleSlotsFromSide(int side) {
|
||||
return side == 0 ? slots_bottom : (side == 1 ? new int[0] : slots_side);
|
||||
}
|
||||
|
||||
public long getPowerScaled(long i) {
|
||||
return (power * i) / maxPower;
|
||||
}
|
||||
AxisAlignedBB bb = null;
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getRenderBoundingBox() {
|
||||
return TileEntity.INFINITE_EXTENT_AABB;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPower(long i) {
|
||||
power = i;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getPower() {
|
||||
return power;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getMaxPower() {
|
||||
return maxPower;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long transferPower(long power) {
|
||||
this.power += power;
|
||||
if(this.power > this.getMaxPower()) {
|
||||
long overshoot = this.power - this.getMaxPower();
|
||||
this.power = this.getMaxPower();
|
||||
return overshoot;
|
||||
|
||||
if(bb == null) {
|
||||
bb = AxisAlignedBB.getBoundingBox(
|
||||
xCoord - 2,
|
||||
yCoord,
|
||||
zCoord - 2,
|
||||
xCoord + 3,
|
||||
yCoord + 15,
|
||||
zCoord + 3
|
||||
);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canConnect(ForgeDirection dir) {
|
||||
return dir != ForgeDirection.UP && dir != ForgeDirection.UNKNOWN;
|
||||
|
||||
return bb;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -232,181 +67,4 @@ public class TileEntityLaunchPad extends TileEntityMachineBase implements IEnerg
|
||||
public double getMaxRenderDistanceSquared() {
|
||||
return 65536.0D;
|
||||
}
|
||||
|
||||
public boolean hasPower() {
|
||||
return this.power >= 75_000;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean sendCommandPosition(int x, int y, int z) {
|
||||
return this.launchToCoordinate(x, z) == BombReturnCode.LAUNCHED;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean sendCommandEntity(Entity target) {
|
||||
return this.launchToEntity(target) == BombReturnCode.LAUNCHED;
|
||||
}
|
||||
|
||||
public BombReturnCode launchFromDesignator() {
|
||||
if(slots[0] == null) return BombReturnCode.ERROR_MISSING_COMPONENT;
|
||||
|
||||
boolean needsDesignator = missiles.containsKey(new ComparableStack(slots[0]).makeSingular());
|
||||
|
||||
int targetX = 0;
|
||||
int targetZ = 0;
|
||||
|
||||
if(slots[1] != null && slots[1].getItem() instanceof IDesignatorItem) {
|
||||
|
||||
IDesignatorItem designator = (IDesignatorItem) slots[1].getItem();
|
||||
|
||||
if(!designator.isReady(worldObj, slots[1], xCoord, yCoord, zCoord) && needsDesignator) return BombReturnCode.ERROR_MISSING_COMPONENT;
|
||||
|
||||
Vec3 coords = designator.getCoords(worldObj, slots[1], xCoord, yCoord, zCoord);
|
||||
targetX = (int) Math.floor(coords.xCoord);
|
||||
targetZ = (int) Math.floor(coords.zCoord);
|
||||
|
||||
} else {
|
||||
if(needsDesignator) return BombReturnCode.ERROR_MISSING_COMPONENT;
|
||||
}
|
||||
|
||||
return this.launchToCoordinate(targetX, targetZ);
|
||||
}
|
||||
|
||||
public BombReturnCode launchToEntity(Entity entity) {
|
||||
if(!hasPower()) return BombReturnCode.ERROR_MISSING_COMPONENT;
|
||||
Entity e = instantiateMissile((int) Math.floor(entity.posX), (int) Math.floor(entity.posZ));
|
||||
if(e != null) {
|
||||
|
||||
if(e instanceof EntityMissileAntiBallistic) {
|
||||
EntityMissileAntiBallistic abm = (EntityMissileAntiBallistic) e;
|
||||
abm.tracking = entity;
|
||||
}
|
||||
|
||||
finalizeLaunch(e);
|
||||
return BombReturnCode.LAUNCHED;
|
||||
}
|
||||
return BombReturnCode.ERROR_MISSING_COMPONENT;
|
||||
}
|
||||
|
||||
public BombReturnCode launchToCoordinate(int targetX, int targetZ) {
|
||||
if(!hasPower()) return BombReturnCode.ERROR_MISSING_COMPONENT;
|
||||
Entity e = instantiateMissile(targetX, targetZ);
|
||||
if(e != null) {
|
||||
finalizeLaunch(e);
|
||||
return BombReturnCode.LAUNCHED;
|
||||
}
|
||||
return BombReturnCode.ERROR_MISSING_COMPONENT;
|
||||
}
|
||||
|
||||
public Entity instantiateMissile(int targetX, int targetZ) {
|
||||
|
||||
if(slots[0] == null) return null;
|
||||
|
||||
if(slots[0].getItem() == ModItems.missile_carrier) {
|
||||
EntityCarrier missile = new EntityCarrier(worldObj);
|
||||
missile.posX = xCoord + 0.5F;
|
||||
missile.posY = yCoord + 1F;
|
||||
missile.posZ = zCoord + 0.5F;
|
||||
if(slots[1] != null) {
|
||||
missile.setPayload(slots[1]);
|
||||
this.slots[1] = null;
|
||||
}
|
||||
worldObj.playSoundEffect(xCoord + 0.5, yCoord, zCoord + 0.5, "hbm:entity.rocketTakeoff", 100.0F, 1.0F);
|
||||
return missile;
|
||||
}
|
||||
|
||||
Class<? extends EntityMissileBaseNT> clazz = this.missiles.get(new ComparableStack(slots[0]).makeSingular());
|
||||
|
||||
if(clazz != null) {
|
||||
try {
|
||||
EntityMissileBaseNT missile = clazz.getConstructor(World.class, float.class, float.class, float.class, int.class, int.class).newInstance(worldObj, xCoord + 0.5F, yCoord + 1F, zCoord + 0.5F, targetX, targetZ);
|
||||
worldObj.playSoundEffect(xCoord + 0.5, yCoord, zCoord + 0.5, "hbm:weapon.missileTakeOff", 2.0F, 1.0F);
|
||||
if(GeneralConfig.enableExtendedLogging) MainRegistry.logger.log(Level.INFO, "[MISSILE] Tried to launch missile at " + xCoord + " / " + yCoord + " / " + zCoord + " to " + xCoord + " / " + zCoord + "!");
|
||||
return missile;
|
||||
} catch(Exception e) { }
|
||||
}
|
||||
|
||||
if(slots[0].getItem() == ModItems.missile_anti_ballistic) {
|
||||
EntityMissileAntiBallistic missile = new EntityMissileAntiBallistic(worldObj);
|
||||
missile.posX = xCoord + 0.5F;
|
||||
missile.posY = yCoord + 0.5F;
|
||||
missile.posZ = zCoord + 0.5F;
|
||||
worldObj.playSoundEffect(xCoord + 0.5, yCoord, zCoord + 0.5, "hbm:weapon.missileTakeOff", 2.0F, 1.0F);
|
||||
return missile;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public void finalizeLaunch(Entity missile) {
|
||||
this.power -= 75_000;
|
||||
worldObj.spawnEntityInWorld(missile);
|
||||
this.decrStackSize(0, 1);
|
||||
}
|
||||
|
||||
// do some opencomputer stuff
|
||||
@Override
|
||||
public String getComponentName() {
|
||||
return "launch_pad";
|
||||
}
|
||||
|
||||
@Callback
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getEnergyInfo(Context context, Arguments args) {
|
||||
return new Object[] {getPower(), getMaxPower()};
|
||||
}
|
||||
|
||||
@Callback
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getCoords(Context context, Arguments args) {
|
||||
if (slots[1] != null && slots[1].getItem() instanceof IDesignatorItem) {
|
||||
int xCoord2;
|
||||
int zCoord2;
|
||||
if (slots[1].stackTagCompound != null) {
|
||||
xCoord2 = slots[1].stackTagCompound.getInteger("xCoord");
|
||||
zCoord2 = slots[1].stackTagCompound.getInteger("zCoord");
|
||||
} else
|
||||
return new Object[] {false};
|
||||
|
||||
// Not sure if i should have this
|
||||
/*
|
||||
if(xCoord2 == xCoord && zCoord2 == zCoord) {
|
||||
xCoord2 += 1;
|
||||
}
|
||||
*/
|
||||
|
||||
return new Object[] {xCoord2, zCoord2};
|
||||
}
|
||||
return new Object[] {false, "Designator not found"};
|
||||
}
|
||||
@Callback
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] setCoords(Context context, Arguments args) {
|
||||
if (slots[1] != null && slots[1].getItem() instanceof IDesignatorItem) {
|
||||
slots[1].stackTagCompound = new NBTTagCompound();
|
||||
slots[1].stackTagCompound.setInteger("xCoord", args.checkInteger(0));
|
||||
slots[1].stackTagCompound.setInteger("zCoord", args.checkInteger(1));
|
||||
|
||||
return new Object[] {true};
|
||||
}
|
||||
return new Object[] {false, "Designator not found"};
|
||||
}
|
||||
|
||||
@Callback
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] launch(Context context, Arguments args) {
|
||||
((LaunchPad) ModBlocks.launch_pad).explode(worldObj, xCoord, yCoord, zCoord);
|
||||
return new Object[] {};
|
||||
}
|
||||
|
||||
@Override
|
||||
public Container provideContainer(int ID, EntityPlayer player, World world, int x, int y, int z) {
|
||||
return new ContainerLaunchPadTier1(player.inventory, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public GuiScreen provideGUI(int ID, EntityPlayer player, World world, int x, int y, int z) {
|
||||
return new GUILaunchPadTier1(player.inventory, this);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
package com.hbm.tileentity.bomb;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
@ -8,6 +9,31 @@ import org.apache.logging.log4j.Level;
|
||||
import com.hbm.config.GeneralConfig;
|
||||
import com.hbm.entity.missile.EntityMissileAntiBallistic;
|
||||
import com.hbm.entity.missile.EntityMissileBaseNT;
|
||||
import com.hbm.entity.missile.EntityMissileDoomsday;
|
||||
import com.hbm.entity.missile.EntityMissileShuttle;
|
||||
import com.hbm.entity.missile.EntityMissileStealth;
|
||||
import com.hbm.entity.missile.EntityMissileTier0.EntityMissileBHole;
|
||||
import com.hbm.entity.missile.EntityMissileTier0.EntityMissileEMP;
|
||||
import com.hbm.entity.missile.EntityMissileTier0.EntityMissileMicro;
|
||||
import com.hbm.entity.missile.EntityMissileTier0.EntityMissileSchrabidium;
|
||||
import com.hbm.entity.missile.EntityMissileTier0.EntityMissileTaint;
|
||||
import com.hbm.entity.missile.EntityMissileTier1.EntityMissileBunkerBuster;
|
||||
import com.hbm.entity.missile.EntityMissileTier1.EntityMissileCluster;
|
||||
import com.hbm.entity.missile.EntityMissileTier1.EntityMissileDecoy;
|
||||
import com.hbm.entity.missile.EntityMissileTier1.EntityMissileGeneric;
|
||||
import com.hbm.entity.missile.EntityMissileTier1.EntityMissileIncendiary;
|
||||
import com.hbm.entity.missile.EntityMissileTier2.EntityMissileBusterStrong;
|
||||
import com.hbm.entity.missile.EntityMissileTier2.EntityMissileClusterStrong;
|
||||
import com.hbm.entity.missile.EntityMissileTier2.EntityMissileEMPStrong;
|
||||
import com.hbm.entity.missile.EntityMissileTier2.EntityMissileIncendiaryStrong;
|
||||
import com.hbm.entity.missile.EntityMissileTier2.EntityMissileStrong;
|
||||
import com.hbm.entity.missile.EntityMissileTier3.EntityMissileBurst;
|
||||
import com.hbm.entity.missile.EntityMissileTier3.EntityMissileDrill;
|
||||
import com.hbm.entity.missile.EntityMissileTier3.EntityMissileInferno;
|
||||
import com.hbm.entity.missile.EntityMissileTier3.EntityMissileRain;
|
||||
import com.hbm.entity.missile.EntityMissileTier4.EntityMissileMirv;
|
||||
import com.hbm.entity.missile.EntityMissileTier4.EntityMissileNuclear;
|
||||
import com.hbm.entity.missile.EntityMissileTier4.EntityMissileVolcano;
|
||||
import com.hbm.interfaces.IBomb.BombReturnCode;
|
||||
import com.hbm.inventory.RecipesCommon.ComparableStack;
|
||||
import com.hbm.inventory.container.ContainerLaunchPadLarge;
|
||||
@ -37,10 +63,49 @@ import net.minecraft.inventory.Container;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public abstract class TileEntityLaunchPadBase extends TileEntityMachineBase implements IEnergyUser, IFluidStandardReceiver, IGUIProvider, IRadarCommandReceiver {
|
||||
|
||||
/** Automatic instantiation of generic missiles, i.e. everything that both extends EntityMissileBaseNT and needs a designator */
|
||||
public static final HashMap<ComparableStack, Class<? extends EntityMissileBaseNT>> missiles = new HashMap();
|
||||
|
||||
public static void registerLaunchables() {
|
||||
|
||||
//Tier 0
|
||||
missiles.put(new ComparableStack(ModItems.missile_micro), EntityMissileMicro.class);
|
||||
missiles.put(new ComparableStack(ModItems.missile_schrabidium), EntityMissileSchrabidium.class);
|
||||
missiles.put(new ComparableStack(ModItems.missile_bhole), EntityMissileBHole.class);
|
||||
missiles.put(new ComparableStack(ModItems.missile_taint), EntityMissileTaint.class);
|
||||
missiles.put(new ComparableStack(ModItems.missile_emp), EntityMissileEMP.class);
|
||||
//Tier 1
|
||||
missiles.put(new ComparableStack(ModItems.missile_generic), EntityMissileGeneric.class);
|
||||
missiles.put(new ComparableStack(ModItems.missile_decoy), EntityMissileDecoy.class);
|
||||
missiles.put(new ComparableStack(ModItems.missile_incendiary), EntityMissileIncendiary.class);
|
||||
missiles.put(new ComparableStack(ModItems.missile_cluster), EntityMissileCluster.class);
|
||||
missiles.put(new ComparableStack(ModItems.missile_buster), EntityMissileBunkerBuster.class);
|
||||
//Tier 2
|
||||
missiles.put(new ComparableStack(ModItems.missile_strong), EntityMissileStrong.class);
|
||||
missiles.put(new ComparableStack(ModItems.missile_incendiary_strong), EntityMissileIncendiaryStrong.class);
|
||||
missiles.put(new ComparableStack(ModItems.missile_cluster_strong), EntityMissileClusterStrong.class);
|
||||
missiles.put(new ComparableStack(ModItems.missile_buster_strong), EntityMissileBusterStrong.class);
|
||||
missiles.put(new ComparableStack(ModItems.missile_emp_strong), EntityMissileEMPStrong.class);
|
||||
//Tier 3
|
||||
missiles.put(new ComparableStack(ModItems.missile_burst), EntityMissileBurst.class);
|
||||
missiles.put(new ComparableStack(ModItems.missile_inferno), EntityMissileInferno.class);
|
||||
missiles.put(new ComparableStack(ModItems.missile_rain), EntityMissileRain.class);
|
||||
missiles.put(new ComparableStack(ModItems.missile_drill), EntityMissileDrill.class);
|
||||
missiles.put(new ComparableStack(ModItems.missile_shuttle), EntityMissileShuttle.class);
|
||||
//Tier 4
|
||||
missiles.put(new ComparableStack(ModItems.missile_nuclear), EntityMissileNuclear.class);
|
||||
missiles.put(new ComparableStack(ModItems.missile_nuclear_cluster), EntityMissileMirv.class);
|
||||
missiles.put(new ComparableStack(ModItems.missile_volcano), EntityMissileVolcano.class);
|
||||
|
||||
missiles.put(new ComparableStack(ModItems.missile_doomsday), EntityMissileDoomsday.class);
|
||||
missiles.put(new ComparableStack(ModItems.missile_stealth), EntityMissileStealth.class);
|
||||
}
|
||||
|
||||
public ItemStack toRender;
|
||||
|
||||
@ -233,21 +298,22 @@ public abstract class TileEntityLaunchPadBase extends TileEntityMachineBase impl
|
||||
|
||||
if(slots[0] == null) return null;
|
||||
|
||||
Class<? extends EntityMissileBaseNT> clazz = TileEntityLaunchPad.missiles.get(new ComparableStack(slots[0]).makeSingular());
|
||||
Class<? extends EntityMissileBaseNT> clazz = TileEntityLaunchPadBase.missiles.get(new ComparableStack(slots[0]).makeSingular());
|
||||
|
||||
if(clazz != null) {
|
||||
try {
|
||||
EntityMissileBaseNT missile = clazz.getConstructor(World.class, float.class, float.class, float.class, int.class, int.class).newInstance(worldObj, xCoord + 0.5F, yCoord + 2F, zCoord + 0.5F, targetX, targetZ);
|
||||
EntityMissileBaseNT missile = clazz.getConstructor(World.class, float.class, float.class, float.class, int.class, int.class).newInstance(worldObj, xCoord + 0.5F, yCoord + (float) getLaunchOffset() /* Position arguments need to be floats, jackass */, zCoord + 0.5F, targetX, targetZ);
|
||||
if(GeneralConfig.enableExtendedLogging) MainRegistry.logger.log(Level.INFO, "[MISSILE] Tried to launch missile at " + xCoord + " / " + yCoord + " / " + zCoord + " to " + xCoord + " / " + zCoord + "!");
|
||||
missile.getDataWatcher().updateObject(3, (byte) MathHelper.clamp_int(this.getBlockMetadata() - 10, 2, 5));
|
||||
return missile;
|
||||
} catch(Exception e) { }
|
||||
}
|
||||
|
||||
if(slots[0].getItem() == ModItems.missile_anti_ballistic) {
|
||||
EntityMissileAntiBallistic missile = new EntityMissileAntiBallistic(worldObj);
|
||||
missile.posX = xCoord + 0.5F;
|
||||
missile.posY = yCoord + 2F;
|
||||
missile.posZ = zCoord + 0.5F;
|
||||
missile.posX = xCoord + 0.5D;
|
||||
missile.posY = yCoord + getLaunchOffset();
|
||||
missile.posZ = zCoord + 0.5D;
|
||||
return missile;
|
||||
}
|
||||
|
||||
@ -278,7 +344,6 @@ public abstract class TileEntityLaunchPadBase extends TileEntityMachineBase impl
|
||||
int targetZ = 0;
|
||||
|
||||
if(slots[1] != null && slots[1].getItem() instanceof IDesignatorItem) {
|
||||
|
||||
IDesignatorItem designator = (IDesignatorItem) slots[1].getItem();
|
||||
|
||||
if(!designator.isReady(worldObj, slots[1], xCoord, yCoord, zCoord) && needsDesignator) return BombReturnCode.ERROR_MISSING_COMPONENT;
|
||||
@ -365,4 +430,5 @@ public abstract class TileEntityLaunchPadBase extends TileEntityMachineBase impl
|
||||
|
||||
/** Any extra conditions for launching in addition to the missile being valid and fueled */
|
||||
public abstract boolean isReadyForLaunch();
|
||||
public abstract double getLaunchOffset();
|
||||
}
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
package com.hbm.tileentity.bomb;
|
||||
|
||||
import com.hbm.entity.missile.EntityMissileBaseNT;
|
||||
import com.hbm.inventory.fluid.Fluids;
|
||||
import com.hbm.items.weapon.ItemMissile;
|
||||
import com.hbm.items.weapon.ItemMissile.MissileFormFactor;
|
||||
import com.hbm.main.MainRegistry;
|
||||
@ -13,7 +13,6 @@ import api.hbm.fluid.IFluidStandardReceiver;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
|
||||
@ -43,10 +42,8 @@ public class TileEntityLaunchPadLarge extends TileEntityLaunchPadBase implements
|
||||
protected boolean liftMoving = false;
|
||||
protected boolean erectorMoving = false;
|
||||
|
||||
@Override
|
||||
public boolean isReadyForLaunch() {
|
||||
return this.erected && this.readyToLoad;
|
||||
}
|
||||
@Override public boolean isReadyForLaunch() { return this.erected && this.readyToLoad; }
|
||||
@Override public double getLaunchOffset() { return 2D; }
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
@ -187,6 +184,43 @@ public class TileEntityLaunchPadLarge extends TileEntityLaunchPadBase implements
|
||||
this.audioErector = null;
|
||||
}
|
||||
}
|
||||
|
||||
if(this.erected && this.hasFuel() && this.tanks[1].getTankType() == Fluids.OXYGEN) {
|
||||
|
||||
//maybe too much?
|
||||
/*if(this.formFactor == MissileFormFactor.ATLAS.ordinal() && worldObj.getTotalWorldTime() % 4 == 0) {
|
||||
ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata() - 10);
|
||||
ForgeDirection rot = dir.getRotation(ForgeDirection.DOWN);
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setString("type", "tower");
|
||||
data.setFloat("lift", -5F);
|
||||
data.setFloat("base", 0.25F);
|
||||
data.setFloat("max", 0.5F);
|
||||
data.setInteger("life", 30 + worldObj.rand.nextInt(10));
|
||||
data.setDouble("posX", xCoord + 0.5 - (dir.offsetX + rot.offsetX) * 0.5);
|
||||
data.setDouble("posZ", zCoord + 0.5 - (dir.offsetZ + rot.offsetZ) * 0.5);
|
||||
data.setDouble("posY", yCoord + 14.625);
|
||||
data.setBoolean("noWind", true);
|
||||
data.setFloat("alphaMod", 0.01F);
|
||||
data.setFloat("strafe", 0.05F);
|
||||
for(int i = 0; i < 3; i++) MainRegistry.proxy.effectNT(data);
|
||||
}*/
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setString("type", "tower");
|
||||
data.setFloat("lift", 0F);
|
||||
data.setFloat("base", 0.5F);
|
||||
data.setFloat("max", 2F);
|
||||
data.setInteger("life", 60 + worldObj.rand.nextInt(30));
|
||||
data.setDouble("posX", xCoord + 0.5);
|
||||
data.setDouble("posZ", zCoord + 0.5);
|
||||
data.setDouble("posY", yCoord + 2);
|
||||
data.setBoolean("noWind", true);
|
||||
data.setFloat("alphaMod", 2F);
|
||||
data.setFloat("strafe", 0.05F);
|
||||
for(int i = 0; i < 3; i++) MainRegistry.proxy.effectNT(data);
|
||||
}
|
||||
}
|
||||
|
||||
super.updateEntity();
|
||||
@ -244,17 +278,6 @@ public class TileEntityLaunchPadLarge extends TileEntityLaunchPadBase implements
|
||||
nbt.setInteger("formFactor", formFactor);
|
||||
}
|
||||
|
||||
public Entity instantiateMissile(int targetX, int targetZ) {
|
||||
Entity missile = super.instantiateMissile(targetX, targetZ);
|
||||
|
||||
if(missile instanceof EntityMissileBaseNT) {
|
||||
EntityMissileBaseNT base = (EntityMissileBaseNT) missile;
|
||||
base.getDataWatcher().updateObject(3, (byte) (this.getBlockMetadata() - 10));
|
||||
}
|
||||
|
||||
return missile;
|
||||
}
|
||||
|
||||
AxisAlignedBB bb = null;
|
||||
|
||||
@Override
|
||||
|
||||
@ -40,6 +40,8 @@ public class TileEntityFurnaceBrick extends TileEntityMachineBase implements IGU
|
||||
burnSpeed.put(Item.getItemFromBlock(Blocks.netherrack), 4);
|
||||
burnSpeed.put(Item.getItemFromBlock(Blocks.cobblestone), 2);
|
||||
burnSpeed.put(Item.getItemFromBlock(Blocks.sand), 2);
|
||||
burnSpeed.put(Item.getItemFromBlock(Blocks.log), 2);
|
||||
burnSpeed.put(Item.getItemFromBlock(Blocks.log2), 2);
|
||||
}
|
||||
|
||||
public int burnTime;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user