Skip to content

Commit

Permalink
render type fix. hollder hitbox a bit bigger matching the model
Browse files Browse the repository at this point in the history
  • Loading branch information
MehVahdJukaar committed Oct 31, 2024
1 parent 5ba9158 commit df6d05e
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 16 deletions.
21 changes: 11 additions & 10 deletions src/main/java/galena/doom_and_gloom/client/ORenderTypes.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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<ResourceLocation, RenderType> 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);
Expand All @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public class OEntityTypes {

public static final DeferredRegister<EntityType<?>> ENTITIES = DeferredRegister.create(ForgeRegistries.ENTITY_TYPES, DoomAndGloom.MOD_ID);

public static final RegistryObject<EntityType<Holler>> 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<EntityType<Holler>> 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<EntityType<DirtMound>> DIRT_MOUND = ENTITIES.register("dirt_mound", () -> EntityType.Builder.of(DirtMound::new, MobCategory.MISC).sized(0.8F, 0.25F).build("dirt_mound"));

}

0 comments on commit df6d05e

Please sign in to comment.