mirror of
https://github.com/ViaVersion/ViaFabricPlus.git
synced 2024-09-30 04:47:28 +02:00
renamed fields
This commit is contained in:
parent
0521cf236e
commit
e5aa52f10f
@ -21,6 +21,6 @@ import java.nio.ByteBuffer;
|
||||
|
||||
public interface IPublicKeyData {
|
||||
|
||||
ByteBuffer viafabricplus_get1_19_0Key();
|
||||
void viafabricplus_set1_19_0Key(final ByteBuffer oldKey);
|
||||
ByteBuffer viafabricplus_getV1Key();
|
||||
void viafabricplus_setV1Key(final ByteBuffer oldKey);
|
||||
}
|
||||
|
@ -62,11 +62,12 @@ public abstract class MixinClientPlayerInteractionManager {
|
||||
@Shadow protected abstract ActionResult interactBlockInternal(ClientPlayerEntity player, Hand hand, BlockHitResult hitResult);
|
||||
|
||||
@Shadow @Final private ClientPlayNetworkHandler networkHandler;
|
||||
@Unique
|
||||
private ItemStack protocolhack_oldCursorStack;
|
||||
|
||||
@Unique
|
||||
private List<ItemStack> protocolhack_oldItems;
|
||||
private ItemStack viafabricplus_oldCursorStack;
|
||||
|
||||
@Unique
|
||||
private List<ItemStack> viafabricplus_oldItems;
|
||||
|
||||
@Inject(method = "attackEntity", at = @At("HEAD"))
|
||||
private void injectAttackEntity(PlayerEntity player, Entity target, CallbackInfo ci) {
|
||||
@ -79,13 +80,13 @@ public abstract class MixinClientPlayerInteractionManager {
|
||||
@ModifyVariable(method = "clickSlot", at = @At(value = "STORE"), ordinal = 0)
|
||||
private List<ItemStack> captureOldItems(List<ItemStack> oldItems) {
|
||||
assert client.player != null;
|
||||
protocolhack_oldCursorStack = client.player.currentScreenHandler.getCursorStack().copy();
|
||||
return this.protocolhack_oldItems = oldItems;
|
||||
viafabricplus_oldCursorStack = client.player.currentScreenHandler.getCursorStack().copy();
|
||||
return this.viafabricplus_oldItems = oldItems;
|
||||
}
|
||||
|
||||
// Special Cases
|
||||
@Unique
|
||||
private boolean protocolhack_shouldEmpty(final SlotActionType type, final int slot) {
|
||||
private boolean viafabricplus_shouldEmpty(final SlotActionType type, final int slot) {
|
||||
// quick craft always uses empty stack for verification
|
||||
if (type == SlotActionType.QUICK_CRAFT) return true;
|
||||
|
||||
@ -102,12 +103,12 @@ public abstract class MixinClientPlayerInteractionManager {
|
||||
if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_16_4) && packet instanceof ClickSlotC2SPacket clickSlot) {
|
||||
ItemStack slotItemBeforeModification;
|
||||
|
||||
if (this.protocolhack_shouldEmpty(clickSlot.getActionType(), clickSlot.getSlot()))
|
||||
if (this.viafabricplus_shouldEmpty(clickSlot.getActionType(), clickSlot.getSlot()))
|
||||
slotItemBeforeModification = ItemStack.EMPTY;
|
||||
else if (clickSlot.getSlot() < 0 || clickSlot.getSlot() >= protocolhack_oldItems.size())
|
||||
slotItemBeforeModification = protocolhack_oldCursorStack;
|
||||
else if (clickSlot.getSlot() < 0 || clickSlot.getSlot() >= viafabricplus_oldItems.size())
|
||||
slotItemBeforeModification = viafabricplus_oldCursorStack;
|
||||
else
|
||||
slotItemBeforeModification = protocolhack_oldItems.get(clickSlot.getSlot());
|
||||
slotItemBeforeModification = viafabricplus_oldItems.get(clickSlot.getSlot());
|
||||
|
||||
final PacketWrapper clickSlotPacket = PacketWrapper.create(ServerboundPackets1_16_2.CLICK_WINDOW, networkHandler.getConnection().channel.attr(ViaFabricPlus.LOCAL_VIA_CONNECTION).get());
|
||||
|
||||
@ -121,8 +122,8 @@ public abstract class MixinClientPlayerInteractionManager {
|
||||
|
||||
clickSlotPacket.sendToServer(Protocol1_17To1_16_4.class);
|
||||
|
||||
protocolhack_oldCursorStack = null;
|
||||
protocolhack_oldItems = null;
|
||||
viafabricplus_oldCursorStack = null;
|
||||
viafabricplus_oldItems = null;
|
||||
|
||||
return;
|
||||
}
|
||||
@ -152,15 +153,15 @@ public abstract class MixinClientPlayerInteractionManager {
|
||||
}
|
||||
|
||||
@Unique
|
||||
private ActionResult protocolhack_actionResult;
|
||||
private ActionResult viafabricplus_actionResult;
|
||||
|
||||
@Inject(method = "interactBlock", at = @At("HEAD"), cancellable = true)
|
||||
public void cacheActionResult(ClientPlayerEntity player, Hand hand, BlockHitResult hitResult, CallbackInfoReturnable<ActionResult> cir) {
|
||||
if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_12_2)) {
|
||||
this.protocolhack_actionResult = this.interactBlockInternal(player, hand, hitResult);
|
||||
this.viafabricplus_actionResult = this.interactBlockInternal(player, hand, hitResult);
|
||||
|
||||
if (this.protocolhack_actionResult == ActionResult.FAIL) {
|
||||
cir.setReturnValue(this.protocolhack_actionResult);
|
||||
if (this.viafabricplus_actionResult == ActionResult.FAIL) {
|
||||
cir.setReturnValue(this.viafabricplus_actionResult);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -168,7 +169,7 @@ public abstract class MixinClientPlayerInteractionManager {
|
||||
@Redirect(method = "method_41933", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerInteractionManager;interactBlockInternal(Lnet/minecraft/client/network/ClientPlayerEntity;Lnet/minecraft/util/Hand;Lnet/minecraft/util/hit/BlockHitResult;)Lnet/minecraft/util/ActionResult;"))
|
||||
public ActionResult provideCachedResult(ClientPlayerInteractionManager instance, ClientPlayerEntity player, Hand hand, BlockHitResult hitResult) {
|
||||
if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_12_2)) {
|
||||
return this.protocolhack_actionResult;
|
||||
return this.viafabricplus_actionResult;
|
||||
}
|
||||
return interactBlockInternal(player, hand, hitResult);
|
||||
}
|
||||
|
@ -28,15 +28,15 @@ import java.nio.ByteBuffer;
|
||||
public class MixinPlayerPublicKey_PublicKeyData implements IPublicKeyData {
|
||||
|
||||
@Unique
|
||||
private ByteBuffer protocolhack_1_19_0Key;
|
||||
private ByteBuffer viafabricplus_v1_key;
|
||||
|
||||
@Override
|
||||
public ByteBuffer viafabricplus_get1_19_0Key() {
|
||||
return protocolhack_1_19_0Key;
|
||||
public ByteBuffer viafabricplus_getV1Key() {
|
||||
return viafabricplus_v1_key;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void viafabricplus_set1_19_0Key(ByteBuffer byteBuffer) {
|
||||
this.protocolhack_1_19_0Key = byteBuffer;
|
||||
public void viafabricplus_setV1Key(ByteBuffer byteBuffer) {
|
||||
this.viafabricplus_v1_key = byteBuffer;
|
||||
}
|
||||
}
|
||||
|
@ -31,6 +31,6 @@ public class MixinProfileKeysImpl {
|
||||
|
||||
@Inject(method = "decodeKeyPairResponse", at = @At("RETURN"))
|
||||
private static void trackLegacyKey(KeyPairResponse keyPairResponse, CallbackInfoReturnable<PlayerPublicKey.PublicKeyData> cir) {
|
||||
((IPublicKeyData) (Object) cir.getReturnValue()).viafabricplus_set1_19_0Key(keyPairResponse.getLegacyPublicKeySignature());
|
||||
((IPublicKeyData) (Object) cir.getReturnValue()).viafabricplus_setV1Key(keyPairResponse.getLegacyPublicKeySignature());
|
||||
}
|
||||
}
|
||||
|
@ -44,7 +44,7 @@ import java.util.Map;
|
||||
public class MixinServerResourcePackProvider {
|
||||
|
||||
@Unique
|
||||
private File protocolhack_trackedFile;
|
||||
private File viafabricplus_trackedFile;
|
||||
|
||||
@Redirect(method = "getDownloadHeaders", at = @At(value = "INVOKE", target = "Lnet/minecraft/SharedConstants;getGameVersion()Lnet/minecraft/GameVersion;"))
|
||||
private static GameVersion editHeaders() {
|
||||
@ -67,7 +67,7 @@ public class MixinServerResourcePackProvider {
|
||||
|
||||
@Inject(method = "verifyFile", at = @At("HEAD"))
|
||||
public void keepFile(String expectedSha1, File file, CallbackInfoReturnable<Boolean> cir) {
|
||||
protocolhack_trackedFile = file;
|
||||
viafabricplus_trackedFile = file;
|
||||
}
|
||||
|
||||
@Redirect(method = "verifyFile", at = @At(value = "INVOKE", target = "Lcom/google/common/hash/HashCode;toString()Ljava/lang/String;", remap = false))
|
||||
@ -75,9 +75,9 @@ public class MixinServerResourcePackProvider {
|
||||
try {
|
||||
if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8)) {
|
||||
//noinspection deprecation
|
||||
return Hashing.sha1().hashBytes(Files.toByteArray(protocolhack_trackedFile)).toString();
|
||||
return Hashing.sha1().hashBytes(Files.toByteArray(viafabricplus_trackedFile)).toString();
|
||||
} else if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThan(ProtocolVersion.v1_18)) {
|
||||
return DigestUtils.sha1Hex(new FileInputStream(protocolhack_trackedFile));
|
||||
return DigestUtils.sha1Hex(new FileInputStream(viafabricplus_trackedFile));
|
||||
}
|
||||
} catch (IOException ignored) {
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ public class MixinPaneBlock extends HorizontalConnectingBlock {
|
||||
@Override
|
||||
public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) {
|
||||
if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8)) {
|
||||
return protocolhack_get1_8Shape(state);
|
||||
return viafabricplus_get1_8Shape(state);
|
||||
}
|
||||
return super.getOutlineShape(state, world, pos, context);
|
||||
}
|
||||
@ -45,7 +45,7 @@ public class MixinPaneBlock extends HorizontalConnectingBlock {
|
||||
@Override
|
||||
public VoxelShape getCollisionShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) {
|
||||
if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8)) {
|
||||
return protocolhack_get1_8Shape(state);
|
||||
return viafabricplus_get1_8Shape(state);
|
||||
}
|
||||
return super.getCollisionShape(state, world, pos, context);
|
||||
}
|
||||
@ -69,7 +69,7 @@ public class MixinPaneBlock extends HorizontalConnectingBlock {
|
||||
private final VoxelShape viafabricplus_north_south_combined_shape_v1_8_x = Block.createCuboidShape(7, 0, 0, 9, 16, 16);
|
||||
|
||||
@Unique
|
||||
public VoxelShape protocolhack_get1_8Shape(BlockState state) {
|
||||
public VoxelShape viafabricplus_get1_8Shape(BlockState state) {
|
||||
VoxelShape finalShape = VoxelShapes.empty();
|
||||
|
||||
final boolean isNorthFacing = state.get(NORTH);
|
||||
|
@ -74,7 +74,7 @@ public abstract class MixinClientPlayerEntity extends AbstractClientPlayerEntity
|
||||
@Shadow
|
||||
private double lastZ;
|
||||
@Unique
|
||||
private boolean protocolhack_areSwingCanceledThisTick = false;
|
||||
private boolean viafabricplus_areSwingCanceledThisTick = false;
|
||||
|
||||
public MixinClientPlayerEntity(ClientWorld world, GameProfile profile) {
|
||||
super(world, profile);
|
||||
@ -140,11 +140,11 @@ public abstract class MixinClientPlayerEntity extends AbstractClientPlayerEntity
|
||||
|
||||
@Inject(method = "swingHand", at = @At("HEAD"), cancellable = true)
|
||||
public void injectSwingHand(Hand hand, CallbackInfo ci) {
|
||||
if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8) && protocolhack_areSwingCanceledThisTick) {
|
||||
if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8) && viafabricplus_areSwingCanceledThisTick) {
|
||||
ci.cancel();
|
||||
}
|
||||
|
||||
protocolhack_areSwingCanceledThisTick = false;
|
||||
viafabricplus_areSwingCanceledThisTick = false;
|
||||
}
|
||||
|
||||
@Inject(
|
||||
@ -215,6 +215,6 @@ public abstract class MixinClientPlayerEntity extends AbstractClientPlayerEntity
|
||||
|
||||
@Override
|
||||
public void viafabricplus_cancelSwingOnce() {
|
||||
protocolhack_areSwingCanceledThisTick = true;
|
||||
viafabricplus_areSwingCanceledThisTick = true;
|
||||
}
|
||||
}
|
||||
|
@ -43,7 +43,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
public abstract class MixinPlayerEntity extends LivingEntity {
|
||||
|
||||
@Unique
|
||||
private static final EntityDimensions protocolhack_SNEAKING_DIMENSIONS_1_13_2 = EntityDimensions.changing(0.6f, 1.65f);
|
||||
private static final EntityDimensions viafabricplus_SNEAKING_DIMENSIONS_1_13_2 = EntityDimensions.changing(0.6f, 1.65f);
|
||||
@Shadow
|
||||
@Final
|
||||
private PlayerAbilities abilities;
|
||||
@ -81,7 +81,7 @@ public abstract class MixinPlayerEntity extends LivingEntity {
|
||||
if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_8)) {
|
||||
ci.setReturnValue(PlayerEntity.STANDING_DIMENSIONS);
|
||||
} else if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_13_2)) {
|
||||
ci.setReturnValue(protocolhack_SNEAKING_DIMENSIONS_1_13_2);
|
||||
ci.setReturnValue(viafabricplus_SNEAKING_DIMENSIONS_1_13_2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ import java.util.Set;
|
||||
public abstract class MixinHoeItem extends MiningToolItem {
|
||||
|
||||
@Unique
|
||||
private static final Set<Block> protocolhack_EFFECTIVE_BLOCKS_1165 = ImmutableSet.of(
|
||||
private static final Set<Block> viafabricplus_EFFECTIVE_BLOCKS_1165 = ImmutableSet.of(
|
||||
Blocks.NETHER_WART_BLOCK,
|
||||
Blocks.WARPED_WART_BLOCK,
|
||||
Blocks.HAY_BLOCK,
|
||||
@ -73,7 +73,7 @@ public abstract class MixinHoeItem extends MiningToolItem {
|
||||
return 1.0F;
|
||||
}
|
||||
if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_16_4)) {
|
||||
return protocolhack_EFFECTIVE_BLOCKS_1165.contains(state.getBlock()) ? this.miningSpeed : 1.0F;
|
||||
return viafabricplus_EFFECTIVE_BLOCKS_1165.contains(state.getBlock()) ? this.miningSpeed : 1.0F;
|
||||
}
|
||||
return super.getMiningSpeedMultiplier(stack, state);
|
||||
}
|
||||
|
@ -38,13 +38,13 @@ import java.util.Set;
|
||||
public abstract class MixinPickaxeItem extends MiningToolItem {
|
||||
|
||||
@Unique
|
||||
private static final Set<Block> protocolhack_EFFECTIVE_BLOCKS_1165 = ImmutableSet.of(Blocks.ACTIVATOR_RAIL, Blocks.COAL_ORE, Blocks.COBBLESTONE, Blocks.DETECTOR_RAIL, Blocks.DIAMOND_BLOCK, Blocks.DIAMOND_ORE, Blocks.POWERED_RAIL, Blocks.GOLD_BLOCK, Blocks.GOLD_ORE, Blocks.NETHER_GOLD_ORE, Blocks.ICE, Blocks.IRON_BLOCK, Blocks.IRON_ORE, Blocks.LAPIS_BLOCK, Blocks.LAPIS_ORE, Blocks.MOSSY_COBBLESTONE, Blocks.NETHERRACK, Blocks.PACKED_ICE, Blocks.BLUE_ICE, Blocks.RAIL, Blocks.REDSTONE_ORE, Blocks.SANDSTONE, Blocks.CHISELED_SANDSTONE, Blocks.CUT_SANDSTONE, Blocks.CHISELED_RED_SANDSTONE, Blocks.CUT_RED_SANDSTONE, Blocks.RED_SANDSTONE, Blocks.STONE, Blocks.GRANITE, Blocks.POLISHED_GRANITE, Blocks.DIORITE, Blocks.POLISHED_DIORITE, Blocks.ANDESITE, Blocks.POLISHED_ANDESITE, Blocks.STONE_SLAB, Blocks.SMOOTH_STONE_SLAB, Blocks.SANDSTONE_SLAB, Blocks.PETRIFIED_OAK_SLAB, Blocks.COBBLESTONE_SLAB, Blocks.BRICK_SLAB, Blocks.STONE_BRICK_SLAB, Blocks.NETHER_BRICK_SLAB, Blocks.QUARTZ_SLAB, Blocks.RED_SANDSTONE_SLAB, Blocks.PURPUR_SLAB, Blocks.SMOOTH_QUARTZ, Blocks.SMOOTH_RED_SANDSTONE, Blocks.SMOOTH_SANDSTONE, Blocks.SMOOTH_STONE, Blocks.STONE_BUTTON, Blocks.STONE_PRESSURE_PLATE, Blocks.POLISHED_GRANITE_SLAB, Blocks.SMOOTH_RED_SANDSTONE_SLAB, Blocks.MOSSY_STONE_BRICK_SLAB, Blocks.POLISHED_DIORITE_SLAB, Blocks.MOSSY_COBBLESTONE_SLAB, Blocks.END_STONE_BRICK_SLAB, Blocks.SMOOTH_SANDSTONE_SLAB, Blocks.SMOOTH_QUARTZ_SLAB, Blocks.GRANITE_SLAB, Blocks.ANDESITE_SLAB, Blocks.RED_NETHER_BRICK_SLAB, Blocks.POLISHED_ANDESITE_SLAB, Blocks.DIORITE_SLAB, Blocks.SHULKER_BOX, Blocks.BLACK_SHULKER_BOX, Blocks.BLUE_SHULKER_BOX, Blocks.BROWN_SHULKER_BOX, Blocks.CYAN_SHULKER_BOX, Blocks.GRAY_SHULKER_BOX, Blocks.GREEN_SHULKER_BOX, Blocks.LIGHT_BLUE_SHULKER_BOX, Blocks.LIGHT_GRAY_SHULKER_BOX, Blocks.LIME_SHULKER_BOX, Blocks.MAGENTA_SHULKER_BOX, Blocks.ORANGE_SHULKER_BOX, Blocks.PINK_SHULKER_BOX, Blocks.PURPLE_SHULKER_BOX, Blocks.RED_SHULKER_BOX, Blocks.WHITE_SHULKER_BOX, Blocks.YELLOW_SHULKER_BOX, Blocks.PISTON, Blocks.STICKY_PISTON, Blocks.PISTON_HEAD);
|
||||
private static final Set<Block> viafabricplus_EFFECTIVE_BLOCKS_1165 = ImmutableSet.of(Blocks.ACTIVATOR_RAIL, Blocks.COAL_ORE, Blocks.COBBLESTONE, Blocks.DETECTOR_RAIL, Blocks.DIAMOND_BLOCK, Blocks.DIAMOND_ORE, Blocks.POWERED_RAIL, Blocks.GOLD_BLOCK, Blocks.GOLD_ORE, Blocks.NETHER_GOLD_ORE, Blocks.ICE, Blocks.IRON_BLOCK, Blocks.IRON_ORE, Blocks.LAPIS_BLOCK, Blocks.LAPIS_ORE, Blocks.MOSSY_COBBLESTONE, Blocks.NETHERRACK, Blocks.PACKED_ICE, Blocks.BLUE_ICE, Blocks.RAIL, Blocks.REDSTONE_ORE, Blocks.SANDSTONE, Blocks.CHISELED_SANDSTONE, Blocks.CUT_SANDSTONE, Blocks.CHISELED_RED_SANDSTONE, Blocks.CUT_RED_SANDSTONE, Blocks.RED_SANDSTONE, Blocks.STONE, Blocks.GRANITE, Blocks.POLISHED_GRANITE, Blocks.DIORITE, Blocks.POLISHED_DIORITE, Blocks.ANDESITE, Blocks.POLISHED_ANDESITE, Blocks.STONE_SLAB, Blocks.SMOOTH_STONE_SLAB, Blocks.SANDSTONE_SLAB, Blocks.PETRIFIED_OAK_SLAB, Blocks.COBBLESTONE_SLAB, Blocks.BRICK_SLAB, Blocks.STONE_BRICK_SLAB, Blocks.NETHER_BRICK_SLAB, Blocks.QUARTZ_SLAB, Blocks.RED_SANDSTONE_SLAB, Blocks.PURPUR_SLAB, Blocks.SMOOTH_QUARTZ, Blocks.SMOOTH_RED_SANDSTONE, Blocks.SMOOTH_SANDSTONE, Blocks.SMOOTH_STONE, Blocks.STONE_BUTTON, Blocks.STONE_PRESSURE_PLATE, Blocks.POLISHED_GRANITE_SLAB, Blocks.SMOOTH_RED_SANDSTONE_SLAB, Blocks.MOSSY_STONE_BRICK_SLAB, Blocks.POLISHED_DIORITE_SLAB, Blocks.MOSSY_COBBLESTONE_SLAB, Blocks.END_STONE_BRICK_SLAB, Blocks.SMOOTH_SANDSTONE_SLAB, Blocks.SMOOTH_QUARTZ_SLAB, Blocks.GRANITE_SLAB, Blocks.ANDESITE_SLAB, Blocks.RED_NETHER_BRICK_SLAB, Blocks.POLISHED_ANDESITE_SLAB, Blocks.DIORITE_SLAB, Blocks.SHULKER_BOX, Blocks.BLACK_SHULKER_BOX, Blocks.BLUE_SHULKER_BOX, Blocks.BROWN_SHULKER_BOX, Blocks.CYAN_SHULKER_BOX, Blocks.GRAY_SHULKER_BOX, Blocks.GREEN_SHULKER_BOX, Blocks.LIGHT_BLUE_SHULKER_BOX, Blocks.LIGHT_GRAY_SHULKER_BOX, Blocks.LIME_SHULKER_BOX, Blocks.MAGENTA_SHULKER_BOX, Blocks.ORANGE_SHULKER_BOX, Blocks.PINK_SHULKER_BOX, Blocks.PURPLE_SHULKER_BOX, Blocks.RED_SHULKER_BOX, Blocks.WHITE_SHULKER_BOX, Blocks.YELLOW_SHULKER_BOX, Blocks.PISTON, Blocks.STICKY_PISTON, Blocks.PISTON_HEAD);
|
||||
|
||||
@Unique
|
||||
private static final Set<Material> protocolhack_EFFECTIVE_MATERIALS = ImmutableSet.of(Material.METAL, Material.REPAIR_STATION, Material.STONE);
|
||||
private static final Set<Material> viafabricplus_EFFECTIVE_MATERIALS = ImmutableSet.of(Material.METAL, Material.REPAIR_STATION, Material.STONE);
|
||||
|
||||
@Unique
|
||||
private static final Set<Block> protocolhack_EFFECTIVE_BLOCKS_1152 = ImmutableSet.of(Blocks.ACTIVATOR_RAIL, Blocks.COAL_ORE, Blocks.COBBLESTONE, Blocks.DETECTOR_RAIL, Blocks.DIAMOND_BLOCK, Blocks.DIAMOND_ORE, Blocks.POWERED_RAIL, Blocks.GOLD_BLOCK, Blocks.GOLD_ORE, Blocks.ICE, Blocks.IRON_BLOCK, Blocks.IRON_ORE, Blocks.LAPIS_BLOCK, Blocks.LAPIS_ORE, Blocks.MOSSY_COBBLESTONE, Blocks.NETHERRACK, Blocks.PACKED_ICE, Blocks.BLUE_ICE, Blocks.RAIL, Blocks.REDSTONE_ORE, Blocks.SANDSTONE, Blocks.CHISELED_SANDSTONE, Blocks.CUT_SANDSTONE, Blocks.CHISELED_RED_SANDSTONE, Blocks.CUT_RED_SANDSTONE, Blocks.RED_SANDSTONE, Blocks.STONE, Blocks.GRANITE, Blocks.POLISHED_GRANITE, Blocks.DIORITE, Blocks.POLISHED_DIORITE, Blocks.ANDESITE, Blocks.POLISHED_ANDESITE, Blocks.STONE_SLAB, Blocks.SMOOTH_STONE_SLAB, Blocks.SANDSTONE_SLAB, Blocks.PETRIFIED_OAK_SLAB, Blocks.COBBLESTONE_SLAB, Blocks.BRICK_SLAB, Blocks.STONE_BRICK_SLAB, Blocks.NETHER_BRICK_SLAB, Blocks.QUARTZ_SLAB, Blocks.RED_SANDSTONE_SLAB, Blocks.PURPUR_SLAB, Blocks.SMOOTH_QUARTZ, Blocks.SMOOTH_RED_SANDSTONE, Blocks.SMOOTH_SANDSTONE, Blocks.SMOOTH_STONE, Blocks.STONE_BUTTON, Blocks.STONE_PRESSURE_PLATE, Blocks.POLISHED_GRANITE_SLAB, Blocks.SMOOTH_RED_SANDSTONE_SLAB, Blocks.MOSSY_STONE_BRICK_SLAB, Blocks.POLISHED_DIORITE_SLAB, Blocks.MOSSY_COBBLESTONE_SLAB, Blocks.END_STONE_BRICK_SLAB, Blocks.SMOOTH_SANDSTONE_SLAB, Blocks.SMOOTH_QUARTZ_SLAB, Blocks.GRANITE_SLAB, Blocks.ANDESITE_SLAB, Blocks.RED_NETHER_BRICK_SLAB, Blocks.POLISHED_ANDESITE_SLAB, Blocks.DIORITE_SLAB, Blocks.SHULKER_BOX, Blocks.BLACK_SHULKER_BOX, Blocks.BLUE_SHULKER_BOX, Blocks.BROWN_SHULKER_BOX, Blocks.CYAN_SHULKER_BOX, Blocks.GRAY_SHULKER_BOX, Blocks.GREEN_SHULKER_BOX, Blocks.LIGHT_BLUE_SHULKER_BOX, Blocks.LIGHT_GRAY_SHULKER_BOX, Blocks.LIME_SHULKER_BOX, Blocks.MAGENTA_SHULKER_BOX, Blocks.ORANGE_SHULKER_BOX, Blocks.PINK_SHULKER_BOX, Blocks.PURPLE_SHULKER_BOX, Blocks.RED_SHULKER_BOX, Blocks.WHITE_SHULKER_BOX, Blocks.YELLOW_SHULKER_BOX);
|
||||
private static final Set<Block> viafabricplus_EFFECTIVE_BLOCKS_1152 = ImmutableSet.of(Blocks.ACTIVATOR_RAIL, Blocks.COAL_ORE, Blocks.COBBLESTONE, Blocks.DETECTOR_RAIL, Blocks.DIAMOND_BLOCK, Blocks.DIAMOND_ORE, Blocks.POWERED_RAIL, Blocks.GOLD_BLOCK, Blocks.GOLD_ORE, Blocks.ICE, Blocks.IRON_BLOCK, Blocks.IRON_ORE, Blocks.LAPIS_BLOCK, Blocks.LAPIS_ORE, Blocks.MOSSY_COBBLESTONE, Blocks.NETHERRACK, Blocks.PACKED_ICE, Blocks.BLUE_ICE, Blocks.RAIL, Blocks.REDSTONE_ORE, Blocks.SANDSTONE, Blocks.CHISELED_SANDSTONE, Blocks.CUT_SANDSTONE, Blocks.CHISELED_RED_SANDSTONE, Blocks.CUT_RED_SANDSTONE, Blocks.RED_SANDSTONE, Blocks.STONE, Blocks.GRANITE, Blocks.POLISHED_GRANITE, Blocks.DIORITE, Blocks.POLISHED_DIORITE, Blocks.ANDESITE, Blocks.POLISHED_ANDESITE, Blocks.STONE_SLAB, Blocks.SMOOTH_STONE_SLAB, Blocks.SANDSTONE_SLAB, Blocks.PETRIFIED_OAK_SLAB, Blocks.COBBLESTONE_SLAB, Blocks.BRICK_SLAB, Blocks.STONE_BRICK_SLAB, Blocks.NETHER_BRICK_SLAB, Blocks.QUARTZ_SLAB, Blocks.RED_SANDSTONE_SLAB, Blocks.PURPUR_SLAB, Blocks.SMOOTH_QUARTZ, Blocks.SMOOTH_RED_SANDSTONE, Blocks.SMOOTH_SANDSTONE, Blocks.SMOOTH_STONE, Blocks.STONE_BUTTON, Blocks.STONE_PRESSURE_PLATE, Blocks.POLISHED_GRANITE_SLAB, Blocks.SMOOTH_RED_SANDSTONE_SLAB, Blocks.MOSSY_STONE_BRICK_SLAB, Blocks.POLISHED_DIORITE_SLAB, Blocks.MOSSY_COBBLESTONE_SLAB, Blocks.END_STONE_BRICK_SLAB, Blocks.SMOOTH_SANDSTONE_SLAB, Blocks.SMOOTH_QUARTZ_SLAB, Blocks.GRANITE_SLAB, Blocks.ANDESITE_SLAB, Blocks.RED_NETHER_BRICK_SLAB, Blocks.POLISHED_ANDESITE_SLAB, Blocks.DIORITE_SLAB, Blocks.SHULKER_BOX, Blocks.BLACK_SHULKER_BOX, Blocks.BLUE_SHULKER_BOX, Blocks.BROWN_SHULKER_BOX, Blocks.CYAN_SHULKER_BOX, Blocks.GRAY_SHULKER_BOX, Blocks.GREEN_SHULKER_BOX, Blocks.LIGHT_BLUE_SHULKER_BOX, Blocks.LIGHT_GRAY_SHULKER_BOX, Blocks.LIME_SHULKER_BOX, Blocks.MAGENTA_SHULKER_BOX, Blocks.ORANGE_SHULKER_BOX, Blocks.PINK_SHULKER_BOX, Blocks.PURPLE_SHULKER_BOX, Blocks.RED_SHULKER_BOX, Blocks.WHITE_SHULKER_BOX, Blocks.YELLOW_SHULKER_BOX);
|
||||
|
||||
protected MixinPickaxeItem(float attackDamage, float attackSpeed, ToolMaterial material, TagKey<Block> effectiveBlocks, Settings settings) {
|
||||
super(attackDamage, attackSpeed, material, effectiveBlocks, settings);
|
||||
@ -59,7 +59,7 @@ public abstract class MixinPickaxeItem extends MiningToolItem {
|
||||
return i == 3;
|
||||
} else if (block != Blocks.DIAMOND_BLOCK && block != Blocks.DIAMOND_ORE && block != Blocks.EMERALD_ORE && block != Blocks.EMERALD_BLOCK && block != Blocks.GOLD_BLOCK && block != Blocks.GOLD_ORE && block != Blocks.REDSTONE_ORE) {
|
||||
if (block != Blocks.IRON_BLOCK && block != Blocks.IRON_ORE && block != Blocks.LAPIS_BLOCK && block != Blocks.LAPIS_ORE) {
|
||||
return protocolhack_EFFECTIVE_MATERIALS.contains(state.getMaterial());
|
||||
return viafabricplus_EFFECTIVE_MATERIALS.contains(state.getMaterial());
|
||||
} else
|
||||
return i >= 1;
|
||||
} else
|
||||
@ -71,9 +71,9 @@ public abstract class MixinPickaxeItem extends MiningToolItem {
|
||||
@Override
|
||||
public float getMiningSpeedMultiplier(ItemStack stack, BlockState state) {
|
||||
if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_15_2)) {
|
||||
return protocolhack_EFFECTIVE_MATERIALS.contains(state.getMaterial()) || protocolhack_EFFECTIVE_BLOCKS_1152.contains(state.getBlock()) ? this.miningSpeed : 1.0F;
|
||||
return viafabricplus_EFFECTIVE_MATERIALS.contains(state.getMaterial()) || viafabricplus_EFFECTIVE_BLOCKS_1152.contains(state.getBlock()) ? this.miningSpeed : 1.0F;
|
||||
} else if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_16_4)) {
|
||||
return protocolhack_EFFECTIVE_MATERIALS.contains(state.getMaterial()) || protocolhack_EFFECTIVE_BLOCKS_1165.contains(state.getBlock()) ? this.miningSpeed : 1.0F;
|
||||
return viafabricplus_EFFECTIVE_MATERIALS.contains(state.getMaterial()) || viafabricplus_EFFECTIVE_BLOCKS_1165.contains(state.getBlock()) ? this.miningSpeed : 1.0F;
|
||||
}
|
||||
return super.getMiningSpeedMultiplier(stack, state);
|
||||
}
|
||||
|
@ -93,7 +93,7 @@ public class MixinConnectScreen_1 {
|
||||
userConnection.put(new ChatSession1_19_2(userConnection, profileKey, playerKeyPair.privateKey()));
|
||||
|
||||
if (ViaLoadingBase.getClassWrapper().getTargetVersion().isEqualTo(ProtocolVersion.v1_19)) {
|
||||
final byte[] legacyKey = ((IPublicKeyData) (Object) publicKeyData).viafabricplus_get1_19_0Key().array();
|
||||
final byte[] legacyKey = ((IPublicKeyData) (Object) publicKeyData).viafabricplus_getV1Key().array();
|
||||
if (legacyKey != null) {
|
||||
userConnection.put(new ChatSession1_19_0(userConnection, profileKey, playerKeyPair.privateKey(), legacyKey));
|
||||
} else {
|
||||
|
@ -40,7 +40,7 @@ public class MixinDownloadingTerrainScreen extends Screen {
|
||||
@Shadow private boolean closeOnNextTick;
|
||||
@Shadow private boolean ready;
|
||||
@Unique
|
||||
private int protocolhack_tickCounter;
|
||||
private int viafabricplus_tickCounter;
|
||||
|
||||
public MixinDownloadingTerrainScreen(Text title) {
|
||||
super(title);
|
||||
@ -49,9 +49,9 @@ public class MixinDownloadingTerrainScreen extends Screen {
|
||||
@Inject(method = "tick", at = @At("HEAD"), cancellable = true)
|
||||
public void injectTick(CallbackInfo ci) {
|
||||
if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThanOrEqualTo(ProtocolVersion.v1_12_1)) {
|
||||
protocolhack_tickCounter++;
|
||||
viafabricplus_tickCounter++;
|
||||
|
||||
if (protocolhack_tickCounter % 20 == 0) {
|
||||
if (viafabricplus_tickCounter % 20 == 0) {
|
||||
MinecraftClient.getInstance().getNetworkHandler().sendPacket(new KeepAliveC2SPacket(0));
|
||||
}
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ public class MixinGameModeSelectionScreen {
|
||||
@Shadow @Final private static int UI_WIDTH;
|
||||
|
||||
@Unique
|
||||
private GameModeSelectionScreen.GameModeSelection[] protocolhack_unwrappedGameModes;
|
||||
private GameModeSelectionScreen.GameModeSelection[] viafabricplus_unwrappedGameModes;
|
||||
|
||||
@Inject(method = "<init>", at = @At("RETURN"))
|
||||
public void fixUIWidth(CallbackInfo ci) {
|
||||
@ -46,15 +46,15 @@ public class MixinGameModeSelectionScreen {
|
||||
if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThan(LegacyProtocolVersion.r1_3_1tor1_3_2)) gameModeSelections.remove(GameModeSelectionScreen.GameModeSelection.ADVENTURE);
|
||||
if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThan(ProtocolVersion.v1_8)) gameModeSelections.remove(GameModeSelectionScreen.GameModeSelection.SPECTATOR);
|
||||
|
||||
protocolhack_unwrappedGameModes = gameModeSelections.toArray(GameModeSelectionScreen.GameModeSelection[]::new);
|
||||
UI_WIDTH = protocolhack_unwrappedGameModes.length * 31 - 5;
|
||||
viafabricplus_unwrappedGameModes = gameModeSelections.toArray(GameModeSelectionScreen.GameModeSelection[]::new);
|
||||
UI_WIDTH = viafabricplus_unwrappedGameModes.length * 31 - 5;
|
||||
}
|
||||
}
|
||||
|
||||
@Redirect(method = "init", at = @At(value = "FIELD", target = "Lnet/minecraft/client/gui/screen/GameModeSelectionScreen$GameModeSelection;VALUES:[Lnet/minecraft/client/gui/screen/GameModeSelectionScreen$GameModeSelection;"))
|
||||
public GameModeSelectionScreen.GameModeSelection[] removeNewerGameModes() {
|
||||
if (ViaLoadingBase.getClassWrapper().getTargetVersion().isOlderThan(ProtocolVersion.v1_8)) {
|
||||
return protocolhack_unwrappedGameModes;
|
||||
return viafabricplus_unwrappedGameModes;
|
||||
}
|
||||
return GameModeSelectionScreen.GameModeSelection.values();
|
||||
}
|
||||
|
@ -38,7 +38,7 @@ public abstract class MixinMerchantScreen extends HandledScreen<MerchantScreenHa
|
||||
private int selectedIndex;
|
||||
|
||||
@Unique
|
||||
private int protocolhack_previousRecipeIndex;
|
||||
private int viafabricplus_previousRecipeIndex;
|
||||
|
||||
public MixinMerchantScreen(MerchantScreenHandler handler, PlayerInventory inventory, Text title) {
|
||||
super(handler, inventory, title);
|
||||
@ -46,18 +46,18 @@ public abstract class MixinMerchantScreen extends HandledScreen<MerchantScreenHa
|
||||
|
||||
@Inject(method = "init", at = @At("HEAD"))
|
||||
public void reset(CallbackInfo ci) {
|
||||
protocolhack_previousRecipeIndex = 0;
|
||||
viafabricplus_previousRecipeIndex = 0;
|
||||
}
|
||||
|
||||
@Inject(method = "syncRecipeIndex", at = @At("HEAD"))
|
||||
public void smoothOutRecipeIndex(CallbackInfo ci) {
|
||||
if (DebugSettings.getClassWrapper().smoothOutMerchantScreens.getValue()) {
|
||||
if (protocolhack_previousRecipeIndex != selectedIndex) {
|
||||
int direction = protocolhack_previousRecipeIndex < selectedIndex ? 1 : -1;
|
||||
for (int smooth = protocolhack_previousRecipeIndex + direction /* don't send the page we already are on */; smooth != selectedIndex; smooth += direction) {
|
||||
if (viafabricplus_previousRecipeIndex != selectedIndex) {
|
||||
int direction = viafabricplus_previousRecipeIndex < selectedIndex ? 1 : -1;
|
||||
for (int smooth = viafabricplus_previousRecipeIndex + direction /* don't send the page we already are on */; smooth != selectedIndex; smooth += direction) {
|
||||
client.getNetworkHandler().sendPacket(new SelectMerchantTradeC2SPacket(smooth));
|
||||
}
|
||||
protocolhack_previousRecipeIndex = selectedIndex;
|
||||
viafabricplus_previousRecipeIndex = selectedIndex;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
public class MixinScreenHandler implements IScreenHandler {
|
||||
|
||||
@Unique
|
||||
private short protocolhack_lastActionId = 0;
|
||||
private short viafabricplus_lastActionId = 0;
|
||||
|
||||
@Inject(method = "internalOnSlotClick", at = @At("HEAD"), cancellable = true)
|
||||
private void injectInternalOnSlotClick(int slot, int clickData, SlotActionType actionType, PlayerEntity player, CallbackInfo ci) {
|
||||
@ -44,6 +44,6 @@ public class MixinScreenHandler implements IScreenHandler {
|
||||
|
||||
@Override
|
||||
public short viafabricplus_getAndIncrementLastActionId() {
|
||||
return ++protocolhack_lastActionId;
|
||||
return ++viafabricplus_lastActionId;
|
||||
}
|
||||
}
|
||||
|
@ -35,23 +35,23 @@ import java.util.Map;
|
||||
public abstract class MixinProtocolVersion {
|
||||
|
||||
@Unique
|
||||
private static Map<String, Pair<String, VersionRange>> protocolhack_remaps;
|
||||
private static Map<String, Pair<String, VersionRange>> viafabricplus_remaps;
|
||||
|
||||
@Inject(method = "<clinit>", at = @At("HEAD"))
|
||||
private static void initMaps(CallbackInfo ci) {
|
||||
protocolhack_remaps = new HashMap<>();
|
||||
protocolhack_remaps.put("1.7-1.7.5", new Pair<>("1.7.2-1.7.5", new VersionRange("1.7", 2, 5)));
|
||||
protocolhack_remaps.put("1.9.3/4", new Pair<>("1.9.3-1.9.4", null));
|
||||
protocolhack_remaps.put("1.11.1/2", new Pair<>("1.11.1-1.11.2", null));
|
||||
protocolhack_remaps.put("1.16.4/5", new Pair<>("1.16.4-1.16.5", null));
|
||||
protocolhack_remaps.put("1.18/1.18.1", new Pair<>("1.18-1.18.1", null));
|
||||
protocolhack_remaps.put("1.19.1/2", new Pair<>("1.19.1-1.19.2", null));
|
||||
protocolhack_remaps.put("1.19.4", new Pair<>("1.19.4-rc1", null));
|
||||
viafabricplus_remaps = new HashMap<>();
|
||||
viafabricplus_remaps.put("1.7-1.7.5", new Pair<>("1.7.2-1.7.5", new VersionRange("1.7", 2, 5)));
|
||||
viafabricplus_remaps.put("1.9.3/4", new Pair<>("1.9.3-1.9.4", null));
|
||||
viafabricplus_remaps.put("1.11.1/2", new Pair<>("1.11.1-1.11.2", null));
|
||||
viafabricplus_remaps.put("1.16.4/5", new Pair<>("1.16.4-1.16.5", null));
|
||||
viafabricplus_remaps.put("1.18/1.18.1", new Pair<>("1.18-1.18.1", null));
|
||||
viafabricplus_remaps.put("1.19.1/2", new Pair<>("1.19.1-1.19.2", null));
|
||||
viafabricplus_remaps.put("1.19.4", new Pair<>("1.19.4-rc1", null));
|
||||
}
|
||||
|
||||
@Redirect(method = "<clinit>", at = @At(value = "INVOKE", target = "Lcom/viaversion/viaversion/api/protocol/version/ProtocolVersion;register(ILjava/lang/String;)Lcom/viaversion/viaversion/api/protocol/version/ProtocolVersion;"))
|
||||
private static ProtocolVersion unregisterAndRenameVersions(int version, String name) {
|
||||
final Pair<String, VersionRange> remapEntry = protocolhack_remaps.get(name);
|
||||
final Pair<String, VersionRange> remapEntry = viafabricplus_remaps.get(name);
|
||||
if (remapEntry != null) {
|
||||
if (remapEntry.key() != null) name = remapEntry.key();
|
||||
}
|
||||
@ -62,7 +62,7 @@ public abstract class MixinProtocolVersion {
|
||||
@SuppressWarnings({"UnresolvedMixinReference", "MixinAnnotationTarget", "InvalidInjectorMethodSignature"}) // Optional injection
|
||||
@Redirect(method = "<clinit>", at = @At(value = "INVOKE", target = "Lcom/viaversion/viaversion/api/protocol/version/ProtocolVersion;register(IILjava/lang/String;)Lcom/viaversion/viaversion/api/protocol/version/ProtocolVersion;"), require = 0)
|
||||
private static ProtocolVersion unregisterAndRenameVersions(int version, int snapshotVersion, String name) {
|
||||
final Pair<String, VersionRange> remapEntry = protocolhack_remaps.get(name);
|
||||
final Pair<String, VersionRange> remapEntry = viafabricplus_remaps.get(name);
|
||||
if (remapEntry != null) {
|
||||
if (remapEntry.key() != null) name = remapEntry.key();
|
||||
}
|
||||
@ -72,7 +72,7 @@ public abstract class MixinProtocolVersion {
|
||||
|
||||
@Redirect(method = "<clinit>", at = @At(value = "INVOKE", target = "Lcom/viaversion/viaversion/api/protocol/version/ProtocolVersion;register(ILjava/lang/String;Lcom/viaversion/viaversion/api/protocol/version/VersionRange;)Lcom/viaversion/viaversion/api/protocol/version/ProtocolVersion;"))
|
||||
private static ProtocolVersion unregisterAndRenameVersions(int version, String name, VersionRange versionRange) {
|
||||
final Pair<String, VersionRange> remapEntry = protocolhack_remaps.get(name);
|
||||
final Pair<String, VersionRange> remapEntry = viafabricplus_remaps.get(name);
|
||||
if (remapEntry != null) {
|
||||
if (remapEntry.key() != null) name = remapEntry.key();
|
||||
if (remapEntry.value() != null) versionRange = remapEntry.value();
|
||||
|
@ -33,22 +33,22 @@ public class MixinInventoryAcknowledgements {
|
||||
@Mutable
|
||||
@Shadow @Final private IntList ids;
|
||||
@Unique
|
||||
private it.unimi.dsi.fastutil.ints.IntList protocolhack_ids;
|
||||
private it.unimi.dsi.fastutil.ints.IntList viafabricplus_ids;
|
||||
|
||||
@Inject(method = "<init>", at = @At("RETURN"))
|
||||
public void fixJavaIssue(CallbackInfo ci) {
|
||||
this.ids = null;
|
||||
this.protocolhack_ids = IntLists.synchronize(new IntArrayList());
|
||||
this.viafabricplus_ids = IntLists.synchronize(new IntArrayList());
|
||||
}
|
||||
|
||||
@Inject(method = "addId", at = @At("HEAD"), cancellable = true)
|
||||
public void forwardAdd(int id, CallbackInfo ci) {
|
||||
protocolhack_ids.add(id);
|
||||
viafabricplus_ids.add(id);
|
||||
ci.cancel();
|
||||
}
|
||||
|
||||
@Inject(method = "removeId", at = @At("HEAD"), cancellable = true)
|
||||
public void forwardRemove(int id, CallbackInfoReturnable<Boolean> cir) {
|
||||
cir.setReturnValue(protocolhack_ids.rem(id));
|
||||
cir.setReturnValue(viafabricplus_ids.rem(id));
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user