diff --git a/src/main/java/com/github/tartaricacid/touhoulittlemaid/client/animation/gecko/AnimationManager.java b/src/main/java/com/github/tartaricacid/touhoulittlemaid/client/animation/gecko/AnimationManager.java index e4ffe0585..8bff53f97 100644 --- a/src/main/java/com/github/tartaricacid/touhoulittlemaid/client/animation/gecko/AnimationManager.java +++ b/src/main/java/com/github/tartaricacid/touhoulittlemaid/client/animation/gecko/AnimationManager.java @@ -195,6 +195,17 @@ public PlayState predicateUse(AnimationEvent event) { return PlayState.STOP; } + public PlayState predicateBeg(AnimationEvent event) { + EntityMaid maid = event.getAnimatable().getMaid(); + if (maid == null) { + return PlayState.STOP; + } + if (maid.isBegging()) { + return playAnimation(event, "beg", ILoopType.EDefaultLoopTypes.LOOP); + } + return PlayState.STOP; + } + public PlayState predicateArmor(AnimationEvent event, EquipmentSlot slot) { EntityMaid maid = event.getAnimatable().getMaid(); if (maid == null) { diff --git a/src/main/java/com/github/tartaricacid/touhoulittlemaid/client/animation/gecko/AnimationRegister.java b/src/main/java/com/github/tartaricacid/touhoulittlemaid/client/animation/gecko/AnimationRegister.java index 43a5c0c3b..f7d653ec1 100644 --- a/src/main/java/com/github/tartaricacid/touhoulittlemaid/client/animation/gecko/AnimationRegister.java +++ b/src/main/java/com/github/tartaricacid/touhoulittlemaid/client/animation/gecko/AnimationRegister.java @@ -31,7 +31,8 @@ public static void registerAnimationState() { register("swim", Priority.HIGHEST, (maid, event) -> maid.isSwimming()); register("boat", Priority.HIGH, (maid, event) -> maid.getVehicle() instanceof Boat); - register("sit", Priority.HIGH, (maid, event) -> maid.isPassenger() || maid.isInSittingPose()); + register("sit", Priority.HIGH, (maid, event) -> maid.isInSittingPose()); + register("chair", Priority.HIGH, (maid, event) -> maid.isPassenger()); register("swim_stand", Priority.NORMAL, (maid, event) -> maid.isInWater()); register("attacked", ILoopType.EDefaultLoopTypes.PLAY_ONCE, Priority.NORMAL, (maid, event) -> maid.hurtTime > 0); @@ -90,7 +91,7 @@ public static void registerVariables() { parser.register(new LazyVariable("query.modified_distance_moved", 0)); parser.register(new LazyVariable("query.moon_phase", 0)); - parser.register(new LazyVariable("query.maid_level", 0)); + parser.register(new LazyVariable("query.player_level", 0)); parser.register(new LazyVariable("query.time_of_day", 0)); parser.register(new LazyVariable("query.time_stamp", 0)); parser.register(new LazyVariable("query.vertical_speed", 0)); @@ -122,6 +123,11 @@ public static void registerVariables() { parser.register(new LazyVariable("ysm.food_level", 20)); parser.register(new LazyVariable("ysm.first_person_mod_hide", MolangUtils.FALSE)); + + parser.register(new LazyVariable("tlm.is_begging", MolangUtils.FALSE)); + parser.register(new LazyVariable("tlm.is_sitting", MolangUtils.FALSE)); + parser.register(new LazyVariable("tlm.has_backpack", MolangUtils.FALSE)); + parser.register(new LazyVariable("tlm.backpack_level", 0)); } public static void setParserValue(AnimationEvent animationEvent, MolangParser parser, EntityModelData data, EntityMaid maid) { @@ -169,7 +175,7 @@ public static void setParserValue(AnimationEvent animationEvent parser.setValue("query.modified_distance_moved", () -> maid.walkDist); parser.setValue("query.moon_phase", () -> mc.level.getMoonPhase()); - parser.setValue("query.maid_level", () -> maid.getExperience() / 120); + parser.setValue("query.player_level", () -> maid.getExperience() / 120); parser.setValue("query.time_of_day", () -> MolangUtils.normalizeTime(mc.level.getDayTime())); parser.setValue("query.time_stamp", () -> mc.level.getDayTime()); parser.setValue("query.vertical_speed", () -> getVerticalSpeed(maid)); @@ -196,6 +202,11 @@ public static void setParserValue(AnimationEvent animationEvent parser.setValue("ysm.armor_value", maid::getArmorValue); parser.setValue("ysm.hurt_time", () -> maid.hurtTime); + + parser.setValue("tlm.is_begging", () -> MolangUtils.booleanToFloat(maid.isBegging())); + parser.setValue("tlm.is_sitting", () -> MolangUtils.booleanToFloat(maid.isInSittingPose())); + parser.setValue("tlm.has_backpack", () -> MolangUtils.booleanToFloat(maid.hasBackpack())); + parser.setValue("tlm.backpack_level", maid::getBackpackLevel); } private static void register(String animationName, ILoopType loopType, int priority, BiPredicate> predicate) { diff --git a/src/main/java/com/github/tartaricacid/touhoulittlemaid/client/entity/GeckoMaidEntity.java b/src/main/java/com/github/tartaricacid/touhoulittlemaid/client/entity/GeckoMaidEntity.java index 8a1331d1b..57100e20e 100644 --- a/src/main/java/com/github/tartaricacid/touhoulittlemaid/client/entity/GeckoMaidEntity.java +++ b/src/main/java/com/github/tartaricacid/touhoulittlemaid/client/entity/GeckoMaidEntity.java @@ -11,6 +11,7 @@ import com.github.tartaricacid.touhoulittlemaid.geckolib3.resource.GeckoLibCache; import com.github.tartaricacid.touhoulittlemaid.geckolib3.util.GeckoLibUtil; import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.entity.EquipmentSlot; public class GeckoMaidEntity implements IAnimatable { private static final ResourceLocation GECKO_DEFAULT_ID = new ResourceLocation(TouhouLittleMaid.MOD_ID, "fox_miko"); @@ -27,15 +28,22 @@ public void registerControllers(AnimationData data) { data.addAnimationController(new AnimationController<>(this, controllerName, 0, e -> manager.predicateParallel(e, animationName))); } data.addAnimationController(new AnimationController<>(this, "main", 2, manager::predicateMain)); - data.addAnimationController(new AnimationController(this, "hold_offhand", 0, manager::predicateOffhandHold)); - data.addAnimationController(new AnimationController(this, "hold_mainhand", 0, manager::predicateMainhandHold)); - data.addAnimationController(new AnimationController(this, "swing", 2, manager::predicateSwing)); - data.addAnimationController(new AnimationController(this, "use", 2, manager::predicateUse)); + data.addAnimationController(new AnimationController<>(this, "hold_offhand", 0, manager::predicateOffhandHold)); + data.addAnimationController(new AnimationController<>(this, "hold_mainhand", 0, manager::predicateMainhandHold)); + data.addAnimationController(new AnimationController<>(this, "swing", 2, manager::predicateSwing)); + data.addAnimationController(new AnimationController<>(this, "use", 2, manager::predicateUse)); + data.addAnimationController(new AnimationController<>(this, "beg", 2, manager::predicateBeg)); for (int i = 0; i < 8; i++) { String controllerName = String.format("parallel_%d_controller", i); String animationName = String.format("parallel%d", i); data.addAnimationController(new AnimationController<>(this, controllerName, 0, e -> manager.predicateParallel(e, animationName))); } + for (EquipmentSlot slot : EquipmentSlot.values()) { + if (slot.getType() == EquipmentSlot.Type.ARMOR) { + String controllerName = String.format("%s_controller", slot.getName()); + data.addAnimationController(new AnimationController<>(this, controllerName, 0, e -> manager.predicateArmor(e, slot))); + } + } } public ResourceLocation getModel() { diff --git a/src/main/java/com/github/tartaricacid/touhoulittlemaid/client/gui/entity/detail/AbstractModelDetailsGui.java b/src/main/java/com/github/tartaricacid/touhoulittlemaid/client/gui/entity/detail/AbstractModelDetailsGui.java index 21da05ccc..4b644c8fb 100644 --- a/src/main/java/com/github/tartaricacid/touhoulittlemaid/client/gui/entity/detail/AbstractModelDetailsGui.java +++ b/src/main/java/com/github/tartaricacid/touhoulittlemaid/client/gui/entity/detail/AbstractModelDetailsGui.java @@ -230,8 +230,8 @@ private void renderEntity(int middleWidth, int middleHeight) { MultiBufferSource.BufferSource buffer = Minecraft.getInstance().renderBuffers().bufferSource(); RenderSystem.runAsFancy(() -> { manager.render(guiEntity, 0, 0, 0, 0, 1, poseStack, buffer, 0xf000f0); + poseStack.translate(0, 0.5, 0); if (showFloor) { - poseStack.translate(0, 0.5, 0); this.floorModel.renderToBuffer(poseStack, buffer.getBuffer(this.floorModel.renderType(FLOOR_TEXTURE)), 0xf000f0, OverlayTexture.NO_OVERLAY, 1.0F, 1.0F, 1.0F, 1.0F); } this.renderExtraEntity(manager, poseStack, buffer); @@ -244,6 +244,11 @@ private void renderEntity(int middleWidth, int middleHeight) { Lighting.setupFor3DItems(); } + @Override + public boolean isPauseScreen() { + return false; + } + private void fillGradient(GuiGraphics graphics, Rectangle vec4d, int color) { graphics.fillGradient((int) vec4d.x, (int) vec4d.y, (int) vec4d.w, (int) vec4d.h, color, color); } diff --git a/src/main/java/com/github/tartaricacid/touhoulittlemaid/client/gui/entity/detail/MaidModelDetailsGui.java b/src/main/java/com/github/tartaricacid/touhoulittlemaid/client/gui/entity/detail/MaidModelDetailsGui.java index 0450e7c4b..1310f91d5 100644 --- a/src/main/java/com/github/tartaricacid/touhoulittlemaid/client/gui/entity/detail/MaidModelDetailsGui.java +++ b/src/main/java/com/github/tartaricacid/touhoulittlemaid/client/gui/entity/detail/MaidModelDetailsGui.java @@ -3,6 +3,7 @@ import com.github.tartaricacid.touhoulittlemaid.client.gui.entity.model.MaidModelGui; import com.github.tartaricacid.touhoulittlemaid.client.gui.widget.button.ModelDetailsButton; import com.github.tartaricacid.touhoulittlemaid.client.resource.pojo.MaidModelInfo; +import com.github.tartaricacid.touhoulittlemaid.entity.item.EntityChair; import com.github.tartaricacid.touhoulittlemaid.entity.passive.EntityMaid; import com.github.tartaricacid.touhoulittlemaid.init.InitEntities; import com.mojang.blaze3d.vertex.PoseStack; @@ -11,7 +12,6 @@ import net.minecraft.client.renderer.entity.EntityRenderDispatcher; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.EquipmentSlot; -import net.minecraft.world.entity.vehicle.Minecart; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; @@ -19,14 +19,22 @@ public class MaidModelDetailsGui extends AbstractModelDetailsGui