Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev #80

Merged
merged 3 commits into from
Jan 20, 2025
Merged

Dev #80

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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);
}
}
}
Loading