Skip to content

Commit

Permalink
Merge pull request #16 from ChampionAsh5357/fixes/teleportation
Browse files Browse the repository at this point in the history
Improve Cake Teleportation Logic
  • Loading branch information
Mrbysco authored Oct 15, 2023
2 parents 572b6a7 + 381cdf0 commit 77de040
Show file tree
Hide file tree
Showing 3 changed files with 252 additions and 191 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ public class BlockCakeBase extends BlockPastryBase {
Block.box(11.0D, 0.0D, 1.0D, 15.0D, 8.0D, 15.0D),
Block.box(13.0D, 0.0D, 1.0D, 15.0D, 8.0D, 15.0D)};

protected static final CakeTeleporter TELEPORTER = new CakeTeleporter();

public BlockCakeBase(BlockBehaviour.Properties properties) {
super(properties.strength(0.5F).sound(SoundType.WOOL).randomTicks());
this.registerDefaultState(this.stateDefinition.any().setValue(BITES, Integer.valueOf(0)));
Expand Down Expand Up @@ -181,9 +183,8 @@ public void teleportToDimension(LevelAccessor worldIn, BlockPos pos, Player play
return;
}

CakeTeleporter cakeTeleporter = new CakeTeleporter(destinationWorld);
CakeTeleporter.addDimensionPosition(serverPlayer, serverPlayer.level().dimension(), serverPlayer.blockPosition().offset(0, 1, 0));
serverPlayer.changeDimension(destinationWorld, cakeTeleporter);
CakeTeleporter.addDimensionPosition(serverPlayer, serverPlayer.level().dimension(), serverPlayer.blockPosition());
serverPlayer.changeDimension(destinationWorld, TELEPORTER);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,8 @@ public void teleportToDimension(LevelAccessor worldIn, BlockPos pos, Player play
if (destinationWorld == null)
return;

CakeTeleporter teleporter = new CakeTeleporter(destinationWorld);
CakeTeleporter.addDimensionPosition(serverPlayer, serverPlayer.level().dimension(), serverPlayer.blockPosition().offset(0, 1, 0));
serverPlayer.changeDimension(destinationWorld, teleporter);
CakeTeleporter.addDimensionPosition(serverPlayer, serverPlayer.level().dimension(), serverPlayer.blockPosition());
serverPlayer.changeDimension(destinationWorld, TELEPORTER);
}
}
}
Expand Down
Loading

0 comments on commit 77de040

Please sign in to comment.