Guest User

Untitled

a guest
Aug 13th, 2016
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.71 KB | None | 0 0
  1. package Uzzycamera;
  2.  
  3. import com.Maddoctor.item.RotatingBB;
  4.  
  5. import net.minecraft.block.Block;
  6. import net.minecraft.client.Minecraft;
  7. import net.minecraft.client.renderer.entity.RenderLiving;
  8. import net.minecraft.entity.Entity;
  9. import net.minecraft.entity.item.EntityItem;
  10. import net.minecraft.entity.player.EntityPlayer;
  11. import net.minecraft.item.ItemStack;
  12. import net.minecraft.nbt.NBTTagCompound;
  13. import net.minecraft.nbt.NBTTagList;
  14. import net.minecraft.tileentity.TileEntity;
  15. import net.minecraft.util.Vec3;
  16. import net.minecraft.world.World;
  17. import nook.mod_hoipoi;
  18.  
  19. public class LandGrabber
  20. {
  21.  
  22.  
  23. private Minecraft MC = Minecraft.getMinecraft();
  24. private Vec3 VC;
  25.  
  26.  
  27. public static LandGrabber getVC(Vec3 VC)
  28. {
  29. return new LandGrabber(VC);
  30. }
  31.  
  32.  
  33.  
  34. protected LandGrabber(Vec3 VC) {
  35.  
  36. this.VC = VC;
  37. }
  38.  
  39.  
  40. public void ChangeL()
  41. {
  42. if(!Minecraft.getMinecraft().theWorld.isRemote){
  43. MC.thePlayer.worldObj.createExplosion((Entity)null, VC.xCoord, VC.xCoord, VC.zCoord, 0.0F, true);
  44. int LandedX = (int)VC.xCoord;
  45. int LandedY = (int)VC.yCoord;
  46. int LandedZ = (int)VC.zCoord;
  47. ItemStack itemstack = new ItemStack(mod_hoipoi.HoipoiCapsule);
  48. itemstack.setTagCompound(new NBTTagCompound());
  49. NBTTagList itemstacklist = new NBTTagList();
  50.  
  51. for (int X = mod_hoipoi.startX; X <= mod_hoipoi.endX; ++X)
  52. {
  53. for (int Y = mod_hoipoi.endY; Y >= mod_hoipoi.startY && LandedY + Y >= 0; --Y)
  54. {
  55. for (int Z = mod_hoipoi.startZ; Z <= mod_hoipoi.endZ; ++Z)
  56. {
  57. Block blockID = MC.thePlayer.worldObj.getBlock(LandedX + X, LandedY + Y, LandedZ + Z);
  58. int blockMD = MC.thePlayer.worldObj.getBlockMetadata(LandedX + X, LandedY + Y, LandedZ + Z);
  59. NBTTagCompound TagComp = new NBTTagCompound();
  60. int R = Block.getIdFromBlock(blockID);
  61. TagComp.setByte("x", (byte)X);
  62. TagComp.setByte("y", (byte)Y);
  63. TagComp.setByte("z", (byte)Z);
  64.  
  65. TagComp.setInteger("id", R);
  66. TagComp.setByte("meta", (byte)blockMD);
  67. TileEntity tileentity = MC.thePlayer.worldObj.getTileEntity(LandedX + X, LandedY + Y, LandedZ + Z);
  68.  
  69. if (tileentity != null)
  70. {
  71. NBTTagCompound Tagcomp2 = new NBTTagCompound();
  72. tileentity.writeToNBT(Tagcomp2);
  73. TagComp.setTag("tile", Tagcomp2);
  74. }
  75.  
  76. itemstacklist.appendTag(TagComp);
  77. MC.thePlayer.worldObj.removeTileEntity(LandedX + X, LandedY + Y, LandedZ + Z);
  78. MC.thePlayer.worldObj.setBlock(LandedX + X, LandedY + Y, LandedZ + Z, Block.getBlockFromName("air"));
  79.  
  80.  
  81. }
  82. }
  83. }
  84.  
  85.  
  86.  
  87.  
  88.  
  89. {
  90. itemstack.stackTagCompound.setTag("blocks", itemstacklist);
  91. spawnItem(MC.thePlayer.worldObj, VC.xCoord, VC.yCoord, VC.zCoord, itemstack);
  92. }
  93. }}
  94.  
  95.  
  96.  
  97.  
  98. public void spawnItem(World wrldobj, double X, double Y, double Z, ItemStack hoipoi)
  99. {
  100. float Rnum1 = wrldobj.rand.nextFloat() * 0.8F - 0.4F;
  101. float Rnum2 = wrldobj.rand.nextFloat() * 0.8F + 0.1F - 0.4F;
  102. float Rnum3 = wrldobj.rand.nextFloat() * 0.8F - 0.4F;
  103. EntityItem Placment = new EntityItem(wrldobj, X + (double)Rnum1, Y + (double)Rnum2, Z + (double)Rnum3, hoipoi);
  104. float num = 0.05F;
  105. Placment.motionX = (double)((float)wrldobj.rand.nextGaussian() * num);
  106. Placment.motionY = (double)((float)wrldobj.rand.nextGaussian() * num + 0.2F);
  107. Placment.motionZ = (double)((float)wrldobj.rand.nextGaussian() * num);
  108. Placment.delayBeforeCanPickup = 20;
  109. wrldobj.spawnEntityInWorld(Placment);
  110. }
  111.  
  112. }
Add Comment
Please, Sign In to add comment