-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
57aa241
commit 4d5df70
Showing
4 changed files
with
49 additions
and
57 deletions.
There are no files selected for viewing
45 changes: 45 additions & 0 deletions
45
...n/java/io/github/sakurawald/module/mixin/multi_obsidian_platform/EndPortalBlockMixin.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package io.github.sakurawald.module.mixin.multi_obsidian_platform; | ||
|
||
import com.llamalad7.mixinextras.sugar.Local; | ||
import io.github.sakurawald.module.ModuleManager; | ||
import io.github.sakurawald.module.initializer.multi_obsidian_platform.MultiObsidianPlatformModule; | ||
import net.minecraft.block.EndPortalBlock; | ||
import net.minecraft.entity.Entity; | ||
import net.minecraft.server.world.ServerWorld; | ||
import net.minecraft.util.math.BlockPos; | ||
import net.minecraft.world.World; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.Unique; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Redirect; | ||
|
||
@Mixin(EndPortalBlock.class) | ||
public class EndPortalBlockMixin { | ||
|
||
@Unique | ||
private static final MultiObsidianPlatformModule module = ModuleManager.getInitializer(MultiObsidianPlatformModule.class); | ||
|
||
@Unique | ||
BlockPos getTransformedEndSpawnPoint(Entity entity) { | ||
return module.transform(entity.getBlockPos()); | ||
} | ||
|
||
@Unique | ||
World getEntityCurrentLevel(Entity entity) { | ||
return entity.getWorld(); | ||
} | ||
|
||
@Redirect(method = "createTeleportTarget", at = @At(value = "FIELD", target = "Lnet/minecraft/server/world/ServerWorld;END_SPAWN_POS:Lnet/minecraft/util/math/BlockPos;") | ||
) | ||
/* This method will NOT be called when an entity (including player, item and other entities) jump into overworld's ender-portal-frame */ | ||
BlockPos $createTeleportTarget(@Local(argsOnly = true) Entity entity) { | ||
if (getEntityCurrentLevel(entity).getRegistryKey() != World.OVERWORLD) { | ||
// modify: resource_world:overworld -> minecraft:the_end (default obsidian platform) | ||
// feature: https://bugs.mojang.com/browse/MC-252361 | ||
return ServerWorld.END_SPAWN_POS; | ||
} | ||
BlockPos transformedEndSpawnPoint = getTransformedEndSpawnPoint(entity); | ||
return transformedEndSpawnPoint; | ||
} | ||
|
||
} |
51 changes: 0 additions & 51 deletions
51
src/main/java/io/github/sakurawald/module/mixin/multi_obsidian_platform/EntityMixin.java
This file was deleted.
Oops, something went wrong.
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
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