1.0.2
All checks were successful
Gestus/pipeline/head This commit looks good

This commit is contained in:
TheBrokenRail 2020-08-14 21:15:59 -04:00
parent 26492891a6
commit 419b2c1f21
7 changed files with 34 additions and 23 deletions

View File

@ -1,5 +1,8 @@
# Changelog # Changelog
**1.0.2**
* Add Eating Animation
**1.0.1** **1.0.1**
* Average Skin Color In Default Leather Armor * Average Skin Color In Default Leather Armor

View File

@ -10,7 +10,7 @@ org.gradle.jvmargs = -Xmx1G
fabric_loader_version = 0.9.0+build.204 fabric_loader_version = 0.9.0+build.204
# Mod Properties # Mod Properties
mod_version = 1.0.1 mod_version = 1.0.2
maven_group = com.thebrokenrail maven_group = com.thebrokenrail
# Dependencies # Dependencies

View File

@ -47,8 +47,9 @@ public class FakePlayerEntity extends ArmorStandEntity {
private static final Identifier HIT_EMOTE = new Identifier(Gestus.NAMESPACE, "builtin/hit"); // Hit Layer private static final Identifier HIT_EMOTE = new Identifier(Gestus.NAMESPACE, "builtin/hit"); // Hit Layer
private static final Identifier AIM_EMOTE = new Identifier(Gestus.NAMESPACE, "builtin/aim"); // Aim Layer private static final Identifier AIM_EMOTE = new Identifier(Gestus.NAMESPACE, "builtin/aim"); // Aim Layer
private static final Identifier TRIDENT_EMOTE = new Identifier(Gestus.NAMESPACE, "builtin/trident"); // Aim Layer
private static final Identifier SHIELD_EMOTE = new Identifier(Gestus.NAMESPACE, "builtin/shield"); // Aim Layer private static final Identifier SHIELD_EMOTE = new Identifier(Gestus.NAMESPACE, "builtin/shield"); // Aim Layer
private static final Identifier TRIDENT_EMOTE = new Identifier(Gestus.NAMESPACE, "builtin/trident"); // Aim Layer
private static final Identifier EAT_EMOTE = new Identifier(Gestus.NAMESPACE, "builtin/eat"); // Aim Layer
public final ServerPlayerEntity player; public final ServerPlayerEntity player;
@ -175,6 +176,11 @@ public class FakePlayerEntity extends ArmorStandEntity {
emote = TRIDENT_EMOTE; emote = TRIDENT_EMOTE;
break; break;
} }
case EAT:
case DRINK: {
emote = EAT_EMOTE;
break;
}
} }
} }

View File

@ -14,6 +14,7 @@ import net.minecraft.server.network.ServerPlayNetworkHandler;
import net.minecraft.server.network.ServerPlayerEntity; import net.minecraft.server.network.ServerPlayerEntity;
import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.Unique;
import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.ModifyVariable; import org.spongepowered.asm.mixin.injection.ModifyVariable;
@ -26,24 +27,25 @@ public class MixinServerPlayNetworkHandler {
@Inject(at = @At("HEAD"), method = "sendPacket(Lnet/minecraft/network/Packet;Lio/netty/util/concurrent/GenericFutureListener;)V", cancellable = true) @Inject(at = @At("HEAD"), method = "sendPacket(Lnet/minecraft/network/Packet;Lio/netty/util/concurrent/GenericFutureListener;)V", cancellable = true)
public void sendPacket(Packet<?> packet, GenericFutureListener<? extends Future<? super Void>> listener, CallbackInfo info) { public void sendPacket(Packet<?> packet, GenericFutureListener<? extends Future<? super Void>> listener, CallbackInfo info) {
if (packet == null) {
info.cancel();
}
}
@ModifyVariable(at = @At("HEAD"), method = "sendPacket(Lnet/minecraft/network/Packet;Lio/netty/util/concurrent/GenericFutureListener;)V", argsOnly = true)
public Packet<?> modifyPacket(Packet<?> packet) {
if (packet instanceof MobSpawnS2CPacket) { if (packet instanceof MobSpawnS2CPacket) {
MobSpawnS2CPacketAccessor packetData = (MobSpawnS2CPacketAccessor) packet; MobSpawnS2CPacketAccessor packetData = (MobSpawnS2CPacketAccessor) packet;
Entity entity = player.getEntityWorld().getEntityById(packetData.getId()); Entity entity = player.getEntityWorld().getEntityById(packetData.getId());
if (entity instanceof FakePlayerEntity && ((FakePlayerEntity) entity).player.getUuid().equals(player.getUuid())) { if (entity instanceof FakePlayerEntity && ((FakePlayerEntity) entity).player.getUuid().equals(player.getUuid())) {
return null; info.cancel();
} else {
return packet;
} }
} else if (packet instanceof EntityTrackerUpdateS2CPacket && ((EntityTrackerUpdateS2CPacketAccessor) packet).getId() == player.getEntityId()) { }
}
@Unique
private boolean shouldModify(int id) {
return player.getEntityWorld().getEntityById(id) instanceof PlayerEntity && id != player.getEntityId();
}
@ModifyVariable(at = @At("HEAD"), method = "sendPacket(Lnet/minecraft/network/Packet;Lio/netty/util/concurrent/GenericFutureListener;)V", argsOnly = true)
public Packet<?> modifyPacket(Packet<?> packet) {
if (packet instanceof EntityTrackerUpdateS2CPacket && shouldModify(((EntityTrackerUpdateS2CPacketAccessor) packet).getId())) {
return Util.modifyTracker(player, (EntityTrackerUpdateS2CPacket) packet); return Util.modifyTracker(player, (EntityTrackerUpdateS2CPacket) packet);
} else if (packet instanceof EntityEquipmentUpdateS2CPacket && player.getEntityWorld().getEntityById(((EntityEquipmentUpdateS2CPacketAccessor) packet).getId()) instanceof PlayerEntity) { } else if (packet instanceof EntityEquipmentUpdateS2CPacket && shouldModify(((EntityEquipmentUpdateS2CPacketAccessor) packet).getId())) {
return Util.modifyEquipment((EntityEquipmentUpdateS2CPacket) packet); return Util.modifyEquipment((EntityEquipmentUpdateS2CPacket) packet);
} else { } else {
return packet; return packet;

View File

@ -4,7 +4,6 @@ import com.mojang.authlib.GameProfile;
import com.thebrokenrail.gestus.Gestus; import com.thebrokenrail.gestus.Gestus;
import com.thebrokenrail.gestus.entity.FakePlayerEntity; import com.thebrokenrail.gestus.entity.FakePlayerEntity;
import com.thebrokenrail.gestus.util.ServerPlayerEntityExtension; import com.thebrokenrail.gestus.util.ServerPlayerEntityExtension;
import net.minecraft.entity.effect.StatusEffects;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.server.network.ServerPlayerEntity; import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.util.Hand; import net.minecraft.util.Hand;
@ -42,11 +41,10 @@ public abstract class MixinServerPlayerEntity extends PlayerEntity implements Se
spawn = true; spawn = true;
} }
boolean invisible = hasStatusEffect(StatusEffects.INVISIBILITY); boolean invisible = isInvisible();
boolean glowing = hasStatusEffect(StatusEffects.GLOWING);
shadow.setInvisible(invisible); shadow.setInvisible(invisible);
shadow.setGlowing(glowing); shadow.setGlowing(isGlowing());
shadow.setWorld(getEntityWorld()); shadow.setWorld(getEntityWorld());
shadow.refreshPositionAndAngles(getX(), getY(), getZ(), yaw, pitch); shadow.refreshPositionAndAngles(getX(), getY(), getZ(), yaw, pitch);
@ -75,8 +73,6 @@ public abstract class MixinServerPlayerEntity extends PlayerEntity implements Se
@Inject(at = @At("HEAD"), method = "tick") @Inject(at = @At("HEAD"), method = "tick")
public void tick(CallbackInfo info) { public void tick(CallbackInfo info) {
setInvisible(true);
setGlowing(false);
updateShadow(); updateShadow();
lastPos = getPos(); lastPos = getPos();
} }

View File

@ -7,7 +7,6 @@ import com.thebrokenrail.gestus.mixin.EntityTrackerUpdateS2CPacketAccessor;
import net.minecraft.entity.EquipmentSlot; import net.minecraft.entity.EquipmentSlot;
import net.minecraft.entity.data.DataTracker; import net.minecraft.entity.data.DataTracker;
import net.minecraft.entity.data.TrackedData; import net.minecraft.entity.data.TrackedData;
import net.minecraft.entity.effect.StatusEffects;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.network.packet.s2c.play.EntityEquipmentUpdateS2CPacket; import net.minecraft.network.packet.s2c.play.EntityEquipmentUpdateS2CPacket;
@ -45,8 +44,8 @@ public class Util {
for (DataTracker.Entry<?> entry : entries) { for (DataTracker.Entry<?> entry : entries) {
if (entry.getData() == flags) { if (entry.getData() == flags) {
byte data = (Byte) entry.get(); byte data = (Byte) entry.get();
data = setFlag(data, INVISIBILITY_FLAG, entity.hasStatusEffect(StatusEffects.INVISIBILITY)); data = setFlag(data, INVISIBILITY_FLAG, true);
data = setFlag(data, GLOWING_FLAG, entity.hasStatusEffect(StatusEffects.GLOWING)); data = setFlag(data, GLOWING_FLAG, false);
newEntries.add(new DataTracker.Entry<>(flags, data)); newEntries.add(new DataTracker.Entry<>(flags, data));
} else { } else {
newEntries.add(entry); newEntries.add(entry);

View File

@ -0,0 +1,5 @@
main_arm -51 -76 0
main_arm -55 -80 0
main_arm -59 -84 0
main_arm -55 -80 0
main_arm -51 -76 0