Finished altars
This commit is contained in:
parent
3b0ec1ec85
commit
1d013451f8
3 changed files with 143 additions and 7 deletions
|
@ -9,10 +9,13 @@ import cpw.mods.fml.relauncher.SideOnly;
|
|||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.texture.IconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.boss.EntityDragon;
|
||||
import net.minecraft.entity.effect.EntityLightningBolt;
|
||||
import net.minecraft.entity.item.EntityTNTPrimed;
|
||||
import net.minecraft.entity.passive.EntityVillager;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
@ -82,7 +85,21 @@ public class BlockBOPGlass extends Block
|
|||
{
|
||||
if (equippedItem.getItemDamage() == 0)
|
||||
{
|
||||
if (world.getBlockMetadata(x, y, z) == 3)
|
||||
if (world.getBlockMetadata(x, y, z) == 2)
|
||||
{
|
||||
if (checkAltarStructreIntegrity(world, x, y, z))
|
||||
{
|
||||
if (!player.capabilities.isCreativeMode)
|
||||
{
|
||||
player.setCurrentItemOrArmor(0, new ItemStack(Items.soulManipulator.get(), 1, 1));
|
||||
}
|
||||
|
||||
world.setBlockMetadataWithNotify(x, y, z, 1, 2);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else if (world.getBlockMetadata(x, y, z) == 3)
|
||||
{
|
||||
if (checkAltarStructreIntegrity(world, x, y, z))
|
||||
{
|
||||
|
@ -90,14 +107,14 @@ public class BlockBOPGlass extends Block
|
|||
{
|
||||
player.setCurrentItemOrArmor(0, new ItemStack(Items.soulManipulator.get(), 1, 2));
|
||||
}
|
||||
|
||||
FMLClientHandler.instance().getClient().sndManager.playSound("mods.BiomesOPlenty.audio.villager.no", (float) x + 0.5F, (float) y + 0.5F, (float) z + 0.5F, 1.0F, 1.0F);
|
||||
|
||||
FMLClientHandler.instance().getClient().sndManager.playSound("mods.BiomesOPlenty.audio.villager.no", (float) x + 0.5F, (float) y + 0.5F, (float) z + 0.5F, 1.0F, 1.0F);
|
||||
|
||||
world.setBlockMetadataWithNotify(x, y, z, 1, 2);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (equippedItem.getItemDamage() == 1)
|
||||
{
|
||||
|
@ -120,6 +137,56 @@ public class BlockBOPGlass extends Block
|
|||
return true;
|
||||
}
|
||||
}
|
||||
if (world.getBlockMetadata(x, y, z) == 3)
|
||||
{
|
||||
if (checkAltarStructreIntegrity(world, x, y, z))
|
||||
{
|
||||
if (!player.capabilities.isCreativeMode)
|
||||
{
|
||||
player.setCurrentItemOrArmor(0, new ItemStack(Items.soulManipulator.get(), 1, 0));
|
||||
}
|
||||
|
||||
world.spawnEntityInWorld(new EntityLightningBolt(world, x, y + 1, z));
|
||||
|
||||
FMLClientHandler.instance().getClient().sndManager.playSound("mob.wither.death", (float) x + 0.5F, (float) y + 0.5F, (float) z + 0.5F, 5.0F, 10.0F);
|
||||
FMLClientHandler.instance().getClient().sndManager.playSound("mob.enderdragon.growl", (float) x + 0.5F, (float) y + 0.5F, (float) z + 0.5F, 5.0F, 1.0F);
|
||||
|
||||
world.spawnEntityInWorld(new EntityDragon(world));
|
||||
|
||||
world.setBlockMetadataWithNotify(x, y, z, 1, 2);
|
||||
|
||||
Entity entitytnt = new EntityTNTPrimed(world);
|
||||
|
||||
world.createExplosion(entitytnt, (double)x, (double)y, (double)z, 10.0F, true);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (equippedItem.getItemDamage() == 2)
|
||||
{
|
||||
if (world.getBlockMetadata(x, y, z) == 2)
|
||||
{
|
||||
if (checkAltarStructreIntegrity(world, x, y, z))
|
||||
{
|
||||
if (player.dimension != 1)
|
||||
{
|
||||
world.spawnEntityInWorld(new EntityLightningBolt(world, x + 1, y + 2, z));
|
||||
world.spawnEntityInWorld(new EntityLightningBolt(world, x -1, y + 2, z));
|
||||
world.spawnEntityInWorld(new EntityLightningBolt(world, x, y + 2, z + 1));
|
||||
world.spawnEntityInWorld(new EntityLightningBolt(world, x, y + 2, z - 1));
|
||||
|
||||
if (!player.capabilities.isCreativeMode)
|
||||
{
|
||||
player.setCurrentItemOrArmor(0, new ItemStack(Items.soulManipulator.get(), 1, 0));
|
||||
}
|
||||
|
||||
world.setBlockMetadataWithNotify(x, y, z, 3, 2);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@ package biomesoplenty.items;
|
|||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.BlockCloth;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.texture.IconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
|
@ -45,8 +46,12 @@ public class ItemBOP extends Item
|
|||
|
||||
if (i != entitywolf.getCollarColor())
|
||||
{
|
||||
entitywolf.setCollarColor(i);
|
||||
--par1ItemStack.stackSize;
|
||||
entitywolf.setCollarColor(i)
|
||||
;
|
||||
if (!Minecraft.getMinecraft().thePlayer.capabilities.isCreativeMode)
|
||||
{
|
||||
--par1ItemStack.stackSize;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -58,7 +63,11 @@ public class ItemBOP extends Item
|
|||
if (!entitysheep.getSheared() && entitysheep.getFleeceColor() != i)
|
||||
{
|
||||
entitysheep.setFleeceColor(i);
|
||||
--par1ItemStack.stackSize;
|
||||
|
||||
if (!Minecraft.getMinecraft().thePlayer.capabilities.isCreativeMode)
|
||||
{
|
||||
--par1ItemStack.stackSize;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
|
@ -3,17 +3,27 @@ package biomesoplenty.items;
|
|||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockCloth;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.texture.IconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
import net.minecraft.entity.monster.EntityEnderman;
|
||||
import net.minecraft.entity.passive.EntitySheep;
|
||||
import net.minecraft.entity.passive.EntityVillager;
|
||||
import net.minecraft.entity.passive.EntityWolf;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.Icon;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
import biomesoplenty.BiomesOPlenty;
|
||||
import biomesoplenty.api.Blocks;
|
||||
import biomesoplenty.api.Items;
|
||||
import biomesoplenty.configuration.BOPConfiguration;
|
||||
import cpw.mods.fml.client.FMLClientHandler;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
|
@ -35,6 +45,56 @@ public class ItemSoulManipulator extends Item
|
|||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean itemInteractionForEntity(ItemStack par1ItemStack, EntityLiving par2EntityLiving)
|
||||
{
|
||||
int itemDamage = par1ItemStack.getItemDamage();
|
||||
|
||||
if (itemDamage == 2)
|
||||
{
|
||||
if (par2EntityLiving instanceof EntityEnderman)
|
||||
{
|
||||
EntityEnderman entityenderman = (EntityEnderman)par2EntityLiving;
|
||||
|
||||
if (entityenderman.worldObj.rand.nextInt(2) == 0)
|
||||
{
|
||||
entityenderman.attackEntityFrom(DamageSource.causePlayerDamage(Minecraft.getMinecraft().thePlayer), 1);
|
||||
}
|
||||
|
||||
entityenderman.attackEntityFrom(DamageSource.causePlayerDamage(Minecraft.getMinecraft().thePlayer), 0);
|
||||
|
||||
if (entityenderman.worldObj.rand.nextInt(6) == 0)
|
||||
{
|
||||
EntityVillager entityvillager = new EntityVillager(entityenderman.worldObj);
|
||||
entityvillager.setLocationAndAngles(entityenderman.posX, entityenderman.posY, entityenderman.posZ, MathHelper.wrapAngleTo180_float(entityenderman.worldObj.rand.nextFloat() * 360.0F), 0.0F);
|
||||
entityvillager.rotationYawHead = entityvillager.rotationYaw;
|
||||
entityvillager.renderYawOffset = entityvillager.rotationYaw;
|
||||
|
||||
if (!entityenderman.worldObj.isRemote)
|
||||
{
|
||||
entityenderman.worldObj.spawnEntityInWorld(entityvillager);
|
||||
|
||||
FMLClientHandler.instance().getClient().sndManager.playSound("mob.endermen.death", (float) entityvillager.posX + 0.5F, (float) entityvillager.posY + 0.5F, (float) entityvillager.posZ + 0.5F, 5.0F, -8.0F);
|
||||
entityenderman.setDead();
|
||||
}
|
||||
|
||||
if (!Minecraft.getMinecraft().thePlayer.capabilities.isCreativeMode)
|
||||
{
|
||||
par1ItemStack.setItemDamage(0);
|
||||
}
|
||||
|
||||
//entityvillager.playLivingSound();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerIcons(IconRegister iconRegister)
|
||||
|
|
Loading…
Reference in a new issue