Skip to content

Commit

Permalink
feat: takenaka support for 1.21.3
Browse files Browse the repository at this point in the history
Protocol is yet to be updated
  • Loading branch information
Misat11 committed Oct 25, 2024
1 parent 07127fb commit 0280207
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
import org.screamingsandals.lib.impl.nms.accessors.network.protocol.game.ClientboundResetScorePacketAccessor;
import org.screamingsandals.lib.impl.nms.accessors.network.protocol.game.ClientboundRotateHeadPacketAccessor;
import org.screamingsandals.lib.impl.nms.accessors.network.protocol.game.ClientboundSetCameraPacketAccessor;
import org.screamingsandals.lib.impl.nms.accessors.network.protocol.game.ClientboundSetCarriedItemPacketAccessor;
import org.screamingsandals.lib.impl.nms.accessors.network.protocol.game.ClientboundSetHeldSlotPacketAccessor;
import org.screamingsandals.lib.impl.nms.accessors.network.protocol.game.ClientboundSetDisplayObjectivePacketAccessor;
import org.screamingsandals.lib.impl.nms.accessors.network.protocol.game.ClientboundSetEntityDataPacketAccessor;
import org.screamingsandals.lib.impl.nms.accessors.network.protocol.game.ClientboundSetEntityLinkPacketAccessor;
Expand Down Expand Up @@ -97,7 +97,7 @@ public class PacketIdMapping {
putTranslateSafely(ClientboundRemoveMobEffectPacket.class, ClientboundRemoveMobEffectPacketAccessor.TYPE.get());
putTranslateSafely(ClientboundRotateHeadPacket.class, ClientboundRotateHeadPacketAccessor.TYPE.get());
putTranslateSafely(ClientboundSetCameraPacket.class, ClientboundSetCameraPacketAccessor.TYPE.get());
putTranslateSafely(ClientboundSetCarriedItemPacket.class, ClientboundSetCarriedItemPacketAccessor.TYPE.get());
putTranslateSafely(ClientboundSetCarriedItemPacket.class, ClientboundSetHeldSlotPacketAccessor.TYPE.get());
putTranslateSafely(ClientboundSetDisplayObjectivePacket.class, ClientboundSetDisplayObjectivePacketAccessor.TYPE.get());
putTranslateSafely(ClientboundSetEntityDataPacket.class, ClientboundSetEntityDataPacketAccessor.TYPE.get());
putTranslateSafely(ClientboundSetEntityLinkPacket.class, ClientboundSetEntityLinkPacketAccessor.TYPE.get());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ public class PacketIdMapping1_20_5 {
private static final @NotNull Map<@NotNull Class<? extends AbstractPacket>, Integer> ID_CACHE = new ConcurrentHashMap<>();
private static @Nullable Map<Object, Integer> map;

// TODO: update the protocol to 1.21.2/3
static {
PACKET_RESOURCE_LOCATION.put(ClientboundAddEntityPacket.class, "minecraft:add_entity");
PACKET_RESOURCE_LOCATION.put(ClientboundAnimatePacket.class, "minecraft:animate");
Expand All @@ -92,7 +93,7 @@ public class PacketIdMapping1_20_5 {
PACKET_RESOURCE_LOCATION.put(ClientboundRemoveMobEffectPacket.class, "minecraft:remove_mob_effect");
PACKET_RESOURCE_LOCATION.put(ClientboundRotateHeadPacket.class, "minecraft:rotate_head");
PACKET_RESOURCE_LOCATION.put(ClientboundSetCameraPacket.class, "minecraft:set_camera");
PACKET_RESOURCE_LOCATION.put(ClientboundSetCarriedItemPacket.class, "minecraft:set_carried_item");
PACKET_RESOURCE_LOCATION.put(ClientboundSetCarriedItemPacket.class, "minecraft:set_carried_item"); // TODO: did the id change?
PACKET_RESOURCE_LOCATION.put(ClientboundSetDisplayObjectivePacket.class, "minecraft:set_display_objective");
PACKET_RESOURCE_LOCATION.put(ClientboundSetEntityDataPacket.class, "minecraft:set_entity_data");
PACKET_RESOURCE_LOCATION.put(ClientboundSetEntityLinkPacket.class, "minecraft:set_entity_link");
Expand Down
4 changes: 2 additions & 2 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ junit-platform = "1.10.2"
# plugins
screaming-plugin-builder = "1.0.86"
takenaka = "1.2.0"
mappings = "1.8.8+1.21.1"
mappings = "1.8.8+1.21.3"

[libraries]
paperlib = { group = "io.papermc", name = "paperlib", version.ref = "paperlib" }
Expand Down Expand Up @@ -104,4 +104,4 @@ takenaka-mappings = { group = "me.kcra.takenaka", name = "mappings", version.ref
[plugins]
screaming-plugin-builder = { id = "org.screamingsandals.plugin-builder", version.ref = "screaming-plugin-builder" }
kotlin = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
takenaka = { id = "me.kcra.takenaka.accessor", version.ref = "takenaka" }
takenaka = { id = "me.kcra.takenaka.accessor", version.ref = "takenaka" }
12 changes: 6 additions & 6 deletions nms/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,12 @@ class SlibNamingStrategy extends ForwardingNamingStrategy {
accessors {
// uncomment this and remove the mappingBundle dependency,
// if you want to develop against custom versions
/*versionRange('1.8.8', '1.21.1') {
// exclude 1.20, 1.20.3 and 1.20.5 - hotfixed versions
/*versionRange('1.8.8', '1.21.3') {
// exclude 1.20, 1.20.3, 1.20.5 and 1.21.1 - hotfixed versions
// exclude 1.16 and 1.10.1, they don't have most mappings and are basically not used at all
// exclude 1.8.9, client-only update - no Spigot mappings, no thank you
// exclude 1.9.1 and 1.9.3 - no mappings at all
exclude '1.16', '1.10.1', '1.8.9', '1.9.1', '1.9.3', '1.20', '1.20.3', '1.20.5'
exclude '1.16', '1.10.1', '1.8.9', '1.9.1', '1.9.3', '1.20', '1.20.3', '1.20.5', '1.21.1'
// include only releases, no snapshots
includeTypes 'release'
Expand Down Expand Up @@ -133,7 +133,7 @@ accessors {
field(int, 'removeArrowTime')
getter(int, 'arrowCount')
setter(int, 'arrowCount')
method(boolean, 'doHurtTarget', Entity)
method(boolean, 'doHurtTarget', Entity) // <= 1.21.1, no longer needed
method(void, 'swing', InteractionHand)
getter(float, 'absorptionAmount')
setter(float, 'absorptionAmount')
Expand Down Expand Up @@ -352,7 +352,7 @@ accessors {
mapClass('net.minecraft.network.protocol.game.ClientboundSetEntityMotionPacket')
mapClass('net.minecraft.network.protocol.game.ClientboundSetExperiencePacket')
mapClass('net.minecraft.network.protocol.game.ClientboundExplodePacket')
mapClass('net.minecraft.network.protocol.game.ClientboundSetCarriedItemPacket')
mapClass('net.minecraft.network.protocol.game.ClientboundSetHeldSlotPacket')

mapClass('net.minecraft.network.protocol.common.ClientboundDisconnectPacket')

Expand Down Expand Up @@ -740,4 +740,4 @@ if (tasks.findByName("sourceJar")) {
tasks.named("sourceJar") {
dependsOn('generateAccessors')
}
}
}

0 comments on commit 0280207

Please sign in to comment.