Uses Mixin Magic to add BlockBreakAnimation Packets to the Replay when a Player breaks a block
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
package eu.crushedpixel.replaymod.mixin;
|
||||
|
||||
import eu.crushedpixel.replaymod.recording.ConnectionEventHandler;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.RenderGlobal;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.network.play.server.S25PacketBlockBreakAnim;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
@Mixin(RenderGlobal.class)
|
||||
public abstract class MixinRenderGlobal {
|
||||
@Inject(method = "sendBlockBreakProgress", at = @At("HEAD"))
|
||||
public void saveBlockBreakProgressPacket(int breakerId, BlockPos pos, int progress, CallbackInfo info) {
|
||||
if(ConnectionEventHandler.isRecording()) {
|
||||
EntityPlayer thePlayer = Minecraft.getMinecraft().thePlayer;
|
||||
if(thePlayer != null && breakerId == thePlayer.getEntityId()) {
|
||||
ConnectionEventHandler.insertPacket(new S25PacketBlockBreakAnim(breakerId, pos, progress));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -8,7 +8,8 @@
|
||||
"MixinRender",
|
||||
"MixinRendererLivingEntity",
|
||||
"MixinRenderItem",
|
||||
"MixinRenderManager"
|
||||
"MixinRenderManager",
|
||||
"MixinRenderGlobal"
|
||||
],
|
||||
"server": [],
|
||||
"client": [],
|
||||
|
||||
Reference in New Issue
Block a user