forked from SteamWar/SteamWar
twast
This commit is contained in:
+5
-4
@@ -59,12 +59,12 @@ public class TechHiderWrapper extends StateDependent implements Listener {
|
|||||||
Set<Block> blocksToObfuscate = Config.GameModeConfig.Techhider.HiddenBlocks.stream()
|
Set<Block> blocksToObfuscate = Config.GameModeConfig.Techhider.HiddenBlocks.stream()
|
||||||
.map(CraftMagicNumbers::getBlock)
|
.map(CraftMagicNumbers::getBlock)
|
||||||
.collect(Collectors.toUnmodifiableSet());
|
.collect(Collectors.toUnmodifiableSet());
|
||||||
Set<BlockEntityType<?>> blockEntityTypeToObfuscate = Config.GameModeConfig.Techhider.HiddenBlockEntities.stream()
|
/* Set<BlockEntityType<?>> blockEntityTypeToObfuscate = Config.GameModeConfig.Techhider.HiddenBlockEntities.stream()
|
||||||
.map((id) -> {
|
.map((id) -> {
|
||||||
ResourceLocation loc = ResourceLocation.parse(id);
|
ResourceLocation loc = ResourceLocation.parse(id);
|
||||||
return BuiltInRegistries.BLOCK_ENTITY_TYPE.get(loc).get().value();
|
return BuiltInRegistries.BLOCK_ENTITY_TYPE.get(loc).get().value();
|
||||||
})
|
})
|
||||||
.collect(Collectors.toUnmodifiableSet());
|
.collect(Collectors.toUnmodifiableSet()); */
|
||||||
techHider = new TechHider(CraftMagicNumbers.getBlock(Config.GameModeConfig.Techhider.ObfuscateWith)) {
|
techHider = new TechHider(CraftMagicNumbers.getBlock(Config.GameModeConfig.Techhider.ObfuscateWith)) {
|
||||||
@Override
|
@Override
|
||||||
public boolean isPlayerPrivilegedToAccessPosition(Player p, int blockX, int blockY, int blockZ) {
|
public boolean isPlayerPrivilegedToAccessPosition(Player p, int blockX, int blockY, int blockZ) {
|
||||||
@@ -84,8 +84,9 @@ public class TechHiderWrapper extends StateDependent implements Listener {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isPlayerPrivilegedToAccessBlocEntity(Player p, int blockX, int blockY, int blockZ, BlockEntityType<?> type) {
|
public boolean isPlayerPrivilegedToAccessBlocEntity(Player p, int blockX, int blockY, int blockZ, BlockEntityType<?> type) {
|
||||||
Region hiddenRegion = getHiddenRegion(p);
|
//Region hiddenRegion = getHiddenRegion(p);
|
||||||
return !hiddenRegion.inRegion(blockX, blockY, blockZ) || !blockEntityTypeToObfuscate.contains(type);
|
//return !hiddenRegion.inRegion(blockX, blockY, blockZ) || !blockEntityTypeToObfuscate.contains(type);
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -62,10 +62,10 @@ public abstract class ChunkHider {
|
|||||||
|
|
||||||
private final byte BITS_PER_LONG = 64;
|
private final byte BITS_PER_LONG = 64;
|
||||||
|
|
||||||
private final int blockIdUsedForHiding;
|
private final int blockIdUsedForHiding = 121;
|
||||||
|
|
||||||
public ChunkHider(Block blockUsedForObfuscation) {
|
public ChunkHider(Block blockUsedForObfuscation) {
|
||||||
blockIdUsedForHiding = Block.BLOCK_STATE_REGISTRY.getId(blockUsedForObfuscation.defaultBlockState());
|
// blockIdUsedForHiding = Block.BLOCK_STATE_REGISTRY.getId(blockUsedForObfuscation.defaultBlockState());
|
||||||
}
|
}
|
||||||
|
|
||||||
private long[] readSectionDataFromBuffer(ByteBuf dataSource, short bitsPerEntry, int entryCount) {
|
private long[] readSectionDataFromBuffer(ByteBuf dataSource, short bitsPerEntry, int entryCount) {
|
||||||
@@ -251,8 +251,8 @@ public abstract class ChunkHider {
|
|||||||
private static final Class<?> blockEntitiyInfoClass = Reflection.getClass("net.minecraft.network.protocol.game.ClientboundLevelChunkPacketData$BlockEntityInfo");
|
private static final Class<?> blockEntitiyInfoClass = Reflection.getClass("net.minecraft.network.protocol.game.ClientboundLevelChunkPacketData$BlockEntityInfo");
|
||||||
|
|
||||||
private static final Reflection.Field<BlockEntityType> blockEntityInfoTypeField = Reflection.getField(blockEntitiyInfoClass, BlockEntityType.class, 0);
|
private static final Reflection.Field<BlockEntityType> blockEntityInfoTypeField = Reflection.getField(blockEntitiyInfoClass, BlockEntityType.class, 0);
|
||||||
private static final Reflection.Field<Integer> packedXZField = Reflection.getField(blockEntitiyInfoClass, Integer.class, 0);
|
private static final Reflection.Field<Integer> packedXZField = Reflection.getField(blockEntitiyInfoClass, int.class, 0);
|
||||||
private static final Reflection.Field<Integer> yField = Reflection.getField(blockEntitiyInfoClass, Integer.class, 1);
|
private static final Reflection.Field<Integer> yField = Reflection.getField(blockEntitiyInfoClass, int.class, 1);
|
||||||
private List<Object> filterBlockEntities(Player player, List<Object> blockEntities) {
|
private List<Object> filterBlockEntities(Player player, List<Object> blockEntities) {
|
||||||
return blockEntities.stream()
|
return blockEntities.stream()
|
||||||
.filter((blockEntityInfo) -> {
|
.filter((blockEntityInfo) -> {
|
||||||
|
|||||||
@@ -475,7 +475,7 @@ public abstract class TechHider {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private final Reflection.Field<Integer> moveEntityPacketEntityIdField = Reflection.getField(ClientboundMoveEntityPacket.class, Integer.class, 0);
|
private final Reflection.Field<Integer> moveEntityPacketEntityIdField = Reflection.getField(ClientboundMoveEntityPacket.class, int.class, 0);
|
||||||
private Packet<?> processMoveEntityPacket(Player player, ClientboundMoveEntityPacket packet) {
|
private Packet<?> processMoveEntityPacket(Player player, ClientboundMoveEntityPacket packet) {
|
||||||
int entityId = moveEntityPacketEntityIdField.get(packet);
|
int entityId = moveEntityPacketEntityIdField.get(packet);
|
||||||
|
|
||||||
@@ -487,7 +487,7 @@ public abstract class TechHider {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private final Reflection.Field<Integer> rotateHeadPacketEntityIdField = Reflection.getField(ClientboundRotateHeadPacket.class, Integer.class, 0);
|
private final Reflection.Field<Integer> rotateHeadPacketEntityIdField = Reflection.getField(ClientboundRotateHeadPacket.class, int.class, 0);
|
||||||
private Packet<?> processRotateHeadPacket(Player player, ClientboundRotateHeadPacket packet) {
|
private Packet<?> processRotateHeadPacket(Player player, ClientboundRotateHeadPacket packet) {
|
||||||
int entityId = rotateHeadPacketEntityIdField.get(packet);
|
int entityId = rotateHeadPacketEntityIdField.get(packet);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user