mirror of
https://github.com/GTNewHorizons/Tainted-Magic.git
synced 2026-11-25 14:24:27 +00:00
1 parent
6b2ceddd86
commit
cc77874e71
74 files changed
+1696
-1296
No files matched your search
@@ -0,0 +1,128 @@
|
||||
package taintedmagic.common.blocks;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.ITileEntityProvider;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import taintedmagic.common.blocks.tile.TileEntityLumos;
|
||||
import thaumcraft.common.config.Config;
|
||||
import thaumcraft.common.config.ConfigItems;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class BlockLumos extends Block implements ITileEntityProvider
|
||||
{
|
||||
int duration = 0;
|
||||
|
||||
public BlockLumos ()
|
||||
{
|
||||
super(Config.airyMaterial);
|
||||
this.setBlockName("BlockLumos");
|
||||
this.setTickRandomly(false);
|
||||
this.setLightLevel(1.0F);
|
||||
this.setStepSound(new CustomStepSound("thaumcraft:crystal", 0.3F, 1.0F));
|
||||
this.setBlockTextureName("thaumcraft:blank");
|
||||
}
|
||||
|
||||
public void setGlowDuration (int i)
|
||||
{
|
||||
this.duration = i;
|
||||
}
|
||||
|
||||
public int getGlowDuration ()
|
||||
{
|
||||
return this.duration;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBlockBoundsBasedOnState (IBlockAccess w, int x, int y, int z)
|
||||
{
|
||||
int meta = w.getBlockMetadata(x, y, z);
|
||||
if (meta == 2) setBlockBounds(0.3F, 0.3F, 0.3F, 0.7F, 0.7F, 0.7F);
|
||||
else setBlockBounds(0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F);
|
||||
}
|
||||
|
||||
@SideOnly (Side.CLIENT)
|
||||
@Override
|
||||
public AxisAlignedBB getSelectedBoundingBoxFromPool (World w, int x, int y, int z)
|
||||
{
|
||||
return AxisAlignedBB.getBoundingBox(0.0D, 0.0D, 0.0D, 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getCollisionBoundingBoxFromPool (World w, int x, int y, int z)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType ()
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSideSolid (IBlockAccess w, int x, int y, int z, ForgeDirection side)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBlockNormalCube ()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube ()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isReplaceable (IBlockAccess w, int x, int y, int z)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canBeReplacedByLeaves (IBlockAccess w, int x, int y, int z)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean renderAsNormalBlock ()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isLeaves (IBlockAccess w, int x, int y, int z)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getItemDropped (int a, Random r, int b)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getItem (World w, int x, int y, int z)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity (World w, int m)
|
||||
{
|
||||
return new TileEntityLumos();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package taintedmagic.common.blocks;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
|
||||
public class CustomStepSound extends Block.SoundType
|
||||
{
|
||||
public CustomStepSound (String soundPath, float volume, float pitch)
|
||||
{
|
||||
super(soundPath, volume, pitch);
|
||||
}
|
||||
|
||||
public String getBreakSound ()
|
||||
{
|
||||
return this.soundName;
|
||||
}
|
||||
|
||||
public String getStepResourcePath ()
|
||||
{
|
||||
return this.soundName;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
package taintedmagic.common.blocks.tile;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import taintedmagic.common.blocks.BlockLumos;
|
||||
import taintedmagic.common.entities.EntityGlowpet;
|
||||
import taintedmagic.common.items.wand.foci.ItemFocusLumos;
|
||||
import thaumcraft.client.fx.ParticleEngine;
|
||||
import thaumcraft.client.fx.particles.FXSparkle;
|
||||
import thaumcraft.common.Thaumcraft;
|
||||
import thaumcraft.common.items.wands.ItemWandCasting;
|
||||
|
||||
public class TileEntityLumos extends TileEntity
|
||||
{
|
||||
int ticksExisted;
|
||||
|
||||
public TileEntityLumos ()
|
||||
{
|
||||
}
|
||||
|
||||
public boolean canUpdate ()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateEntity ()
|
||||
{
|
||||
ticksExisted++;
|
||||
|
||||
Block b = worldObj.getBlock(xCoord, yCoord, zCoord);
|
||||
int meta = worldObj.getBlockMetadata(xCoord, yCoord, zCoord);
|
||||
|
||||
List<EntityGlowpet> ents = worldObj.getEntitiesWithinAABB(EntityGlowpet.class, AxisAlignedBB.getBoundingBox(xCoord, yCoord, zCoord, xCoord + 1, yCoord + 1, zCoord + 1).expand(2.0D, 2.0D, 2.0D));
|
||||
if (b instanceof BlockLumos)
|
||||
{
|
||||
BlockLumos src = (BlockLumos) b;
|
||||
if (meta == 0 && ents.isEmpty())
|
||||
{
|
||||
worldObj.setBlockToAir(xCoord, yCoord, zCoord);
|
||||
}
|
||||
|
||||
else if (meta == 1 && ticksExisted > src.getGlowDuration())
|
||||
{
|
||||
worldObj.setBlockToAir(xCoord, yCoord, zCoord);
|
||||
}
|
||||
|
||||
Random r = new Random();
|
||||
if ( (meta == 1 && r.nextInt(50) == 0) || (meta == 2 && r.nextInt(9) == 0))
|
||||
{
|
||||
Thaumcraft.proxy.sparkle((float) xCoord + 0.5F + (this.worldObj.rand.nextFloat() - this.worldObj.rand.nextFloat()) * 0.25F, (float) yCoord + 0.5F + (this.worldObj.rand.nextFloat() - this.worldObj.rand.nextFloat()) * 0.25F, (float) zCoord + 0.5F + (this.worldObj.rand.nextFloat() - this.worldObj.rand.nextFloat()) * 0.25F, 0.5F, 6, -0.05F);
|
||||
}
|
||||
|
||||
if ( (meta == 1 || meta == 2) && r.nextInt(512) == 0)
|
||||
{
|
||||
for (int a = 0; a < 9; a++)
|
||||
{
|
||||
FXSparkle fx = new FXSparkle(worldObj, xCoord + worldObj.rand.nextFloat(), yCoord + worldObj.rand.nextFloat(), zCoord + worldObj.rand.nextFloat(), 1.75F, worldObj.rand.nextInt(5), 3 + worldObj.rand.nextInt(3));
|
||||
fx.setGravity(0.1F);
|
||||
ParticleEngine.instance.addEffect(worldObj, fx);
|
||||
if (r.nextBoolean()) break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user