Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: 1.20.1 #1685

Merged
merged 40 commits into from
Sep 16, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
bb2a1e9
feat: 1.20.1 functionality, begin Lootr compat, begin entity accessor…
bconlon1 Sep 9, 2023
8dcfe82
improv: Hoppers no longer affect locked treasure chests
bconlon1 Sep 10, 2023
d653cff
fix: Remove shadow for book of lore text
bconlon1 Sep 10, 2023
7b38e5f
Merge branch '1.20.1-develop' into feat/bconlon/porting
bconlon1 Sep 10, 2023
20ade17
build: Fix Curios dependency
bconlon1 Sep 10, 2023
018518e
ci: Fix artifact downloads
bconlon1 Sep 10, 2023
0146c22
ci: Fix again
bconlon1 Sep 10, 2023
2a56e5a
refactor: Change minimum Forge version
bconlon1 Sep 11, 2023
681da07
fix: typo
bconlon1 Sep 11, 2023
8e8667b
update: Nitrogen and Cumulus
bconlon1 Sep 11, 2023
6635668
improv: WIP continued lootr compat work
bconlon1 Sep 11, 2023
eb54478
improv: WIP more lootr stuff
bconlon1 Sep 12, 2023
2e0ad65
refactor: remove lootr code
bconlon1 Sep 12, 2023
4196cbb
chore: Todo comments
bconlon1 Sep 12, 2023
da64050
chore: Update CREDITS.txt
bconlon1 Sep 12, 2023
d90ae98
improv: Functional mob accessory behavior
bconlon1 Sep 14, 2023
ca8781c
feat: Armor Trim Materials
bconlon1 Sep 14, 2023
a334da2
feat: Skyroot Hanging Sign
bconlon1 Sep 14, 2023
d2e5bcd
Merge branch '1.20.1-develop' into feat/bconlon/porting
bconlon1 Sep 14, 2023
552b384
chore: Update CREDITS.txt
bconlon1 Sep 14, 2023
4d23174
feat: 1.20 tags
bconlon1 Sep 14, 2023
b0989ca
refactor: RenderSystem and GuiGraphics cleanup
bconlon1 Sep 15, 2023
5d7cad2
refactor: Egg advancement tag and skyroot bed crafting tag
bconlon1 Sep 15, 2023
28d887c
improv: Gloves now use ArmorMaterials
bconlon1 Sep 15, 2023
f4c3c9f
feat: Glove trims support
bconlon1 Sep 15, 2023
993934c
chore: remove comment
bconlon1 Sep 15, 2023
2d67ca2
feat: vanilla material glove trims support
OzPayn Sep 15, 2023
8ee7fd5
feat: Armor Stands support accessories
bconlon1 Sep 15, 2023
e1b6edc
improv: Trim overlay for gloves item
bconlon1 Sep 15, 2023
bc03cdc
refactor: Moa UV map expanded
bconlon1 Sep 15, 2023
2684289
update: Nitrogen 0.1.1->0.1.2
bconlon1 Sep 16, 2023
2275e3a
chore: Update.json
bconlon1 Sep 16, 2023
040e092
chore: Update references to 1.20.1
bconlon1 Sep 16, 2023
bab0f6f
build: Make lootr compileOnly again
bconlon1 Sep 16, 2023
e590f74
improv: Dispeners can equip accessories to armor stands
bconlon1 Sep 16, 2023
ced446c
fix: Silver hearts render again
bconlon1 Sep 16, 2023
b055701
docs: Cape render docs
bconlon1 Sep 16, 2023
0b91d4e
docs: Mixin docs
bconlon1 Sep 16, 2023
af011c6
docs: AetherMixinHooks
bconlon1 Sep 16, 2023
37082dd
docs: entity hooks
bconlon1 Sep 16, 2023
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
Prev Previous commit
Next Next commit
feat: Armor Stands support accessories
  • Loading branch information
bconlon1 committed Sep 15, 2023
commit 8ee7fd5b8f61959611f314787165f7217bb93043
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ public class AetherModelLayers {
public static final ModelLayerLocation SHIELD_OF_REPULSION = register("shield_of_repulsion");
public static final ModelLayerLocation SHIELD_OF_REPULSION_SLIM = register("shield_of_repulsion_slim");
public static final ModelLayerLocation SHIELD_OF_REPULSION_ARM = register("shield_of_repulsion_arm");
public static final ModelLayerLocation CAPE = register("cape");

public static final ModelLayerLocation PLAYER_HALO = register("player_halo");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,15 @@
import com.aetherteam.aether.client.renderer.accessory.GlovesRenderer;
import com.aetherteam.aether.client.renderer.accessory.PendantRenderer;
import com.aetherteam.aether.client.renderer.accessory.ShieldOfRepulsionRenderer;
import com.aetherteam.aether.client.renderer.accessory.layer.ArmorStandCapeLayer;
import com.aetherteam.aether.client.renderer.accessory.layer.EntityAccessoryLayer;
import com.aetherteam.aether.client.renderer.accessory.model.CapeModel;
import com.aetherteam.aether.client.renderer.accessory.model.GlovesModel;
import com.aetherteam.aether.client.renderer.accessory.model.PendantModel;
import com.aetherteam.aether.client.renderer.blockentity.ChestMimicRenderer;
import com.aetherteam.aether.client.renderer.blockentity.SkyrootBedRenderer;
import com.aetherteam.aether.client.renderer.blockentity.TreasureChestRenderer;
import com.aetherteam.aether.client.renderer.entity.*;
import com.aetherteam.aether.client.renderer.entity.layers.EntityAccessoryLayer;
import com.aetherteam.aether.client.renderer.entity.model.*;
import com.aetherteam.aether.client.renderer.player.layer.DartLayer;
import com.aetherteam.aether.client.renderer.player.layer.DeveloperGlowLayer;
Expand All @@ -38,6 +40,7 @@
import net.minecraft.client.renderer.entity.player.PlayerRenderer;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.decoration.ArmorStand;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.client.event.EntityRenderersEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
Expand Down Expand Up @@ -163,6 +166,7 @@ public static void registerLayerDefinitions(EntityRenderersEvent.RegisterLayerDe
event.registerLayerDefinition(AetherModelLayers.SHIELD_OF_REPULSION, () -> LayerDefinition.create(PlayerModel.createMesh(new CubeDeformation(1.1F), false), 64, 64));
event.registerLayerDefinition(AetherModelLayers.SHIELD_OF_REPULSION_SLIM, () -> LayerDefinition.create(PlayerModel.createMesh(new CubeDeformation(1.15F), true), 64, 64));
event.registerLayerDefinition(AetherModelLayers.SHIELD_OF_REPULSION_ARM, () -> LayerDefinition.create(PlayerModel.createMesh(new CubeDeformation(0.4F), false), 64, 64));
event.registerLayerDefinition(AetherModelLayers.CAPE, CapeModel::createLayer);

event.registerLayerDefinition(AetherModelLayers.PLAYER_HALO, () -> HaloModel.createLayer(0.0F, 0.0F, 0.0F, 0.0F));
}
Expand Down Expand Up @@ -214,5 +218,9 @@ public static void addEntityLayers(EntityRenderersEvent.AddLayers event) {
renderer.addLayer(new EntityAccessoryLayer(renderer));
}
}
LivingEntityRenderer<ArmorStand, ArmorStandModel> renderer = event.getRenderer(EntityType.ARMOR_STAND);
if (renderer != null) {
renderer.addLayer(new ArmorStandCapeLayer(renderer));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

import com.aetherteam.aether.capability.player.AetherPlayer;
import com.aetherteam.aether.client.renderer.AetherModelLayers;
import com.aetherteam.aether.item.AetherItems;
import com.aetherteam.aether.item.EquipmentUtil;
import com.aetherteam.aether.item.accessories.miscellaneous.ShieldOfRepulsionItem;
import com.aetherteam.aether.mixin.mixins.client.accessor.PlayerModelAccessor;
import com.aetherteam.nitrogen.ConstantsUtil;
Expand All @@ -27,7 +25,6 @@
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.phys.Vec3;
import top.theillusivec4.curios.api.CuriosApi;
import top.theillusivec4.curios.api.SlotContext;
import top.theillusivec4.curios.api.client.ICurioRenderer;

Expand Down Expand Up @@ -66,43 +63,37 @@ public ShieldOfRepulsionRenderer() {
@Override
public <T extends LivingEntity, M extends EntityModel<T>> void render(ItemStack stack, SlotContext slotContext, PoseStack poseStack, RenderLayerParent<T, M> renderLayerParent, MultiBufferSource buffer, int packedLight, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch) {
LivingEntity livingEntity = slotContext.entity();
EquipmentUtil.findFirstCurio(livingEntity, AetherItems.SHIELD_OF_REPULSION.get()).ifPresent((slotResult) -> CuriosApi.getCuriosInventory(livingEntity).ifPresent(handler ->
handler.getStacksHandler(slotResult.slotContext().identifier()).ifPresent(stacksHandler -> {
ShieldOfRepulsionItem shield = (ShieldOfRepulsionItem) slotResult.stack().getItem();
if (stacksHandler.getRenders().get(slotResult.slotContext().index())) {
ResourceLocation texture;
HumanoidModel<LivingEntity> model;

if (livingEntity instanceof Player player && renderLayerParent.getModel() instanceof PlayerModel<?> playerModel) {
PlayerModelAccessor playerModelAccessor = (PlayerModelAccessor) playerModel;
model = playerModelAccessor.aether$getSlim() ? this.shieldModelSlim : this.shieldModel;
Optional<AetherPlayer> aetherPlayerOptional = AetherPlayer.get(player).resolve();
if (aetherPlayerOptional.isPresent()) {
if (!aetherPlayerOptional.get().isMoving()) {
texture = playerModelAccessor.aether$getSlim() ? shield.getShieldOfRepulsionSlimTexture() : shield.getShieldOfRepulsionTexture();
} else {
texture = playerModelAccessor.aether$getSlim() ? shield.getShieldOfRepulsionSlimInactiveTexture() : shield.getShieldOfRepulsionInactiveTexture();
}
} else {
texture = playerModelAccessor.aether$getSlim() ? shield.getShieldOfRepulsionSlimInactiveTexture() : shield.getShieldOfRepulsionInactiveTexture();
}
} else {
model = this.shieldModel;
Vec3 motion = livingEntity.getDeltaMovement();
if (motion.x() == 0.0 && (motion.y() == ConstantsUtil.DEFAULT_DELTA_MOVEMENT_Y || motion.y() == 0.0) && motion.z() == 0.0) {
texture = shield.getShieldOfRepulsionTexture();
} else {
texture = shield.getShieldOfRepulsionInactiveTexture();
}
}

ICurioRenderer.followHeadRotations(slotContext.entity(), model.head);
ICurioRenderer.followBodyRotations(slotContext.entity(), model);
VertexConsumer consumer = ItemRenderer.getArmorFoilBuffer(buffer, RenderType.entityTranslucent(texture), false, false);
model.renderToBuffer(poseStack, consumer, packedLight, OverlayTexture.NO_OVERLAY, 1.0F, 1.0F, 1.0F, 1.0F);
}
})
));
ShieldOfRepulsionItem shield = (ShieldOfRepulsionItem) stack.getItem();
ResourceLocation texture;
HumanoidModel<LivingEntity> model;

if (livingEntity instanceof Player player && renderLayerParent.getModel() instanceof PlayerModel<?> playerModel) {
PlayerModelAccessor playerModelAccessor = (PlayerModelAccessor) playerModel;
model = playerModelAccessor.aether$getSlim() ? this.shieldModelSlim : this.shieldModel;
Optional<AetherPlayer> aetherPlayerOptional = AetherPlayer.get(player).resolve();
if (aetherPlayerOptional.isPresent()) {
if (!aetherPlayerOptional.get().isMoving()) {
texture = playerModelAccessor.aether$getSlim() ? shield.getShieldOfRepulsionSlimTexture() : shield.getShieldOfRepulsionTexture();
} else {
texture = playerModelAccessor.aether$getSlim() ? shield.getShieldOfRepulsionSlimInactiveTexture() : shield.getShieldOfRepulsionInactiveTexture();
}
} else {
texture = playerModelAccessor.aether$getSlim() ? shield.getShieldOfRepulsionSlimInactiveTexture() : shield.getShieldOfRepulsionInactiveTexture();
}
} else {
model = this.shieldModel;
Vec3 motion = livingEntity.getDeltaMovement();
if (motion.x() == 0.0 && (motion.y() == ConstantsUtil.DEFAULT_DELTA_MOVEMENT_Y || motion.y() == 0.0) && motion.z() == 0.0) {
texture = shield.getShieldOfRepulsionTexture();
} else {
texture = shield.getShieldOfRepulsionInactiveTexture();
}
}

ICurioRenderer.followHeadRotations(slotContext.entity(), model.head);
ICurioRenderer.followBodyRotations(slotContext.entity(), model);
VertexConsumer consumer = ItemRenderer.getArmorFoilBuffer(buffer, RenderType.entityTranslucent(texture), false, false);
model.renderToBuffer(poseStack, consumer, packedLight, OverlayTexture.NO_OVERLAY, 1.0F, 1.0F, 1.0F, 1.0F);
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
package com.aetherteam.aether.client.renderer.accessory.layer;

import com.aetherteam.aether.AetherConfig;
import com.aetherteam.aether.client.renderer.AetherModelLayers;
import com.aetherteam.aether.client.renderer.accessory.model.CapeModel;
import com.aetherteam.aether.item.accessories.cape.CapeItem;
import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.blaze3d.vertex.VertexConsumer;
import com.mojang.math.Axis;
import net.minecraft.client.Minecraft;
import net.minecraft.client.model.ArmorStandModel;
import net.minecraft.client.renderer.MultiBufferSource;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.renderer.entity.RenderLayerParent;
import net.minecraft.client.renderer.entity.layers.RenderLayer;
import net.minecraft.client.renderer.texture.OverlayTexture;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.entity.EquipmentSlot;
import net.minecraft.world.entity.decoration.ArmorStand;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Items;
import net.minecraftforge.common.util.LazyOptional;
import top.theillusivec4.curios.api.CuriosApi;
import top.theillusivec4.curios.api.type.capability.ICuriosItemHandler;
import top.theillusivec4.curios.api.type.inventory.ICurioStacksHandler;
import top.theillusivec4.curios.api.type.inventory.IDynamicStackHandler;

import java.util.Optional;

public class ArmorStandCapeLayer extends RenderLayer<ArmorStand, ArmorStandModel> {
private final CapeModel cape;

public ArmorStandCapeLayer(RenderLayerParent<ArmorStand, ArmorStandModel> renderer) {
super(renderer);
this.cape = new CapeModel(Minecraft.getInstance().getEntityModels().bakeLayer(AetherModelLayers.CAPE));
}

@Override
public void render(PoseStack poseStack, MultiBufferSource buffer, int packedLight, ArmorStand livingEntity, float limbSwing, float limbSwingAmount, float partialTick, float ageInTicks, float netHeadYaw, float headPitch) {
String identifier = AetherConfig.COMMON.use_curios_menu.get() ? "back" : "aether_cape";
LazyOptional<ICuriosItemHandler> lazyHandler = CuriosApi.getCuriosInventory(livingEntity);
if (lazyHandler.isPresent() && lazyHandler.resolve().isPresent()) {
ICuriosItemHandler handler = lazyHandler.resolve().get();
Optional<ICurioStacksHandler> stacksHandler = handler.getStacksHandler(identifier);
if (stacksHandler.isPresent()) {
IDynamicStackHandler stackHandler = stacksHandler.get().getCosmeticStacks();
if (0 < stackHandler.getSlots()) {
ItemStack itemStack = stackHandler.getStackInSlot(0);
if (!itemStack.isEmpty()) {
if (itemStack.getItem() instanceof CapeItem capeItem) {
ResourceLocation texture = capeItem.getCapeTexture();
if (!livingEntity.isInvisible() && texture != null) {
ItemStack itemstack = livingEntity.getItemBySlot(EquipmentSlot.CHEST);
if (!itemstack.is(Items.ELYTRA)) {
poseStack.pushPose();
poseStack.translate(0.0F, 0.0F, 0.0925F);
poseStack.mulPose(Axis.XP.rotationDegrees(6.0F + 0 / 2.0F + 0));
poseStack.mulPose(Axis.ZP.rotationDegrees(0 / 2.0F));
poseStack.mulPose(Axis.YP.rotationDegrees(180.0F - 0 / 2.0F));
VertexConsumer vertexconsumer = buffer.getBuffer(RenderType.entitySolid(texture));
this.cape.renderToBuffer(poseStack, vertexconsumer, packedLight, OverlayTexture.NO_OVERLAY, 1.0F, 1.0F, 1.0F, 1.0F);
poseStack.popPose();
}
}
}
}
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.aetherteam.aether.client.renderer.entity.layers;
package com.aetherteam.aether.client.renderer.accessory.layer;

import com.aetherteam.aether.AetherTags;
import com.mojang.blaze3d.vertex.PoseStack;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
package com.aetherteam.aether.client.renderer.accessory.model;

import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.blaze3d.vertex.VertexConsumer;
import net.minecraft.client.model.HumanoidModel;
import net.minecraft.client.model.geom.ModelPart;
import net.minecraft.client.model.geom.PartPose;
import net.minecraft.client.model.geom.builders.*;
import net.minecraft.world.entity.EquipmentSlot;
import net.minecraft.world.entity.LivingEntity;

public class CapeModel extends HumanoidModel<LivingEntity> {
private final ModelPart cloak;

public CapeModel(ModelPart root) {
super(root);
this.cloak = root.getChild("cloak");
}

public static LayerDefinition createLayer() {
MeshDefinition meshDefinition = HumanoidModel.createMesh(CubeDeformation.NONE, 0.0F);
PartDefinition partDefinition = meshDefinition.getRoot();
partDefinition.addOrReplaceChild("cloak", CubeListBuilder.create().texOffs(0, 0).addBox(-5.0F, 0.0F, -1.0F, 10.0F, 16.0F, 1.0F), PartPose.ZERO);
return LayerDefinition.create(meshDefinition, 64, 32);
}

@Override
public void renderToBuffer(PoseStack poseStack, VertexConsumer buffer, int packedLight, int packedOverlay, float red, float green, float blue, float alpha) {
this.cloak.render(poseStack, buffer, packedLight, packedOverlay, red, green, blue, alpha);
}

@Override
public void setupAnim(LivingEntity livingEntity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) {
super.setupAnim(livingEntity, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch);
if (livingEntity.getItemBySlot(EquipmentSlot.CHEST).isEmpty()) {
if (livingEntity.isCrouching()) {
this.cloak.z = 1.4F;
this.cloak.y = 1.85F;
} else {
this.cloak.z = 0.0F;
this.cloak.y = 0.0F;
}
} else if (livingEntity.isCrouching()) {
this.cloak.z = 0.3F;
this.cloak.y = 0.8F;
} else {
this.cloak.z = -1.1F;
this.cloak.y = -0.85F;
}
}
}
Loading