Guest User

Untitled

a guest
Aug 20th, 2016
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.83 KB | None | 0 0
  1. public class BlockEnderium extends BlockFluidClassic {
  2.  
  3. public static final BlockEnderium instance = new BlockEnderium();
  4.  
  5. public BlockEnderium() {
  6. super(FluidEnderium.instance, MaterialEnderium.enderium);
  7. }
  8.  
  9. @Override
  10. public void onEntityCollidedWithBlock(World worldIn, BlockPos pos, IBlockState state, Entity entityIn) {
  11. float x = worldIn.getSpawnPoint().getX();
  12. float y = worldIn.getSpawnPoint().getY();
  13. float z = worldIn.getSpawnPoint().getZ();
  14. if (!worldIn.isRemote) {
  15. if (entityIn instanceof EntityPlayerMP) {
  16. EntityPlayerMP player = (EntityPlayerMP) entityIn;
  17. BlockPos spawnPoint = player.getBedLocation(player.worldObj.provider.getDimension());
  18. if (spawnPoint != null) {
  19. if (player.timeUntilPortal == 0) {
  20. player.connection.setPlayerLocation(spawnPoint.getX(), spawnPoint.getY(), spawnPoint.getZ(),
  21. player.cameraYaw, player.cameraPitch);
  22. player.timeUntilPortal = 3;
  23. }
  24. } else {
  25. if (player.timeUntilPortal == 0) {
  26. player.connection.setPlayerLocation(x, y, z, player.cameraYaw, player.cameraPitch);
  27. player.timeUntilPortal = 3;
  28. }
  29. }
  30. } else {
  31. entityIn.setPosition(x, y, z);
  32. }
  33. }
  34. entityIn.worldObj.playSound((EntityPlayer) null, x, y, z, SoundEvents.ENTITY_ENDERPEARL_THROW,
  35. SoundCategory.AMBIENT, 1, 1);
  36. worldIn.spawnParticle(EnumParticleTypes.PORTAL, x, y, z, 0, 7, 0, 0);
  37. worldIn.spawnParticle(EnumParticleTypes.PORTAL, x + 0.25f, y, z, 0, 7, 0, 0);
  38. worldIn.spawnParticle(EnumParticleTypes.PORTAL, x - 0.25f, y, z, 0, 7, 0, 0);
  39. worldIn.spawnParticle(EnumParticleTypes.PORTAL, x, y, z + 0.25f, 0, 7, 0, 0);
  40. worldIn.spawnParticle(EnumParticleTypes.PORTAL, x, y, z - 0.25f, 0, 7, 0, 0);
  41. }
  42.  
  43. @Override
  44. public EnumBlockRenderType getRenderType(IBlockState state) {
  45. return EnumBlockRenderType.MODEL;
  46. }
  47.  
  48. }
Add Comment
Please, Sign In to add comment