-
-
Notifications
You must be signed in to change notification settings - Fork 10
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
56aa788
commit b037a39
Showing
20 changed files
with
109 additions
and
130 deletions.
There are no files selected for viewing
File renamed without changes.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,4 +21,7 @@ build | |
eclipse | ||
run | ||
runs | ||
runserver | ||
logs | ||
|
||
common/src/generated/resources/.cache |
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 |
---|---|---|
@@ -1 +1 @@ | ||
- Updated to Minecraft 1.20.6 | ||
- Updated to Minecraft 1.21 |
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
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
12 changes: 6 additions & 6 deletions
12
common/src/main/java/net/blay09/mods/netherportalfix/ReturnPortal.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 |
---|---|---|
@@ -1,23 +1,23 @@ | ||
package net.blay09.mods.netherportalfix; | ||
|
||
import net.minecraft.BlockUtil; | ||
import net.minecraft.core.BlockPos; | ||
|
||
import java.util.UUID; | ||
|
||
public class ReturnPortal { | ||
private final UUID uid; | ||
private final BlockUtil.FoundRectangle rectangle; | ||
private final BlockPos pos; | ||
|
||
public ReturnPortal(UUID uid, BlockUtil.FoundRectangle rectangle) { | ||
public ReturnPortal(UUID uid, BlockPos pos) { | ||
this.uid = uid; | ||
this.rectangle = rectangle; | ||
this.pos = pos; | ||
} | ||
|
||
public UUID getUid() { | ||
return uid; | ||
} | ||
|
||
public BlockUtil.FoundRectangle getRectangle() { | ||
return rectangle; | ||
public BlockPos getPos() { | ||
return pos; | ||
} | ||
} |
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
12 changes: 0 additions & 12 deletions
12
common/src/main/java/net/blay09/mods/netherportalfix/mixin/EntityAccessor.java
This file was deleted.
Oops, something went wrong.
40 changes: 40 additions & 0 deletions
40
common/src/main/java/net/blay09/mods/netherportalfix/mixin/NetherPortalBlockMixin.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,40 @@ | ||
package net.blay09.mods.netherportalfix.mixin; | ||
|
||
import com.llamalad7.mixinextras.injector.ModifyExpressionValue; | ||
import net.blay09.mods.netherportalfix.NetherPortalFix; | ||
import net.blay09.mods.netherportalfix.ReturnPortalManager; | ||
import net.minecraft.core.BlockPos; | ||
import net.minecraft.resources.ResourceKey; | ||
import net.minecraft.server.level.ServerLevel; | ||
import net.minecraft.world.entity.Entity; | ||
import net.minecraft.world.level.Level; | ||
import net.minecraft.world.level.block.Blocks; | ||
import net.minecraft.world.level.block.NetherPortalBlock; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
|
||
import java.util.Optional; | ||
|
||
@Mixin(NetherPortalBlock.class) | ||
public class NetherPortalBlockMixin { | ||
|
||
@ModifyExpressionValue(method = "getExitPortal(Lnet/minecraft/server/level/ServerLevel;Lnet/minecraft/world/entity/Entity;Lnet/minecraft/core/BlockPos;Lnet/minecraft/core/BlockPos;ZLnet/minecraft/world/level/border/WorldBorder;)Lnet/minecraft/world/level/portal/DimensionTransition;", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/portal/PortalForcer;findClosestPortalPosition(Lnet/minecraft/core/BlockPos;ZLnet/minecraft/world/level/border/WorldBorder;)Ljava/util/Optional;")) | ||
public Optional<BlockPos> getExitPortal(Optional<BlockPos> original, ServerLevel level, Entity entity) { | ||
final var fromPos = entity.blockPosition(); | ||
final ResourceKey<Level> fromDim = entity.level().dimension(); | ||
final var returnPortal = ReturnPortalManager.findReturnPortal(entity, fromDim, fromPos); | ||
if (returnPortal == null) { | ||
NetherPortalFix.logger.info("No return portal found"); | ||
return original; | ||
} | ||
|
||
if (!level.getBlockState(returnPortal.getPos()).is(Blocks.NETHER_PORTAL)) { | ||
NetherPortalFix.logger.info("Return portal is no longer valid"); | ||
return original; | ||
} | ||
|
||
NetherPortalFix.logger.debug("Return portal found, redirecting! :)"); | ||
return Optional.of(returnPortal.getPos()); | ||
} | ||
|
||
} |
63 changes: 0 additions & 63 deletions
63
common/src/main/java/net/blay09/mods/netherportalfix/mixin/ServerPlayerMixin.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
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
Oops, something went wrong.