Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @Overwrite
- public void onCollision(HitResult hitResult) {
- super.onCollision(hitResult);
- for(int i = 0; i < 32; ++i) {
- this.world.addParticle(ParticleTypes.PORTAL, this.getX(), this.getY() + this.random.nextDouble() * 2.0D, this.getZ(), this.random.nextGaussian(), 0.0D, this.random.nextGaussian());
- }
- if (!this.world.isClient && !this.isRemoved()) {
- Entity entity = this.getOwner();
- if (entity instanceof ServerPlayerEntity) {
- ServerPlayerEntity serverPlayerEntity = (ServerPlayerEntity)entity;
- if (serverPlayerEntity.networkHandler.getConnection().isOpen() && !serverPlayerEntity.isSleeping()) {
- if (this.random.nextFloat() < 0.05F && this.world.getGameRules().getBoolean(GameRules.DO_MOB_SPAWNING)) {
- EndermiteEntity endermiteEntity = (EndermiteEntity)EntityType.ENDERMITE.create(this.world);
- endermiteEntity.refreshPositionAndAngles(entity.getX(), entity.getY(), entity.getZ(), entity.getYaw(), entity.getPitch());
- this.world.spawnEntity(endermiteEntity);
- }
- if (entity.hasVehicle()) {
- if (serverPlayerEntity.world != this.world) {
- serverPlayerEntity.moveToWorld((ServerWorld) this.world);
- }
- serverPlayerEntity.requestTeleportAndDismount(this.getX(), this.getY(), this.getZ());
- } else {
- if (serverPlayerEntity.world != this.world) {
- serverPlayerEntity.moveToWorld((ServerWorld) this.world);
- }
- serverPlayerEntity.requestTeleport(this.getX(), this.getY(), this.getZ());
- }
- entity.fallDistance = 0.0F;
- entity.damage(DamageSource.FALL, 2.5F);
- }
- } else if (entity != null) {
- if (entity.world != this.world) {
- entity.moveToWorld((ServerWorld) this.world);
- }
- entity.requestTeleport(this.getX(), this.getY(), this.getZ());
- entity.fallDistance = 0.0F;
- }
- this.discard();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement