SteamWar/FightSystem
Archiviert
13
1

Full TinyProtocol implementation (some tests on 1.15, further untested)
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Signed-off-by: Lixfel <agga-games@gmx.de>
Dieser Commit ist enthalten in:
Lixfel 2021-09-28 22:21:30 +02:00
Ursprung b0cbf622df
Commit b68508eec8
2 geänderte Dateien mit 10 neuen und 11 gelöschten Zeilen

Datei anzeigen

@ -312,7 +312,7 @@ public class REntity {
private static final Reflection.MethodInvoker asNMSCopy = Reflection.getTypedMethod(craftItemStack, "asNMSCopy", itemStack, ItemStack.class);
private Object getEquipmentPacket(String slot, ItemStack stack){
Object packet = equipmentConstructor.invoke();
equipmentEntity.set(0, entityId);
equipmentEntity.set(packet, entityId);
BountifulWrapper.impl.setEquipmentPacketSlot(packet, slot);
equipmentStack.set(packet, asNMSCopy.invoke(null, stack));
return packet;

Datei anzeigen

@ -143,12 +143,13 @@ public class TechHider extends StateDependent {
private static final UnaryOperator<Object> multiBlockChangeCloner = ProtocolAPI.shallowCloneGenerator(multiBlockChangePacket);
private static final Class<?> chunkCoordinateIntPair = Reflection.getClass("{nms}.ChunkCoordIntPair");
private static final Reflection.FieldAccessor<?> multiBlockChangeChunk = Reflection.getField(multiBlockChangePacket, chunkCoordinateIntPair, 0);
private static final Reflection.FieldAccessor<Integer> chunkCoordinateX = Reflection.getField(baseBlockPosition, int.class, 0);
private static final Reflection.FieldAccessor<Integer> chunkCoordinateZ = Reflection.getField(baseBlockPosition, int.class, 1);
private static final Reflection.FieldAccessor<Integer> chunkCoordinateX = Reflection.getField(chunkCoordinateIntPair, int.class, 0);
private static final Reflection.FieldAccessor<Integer> chunkCoordinateZ = Reflection.getField(chunkCoordinateIntPair, int.class, 1);
private static final Class<?> multiBlockChangeInfo = Reflection.getClass("{nms}.PacketPlayOutMultiBlockChange$MultiBlockChangeInfo");
private static final UnaryOperator<Object> multiBlockChangeInfoCloner = ProtocolAPI.shallowCloneGenerator(multiBlockChangeInfo);
private static final Reflection.ConstructorInvoker multiBlockChangeInfoConstructor = Reflection.getConstructor(multiBlockChangeInfo, multiBlockChangePacket, short.class, iBlockData);
private static final BiFunction<Object, UnaryOperator<Object>, Object> multiBlockChangeInfoArrayCloner = ProtocolAPI.arrayCloneGenerator(multiBlockChangeInfo);
private static final Reflection.FieldAccessor<?> multiBlockChangeInfoBlock = Reflection.getField(multiBlockChangeInfo, iBlockData, 0);
private static final Reflection.FieldAccessor<?> multiBlockChangeInfoPos = Reflection.getField(multiBlockChangeInfo, short.class, 0);
private static final Class<?> multiBlockChangeInfoArray = Reflection.getClass("[L{nms}.PacketPlayOutMultiBlockChange$MultiBlockChangeInfo;");
private static final Reflection.FieldAccessor<?> multiBlockChangeInfos = Reflection.getField(multiBlockChangePacket, multiBlockChangeInfoArray, 0);
private Object multiBlockChangeHider(Player p, Object packet) {
@ -156,15 +157,13 @@ public class TechHider extends StateDependent {
if(bypass(p, chunkCoordinateX.get(chunkCoords), chunkCoordinateZ.get(chunkCoords)))
return packet;
packet = multiBlockChangeCloner.apply(packet);
multiBlockChangeInfos.set(packet, multiBlockChangeInfoArrayCloner.apply(multiBlockChangeInfos.get(packet), mbci -> {
if(Config.HiddenBlocks.contains(getMaterialByIBlockData(multiBlockChangeInfoBlock.get(mbci)).name().toLowerCase())) {
mbci = multiBlockChangeInfoCloner.apply(mbci);
multiBlockChangeInfoBlock.set(mbci, obfuscateIBlockData);
}
Object modpacket = multiBlockChangeCloner.apply(packet);
multiBlockChangeInfos.set(modpacket, multiBlockChangeInfoArrayCloner.apply(multiBlockChangeInfos.get(modpacket), mbci -> {
if(Config.HiddenBlocks.contains(getMaterialByIBlockData(multiBlockChangeInfoBlock.get(mbci)).name().toLowerCase()))
return multiBlockChangeInfoConstructor.invoke(modpacket, multiBlockChangeInfoPos.get(mbci), obfuscateIBlockData);
return mbci;
}));
return packet;
return modpacket;
}
private static final Class<?> blockChangePacket = Reflection.getClass("{nms}.PacketPlayOutBlockChange");