Created
January 21, 2023 07:14
-
-
Save TheMrJezza/39f737dd7a50cd76d253d8f782ab5e1c to your computer and use it in GitHub Desktop.
An NMS Patch for Spigot 1.19.3 to enable the ability to ride vehicles into portals.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From b4a3723273e0e778871a27607d06e6718856dd56 Mon Sep 17 00:00:00 2001 | |
From: JBouchier <unconfigured@jbouchier.com> | |
Date: Sat, 21 Jan 2023 17:52:11 +1100 | |
Subject: [PATCH] Portal-In-Vehicle | |
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java | |
index cb083b824..9c1abcacc 100644 | |
--- a/src/main/java/net/minecraft/world/entity/Entity.java | |
+++ b/src/main/java/net/minecraft/world/entity/Entity.java | |
@@ -2393,7 +2393,7 @@ public abstract class Entity implements INamableTileEntity, EntityAccess, IComma | |
ResourceKey<World> resourcekey = this.level.getTypeKey() == WorldDimension.NETHER ? World.OVERWORLD : World.NETHER; // CraftBukkit | |
WorldServer worldserver1 = minecraftserver.getLevel(resourcekey); | |
- if (true && !this.isPassenger() && this.portalTime++ >= i) { // CraftBukkit | |
+ if (getVehicle() == null || (this instanceof EntityPlayer && equals(getVehicle().getFirstPassenger())) && this.portalTime++ >= i) { // HorseTpWithMe -> Portal-In-Vehicle Patch | |
this.level.getProfiler().push("portal"); | |
this.portalTime = i; | |
this.setPortalCooldown(); | |
diff --git a/src/main/java/net/minecraft/world/level/block/BlockEnderPortal.java b/src/main/java/net/minecraft/world/level/block/BlockEnderPortal.java | |
index 896ffc0cc..0d1288e01 100644 | |
--- a/src/main/java/net/minecraft/world/level/block/BlockEnderPortal.java | |
+++ b/src/main/java/net/minecraft/world/level/block/BlockEnderPortal.java | |
@@ -46,7 +46,7 @@ public class BlockEnderPortal extends BlockTileEntity { | |
@Override | |
public void entityInside(IBlockData iblockdata, World world, BlockPosition blockposition, Entity entity) { | |
- if (world instanceof WorldServer && !entity.isPassenger() && !entity.isVehicle() && entity.canChangeDimensions() && VoxelShapes.joinIsNotEmpty(VoxelShapes.create(entity.getBoundingBox().move((double) (-blockposition.getX()), (double) (-blockposition.getY()), (double) (-blockposition.getZ()))), iblockdata.getShape(world, blockposition), OperatorBoolean.AND)) { | |
+ if (world instanceof WorldServer && (entity.getVehicle() == null || (entity instanceof EntityPlayer && entity.equals(entity.getVehicle().getFirstPassenger()))) && !entity.isVehicle() && entity.canChangeDimensions() && VoxelShapes.joinIsNotEmpty(VoxelShapes.create(entity.getBoundingBox().move(-blockposition.getX(), -blockposition.getY(), -blockposition.getZ())), iblockdata.getShape(world, blockposition), OperatorBoolean.AND)) { // HorseTpWithMe -> Portal-In-Vehicle Patch | |
ResourceKey<World> resourcekey = world.getTypeKey() == WorldDimension.END ? World.OVERWORLD : World.END; // CraftBukkit - SPIGOT-6152: send back to main overworld in custom ends | |
WorldServer worldserver = ((WorldServer) world).getServer().getLevel(resourcekey); | |
diff --git a/src/main/java/net/minecraft/world/level/block/BlockPortal.java b/src/main/java/net/minecraft/world/level/block/BlockPortal.java | |
index b41533c4d..c3cc1c217 100644 | |
--- a/src/main/java/net/minecraft/world/level/block/BlockPortal.java | |
+++ b/src/main/java/net/minecraft/world/level/block/BlockPortal.java | |
@@ -3,6 +3,7 @@ package net.minecraft.world.level.block; | |
import net.minecraft.core.BlockPosition; | |
import net.minecraft.core.EnumDirection; | |
import net.minecraft.core.particles.Particles; | |
+import net.minecraft.server.level.EntityPlayer; | |
import net.minecraft.server.level.WorldServer; | |
import net.minecraft.sounds.SoundCategory; | |
import net.minecraft.sounds.SoundEffects; | |
@@ -81,7 +82,7 @@ public class BlockPortal extends Block { | |
@Override | |
public void entityInside(IBlockData iblockdata, World world, BlockPosition blockposition, Entity entity) { | |
- if (!entity.isPassenger() && !entity.isVehicle() && entity.canChangeDimensions()) { | |
+ if ((entity.getVehicle() == null || (entity instanceof EntityPlayer && entity.equals(entity.getVehicle().getFirstPassenger()))) && !entity.isVehicle() && entity.canChangeDimensions()) { // HorseTpWithMe -> Portal-In-Vehicle Patch | |
// CraftBukkit start - Entity in portal | |
EntityPortalEnterEvent event = new EntityPortalEnterEvent(entity.getBukkitEntity(), new org.bukkit.Location(world.getWorld(), blockposition.getX(), blockposition.getY(), blockposition.getZ())); | |
world.getCraftServer().getPluginManager().callEvent(event); | |
-- | |
2.33.0.windows.2 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment