Skip to content

Commit

Permalink
migrated pre-hard-fork patch 0016-Fixed-spectator-counting-towards-co…
Browse files Browse the repository at this point in the history
…ntainer-view.patch
  • Loading branch information
TrainmasterHD committed Jan 5, 2025
1 parent 70a154c commit c0fd455
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 32 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
--- a/net/minecraft/world/level/block/entity/ContainerOpenersCounter.java
+++ b/net/minecraft/world/level/block/entity/ContainerOpenersCounter.java
@@ -37,6 +_,12 @@

protected abstract boolean isOwnContainer(Player player);

+ // Cheetah start - [MC-232968] Fixed spectator counting towards container view
+ private boolean isValidContainerViewer(Player player) {
+ return !player.isSpectator() && isOwnContainer(player);
+ }
+ // Cheetah end
+
public void incrementOpeners(Player player, Level level, BlockPos pos, BlockState state) {
int oldPower = Math.max(0, Math.min(15, this.openCount)); // CraftBukkit - Get power before new viewer is added
int i = this.openCount++;
@@ -88,7 +_,7 @@
private List<Player> getPlayersWithContainerOpen(Level level, BlockPos pos) {
double d = this.maxInteractionRange + 4.0;
AABB aabb = new AABB(pos).inflate(d);
- return level.getEntities(EntityTypeTest.forClass(Player.class), aabb, this::isOwnContainer);
+ return level.getEntities(EntityTypeTest.forClass(Player.class), aabb, this::isValidContainerViewer); // Cheetah - [MC-232968] Fixed spectator counting towards container view
}

public void recheckOpeners(Level level, BlockPos pos, BlockState state) {

This file was deleted.

0 comments on commit c0fd455

Please sign in to comment.