Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class BlockEnderium extends BlockFluidClassic {
- public static final BlockEnderium instance = new BlockEnderium();
- public BlockEnderium() {
- super(FluidEnderium.instance, MaterialEnderium.enderium);
- }
- @Override
- public void onEntityCollidedWithBlock(World worldIn, BlockPos pos, IBlockState state, Entity entityIn) {
- float x = worldIn.getSpawnPoint().getX();
- float y = worldIn.getSpawnPoint().getY();
- float z = worldIn.getSpawnPoint().getZ();
- if (!worldIn.isRemote) {
- if (entityIn instanceof EntityPlayerMP) {
- EntityPlayerMP player = (EntityPlayerMP) entityIn;
- BlockPos spawnPoint = player.getBedLocation(player.worldObj.provider.getDimension());
- if (spawnPoint != null) {
- if (player.timeUntilPortal == 0) {
- player.connection.setPlayerLocation(spawnPoint.getX(), spawnPoint.getY(), spawnPoint.getZ(),
- player.cameraYaw, player.cameraPitch);
- player.timeUntilPortal = 3;
- }
- } else {
- if (player.timeUntilPortal == 0) {
- player.connection.setPlayerLocation(x, y, z, player.cameraYaw, player.cameraPitch);
- player.timeUntilPortal = 3;
- }
- }
- } else {
- entityIn.setPosition(x, y, z);
- }
- }
- entityIn.worldObj.playSound((EntityPlayer) null, x, y, z, SoundEvents.ENTITY_ENDERPEARL_THROW,
- SoundCategory.AMBIENT, 1, 1);
- worldIn.spawnParticle(EnumParticleTypes.PORTAL, x, y, z, 0, 7, 0, 0);
- worldIn.spawnParticle(EnumParticleTypes.PORTAL, x + 0.25f, y, z, 0, 7, 0, 0);
- worldIn.spawnParticle(EnumParticleTypes.PORTAL, x - 0.25f, y, z, 0, 7, 0, 0);
- worldIn.spawnParticle(EnumParticleTypes.PORTAL, x, y, z + 0.25f, 0, 7, 0, 0);
- worldIn.spawnParticle(EnumParticleTypes.PORTAL, x, y, z - 0.25f, 0, 7, 0, 0);
- }
- @Override
- public EnumBlockRenderType getRenderType(IBlockState state) {
- return EnumBlockRenderType.MODEL;
- }
- }
Add Comment
Please, Sign In to add comment