Fix remaining local issues

This commit is contained in:
D4rkr34lm
2026-05-14 11:57:26 +02:00
parent 6766862a00
commit 51ff0e1a9f
2 changed files with 8 additions and 26 deletions
@@ -22,32 +22,11 @@ package de.steamwar.techhider;
import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBuf;
import lombok.Getter; import lombok.Getter;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
import org.bukkit.Material;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import java.util.Collections; import java.util.Collections;
import java.util.Set; import java.util.Set;
/*
* This file is a part of the SteamWar software.
*
* Copyright (C) 2025 SteamWar.de-Serverteam
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.steamwar.techhider;
import de.steamwar.Reflection; import de.steamwar.Reflection;
import io.netty.buffer.Unpooled; import io.netty.buffer.Unpooled;
import net.minecraft.network.protocol.game.ClientboundLevelChunkPacketData; import net.minecraft.network.protocol.game.ClientboundLevelChunkPacketData;
@@ -232,7 +211,7 @@ public class ChunkHider {
if(blockIdsToObfuscate.contains(entry)) if(blockIdsToObfuscate.contains(entry))
entry = blockIdToObfuscateTo; entry = blockIdToObfuscateTo;
if(entry == TechHider.AIR_ID) if(entry == BlockIds.impl.materialToId(Material.AIR))
air = i; air = i;
else if(entry == blockIdToObfuscateTo) else if(entry == blockIdToObfuscateTo)
target = i; target = i;
@@ -181,10 +181,13 @@ public class TechHiderUpdated {
} }
} }
private final Reflection.Field<SectionPos> sectionPosField = Reflection.getField(ClientboundSectionBlocksUpdatePacket.class, SectionPos.class, 0);
private final Reflection.Field<short[]> oldPosField = Reflection.getField(ClientboundSectionBlocksUpdatePacket.class, short[].class, 0);
private final Reflection.Field<BlockState[]> oldStatesField = Reflection.getField(ClientboundSectionBlocksUpdatePacket.class, BlockState[].class, 0);
private ClientboundSectionBlocksUpdatePacket processSectionUpdate(Player p, ClientboundSectionBlocksUpdatePacket packet) { private ClientboundSectionBlocksUpdatePacket processSectionUpdate(Player p, ClientboundSectionBlocksUpdatePacket packet) {
SectionPos sectionPos = packet.sectionPos; SectionPos sectionPos = sectionPosField.get(packet);
short[] oldPos = packet.positions; short[] oldPos = oldPosField.get(packet);
BlockState[] oldStates = packet.states; BlockState[] oldStates = oldStatesField.get(packet);
boolean modified = false; boolean modified = false;
List<Short> filteredPos = new ArrayList<>(oldPos.length); List<Short> filteredPos = new ArrayList<>(oldPos.length);