Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
fi

- name: Gradle Publish
if: "${{ github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/heads/version/') }}"
if: "${{ github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/heads/version/') || github.ref == 'refs/heads/feature/bucket-desync' }}"
run: ./gradlew publish

- name: Gradle Release
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
/*
* This file is part of Apollo, licensed under the MIT License.
*
* Copyright (c) 2023 Moonsworth
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package com.lunarclient.apollo.event.packetenrichment.world;

import com.lunarclient.apollo.event.Event;
import com.lunarclient.apollo.module.packetenrichment.PlayerInfo;
import com.lunarclient.apollo.module.packetenrichment.raytrace.RayTraceResult;
import com.lunarclient.apollo.player.ApolloPlayer;
import lombok.Value;

/**
* Represents an event that is fired when a player uses a bucket (1.7 and 1.8).
*
* @since 1.2.2
*/
@Value
public class ApolloPlayerUseItemBucketEvent implements Event {

/**
* The player that sent the packet.
*
* @return the player
* @since 1.2.2
*/
ApolloPlayer player;

/**
* The {@code long} representing the unix timestamp
* when the packet was created.
*
* @return the unix timestamp
* @since 1.2.2
*/
long instantiationTimeMs;

/**
* The player's {@link PlayerInfo} information.
*
* @return the player info
* @since 1.2.2
*/
PlayerInfo playerInfo;

/**
* The result of the client's {@link RayTraceResult} for this bucket interaction.
*
* @return the ray trace result
* @since 1.2.2
*/
RayTraceResult rayTraceResult;

}
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
import lombok.Value;

/**
* Represents an event that is when a player uses an item (1.16.1+).
* Represents an event that is fired when a player uses an item (1.16.1+).
*
* @since 1.0.7
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@

import com.lunarclient.apollo.module.ApolloModule;
import com.lunarclient.apollo.module.ModuleDefinition;
import com.lunarclient.apollo.option.Option;
import com.lunarclient.apollo.option.SimpleOption;
import io.leangen.geantyref.TypeToken;
import org.jetbrains.annotations.ApiStatus;

/**
Expand All @@ -36,8 +39,125 @@
@ModuleDefinition(id = "packet_enrichment", name = "PacketEnrichment")
public abstract class PacketEnrichmentModule extends ApolloModule {

/**
* Controls whether the client sends an additional player attack packet to the server.
*
* @since 1.2.2
*/
public static final SimpleOption<Boolean> PLAYER_ATTACK_PACKET = Option.<Boolean>builder()
.comment("Set to 'true' to have the client send an additional player attack packet to the server, otherwise 'false'.")
.node("player-attack", "send-packet").type(TypeToken.get(Boolean.class))
.defaultValue(false).notifyClient().build();

/**
* Controls whether Apollo fires {@link com.lunarclient.apollo.event.packetenrichment.melee.ApolloPlayerAttackEvent}
* when the packet is received.
*
* @since 1.2.2
*/
public static final SimpleOption<Boolean> PLAYER_ATTACK_EVENT = Option.<Boolean>builder()
.comment("If 'true', Apollo fires the player attack event on the main thread. Disable this and handle the packet yourself if you require asynchronous or off-thread processing.")
.node("player-attack", "fire-apollo-event").type(TypeToken.get(Boolean.class))
.defaultValue(false).build();

/**
* Controls whether the client sends an additional player chat open packet to the server.
*
* @since 1.2.2
*/
public static final SimpleOption<Boolean> PLAYER_CHAT_OPEN_PACKET = Option.<Boolean>builder()
.comment("Set to 'true' to have the client send an additional player chat open packet to the server, otherwise 'false'.")
.node("player-chat-open", "send-packet").type(TypeToken.get(Boolean.class))
.defaultValue(false).notifyClient().build();

/**
* Controls whether Apollo fires {@link com.lunarclient.apollo.event.packetenrichment.chat.ApolloPlayerChatOpenEvent}
* when the packet is received.
*
* @since 1.2.2
*/
public static final SimpleOption<Boolean> PLAYER_CHAT_OPEN_EVENT = Option.<Boolean>builder()
.comment("If 'true', Apollo fires the player chat open event on the main thread. Disable this and handle the packet yourself if you require asynchronous or off-thread processing.")
.node("player-chat-open", "fire-apollo-event").type(TypeToken.get(Boolean.class))
.defaultValue(false).build();

/**
* Controls whether the client sends an additional player chat close packet to the server.
*
* @since 1.2.2
*/
public static final SimpleOption<Boolean> PLAYER_CHAT_CLOSE_PACKET = Option.<Boolean>builder()
.comment("Set to 'true' to have the client send an additional player chat close packet to the server, otherwise 'false'.")
.node("player-chat-close", "send-packet").type(TypeToken.get(Boolean.class))
.defaultValue(false).notifyClient().build();

/**
* Controls whether Apollo fires {@link com.lunarclient.apollo.event.packetenrichment.chat.ApolloPlayerChatCloseEvent}
* when the packet is received.
*
* @since 1.2.2
*/
public static final SimpleOption<Boolean> PLAYER_CHAT_CLOSE_EVENT = Option.<Boolean>builder()
.comment("If 'true', Apollo fires the player chat close event on the main thread. Disable this and handle the packet yourself if you require asynchronous or off-thread processing.")
.node("player-chat-close", "fire-apollo-event").type(TypeToken.get(Boolean.class))
.defaultValue(false).build();

/**
* Controls whether the client sends an additional player use item packet to the server.
*
* @since 1.2.2
*/
public static final SimpleOption<Boolean> PLAYER_USE_ITEM_PACKET = Option.<Boolean>builder()
.comment("Set to 'true' to have the client send an additional player use item packet to the server, otherwise 'false'.")
.node("player-use-item", "send-packet").type(TypeToken.get(Boolean.class))
.defaultValue(false).notifyClient().build();

/**
* Controls whether Apollo fires {@link com.lunarclient.apollo.event.packetenrichment.world.ApolloPlayerUseItemEvent}
* when the packet is received.
*
* @since 1.2.2
*/
public static final SimpleOption<Boolean> PLAYER_USE_ITEM_EVENT = Option.<Boolean>builder()
.comment("If 'true', Apollo fires the player use item event on the main thread. Disable this and handle the packet yourself if you require asynchronous or off-thread processing.")
.node("player-use-item", "fire-apollo-event").type(TypeToken.get(Boolean.class))
.defaultValue(false).build();

/**
* Controls whether the client sends an additional player use item bucket packet to the server.
*
* @since 1.2.2
*/
public static final SimpleOption<Boolean> PLAYER_USE_ITEM_BUCKET_PACKET = Option.<Boolean>builder()
.comment("Set to 'true' to have the client send an additional player use item bucket packet to the server, otherwise 'false'.")
.node("player-use-item-bucket", "send-packet").type(TypeToken.get(Boolean.class))
.defaultValue(false).notifyClient().build();

/**
* Controls whether Apollo fires {@link com.lunarclient.apollo.event.packetenrichment.world.ApolloPlayerUseItemBucketEvent}
* when the packet is received.
*
* @since 1.2.2
*/
public static final SimpleOption<Boolean> PLAYER_USE_ITEM_BUCKET_EVENT = Option.<Boolean>builder()
.comment("If 'true', Apollo fires the player use item bucket event on the main thread. Disable this and handle the packet yourself if you require asynchronous or off-thread processing.")
.node("player-use-item-bucket", "fire-apollo-event").type(TypeToken.get(Boolean.class))
.defaultValue(false).build();

protected PacketEnrichmentModule() {
this.registerOptions(ApolloModule.ENABLE_OPTION_OFF);
this.registerOptions(
ApolloModule.ENABLE_OPTION_OFF,
PacketEnrichmentModule.PLAYER_ATTACK_PACKET,
PacketEnrichmentModule.PLAYER_ATTACK_EVENT,
PacketEnrichmentModule.PLAYER_CHAT_OPEN_PACKET,
PacketEnrichmentModule.PLAYER_CHAT_OPEN_EVENT,
PacketEnrichmentModule.PLAYER_CHAT_CLOSE_PACKET,
PacketEnrichmentModule.PLAYER_CHAT_CLOSE_EVENT,
PacketEnrichmentModule.PLAYER_USE_ITEM_PACKET,
PacketEnrichmentModule.PLAYER_USE_ITEM_EVENT,
PacketEnrichmentModule.PLAYER_USE_ITEM_BUCKET_PACKET,
PacketEnrichmentModule.PLAYER_USE_ITEM_BUCKET_EVENT
);
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
/*
* This file is part of Apollo, licensed under the MIT License.
*
* Copyright (c) 2023 Moonsworth
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package com.lunarclient.apollo.module.packetenrichment.raytrace;

import com.lunarclient.apollo.common.location.ApolloBlockLocation;
import com.lunarclient.apollo.common.location.ApolloLocation;
import lombok.Builder;
import lombok.Getter;

/**
* Represents the block hit ray trace result.
*
* @since 1.2.2
*/
@Getter
@Builder
public class BlockHitResult extends RayTraceResult {

/**
* The exact hit {@link ApolloLocation} of the ray on the block.
*
* @return the hit location
* @since 1.2.2
*/
ApolloLocation hitLocation;

/**
* The {@link ApolloBlockLocation} of the block that was hit.
*
* @return the block location
* @since 1.2.2
*/
ApolloBlockLocation blockLocation;

/**
* The {@link Direction} from which the block was hit.
*
* @return the direction
* @since 1.2.2
*/
Direction direction;

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/*
* This file is part of Apollo, licensed under the MIT License.
*
* Copyright (c) 2023 Moonsworth
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package com.lunarclient.apollo.module.packetenrichment.raytrace;

/**
* Represents a direction in which a block was hit.
*
* @since 1.2.2
*/
public enum Direction {
DOWN,
UP,
NORTH,
SOUTH,
WEST,
EAST
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
/*
* This file is part of Apollo, licensed under the MIT License.
*
* Copyright (c) 2023 Moonsworth
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package com.lunarclient.apollo.module.packetenrichment.raytrace;

import com.lunarclient.apollo.common.ApolloEntity;
import com.lunarclient.apollo.common.location.ApolloLocation;
import lombok.Builder;
import lombok.Getter;

/**
* Represents the entity hit ray trace result.
*
* @since 1.2.2
*/
@Getter
@Builder
public class EntityHitResult extends RayTraceResult {

/**
* The exact hit {@link ApolloLocation} of the ray on the entity.
*
* @return the hit location
* @since 1.2.2
*/
ApolloLocation hitLocation;

/**
* The {@link ApolloEntity} that was hit.
*
* @return the entity ID
* @since 1.2.2
*/
ApolloEntity entityId;

}
Loading