Skip to content

Commit

Permalink
feat(1.20.1-forged): wip: sword and armor render
Browse files Browse the repository at this point in the history
  • Loading branch information
cnlimiter committed Jun 9, 2024
1 parent 8384c96 commit 6459e71
Show file tree
Hide file tree
Showing 60 changed files with 684 additions and 369 deletions.
5 changes: 5 additions & 0 deletions src/generated/resources/assets/minecraft/atlases/blocks.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@
"type": "minecraft:directory",
"prefix": "misc/",
"source": "misc"
},
{
"type": "minecraft:directory",
"prefix": "models/",
"source": "models"
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import com.mojang.blaze3d.vertex.VertexFormat;
import committee.nova.mods.avaritia.util.client.VertexUtils;
import committee.nova.mods.avaritia.util.math.InterpHelper;
import committee.nova.mods.avaritia.util.math.MathUtil;
import committee.nova.mods.avaritia.util.math.MathUtils;
import committee.nova.mods.avaritia.util.vec.Cuboid6;
import committee.nova.mods.avaritia.util.vec.Vector3;
import net.minecraft.client.renderer.block.model.BakedQuad;
Expand Down Expand Up @@ -175,9 +175,9 @@ public void clamp(AABB bb) {
public void clamp(Cuboid6 cuboid) {
for (Vertex vertex : vertices) {
float[] vec = vertex.vec;
vec[0] = (float) MathUtil.clip(vec[0], cuboid.min.x, cuboid.max.x);
vec[1] = (float) MathUtil.clip(vec[1], cuboid.min.y, cuboid.max.y);
vec[2] = (float) MathUtil.clip(vec[2], cuboid.min.z, cuboid.max.z);
vec[0] = (float) MathUtils.clip(vec[0], cuboid.min.x, cuboid.max.x);
vec[1] = (float) MathUtils.clip(vec[1], cuboid.min.y, cuboid.max.y);
vec[2] = (float) MathUtils.clip(vec[2], cuboid.min.z, cuboid.max.z);
}
calculateOrientation(true);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package committee.nova.mods.avaritia.api.common.tile;

import committee.nova.mods.avaritia.util.TileEntityUtil;
import committee.nova.mods.avaritia.util.TileEntityUtils;
import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.protocol.game.ClientboundBlockEntityDataPacket;
Expand Down Expand Up @@ -47,13 +47,13 @@ public void setChangedFast() {

public void setChangedAndDispatch() {
this.setChanged();
TileEntityUtil.dispatchToNearbyPlayers(this);
TileEntityUtils.dispatchToNearbyPlayers(this);
this.isChanged = false;
}

public void dispatchIfChanged() {
if (this.isChanged) {
TileEntityUtil.dispatchToNearbyPlayers(this);
TileEntityUtils.dispatchToNearbyPlayers(this);
this.isChanged = false;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,16 @@

import committee.nova.mods.avaritia.Static;
import committee.nova.mods.avaritia.api.iface.IColored;
import committee.nova.mods.avaritia.client.model.CosmicModelLoader;
import committee.nova.mods.avaritia.client.model.GapingVoidModel;
import committee.nova.mods.avaritia.client.model.HaloModelLoader;
import committee.nova.mods.avaritia.client.model.WingModel;
import committee.nova.mods.avaritia.client.render.layer.EyeInfinityLayer;
import committee.nova.mods.avaritia.client.render.layer.WingInfinityLayer;
import committee.nova.mods.avaritia.client.model.*;
import committee.nova.mods.avaritia.client.shader.AvaritiaShaders;
import committee.nova.mods.avaritia.init.registry.ModEntities;
import committee.nova.mods.avaritia.init.registry.ModItems;
import committee.nova.mods.avaritia.init.registry.ModMenus;
import committee.nova.mods.avaritia.init.registry.ModTileEntities;
import net.minecraft.client.renderer.entity.EntityRenderer;
import net.minecraft.client.model.PlayerModel;
import net.minecraft.client.renderer.entity.LivingEntityRenderer;
import net.minecraft.client.renderer.entity.RenderLayerParent;
import net.minecraft.world.entity.player.Player;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.client.event.*;
import net.minecraftforge.eventbus.api.EventPriority;
Expand Down Expand Up @@ -47,8 +44,7 @@ public static void onRegisterShaders(RegisterShadersEvent event){
@SubscribeEvent
public static void registerEntityLayerDefinitions(EntityRenderersEvent.RegisterLayerDefinitions event) {
event.registerLayerDefinition(GapingVoidModel.LAYER_LOCATION, GapingVoidModel::createBodyLayer);
event.registerLayerDefinition(WingModel.LAYER_LOCATION, WingModel::createBodyLayer);

//event.registerLayerDefinition(WingModel.LAYER_LOCATION, WingModel::createBodyLayer);
}

@SubscribeEvent
Expand All @@ -69,14 +65,12 @@ public static void registerLoaders(ModelEvent.RegisterGeometryLoaders event) {

@SubscribeEvent
public static void addPlayerLayer(EntityRenderersEvent.AddLayers event) {
event.getSkins().forEach(skin -> {
EntityRenderer<?> renderer = event.getSkin(skin);
if (renderer != null && renderer instanceof LivingEntityRenderer livingRender){
livingRender.addLayer(new WingInfinityLayer(livingRender));
livingRender.addLayer(new EyeInfinityLayer(livingRender));
}
});

addLayer(event, "default");
addLayer(event, "slim");
}

private static void addLayer(final EntityRenderersEvent.AddLayers e, final String s) {
final LivingEntityRenderer entityRenderer = e.getSkin(s);
entityRenderer.addLayer(new InfinityArmorModel.PlayerRender((RenderLayerParent<Player, PlayerModel<Player>>)entityRenderer));
}
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,11 @@ public void renderItem(ItemStack stack, ItemDisplayContext transformType, PoseSt
final Minecraft mc = Minecraft.getInstance();
float yaw = 0.0f;
float pitch = 0.0f;
float scale = 1.0f;
if (transformType != ItemDisplayContext.GUI) {
yaw = (float)((double)(mc.player.getYRot() * 2.0F) * 3.141592653589793D / 360.0D);
pitch = -((float)((double)(mc.player.getXRot() * 2.0F) * 3.141592653589793D / 360.0D));
} else {
scale = 25.0F;
float scale = 25.0f;
if (!AvaritiaShaders.inventoryRender) {
yaw = (float)(mc.player.getYRot() * 2.0f * 3.141592653589793 / 360.0);
pitch = -(float)(mc.player.getXRot() * 2.0f * 3.141592653589793 / 360.0);
scale = 1.0f;
}
if (AvaritiaShaders.cosmicOpacity != null) {
AvaritiaShaders.cosmicOpacity.set(1.0F);
Expand Down
Loading

0 comments on commit 6459e71

Please sign in to comment.