Skip to content

Commit

Permalink
Update effects and send the ability packet when reloading player data.
Browse files Browse the repository at this point in the history
  • Loading branch information
md5sha256 committed Jan 7, 2024
1 parent 24d8b96 commit fbe93ca
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -114,10 +114,10 @@ public class NMSImpl implements NMS {
final BlockPos blockPosition = new BlockPos(origin.getBlockX(), origin.getBlockY(), origin.getBlockZ());
Optional<BlockUtil.FoundRectangle> portalShape = Objects.requireNonNull(portalTravelAgent, "travel agent")
.findPortal(Objects.requireNonNull(blockPosition, "position"), 128);
if (!portalShape.isPresent()) {
if (portalShape.isEmpty()) {
portalShape = portalTravelAgent.createPortal(blockPosition, nmsEntity.getDirection().getAxis(), nmsEntity, 16);
}
if (!portalShape.isPresent()) {
if (portalShape.isEmpty()) {
return null;
}
final BlockUtil.FoundRectangle rectangle = portalShape.get();
Expand Down Expand Up @@ -198,8 +198,8 @@ public class NMSImpl implements NMS {
entityPlayer.reset();
entityPlayer.load(compound);

// entityPlayer.updateEffects = true;
// entityPlayer.updateAbilities();
entityPlayer.effectsDirty = true;
entityPlayer.onUpdateAbilities();
player.teleport(originLocation);

final ServerLevel worldServer = ((CraftWorld) originLocation.getWorld()).getHandle();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,10 @@ public class NMSImpl implements NMS {
final WorldBorder worldBorder = worldServer.getWorldBorder();
Optional<BlockUtil.FoundRectangle> portalShape = Objects.requireNonNull(portalTravelAgent, "travel agent")
.findPortalAround(Objects.requireNonNull(blockPosition, "position"), worldBorder,128);
if (!portalShape.isPresent()) {
if (portalShape.isEmpty()) {
portalShape = portalTravelAgent.createPortal(blockPosition, nmsEntity.getDirection().getAxis(), nmsEntity, 16);
}
if (!portalShape.isPresent()) {
if (portalShape.isEmpty()) {
return null;
}
final BlockUtil.FoundRectangle rectangle = portalShape.get();
Expand Down Expand Up @@ -181,8 +181,8 @@ public class NMSImpl implements NMS {
entityPlayer.reset();
entityPlayer.load(compound);

// entityPlayer.updateEffects = true;
// entityPlayer.updateAbilities();
entityPlayer.effectsDirty = true;
entityPlayer.onUpdateAbilities();
player.teleport(originLocation);

final ServerLevel worldServer = ((CraftWorld) originLocation.getWorld()).getHandle();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,10 @@ public class NMSImpl implements NMS {
final WorldBorder worldBorder = worldServer.getWorldBorder();
Optional<BlockUtil.FoundRectangle> portalShape = Objects.requireNonNull(portalTravelAgent, "travel agent")
.findPortalAround(Objects.requireNonNull(blockPosition, "position"), worldBorder,128);
if (!portalShape.isPresent()) {
if (portalShape.isEmpty()) {
portalShape = portalTravelAgent.createPortal(blockPosition, nmsEntity.getDirection().getAxis(), nmsEntity, 16);
}
if (!portalShape.isPresent()) {
if (portalShape.isEmpty()) {
return null;
}
final BlockUtil.FoundRectangle rectangle = portalShape.get();
Expand Down Expand Up @@ -182,8 +182,8 @@ public class NMSImpl implements NMS {
entityPlayer.reset();
entityPlayer.load(compound);

// entityPlayer.updateEffects = true;
// entityPlayer.updateAbilities();
entityPlayer.effectsDirty = true;
entityPlayer.onUpdateAbilities();
player.teleport(originLocation);

final ServerLevel worldServer = ((CraftWorld) originLocation.getWorld()).getHandle();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,10 @@ public class NMSImpl implements NMS {
final WorldBorder worldBorder = worldServer.getWorldBorder();
Optional<BlockUtil.FoundRectangle> portalShape = Objects.requireNonNull(portalTravelAgent, "travel agent")
.findPortalAround(Objects.requireNonNull(blockPosition, "position"), worldBorder,128);
if (!portalShape.isPresent()) {
if (portalShape.isEmpty()) {
portalShape = portalTravelAgent.createPortal(blockPosition, nmsEntity.getDirection().getAxis(), nmsEntity, 16);
}
if (!portalShape.isPresent()) {
if (portalShape.isEmpty()) {
return null;
}
final BlockUtil.FoundRectangle rectangle = portalShape.get();
Expand Down Expand Up @@ -183,8 +183,8 @@ public class NMSImpl implements NMS {
entityPlayer.reset();
entityPlayer.load(compound);

// entityPlayer.updateEffects = true;
// entityPlayer.updateAbilities();
entityPlayer.effectsDirty = true;
entityPlayer.onUpdateAbilities();
player.teleport(originLocation);

final ServerLevel worldServer = ((CraftWorld) originLocation.getWorld()).getHandle();
Expand Down

0 comments on commit fbe93ca

Please sign in to comment.