Skip to content

Commit

Permalink
Fix #104
Browse files Browse the repository at this point in the history
  • Loading branch information
Edivad99 committed Sep 2, 2023
1 parent 923afcb commit 20f8c42
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ on top of the [NeoForged](https://github.com/neoforged) API.
The mod greatly expands and improves the minecart system in Minecraft - adding many new blocks, entities,
and features.

This prpject is maintained by:
This project is maintained by:
- [**Sm0keySa1m0n**](https://github.com/Sm0keySa1m0n)
- [**Edivad99**](https://github.com/Edivad99)

Expand All @@ -23,8 +23,6 @@ of development.

## Official Links

* [Wiki](https://railcraft.info/wiki)

* [Discord](https://discord.gg/VyaUt2r)

## Issues
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ public <T extends Module> Optional<T> getModule(Class<T> type) {

@Override
public boolean isStillValid(Player player) {
return isStillValid(this, player);
return isStillValid(this, player, 64);
}

public final void setOwner(@Nullable GameProfile profile) {
Expand Down Expand Up @@ -207,10 +207,11 @@ public final BlockEntity asBlockEntity() {
return this;
}

public static boolean isStillValid(BlockEntity blockEntity, Player player) {
public static boolean isStillValid(BlockEntity blockEntity, Player player, int maxDistance) {
var pos = blockEntity.getBlockPos();
var distance = player.distanceToSqr(pos.getX(), pos.getY(), pos.getZ());
return !blockEntity.isRemoved()
&& blockEntity.getLevel().getBlockEntity(pos).equals(blockEntity)
&& player.distanceToSqr(pos.getX(), pos.getY(), pos.getZ()) <= 64;
&& distance <= maxDistance;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,11 @@ protected boolean isBlockEntity(MultiblockPattern.Element element) {
return element.marker() == 'W' || element.marker() == 'B';
}

@Override
public boolean isStillValid(Player player) {
return isStillValid(this, player, 256);
}

@Override
protected void membershipChanged(@Nullable Membership<TankBlockEntity> membership) {
this.getCurrentPattern().ifPresent(pattern -> {
Expand Down

0 comments on commit 20f8c42

Please sign in to comment.