Skip to content

Commit

Permalink
Armor and banner tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
SammySemicolon committed Dec 17, 2024
1 parent ac5ab2e commit f5481ba
Show file tree
Hide file tree
Showing 11 changed files with 135 additions and 279 deletions.
1 change: 1 addition & 0 deletions blockbench/malignant_lead_reforged.bbmodel

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion blockbench/malignant_lead_test.bbmodel

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ mod_authors=Sammy Semicolon
mod_description=A dark magic mod focused on soul and spirit magic.

# Mandatory
lodestone_version=1.7.0.121
lodestone_version=1.7.0.122
curios_version=9.0.15+1.21.1

# Iron's Spellbooks
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import com.sammy.malum.client.*;
import com.sammy.malum.common.block.curiosities.banner.*;
import com.sammy.malum.common.block.curiosities.mana_mote.*;
import com.sammy.malum.common.block.curiosities.spirit_altar.*;
import com.sammy.malum.core.systems.spirit.*;
import com.sammy.malum.registry.common.*;
import net.minecraft.client.renderer.*;
Expand All @@ -14,6 +15,7 @@
import net.minecraft.util.*;
import net.minecraft.world.level.block.*;
import net.minecraft.world.level.block.state.*;
import net.minecraft.world.phys.*;
import org.joml.*;
import team.lodestar.lodestone.handlers.*;
import team.lodestar.lodestone.registry.client.*;
Expand All @@ -37,17 +39,14 @@ public void render(SoulwovenBannerBlockEntity blockEntityIn, float partialTicks,
return;
}
var token = RenderTypeToken.createCachedToken(block.texture);
var banner = LodestoneRenderTypes.CUTOUT_TEXTURE.applyAndCache(token);
var banner = LodestoneRenderTypes.CUTOUT_TEXTURE.applyWithModifierAndCache(token, b -> b.setCullState(RenderStateShard.NO_CULL));
var builder = VFXBuilders.createWorld().setRenderType(banner).setLight(combinedLightIn);
var pos = blockEntityIn.getBlockPos();
var spirit = blockEntityIn.spirit;
var type = blockState.getValue(SoulwovenBannerBlock.BANNER_TYPE);
var direction = type.direction.getAxis().isVertical() ? type.equals(SoulwovenBannerBlock.BannerType.HANGING_Z) ? Direction.NORTH : Direction.WEST : type.direction;
float sway = ((float) Math.floorMod((pos.getX() * 7L + pos.getY() * 9L + pos.getZ() * 13L) + blockEntityIn.getLevel().getGameTime(), 100L) + partialTicks) / 100.0F;
float swayRotation = (0.01F * Mth.cos((float) (Math.PI * 2) * sway)) * (float) Math.PI;
if (spirit == SpiritTypeRegistry.AERIAL_SPIRIT) {
swayRotation*=2f;
}

poseStack.pushPose();
poseStack.translate(0.5f, 0.5f, 0.5f);
Expand All @@ -67,25 +66,28 @@ public void render(SoulwovenBannerBlockEntity blockEntityIn, float partialTicks,
float yStart = -2;
float yEnd = 0;
var vertices = new Vector3f[]{new Vector3f(xEnd, yStart, 0), new Vector3f(xStart, yStart, 0), new Vector3f(xStart, yEnd, 0), new Vector3f(xEnd, yEnd, 0)};
var reversedVertices = new Vector3f[]{vertices[1], vertices[0], vertices[3], vertices[2]};

builder.renderQuad(poseStack, vertices, 1f);
builder.renderQuad(poseStack, reversedVertices, 1f);
if (spirit != null) {
var spiritGlow = blockEntityIn.intense ?
LodestoneRenderTypes.ADDITIVE_TEXTURE.applyAndCache(token) :
LodestoneRenderTypes.ADDITIVE_TEXTURE.applyAndCache(token, ShaderUniformHandler.LUMITRANSPARENT);
LodestoneRenderTypes.ADDITIVE_TEXTURE.applyWithModifierAndCache(token, b -> b.setCullState(RenderStateShard.NO_CULL)) :
LodestoneRenderTypes.ADDITIVE_TEXTURE.applyWithModifierAndCache(token, ShaderUniformHandler.LUMITRANSPARENT, b -> b.setCullState(RenderStateShard.NO_CULL));
var spiritBuilder = VFXBuilders.createWorld().setRenderType(spiritGlow).setColor(spirit.getPrimaryColor());
for (int i = 0; i < 4; i++) {
int offset = 3 - i * 2;
for (int i = 1; i < 4; i++) {
poseStack.pushPose();
poseStack.translate(0, 0, 0.001f * offset);
spiritBuilder.setAlpha(0.8f * Mth.abs(offset));
spiritBuilder.renderQuad(poseStack, vertices, 1f);
spiritBuilder.renderQuad(poseStack, reversedVertices, 1f);
poseStack.translate(0, 0, 0.001f * i);
spiritBuilder.setAlpha(0.9f).renderQuad(poseStack, vertices, 1f);
poseStack.translate(0, 0, -0.002f * i);
spiritBuilder.setAlpha(0.9f).renderQuad(poseStack, vertices, 1f);
poseStack.popPose();
}
}
poseStack.popPose();
}

@Override
public AABB getRenderBoundingBox(SoulwovenBannerBlockEntity altar) {
var pos = altar.getBlockPos();
return new AABB(pos.getX(), pos.getY() - 1, pos.getZ(), pos.getX() + 1, pos.getY() + 1, pos.getZ() + 1);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,6 @@ public LodestoneArmorModel getHumanoidArmorModel(LivingEntity entity, ItemStack

@Override
public ResourceLocation getArmorTexture() {
return MalumMod.malumPath("textures/armor/malignant_stronghold");
return MalumMod.malumPath("textures/armor/malignant_stronghold.png");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,6 @@ public List<ItemAttributeModifiers.Entry> createExtraAttributes() {
}
@Override
public ResourceLocation getArmorTexture() {
return MalumMod.malumPath("textures/armor/soul_stained_steel_reforged");
return MalumMod.malumPath("textures/armor/soul_stained_steel_reforged.png");
}
}
14 changes: 12 additions & 2 deletions src/main/resources/META-INF/renderstates.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,24 @@ public net.minecraft.client.renderer.RenderType$CompositeRenderType state # stat
public net.minecraft.client.renderer.RenderType$CompositeRenderType state()Lnet/minecraft/client/renderer/RenderType$CompositeState; # state
public net.minecraft.client.renderer.RenderType$CompositeRenderType OUTLINE # OUTLINE
public net.minecraft.client.renderer.RenderType$CompositeState states # states
public net.minecraft.client.renderer.RenderType$CompositeState outlineProperty # outlineProperty
public net.minecraft.client.renderer.RenderType$CompositeState textureState # textureState
public net.minecraft.client.renderer.RenderType$CompositeState cullState # cullState
public net.minecraft.client.renderer.RenderType$CompositeState shaderState # shaderState
public net.minecraft.client.renderer.RenderType$CompositeState transparencyState # transparencyState
public net.minecraft.client.renderer.RenderType$CompositeState depthTestState # depthTestState
public net.minecraft.client.renderer.RenderType$CompositeState cullState # cullState
public net.minecraft.client.renderer.RenderType$CompositeState lightmapState # lightmapState
public net.minecraft.client.renderer.RenderType$CompositeState overlayState # overlayState
public net.minecraft.client.renderer.RenderType$CompositeState layeringState # layeringState
public net.minecraft.client.renderer.RenderType$CompositeState outputState # outputState
public net.minecraft.client.renderer.RenderType$CompositeState texturingState # texturingState
public net.minecraft.client.renderer.RenderType$CompositeState writeMaskState # writeMaskState
public net.minecraft.client.renderer.RenderType$CompositeState lineState # lineState
public net.minecraft.client.renderer.RenderType$CompositeState colorLogicState # colorLogicState
public net.minecraft.client.renderer.RenderType$CompositeState outlineProperty # outlineProperty
public net.minecraft.client.renderer.RenderType$CompositeState$CompositeStateBuilder <init>()V
public net.minecraft.client.renderer.RenderType$CompositeState$CompositeStateBuilder <init>()V # CompositeStateBuilder
public net.minecraft.client.renderer.RenderStateShard$WriteMaskStateShard writeDepth # writeDepth
public net.minecraft.client.renderer.RenderStateShard$WriteMaskStateShard writeColor # writeColor
public net.minecraft.client.renderer.RenderStateShard$ShaderStateShard shader # shader
public net.minecraft.client.renderer.RenderStateShard$EmptyTextureStateShard cutoutTexture()Ljava/util/Optional; # cutoutTexture
public net.minecraft.client.renderer.RenderStateShard$TextureStateShard cutoutTexture()Ljava/util/Optional; # cutoutTexture
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.

0 comments on commit f5481ba

Please sign in to comment.