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
6 changes: 3 additions & 3 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ plugins {
id("java-library")
id("maven-publish")

id("io.papermc.paperweight.userdev") version "2.0.0-beta.17" apply false
id("com.gradleup.shadow") version "8.3.6"
id("io.papermc.paperweight.userdev") version "2.0.0-beta.21" apply false
id("com.gradleup.shadow") version "9.4.1"
}

tasks["jar"].enabled = false
Expand Down Expand Up @@ -31,7 +31,7 @@ allprojects {

java {
withSourcesJar()
toolchain.languageVersion.set(JavaLanguageVersion.of(21))
toolchain.languageVersion.set(JavaLanguageVersion.of(25))

sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-9.4.1-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
9 changes: 3 additions & 6 deletions gradlew

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions gradlew.bat

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 30 additions & 0 deletions platform-paper-26.1/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import io.papermc.paperweight.userdev.ReobfArtifactConfiguration

plugins {
id("io.papermc.paperweight.userdev")
}

dependencies {
api(project(":platform-common"))
paperweight.paperDevBundle("26.1.1.build.+")
}

java {
sourceCompatibility = JavaVersion.VERSION_25
targetCompatibility = JavaVersion.VERSION_25
}

// hack to allow depending on this platform in java 17 projects
configurations.runtimeElements.configure {
attributes.attribute(TargetJvmVersion.TARGET_JVM_VERSION_ATTRIBUTE, 17)
}

paperweight {
reobfArtifactConfiguration = ReobfArtifactConfiguration.MOJANG_PRODUCTION
}

tasks.reobfJar {
// hacky workaround to make the shadow plugin shadow our mojang-mapped jar
outputJar.set(tasks.jar.map { it.outputs.files.singleFile }.get())
enabled = false
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
package de.pianoman911.mapengine.common;

import de.pianoman911.mapengine.api.util.PassthroughMode;
import de.pianoman911.mapengine.common.platform.IListenerBridge;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.MessageToMessageDecoder;
import net.minecraft.network.protocol.Packet;
import net.minecraft.network.protocol.game.ClientboundAnimatePacket;
import net.minecraft.network.protocol.game.ServerboundAttackPacket;
import net.minecraft.network.protocol.game.ServerboundInteractPacket;
import net.minecraft.network.protocol.game.ServerboundSwingPacket;
import net.minecraft.world.phys.Vec3;
import org.bukkit.craftbukkit.entity.CraftPlayer;
import org.bukkit.entity.Player;

import java.util.List;

public final class Paper261Listener extends MessageToMessageDecoder<Packet<?>> {

private final Player player;
private final IListenerBridge bridge;

public Paper261Listener(Player player, IListenerBridge bridge) {
this.player = player;
this.bridge = bridge;
}

@Override
public boolean acceptInboundMessage(Object msg) {
return msg instanceof ServerboundInteractPacket || msg instanceof ServerboundSwingPacket || msg instanceof ServerboundAttackPacket;
}

@Override
protected void decode(ChannelHandlerContext ctx, Packet<?> msg, List<Object> out) {
PassthroughMode passthroughMode = null;
if (msg instanceof ServerboundInteractPacket interact) {
int entityId = interact.entityId();
Vec3 pos = interact.location();

passthroughMode = this.bridge.handleInteract(this.player, entityId, pos.x, pos.y, pos.z);
} else if (msg instanceof ServerboundSwingPacket) {
passthroughMode = this.bridge.handleSwing(this.player);
this.handleAnimation(passthroughMode);
} else if (msg instanceof ServerboundAttackPacket(int entityId)) {
passthroughMode = this.bridge.handleAttack(this.player, entityId);
this.handleAnimation(passthroughMode);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't do duplicate animation handling

}
if (passthroughMode != null && passthroughMode != PassthroughMode.ALL) {
return;
}

out.add(msg);
}
Comment thread
booky10 marked this conversation as resolved.

private void handleAnimation(PassthroughMode passthroughMode) {
if (passthroughMode != PassthroughMode.ONLY_ANIMATION) {
return;
}
ClientboundAnimatePacket animatePacket = new ClientboundAnimatePacket(((CraftPlayer) this.player).getHandle(),
ClientboundAnimatePacket.SWING_MAIN_HAND);
this.player.getTrackedBy().forEach(player -> ((CraftPlayer) player).getHandle().connection.send(animatePacket));
}
}
Loading