diff --git a/src/main/java/tombenpotter/emt/common/block/BlockElectricCloud.java b/src/main/java/tombenpotter/emt/common/block/BlockElectricCloud.java new file mode 100644 index 0000000..9aab90f --- /dev/null +++ b/src/main/java/tombenpotter/emt/common/block/BlockElectricCloud.java @@ -0,0 +1,67 @@ +package tombenpotter.emt.common.block; + +import java.util.Random; + +import net.minecraft.block.material.Material; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; +import thaumcraft.client.fx.ParticleEngine; +import thaumcraft.client.fx.particles.FXSparkle; +import thaumcraft.client.fx.particles.FXWisp; +import thaumcraft.common.Thaumcraft; +import thaumcraft.common.lib.world.ThaumcraftWorldGenerator; +import thaumcraft.common.tiles.TileNitor; +import tombenpotter.emt.common.tile.TileElectricCloud; + +public class BlockElectricCloud extends BlockBase { + + public BlockElectricCloud(String unlocName) { + super(unlocName, Material.cloth, soundTypeCloth, 1); + } + + @Override + public void randomDisplayTick(World world, int x, int y, int z, Random rnd) { + FXSparkle ef = new FXSparkle(world, x + 0.5F, y + 0.5F, z + 0.5F, x + 0.5F + (rnd.nextFloat() - rnd.nextFloat()) / 3.0F, y + 0.5F + (rnd.nextFloat() - rnd.nextFloat()) / 3.0F, z + 0.5F + (rnd.nextFloat() - rnd.nextFloat()) / 3.0F, 1.0F, 6, 3); + ef.setGravity(0.05F); + ParticleEngine.instance.addEffect(world, ef); + } + + @Override + public TileEntity createTileEntity(World world, int metadata) { + return new TileElectricCloud(); + } + + @Override + public boolean isAir(IBlockAccess world, int x, int y, int z) { + return false; + } + + @Override + public boolean hasTileEntity() { + return true; + } + + @Override + public boolean hasTileEntity(int metadata) { + return true; + } + + @Override + public int getRenderType() { + return -1; + } + + @Override + public boolean renderAsNormalBlock() { + return false; + } + + @Override + public boolean isOpaqueCube() { + return false; + } +} diff --git a/src/main/java/tombenpotter/emt/common/block/BlockToolRefiller.java b/src/main/java/tombenpotter/emt/common/block/BlockToolRefiller.java deleted file mode 100644 index 5630042..0000000 --- a/src/main/java/tombenpotter/emt/common/block/BlockToolRefiller.java +++ /dev/null @@ -1,17 +0,0 @@ -package tombenpotter.emt.common.block; - -import net.minecraft.block.material.Material; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.World; - -public class BlockToolRefiller extends BlockBaseContainer { - - public BlockToolRefiller() { - super("toolRefiller", Material.iron, soundTypeMetal, 4.0F); - } - - @Override - public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) { - return null; - } -} diff --git a/src/main/java/tombenpotter/emt/common/init/BlockRegistry.java b/src/main/java/tombenpotter/emt/common/init/BlockRegistry.java index b762a4e..fa5a027 100644 --- a/src/main/java/tombenpotter/emt/common/init/BlockRegistry.java +++ b/src/main/java/tombenpotter/emt/common/init/BlockRegistry.java @@ -3,6 +3,9 @@ package tombenpotter.emt.common.init; import cpw.mods.fml.common.registry.GameRegistry; import ic2.api.item.IC2Items; import net.minecraft.block.Block; +import net.minecraft.block.Block.SoundType; +import net.minecraft.block.material.Material; +import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; import static thaumcraft.api.ThaumcraftApi.*; import thaumcraft.api.aspects.Aspect; @@ -11,23 +14,20 @@ import tombenpotter.emt.ModInformation; import tombenpotter.emt.common.block.BlockMachines; import tombenpotter.emt.common.block.BlockSolars; import tombenpotter.emt.common.block.BlockSolars2; +import tombenpotter.emt.common.block.BlockElectricCloud; import tombenpotter.emt.common.block.BlockEssentiaGenerators; import tombenpotter.emt.common.block.BlockPortableNode; import tombenpotter.emt.common.block.BlockShield; import tombenpotter.emt.common.item.block.ItemBlockMachines; import tombenpotter.emt.common.item.block.ItemBlockSolars; import tombenpotter.emt.common.item.block.ItemBlockSolars2; +import tombenpotter.emt.common.item.block.ItemBlockElectricCloud; import tombenpotter.emt.common.item.block.ItemBlockEssentiaGenerator; import tombenpotter.emt.common.item.block.ItemBlockEssentiaGenerators; public class BlockRegistry { - public static Block portableNode; - public static Block essentiaGens; - public static Block shield; - public static Block emtSolars; - public static Block emtMachines; - public static Block emtSolars2; + public static Block portableNode, essentiaGens, shield, emtSolars, emtMachines, emtSolars2, electrum; public static void registerBlocks() { portableNode = new BlockPortableNode("portablenode"); @@ -47,6 +47,9 @@ public class BlockRegistry { essentiaGens = new BlockEssentiaGenerators("essentia"); GameRegistry.registerBlock(essentiaGens, ItemBlockEssentiaGenerators.class, "EssentiaGenerators"); + + electrum = new BlockElectricCloud("electricCloud"); + GameRegistry.registerBlock(electrum, ItemBlockElectricCloud.class, "electricCloud"); } public static void addAspects() { diff --git a/src/main/java/tombenpotter/emt/common/init/TileRegistry.java b/src/main/java/tombenpotter/emt/common/init/TileRegistry.java index 1b42df2..fd8b789 100644 --- a/src/main/java/tombenpotter/emt/common/init/TileRegistry.java +++ b/src/main/java/tombenpotter/emt/common/init/TileRegistry.java @@ -1,5 +1,6 @@ package tombenpotter.emt.common.init; +import tombenpotter.emt.common.tile.TileElectricCloud; import tombenpotter.emt.common.tile.TileEntityEtherealMacerator; import tombenpotter.emt.common.tile.TileEntityIndustrialWandRecharge; import tombenpotter.emt.common.tile.TileEntityPortableNode; @@ -63,5 +64,6 @@ public class TileRegistry { GameRegistry.registerTileEntity(TileEntityEarthSolar.class, "tileentityearthsolar"); GameRegistry.registerTileEntity(TileEntityDoubleEarthSolar.class, "tileentitydoubleearthsolar"); GameRegistry.registerTileEntity(TileEntityTripleEarthSolar.class, "tileentitytripleearthsolar"); + GameRegistry.registerTileEntity(TileElectricCloud.class, "tileEntityElectricCloud"); } } diff --git a/src/main/java/tombenpotter/emt/common/item/block/ItemBlockElectricCloud.java b/src/main/java/tombenpotter/emt/common/item/block/ItemBlockElectricCloud.java new file mode 100644 index 0000000..189392b --- /dev/null +++ b/src/main/java/tombenpotter/emt/common/item/block/ItemBlockElectricCloud.java @@ -0,0 +1,12 @@ +package tombenpotter.emt.common.item.block; + +import net.minecraft.block.Block; +import net.minecraft.item.ItemBlock; + +public class ItemBlockElectricCloud extends ItemBlock{ + + public ItemBlockElectricCloud(Block block) { + super(block); + } + +} diff --git a/src/main/java/tombenpotter/emt/common/tile/TileElectricCloud.java b/src/main/java/tombenpotter/emt/common/tile/TileElectricCloud.java new file mode 100644 index 0000000..4b1d098 --- /dev/null +++ b/src/main/java/tombenpotter/emt/common/tile/TileElectricCloud.java @@ -0,0 +1,41 @@ +package tombenpotter.emt.common.tile; + +import net.minecraft.tileentity.TileEntity; +import thaumcraft.client.fx.ParticleEngine; +import thaumcraft.client.fx.particles.FXWisp; +import thaumcraft.common.Thaumcraft; + +public class TileElectricCloud extends TileEntity { + + @Override + public boolean canUpdate() { + return true; + } + + @Override + public void updateEntity() { + if (worldObj.isRemote) { + if (worldObj.rand.nextInt(4) == 0) { + Thaumcraft.proxy.wispFX3(worldObj, xCoord + 0.5F, yCoord + 0.5F, zCoord + 0.5F, xCoord + 0.4F + worldObj.rand.nextFloat() * 0.2F, yCoord + 0.5F, zCoord + 0.4F + worldObj.rand.nextFloat() * 0.2F, 0.25F, 1, true, -0.02F); + } + + if (worldObj.rand.nextInt(12) == 0) { + Thaumcraft.proxy.nodeBolt(worldObj, xCoord + 0.5f, yCoord + 0.5f, zCoord + 0.5f, xCoord + (worldObj.rand.nextInt(40) / 20f) - 0.5f, yCoord + (worldObj.rand.nextInt(40) / 20f) - 0.5f, zCoord + (worldObj.rand.nextInt(40) / 20f) - 0.5f); + if (worldObj.rand.nextInt(2) == 0) { + Thaumcraft.proxy.nodeBolt(worldObj, xCoord + 0.5f, yCoord + 0.5f, zCoord + 0.5f, xCoord + (worldObj.rand.nextInt(40) / 20f) - 0.5f, yCoord + (worldObj.rand.nextInt(40) / 20f) - 0.5f, zCoord + (worldObj.rand.nextInt(40) / 20f) - 0.5f); + } + if (worldObj.rand.nextInt(4) == 0) { + Thaumcraft.proxy.nodeBolt(worldObj, xCoord + 0.5f, yCoord + 0.5f, zCoord + 0.5f, xCoord + (worldObj.rand.nextInt(40) / 20f) - 0.5f, yCoord + (worldObj.rand.nextInt(40) / 20f) - 0.5f, zCoord + (worldObj.rand.nextInt(40) / 20f) - 0.5f); + } + } + + if (worldObj.rand.nextInt(3) == 0) { + FXWisp wisp = new FXWisp(worldObj, xCoord + 0.5 + ((worldObj.rand.nextInt(40) / 160f) - 0.125f), yCoord + 0.5, zCoord + 0.5 + ((worldObj.rand.nextInt(40) / 160f) - 0.125f), 0.4f + worldObj.rand.nextInt(40) / 100f, 1); + wisp.setGravity(-0.02F); + wisp.setRBGColorF(worldObj.rand.nextInt(40) / 100f, 0, 1); + wisp.setAlphaF(1); + ParticleEngine.instance.addEffect(worldObj, wisp); + } + } + } +}