diff options
| author | Bass <basdxz@github.com> | 2017-07-27 12:00:22 +0100 |
|---|---|---|
| committer | Bass <basdxz@github.com> | 2017-07-27 12:00:22 +0100 |
| commit | e03b3137656348841bf5f58ca23b300279e3acd2 (patch) | |
| tree | b0a416fa0aa1eadef77060648081c329cd707c31 /src/main/java | |
| parent | be70318a4cc7e11a7587e17cd69116ff134f8860 (diff) | |
| download | GT5-Unofficial-e03b3137656348841bf5f58ca23b300279e3acd2.tar.gz GT5-Unofficial-e03b3137656348841bf5f58ca23b300279e3acd2.tar.bz2 GT5-Unofficial-e03b3137656348841bf5f58ca23b300279e3acd2.zip | |
initial work on em turret
Diffstat (limited to 'src/main/java')
6 files changed, 277 insertions, 1 deletions
diff --git a/src/main/java/com/github/technus/tectech/TecTech.java b/src/main/java/com/github/technus/tectech/TecTech.java index 8bfba70ec6..6a99a437cd 100644 --- a/src/main/java/com/github/technus/tectech/TecTech.java +++ b/src/main/java/com/github/technus/tectech/TecTech.java @@ -136,7 +136,7 @@ public class TecTech { modId.equals("gregtech") || modId.equals(Reference.MODID) || modId.equals("IC2") || - modId.equals("EnderIO") || + //modId.equals("EnderIO") || // nerf //modId.equals("Thaumcraft") || // too op, nerf modId.equals("lootgames") || modId.equals("extracells") || diff --git a/src/main/java/com/github/technus/tectech/thing/block/TurretBaseEM.java b/src/main/java/com/github/technus/tectech/thing/block/TurretBaseEM.java new file mode 100644 index 0000000000..4127ecf593 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/thing/block/TurretBaseEM.java @@ -0,0 +1,36 @@ +package com.github.technus.tectech.thing.block; + +import com.github.technus.tectech.TecTech; +import com.github.technus.tectech.auxiliary.Reference; +import com.github.technus.tectech.thing.tileEntity.TileTurretBaseEM; +import cpw.mods.fml.common.Optional; +import net.minecraft.block.Block; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.world.World; +import openmodularturrets.blocks.turretbases.BlockAbstractTurretBase; +import openmodularturrets.tileentity.turretbase.TurretBaseTierFiveTileEntity; + +/** + * Created by Bass on 27/07/2017. + */ +public class TurretBaseEM extends BlockAbstractTurretBase { + public TurretBaseEM(){ + super(); + setCreativeTab(TecTech.mainTab); + this.setResistance(16); + this.setBlockName("turretBaseEM"); + this.setStepSound(Block.soundTypeMetal); + this.setBlockTextureName(Reference.MODID+":turretBaseEM"); + } + + @Override + public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) { + return new TileTurretBaseEM(); + } + + public void registerBlockIcons(IIconRegister p_149651_1_) { + super.registerBlockIcons(p_149651_1_); + this.blockIcon = p_149651_1_.registerIcon(Reference.MODID+":turretBaseEM"); + } +} diff --git a/src/main/java/com/github/technus/tectech/thing/block/TurretHeadEM.java b/src/main/java/com/github/technus/tectech/thing/block/TurretHeadEM.java new file mode 100644 index 0000000000..aa7a61b540 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/thing/block/TurretHeadEM.java @@ -0,0 +1,60 @@ +package com.github.technus.tectech.thing.block; + +import com.github.technus.tectech.TecTech; +import com.github.technus.tectech.auxiliary.Reference; +import com.github.technus.tectech.thing.tileEntity.TileTurretHeadEM; +import net.minecraft.block.Block; +import net.minecraft.block.ITileEntityProvider; +import net.minecraft.block.material.Material; +import net.minecraft.entity.EntityLiving; +import net.minecraft.entity.EnumCreatureType; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; +import openmodularturrets.tileentity.turretbase.TurretBase; + +/** + * Created by Bass on 27/07/2017. + */ +public class TurretHeadEM extends Block implements ITileEntityProvider { + public TurretHeadEM(){ + super(Material.glass); + this.setCreativeTab(TecTech.mainTab); + this.setBlockUnbreakable(); + this.setResistance(6000000.0F); + this.setStepSound(Block.soundTypeMetal); + this.setBlockBounds(0.2F, 0.0F, 0.2F, 0.8F, 1F, 0.8F); + this.setBlockName("turretHeadEM"); + this.setBlockTextureName(Reference.MODID+":turretHeadEM"); + } + + @Override + public int getRenderType() { + return -1; + } + + @Override + public boolean isOpaqueCube() { + return false; + } + + @Override + public boolean canPlaceBlockAt(World worldIn, int x, int y, int z) { + return worldIn.getTileEntity(x + 1, y, z) instanceof TurretBase || + worldIn.getTileEntity(x - 1, y, z) instanceof TurretBase || + worldIn.getTileEntity(x,y + 1, z) instanceof TurretBase || + worldIn.getTileEntity(x,y - 1, z) instanceof TurretBase || + worldIn.getTileEntity(x,y, z + 1) instanceof TurretBase || + worldIn.getTileEntity(x,y, z - 1) instanceof TurretBase; + } + + @Override + public boolean canCreatureSpawn(EnumCreatureType type, IBlockAccess world, int x, int y, int z) { + return false; + } + + @Override + public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) { + return new TileTurretHeadEM(); + } +} diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/entity/projectileEM.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/entity/projectileEM.java new file mode 100644 index 0000000000..b181de2807 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/entity/projectileEM.java @@ -0,0 +1,22 @@ +package com.github.technus.tectech.thing.metaTileEntity.entity; + +import net.minecraft.entity.projectile.EntityThrowable; +import net.minecraft.world.World; +import openmodularturrets.entity.projectiles.LaserProjectile; +import openmodularturrets.entity.projectiles.TurretProjectile; +import openmodularturrets.tileentity.turretbase.TurretBase; + +/** + * Created by Bass on 27/07/2017. + */ +public class projectileEM extends LaserProjectile { + public projectileEM(World par1World) { + super(par1World); + this.gravity = 0.0F; + } + + public projectileEM(World par1World, TurretBase turretBase) { + super(par1World, turretBase); + this.gravity = 0.0F; + } +} diff --git a/src/main/java/com/github/technus/tectech/thing/tileEntity/TileTurretBaseEM.java b/src/main/java/com/github/technus/tectech/thing/tileEntity/TileTurretBaseEM.java new file mode 100644 index 0000000000..b272930a0a --- /dev/null +++ b/src/main/java/com/github/technus/tectech/thing/tileEntity/TileTurretBaseEM.java @@ -0,0 +1,81 @@ +package com.github.technus.tectech.thing.tileEntity; + +import com.github.technus.tectech.elementalMatter.classes.cElementalInstanceStackMap; +import com.github.technus.tectech.elementalMatter.interfaces.iElementalInstanceContainer; +import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_InputElemental; +import cpw.mods.fml.common.Optional; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.metatileentity.MetaTileEntity; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.world.World; +import openmodularturrets.tileentity.turretbase.TurretBase; + +import java.util.ArrayList; + +/** + * Created by Bass on 27/07/2017. + */ +public class TileTurretBaseEM extends TurretBase implements iElementalInstanceContainer { + public TileTurretBaseEM(int MaxEnergyStorage, int MaxIO) { + super(MaxEnergyStorage, MaxIO); + } + + @Override + public int getSizeInventory() { + return 13; + } + + public String getInventoryName() { + return "modtur.turretbasefive"; + } + + @Optional.Method( + modid = "OpenComputers" + ) + public String getComponentName() { + return "turretBaseEM"; + } + + + @Override + public int getBaseTier() { + return 6; + } + + @Override + public cElementalInstanceStackMap getContainerHandler() { + World worldIn=getWorldObj(); + TileEntity te; + if((te=worldIn.getTileEntity(xCoord + 1, yCoord, zCoord)) instanceof IGregTechTileEntity) + if(((IGregTechTileEntity)te).getMetaTileEntity() instanceof GT_MetaTileEntity_Hatch_InputElemental) + return ((GT_MetaTileEntity_Hatch_InputElemental)((IGregTechTileEntity) te).getMetaTileEntity()).getContainerHandler(); + + if((te=worldIn.getTileEntity(xCoord - 1, yCoord, zCoord)) instanceof IGregTechTileEntity) + if(((IGregTechTileEntity)te).getMetaTileEntity() instanceof GT_MetaTileEntity_Hatch_InputElemental) + return ((GT_MetaTileEntity_Hatch_InputElemental)((IGregTechTileEntity) te).getMetaTileEntity()).getContainerHandler(); + + if((te=worldIn.getTileEntity(xCoord, yCoord+1, zCoord)) instanceof IGregTechTileEntity) + if(((IGregTechTileEntity)te).getMetaTileEntity() instanceof GT_MetaTileEntity_Hatch_InputElemental) + return ((GT_MetaTileEntity_Hatch_InputElemental)((IGregTechTileEntity) te).getMetaTileEntity()).getContainerHandler(); + + if((te=worldIn.getTileEntity(xCoord, yCoord-1, zCoord)) instanceof IGregTechTileEntity) + if(((IGregTechTileEntity)te).getMetaTileEntity() instanceof GT_MetaTileEntity_Hatch_InputElemental) + return ((GT_MetaTileEntity_Hatch_InputElemental)((IGregTechTileEntity) te).getMetaTileEntity()).getContainerHandler(); + + if((te=worldIn.getTileEntity(xCoord, yCoord, zCoord+1)) instanceof IGregTechTileEntity) + if(((IGregTechTileEntity)te).getMetaTileEntity() instanceof GT_MetaTileEntity_Hatch_InputElemental) + return ((GT_MetaTileEntity_Hatch_InputElemental)((IGregTechTileEntity) te).getMetaTileEntity()).getContainerHandler(); + + if((te=worldIn.getTileEntity(xCoord, yCoord, zCoord-1)) instanceof IGregTechTileEntity) + if(((IGregTechTileEntity)te).getMetaTileEntity() instanceof GT_MetaTileEntity_Hatch_InputElemental) + return ((GT_MetaTileEntity_Hatch_InputElemental)((IGregTechTileEntity) te).getMetaTileEntity()).getContainerHandler(); + + return null; + } + + @Override + @Deprecated + public float purgeOverflow() { + throw new NoSuchMethodError("This is not a valid use"); + } +} diff --git a/src/main/java/com/github/technus/tectech/thing/tileEntity/TileTurretHeadEM.java b/src/main/java/com/github/technus/tectech/thing/tileEntity/TileTurretHeadEM.java new file mode 100644 index 0000000000..72c79772af --- /dev/null +++ b/src/main/java/com/github/technus/tectech/thing/tileEntity/TileTurretHeadEM.java @@ -0,0 +1,77 @@ +package com.github.technus.tectech.thing.tileEntity; + +import com.github.technus.tectech.elementalMatter.classes.cElementalInstanceStackMap; +import com.github.technus.tectech.elementalMatter.definitions.eLeptonDefinition; +import com.github.technus.tectech.thing.block.QuantumGlassBlock; +import com.github.technus.tectech.thing.block.QuantumGlassItem; +import com.github.technus.tectech.thing.metaTileEntity.entity.projectileEM; +import gregtech.api.util.GT_Utility; +import net.minecraft.entity.Entity; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.world.World; +import openmodularturrets.entity.projectiles.LaserProjectile; +import openmodularturrets.entity.projectiles.TurretProjectile; +import openmodularturrets.handler.ConfigHandler; +import openmodularturrets.tileentity.turrets.TurretHead; +import openmodularturrets.util.TurretHeadUtil; + +import java.lang.reflect.Field; + +/** + * Created by Bass on 27/07/2017. + */ +public class TileTurretHeadEM extends TurretHead{ + private cElementalInstanceStackMap consumedEM; + + public TileTurretHeadEM() { + try { + GT_Utility.getField(this, "turretTier").setInt(this, 6); + }catch (IllegalAccessException e){ + e.printStackTrace(); + } + } + + public int getTurretRange() { + return ConfigHandler.getLaserTurretSettings().getRange(); + } + + public int getTurretPowerUsage() { + return ConfigHandler.getLaserTurretSettings().getPowerUsage(); + } + + public int getTurretFireRate() { + return ConfigHandler.getLaserTurretSettings().getFireRate(); + } + + public double getTurretAccuracy() { + return ConfigHandler.getLaserTurretSettings().getAccuracy() / 10.0D; + } + + public boolean requiresAmmo() { + return true; + } + + public boolean requiresSpecificAmmo() { + return true; + } + + public Item getAmmo() { + //consume em + consumedEM=new cElementalInstanceStackMap().putReplace(); + return QuantumGlassItem.INSTANCE; + } + + public TurretProjectile createProjectile(World world, Entity target, ItemStack ammo) { + if(consumedEM!=null && consumedEM.hasStacks()){ + projectileEM projectile= new projectileEM(world, TurretHeadUtil.getTurretBase(worldObj, xCoord, yCoord, zCoord)); + consumedEM=null; + return projectile; + } + return new LaserProjectile(world, TurretHeadUtil.getTurretBase(worldObj, xCoord, yCoord, zCoord)); + } + + public String getLaunchSoundEffect() { + return "laser"; + } +} |
