This commit is contained in:
parent
26492891a6
commit
419b2c1f21
@ -1,5 +1,8 @@
|
||||
# Changelog
|
||||
|
||||
**1.0.2**
|
||||
* Add Eating Animation
|
||||
|
||||
**1.0.1**
|
||||
* Average Skin Color In Default Leather Armor
|
||||
|
||||
|
@ -10,7 +10,7 @@ org.gradle.jvmargs = -Xmx1G
|
||||
fabric_loader_version = 0.9.0+build.204
|
||||
|
||||
# Mod Properties
|
||||
mod_version = 1.0.1
|
||||
mod_version = 1.0.2
|
||||
maven_group = com.thebrokenrail
|
||||
|
||||
# Dependencies
|
||||
|
@ -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 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 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;
|
||||
|
||||
@ -175,6 +176,11 @@ public class FakePlayerEntity extends ArmorStandEntity {
|
||||
emote = TRIDENT_EMOTE;
|
||||
break;
|
||||
}
|
||||
case EAT:
|
||||
case DRINK: {
|
||||
emote = EAT_EMOTE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -14,6 +14,7 @@ import net.minecraft.server.network.ServerPlayNetworkHandler;
|
||||
import net.minecraft.server.network.ServerPlayerEntity;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
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.Inject;
|
||||
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)
|
||||
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) {
|
||||
MobSpawnS2CPacketAccessor packetData = (MobSpawnS2CPacketAccessor) packet;
|
||||
Entity entity = player.getEntityWorld().getEntityById(packetData.getId());
|
||||
if (entity instanceof FakePlayerEntity && ((FakePlayerEntity) entity).player.getUuid().equals(player.getUuid())) {
|
||||
return null;
|
||||
} else {
|
||||
return packet;
|
||||
info.cancel();
|
||||
}
|
||||
} 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);
|
||||
} 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);
|
||||
} else {
|
||||
return packet;
|
||||
|
@ -4,7 +4,6 @@ import com.mojang.authlib.GameProfile;
|
||||
import com.thebrokenrail.gestus.Gestus;
|
||||
import com.thebrokenrail.gestus.entity.FakePlayerEntity;
|
||||
import com.thebrokenrail.gestus.util.ServerPlayerEntityExtension;
|
||||
import net.minecraft.entity.effect.StatusEffects;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.server.network.ServerPlayerEntity;
|
||||
import net.minecraft.util.Hand;
|
||||
@ -42,11 +41,10 @@ public abstract class MixinServerPlayerEntity extends PlayerEntity implements Se
|
||||
spawn = true;
|
||||
}
|
||||
|
||||
boolean invisible = hasStatusEffect(StatusEffects.INVISIBILITY);
|
||||
boolean glowing = hasStatusEffect(StatusEffects.GLOWING);
|
||||
boolean invisible = isInvisible();
|
||||
|
||||
shadow.setInvisible(invisible);
|
||||
shadow.setGlowing(glowing);
|
||||
shadow.setGlowing(isGlowing());
|
||||
|
||||
shadow.setWorld(getEntityWorld());
|
||||
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")
|
||||
public void tick(CallbackInfo info) {
|
||||
setInvisible(true);
|
||||
setGlowing(false);
|
||||
updateShadow();
|
||||
lastPos = getPos();
|
||||
}
|
||||
|
@ -7,7 +7,6 @@ import com.thebrokenrail.gestus.mixin.EntityTrackerUpdateS2CPacketAccessor;
|
||||
import net.minecraft.entity.EquipmentSlot;
|
||||
import net.minecraft.entity.data.DataTracker;
|
||||
import net.minecraft.entity.data.TrackedData;
|
||||
import net.minecraft.entity.effect.StatusEffects;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.network.packet.s2c.play.EntityEquipmentUpdateS2CPacket;
|
||||
@ -45,8 +44,8 @@ public class Util {
|
||||
for (DataTracker.Entry<?> entry : entries) {
|
||||
if (entry.getData() == flags) {
|
||||
byte data = (Byte) entry.get();
|
||||
data = setFlag(data, INVISIBILITY_FLAG, entity.hasStatusEffect(StatusEffects.INVISIBILITY));
|
||||
data = setFlag(data, GLOWING_FLAG, entity.hasStatusEffect(StatusEffects.GLOWING));
|
||||
data = setFlag(data, INVISIBILITY_FLAG, true);
|
||||
data = setFlag(data, GLOWING_FLAG, false);
|
||||
newEntries.add(new DataTracker.Entry<>(flags, data));
|
||||
} else {
|
||||
newEntries.add(entry);
|
||||
|
5
src/main/resources/data/gestus/emotes/builtin/eat.emote
Normal file
5
src/main/resources/data/gestus/emotes/builtin/eat.emote
Normal 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
|
Reference in New Issue
Block a user