Skip to content

Commit

Permalink
Merge pull request #80 from FTBTeam/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
desht authored Jan 20, 2025
2 parents 69ca01a + 57e4d43 commit 6784024
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 3 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [2101.1.4]

### Fixed
* Fix bug from last release causing teleport positions to be added to the history twice, breaking the `/back` command

## [2101.1.3]

### Added
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ archives_base_name=ftb-essentials
maven_group=dev.ftb.mods

minecraft_version=1.21.1
mod_version=2101.1.3
mod_version=2101.1.4
mod_author=FTB Team

# Deps
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import dev.ftb.mods.ftbessentials.FTBEssentials;
import dev.ftb.mods.ftbessentials.config.FTBEConfig;
import dev.ftb.mods.ftbessentials.util.FTBEPlayerData;
import dev.ftb.mods.ftbessentials.util.neoforge.WarmupCooldownTeleporterImpl;
import net.minecraft.network.chat.Component;
import net.minecraft.server.level.ServerPlayer;
import net.neoforged.bus.api.EventPriority;
Expand Down Expand Up @@ -41,7 +42,8 @@ public void playerNameLow(PlayerEvent.NameFormat event) {
}

public void vanillaTeleportCommand(EntityTeleportEvent.TeleportCommand event) {
if (event.getEntity() instanceof ServerPlayer sp && !FTBEConfig.BACK_ON_DEATH_ONLY.get()) {
// ignore teleport events that we ourselves fired
if (event.getEntity() instanceof ServerPlayer sp && !FTBEConfig.BACK_ON_DEATH_ONLY.get() && !(event instanceof WarmupCooldownTeleporterImpl.EssentialsTeleport)) {
FTBEPlayerData.addTeleportHistory(sp);
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,21 @@
package dev.ftb.mods.ftbessentials.util.neoforge;

import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.phys.Vec3;
import net.neoforged.neoforge.common.NeoForge;
import net.neoforged.neoforge.event.entity.EntityTeleportEvent;

public class WarmupCooldownTeleporterImpl {
public static boolean firePlatformTeleportEvent(ServerPlayer player, Vec3 pos) {
EntityTeleportEvent.TeleportCommand event = new EntityTeleportEvent.TeleportCommand(player, pos.x, pos.y, pos.z);
EssentialsTeleport event = new EssentialsTeleport(player, pos.x, pos.y, pos.z);
NeoForge.EVENT_BUS.post(event);
return !event.isCanceled();
}

public static class EssentialsTeleport extends EntityTeleportEvent.TeleportCommand {
public EssentialsTeleport(Entity entity, double targetX, double targetY, double targetZ) {
super(entity, targetX, targetY, targetZ);
}
}
}

0 comments on commit 6784024

Please sign in to comment.