Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package Uzzycamera;
- import com.Maddoctor.item.RotatingBB;
- import net.minecraft.block.Block;
- import net.minecraft.client.Minecraft;
- import net.minecraft.client.renderer.entity.RenderLiving;
- import net.minecraft.entity.Entity;
- import net.minecraft.entity.item.EntityItem;
- import net.minecraft.entity.player.EntityPlayer;
- import net.minecraft.item.ItemStack;
- import net.minecraft.nbt.NBTTagCompound;
- import net.minecraft.nbt.NBTTagList;
- import net.minecraft.tileentity.TileEntity;
- import net.minecraft.util.Vec3;
- import net.minecraft.world.World;
- import nook.mod_hoipoi;
- public class LandGrabber
- {
- private Minecraft MC = Minecraft.getMinecraft();
- private Vec3 VC;
- public static LandGrabber getVC(Vec3 VC)
- {
- return new LandGrabber(VC);
- }
- protected LandGrabber(Vec3 VC) {
- this.VC = VC;
- }
- public void ChangeL()
- {
- if(!Minecraft.getMinecraft().theWorld.isRemote){
- MC.thePlayer.worldObj.createExplosion((Entity)null, VC.xCoord, VC.xCoord, VC.zCoord, 0.0F, true);
- int LandedX = (int)VC.xCoord;
- int LandedY = (int)VC.yCoord;
- int LandedZ = (int)VC.zCoord;
- ItemStack itemstack = new ItemStack(mod_hoipoi.HoipoiCapsule);
- itemstack.setTagCompound(new NBTTagCompound());
- NBTTagList itemstacklist = new NBTTagList();
- for (int X = mod_hoipoi.startX; X <= mod_hoipoi.endX; ++X)
- {
- for (int Y = mod_hoipoi.endY; Y >= mod_hoipoi.startY && LandedY + Y >= 0; --Y)
- {
- for (int Z = mod_hoipoi.startZ; Z <= mod_hoipoi.endZ; ++Z)
- {
- Block blockID = MC.thePlayer.worldObj.getBlock(LandedX + X, LandedY + Y, LandedZ + Z);
- int blockMD = MC.thePlayer.worldObj.getBlockMetadata(LandedX + X, LandedY + Y, LandedZ + Z);
- NBTTagCompound TagComp = new NBTTagCompound();
- int R = Block.getIdFromBlock(blockID);
- TagComp.setByte("x", (byte)X);
- TagComp.setByte("y", (byte)Y);
- TagComp.setByte("z", (byte)Z);
- TagComp.setInteger("id", R);
- TagComp.setByte("meta", (byte)blockMD);
- TileEntity tileentity = MC.thePlayer.worldObj.getTileEntity(LandedX + X, LandedY + Y, LandedZ + Z);
- if (tileentity != null)
- {
- NBTTagCompound Tagcomp2 = new NBTTagCompound();
- tileentity.writeToNBT(Tagcomp2);
- TagComp.setTag("tile", Tagcomp2);
- }
- itemstacklist.appendTag(TagComp);
- MC.thePlayer.worldObj.removeTileEntity(LandedX + X, LandedY + Y, LandedZ + Z);
- MC.thePlayer.worldObj.setBlock(LandedX + X, LandedY + Y, LandedZ + Z, Block.getBlockFromName("air"));
- }
- }
- }
- {
- itemstack.stackTagCompound.setTag("blocks", itemstacklist);
- spawnItem(MC.thePlayer.worldObj, VC.xCoord, VC.yCoord, VC.zCoord, itemstack);
- }
- }}
- public void spawnItem(World wrldobj, double X, double Y, double Z, ItemStack hoipoi)
- {
- float Rnum1 = wrldobj.rand.nextFloat() * 0.8F - 0.4F;
- float Rnum2 = wrldobj.rand.nextFloat() * 0.8F + 0.1F - 0.4F;
- float Rnum3 = wrldobj.rand.nextFloat() * 0.8F - 0.4F;
- EntityItem Placment = new EntityItem(wrldobj, X + (double)Rnum1, Y + (double)Rnum2, Z + (double)Rnum3, hoipoi);
- float num = 0.05F;
- Placment.motionX = (double)((float)wrldobj.rand.nextGaussian() * num);
- Placment.motionY = (double)((float)wrldobj.rand.nextGaussian() * num + 0.2F);
- Placment.motionZ = (double)((float)wrldobj.rand.nextGaussian() * num);
- Placment.delayBeforeCanPickup = 20;
- wrldobj.spawnEntityInWorld(Placment);
- }
- }
Add Comment
Please, Sign In to add comment