From df6d05e4ac730c3fc5ac4b5ee4ea5f69a2ef8e8a Mon Sep 17 00:00:00 2001 From: MehVahdJukaar Date: Thu, 31 Oct 2024 14:37:40 +0100 Subject: [PATCH] render type fix. hollder hitbox a bit bigger matching the model --- .../doom_and_gloom/client/ORenderTypes.java | 21 ++++++++++--------- .../client/model/HollerModel.java | 6 +----- .../doom_and_gloom/index/OEntityTypes.java | 2 +- 3 files changed, 13 insertions(+), 16 deletions(-) diff --git a/src/main/java/galena/doom_and_gloom/client/ORenderTypes.java b/src/main/java/galena/doom_and_gloom/client/ORenderTypes.java index 17f47275..11e3f830 100644 --- a/src/main/java/galena/doom_and_gloom/client/ORenderTypes.java +++ b/src/main/java/galena/doom_and_gloom/client/ORenderTypes.java @@ -6,7 +6,6 @@ import com.mojang.blaze3d.vertex.VertexFormat; import galena.doom_and_gloom.DoomAndGloom; import net.minecraft.Util; -import net.minecraft.client.renderer.GameRenderer; import net.minecraft.client.renderer.RenderStateShard; import net.minecraft.client.renderer.RenderType; import net.minecraft.client.renderer.ShaderInstance; @@ -26,11 +25,20 @@ public abstract class ORenderTypes extends RenderType { protected static final ShaderStateShard NO_ALPHA_CUTOFF_SHARD = new ShaderStateShard(NO_ALPHA_CUTOFF_SHADER::get); + protected static final TransparencyStateShard ADDITIVE_TRANSPARENCY = new TransparencyStateShard("lightning_transparency", () -> { + RenderSystem.enableBlend(); + RenderSystem.enableDepthTest(); + RenderSystem.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE); + }, () -> { + RenderSystem.disableBlend(); + RenderSystem.defaultBlendFunc(); + }); + public static final Function ADDITIVE_TRANSLUCENCY = Util.memoize((t) -> { RenderType.CompositeState rendertype$compositestate = RenderType.CompositeState.builder() .setShaderState(NO_ALPHA_CUTOFF_SHARD) .setTextureState(new RenderStateShard.TextureStateShard(t, false, false)) - .setTransparencyState(TransparencyStateShard.LIGHTNING_TRANSPARENCY) + .setTransparencyState(ADDITIVE_TRANSPARENCY) .setCullState(NO_CULL) .setLightmapState(LIGHTMAP).setOverlayState(OVERLAY) .createCompositeState(false); @@ -49,14 +57,7 @@ public abstract class ORenderTypes extends RenderType { return create("doom_and_gloom_entity_translucent_no_alpha_cutoff", DefaultVertexFormat.NEW_ENTITY, VertexFormat.Mode.QUADS, 256, true, true, rendertype$compositestate); }); - protected static final TransparencyStateShard LIGHTNING_TRANSPARENCY = new TransparencyStateShard("lightning_transparency", () -> { - RenderSystem.enableBlend(); - RenderSystem.enableDepthTest(); - RenderSystem.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE); - }, () -> { - RenderSystem.disableBlend(); - RenderSystem.defaultBlendFunc(); - }); + public ORenderTypes(String pName, VertexFormat pFormat, VertexFormat.Mode pMode, int pBufferSize, boolean pAffectsCrumbling, boolean pSortOnUpload, Runnable pSetupState, Runnable pClearState) { super(pName, pFormat, pMode, pBufferSize, pAffectsCrumbling, pSortOnUpload, pSetupState, pClearState); diff --git a/src/main/java/galena/doom_and_gloom/client/model/HollerModel.java b/src/main/java/galena/doom_and_gloom/client/model/HollerModel.java index b9670c09..cc0deba7 100644 --- a/src/main/java/galena/doom_and_gloom/client/model/HollerModel.java +++ b/src/main/java/galena/doom_and_gloom/client/model/HollerModel.java @@ -3,17 +3,13 @@ import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.VertexConsumer; import com.mojang.math.Axis; -import galena.doom_and_gloom.DoomAndGloom; import galena.doom_and_gloom.client.ORenderTypes; -import galena.doom_and_gloom.client.render.entity.HollerRender; import galena.doom_and_gloom.content.entity.holler.Holler; -import net.minecraft.client.Minecraft; import net.minecraft.client.model.EntityModel; import net.minecraft.client.model.HeadedModel; import net.minecraft.client.model.geom.ModelPart; import net.minecraft.client.model.geom.PartPose; import net.minecraft.client.model.geom.builders.*; -import net.minecraft.client.renderer.RenderType; import net.minecraft.util.Mth; import net.minecraft.world.phys.Vec3; @@ -82,7 +78,7 @@ public void prepareMobModel(T entity, float pLimbSwing, float pLimbSwingAmount, @Override public void setupAnim(T entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) { - yHover = Math.sin(ageInTicks * 0.12) * 0.1; + yHover = (Math.sin(ageInTicks * 0.12) - 1.5) * 0.1; //we ignore arm swing and limb swing amount and use our own static ones //this could be improved by having some part of the anim depend on those so they increase when mob speeds up diff --git a/src/main/java/galena/doom_and_gloom/index/OEntityTypes.java b/src/main/java/galena/doom_and_gloom/index/OEntityTypes.java index 5cd017d9..1ccebc5f 100644 --- a/src/main/java/galena/doom_and_gloom/index/OEntityTypes.java +++ b/src/main/java/galena/doom_and_gloom/index/OEntityTypes.java @@ -13,7 +13,7 @@ public class OEntityTypes { public static final DeferredRegister> ENTITIES = DeferredRegister.create(ForgeRegistries.ENTITY_TYPES, DoomAndGloom.MOD_ID); - public static final RegistryObject> HOLLER = ENTITIES.register("holler", () -> EntityType.Builder.of(Holler::new, MobCategory.MONSTER).sized(0.35F, 0.6F).clientTrackingRange(8).updateInterval(2).build("holler")); + public static final RegistryObject> HOLLER = ENTITIES.register("holler", () -> EntityType.Builder.of(Holler::new, MobCategory.MONSTER).sized(0.4F, 0.75F).clientTrackingRange(8).updateInterval(2).build("holler")); public static final RegistryObject> DIRT_MOUND = ENTITIES.register("dirt_mound", () -> EntityType.Builder.of(DirtMound::new, MobCategory.MISC).sized(0.8F, 0.25F).build("dirt_mound")); }