BloodMagic/BM_src/WayofTime/alchemicalWizardry/common/block/ImperfectRitualStone.java
Fenn e3644f2d2b Massive rework of configs, items and blocks.
I redone where the items/blocsks are stored and how the configs are
handled to clean up it and give space. You can change the config line to
AWWayofTime if you want to keep the compatibility with old configs. Now
you reference the blocks from the ModBlocks and Items from the ModItems.
2014-01-17 21:05:38 +00:00

140 lines
5.9 KiB
Java

package WayofTime.alchemicalWizardry.common.block;
import WayofTime.alchemicalWizardry.common.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.common.PacketHandler;
import cpw.mods.fml.common.network.PacketDispatcher;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.entity.effect.EntityLightningBolt;
import net.minecraft.entity.monster.EntityZombie;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.world.World;
public class ImperfectRitualStone extends Block {
public ImperfectRitualStone(int id)
{
super(id, Material.iron);
setHardness(2.0F);
setResistance(5.0F);
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
setUnlocalizedName("imperfectRitualStone");
// TODO Auto-generated constructor stub
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IconRegister iconRegister)
{
this.blockIcon = iconRegister.registerIcon("AlchemicalWizardry:ImperfectRitualStone");
}
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float xOff, float yOff, float zOff)
{
//ItemStack ist = player.getItemInUse();
//if (!world.isRemote)
{
int blockID = world.getBlockId(x, y + 1, z);
if (blockID == Block.waterStill.blockID)
{
if (!player.capabilities.isCreativeMode && world.isRemote)
{
PacketDispatcher.sendPacketToServer(PacketHandler.getPacket(player.getEntityName(), -5000, 0));
}
if (!world.isRemote)
{
world.addWeatherEffect(new EntityLightningBolt(world, x, y + 2, z));
// if (!player.capabilities.isCreativeMode)
// {
// PacketDispatcher.sendPacketToServer(PacketHandler.getPacket(player.getEntityName(), -5000, 0));
// }
}
world.getWorldInfo().setRaining(true);
if (world.isRemote)
{
world.setRainStrength(1.0F);
}
world.thunderingStrength = 1.0F;
world.getWorldInfo().setThunderTime(0);
world.getWorldInfo().setThundering(true);
return true;
} else if (blockID == Block.coalBlock.blockID)
{
if (!player.capabilities.isCreativeMode && world.isRemote)
{
PacketDispatcher.sendPacketToServer(PacketHandler.getPacket(player.getEntityName(), -5000, 0));
}
//EntityFallenAngel zomb = new EntityFallenAngel(world);
EntityZombie zomb = new EntityZombie(world);
zomb.setPosition(x + 0.5, y + 2, z + 0.5);
// zomb.setCurrentItemOrArmor(4, new ItemStack(Item.helmetIron.itemID,1,0));
// zomb.setCurrentItemOrArmor(3, new ItemStack(Item.plateIron.itemID,1,0));
// zomb.setCurrentItemOrArmor(2, new ItemStack(Item.legsIron.itemID,1,0));
// zomb.setCurrentItemOrArmor(1, new ItemStack(Item.bootsIron.itemID,1,0));
//zomb.setCurrentItemOrArmor(0, new ItemStack(AlchemicalWizardry.energySword.itemID,1,0));
zomb.addPotionEffect(new PotionEffect(Potion.fireResistance.id, 2000));
zomb.addPotionEffect(new PotionEffect(Potion.damageBoost.id, 20000, 7));
zomb.addPotionEffect(new PotionEffect(Potion.resistance.id, 20000, 3));
if (!world.isRemote)
{
world.spawnEntityInWorld(zomb);
world.addWeatherEffect(new EntityLightningBolt(world, x, y + 2, z));
// if (!player.capabilities.isCreativeMode)
// {
// PacketDispatcher.sendPacketToServer(PacketHandler.getPacket(player.getEntityName(), -5000, 0));
// }
}
return true;
} else if (blockID == Block.blockLapis.blockID)
{
if (!player.capabilities.isCreativeMode && world.isRemote)
{
PacketDispatcher.sendPacketToServer(PacketHandler.getPacket(player.getEntityName(), -5000, 0));
}
if (!world.isRemote)
{
world.addWeatherEffect(new EntityLightningBolt(world, x, y + 2, z));
world.setWorldTime((world.getWorldTime() / 24000) * 24000 + 13800);
// if (!player.capabilities.isCreativeMode)
// {
// PacketDispatcher.sendPacketToServer(PacketHandler.getPacket(player.getEntityName(), -5000, 0));
// }
}
} else if (blockID == Block.bedrock.blockID)
{
if (!player.capabilities.isCreativeMode && world.isRemote)
{
PacketDispatcher.sendPacketToServer(PacketHandler.getPacket(player.getEntityName(), -5000, 0));
}
if (!world.isRemote)
{
world.addWeatherEffect(new EntityLightningBolt(world, x, y + 2, z));
//world.setWorldTime((world.getWorldTime()/24000)*24000+13800);
// if (!player.capabilities.isCreativeMode)
// {
// PacketDispatcher.sendPacketToServer(PacketHandler.getPacket(player.getEntityName(), -5000, 0));
// }
}
player.addPotionEffect(new PotionEffect(Potion.resistance.id, 60 * 20, 1));
}
}
return false;
}
}