Jump to content

Airn

Members
  • Posts

    9
  • Joined

  • Last visited

Everything posted by Airn

  1. Yeah, I'm aware of the issues. I was just wondering if there was another way to do what I wanted without a second block. Well, thanks anyway.
  2. Let's say I have a block that occupies 16x16x16 pixels and there's an extra 8 pixels on the X axis outside this range (24x16x16). Is there a way to make this extra part interactable (through the "use" method) without the need of a second block?
  3. I found the problem. I thought that it would render the entire thing, but it turns out that I was only rendering the "head" part on my Model Class. Well, thanks for the help.
  4. You mean something like this? inside my Renderer Class? Because although the method is being called, it still doesn't render @Override public void render(T pEntity, float pEntityYaw, float pPartialTicks, PoseStack pMatrixStack, MultiBufferSource pBuffer, int pPackedLight) { pMatrixStack.pushPose(); pMatrixStack.translate(0.0D, -0.626D, 0.0D); pMatrixStack.scale(1F, 1F, 1F); VertexConsumer vertexconsumer = pBuffer.getBuffer(this.model.renderType(_texture)); this.model.renderToBuffer(pMatrixStack, vertexconsumer, pPackedLight, OverlayTexture.NO_OVERLAY, 1.0F, 1.0F, 1.0F, 1.0F); pMatrixStack.popPose(); super.render(pEntity, pEntityYaw, pPartialTicks, pMatrixStack, pBuffer, pPackedLight); }
  5. I can spawn the entity (using the summon command inside the game), their hitbox shows when using F3 B. The problem is that it is not rendering. Am I missing something? I have the texture file at 'src\main\resources\assets\stepladder\textures\entity\ladder.png' Main Class @Mod(LadderMod.MODID) public class LadderMod { public static final String MODID = "stepladder"; public static final DeferredRegister<EntityType<?>> ENTITIES = DeferredRegister.create(ForgeRegistries.ENTITY_TYPES, MODID); public static final RegistryObject<EntityType<LadderEntity>> LADDER = ENTITIES.register("ladder", () -> EntityType.Builder.<LadderEntity>of(LadderEntity::new, MobCategory.MISC) .build(String.valueOf(new ResourceLocation(MODID, "ladder")))); public LadderMod() { IEventBus modEventBus = FMLJavaModLoadingContext.get().getModEventBus(); ENTITIES.register(modEventBus); MinecraftForge.EVENT_BUS.register(this); } @Mod.EventBusSubscriber(modid = MODID, bus = Mod.EventBusSubscriber.Bus.MOD) public static class ClientModEvents { @SubscribeEvent public static void registerLayers(EntityRenderersEvent.RegisterLayerDefinitions event) { event.registerLayerDefinition(LadderModel.LAYER_LOCATION, LadderModel::createBodyLayer); } @SubscribeEvent public static void registerRenderers(EntityRenderersEvent.RegisterRenderers event) { event.registerEntityRenderer(LadderMod.LADDER.get(), LadderRenderer::new); } } } Entity Class public class LadderEntity extends Entity { public LadderEntity(EntityType<LadderEntity> type, Level worldIn) { super(type, worldIn); } @Override protected void readAdditionalSaveData(CompoundTag pCompound) { } @Override protected void addAdditionalSaveData(CompoundTag pCompound) { } @Override protected void defineSynchedData() {} @Override public Packet<?> getAddEntityPacket() { return NetworkHooks.getEntitySpawningPacket(this); } } Model Class public class LadderModel<Type extends LadderEntity> extends EntityModel<Type> { public static final ModelLayerLocation LAYER_LOCATION = new ModelLayerLocation(new ResourceLocation(LadderMod.MODID, "ladder"), "main"); private final ModelPart head; public LadderModel(ModelPart root) { this.head = root.getChild("head"); } public static LayerDefinition createBodyLayer() { MeshDefinition meshdefinition = new MeshDefinition(); PartDefinition partdefinition = meshdefinition.getRoot(); partdefinition.addOrReplaceChild("head", CubeListBuilder.create(), PartPose.offset(0.0F, 24.0F, -4.0F)); partdefinition.addOrReplaceChild("step_r1", CubeListBuilder.create().texOffs(0, 0).addBox(-4.0F, -8.0F, 24.0F, 10.0F, 3.0F, 1.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(-1.0F, -31.0F, -15.75F, -1.5708F, 0.0F, 0.0F)); partdefinition.addOrReplaceChild("step_r2", CubeListBuilder.create().texOffs(0, 0).addBox(-4.0F, -8.0F, 24.0F, 10.0F, 3.0F, 1.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(-1.0F, -39.0F, -13.75F, -1.5708F, 0.0F, 0.0F)); partdefinition.addOrReplaceChild("step_r3", CubeListBuilder.create().texOffs(0, 0).addBox(-4.0F, -8.0F, 24.0F, 10.0F, 3.0F, 1.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(-1.0F, -47.0F, -11.75F, -1.5708F, 0.0F, 0.0F)); partdefinition.addOrReplaceChild("step_r4", CubeListBuilder.create().texOffs(0, 0).addBox(-4.0F, -8.0F, 24.0F, 10.0F, 3.0F, 1.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(-1.0F, -55.0F, -9.5F, -1.5708F, 0.0F, 0.0F)); partdefinition.addOrReplaceChild("step_r5", CubeListBuilder.create().texOffs(0, 0).addBox(-4.0F, -8.0F, 24.0F, 10.0F, 4.0F, 1.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(-1.0F, -61.0F, -5.8125F, -1.5708F, 0.0F, 0.0F)); partdefinition.addOrReplaceChild("step_r6", CubeListBuilder.create().texOffs(0, 0).addBox(-4.0F, -8.0F, 24.0F, 10.0F, 3.0F, 1.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(-1.0F, -55.0F, -3.0F, -1.5708F, 0.0F, 0.0F)); partdefinition.addOrReplaceChild("step_r7", CubeListBuilder.create().texOffs(0, 0).addBox(-4.0F, -8.0F, 24.0F, 10.0F, 3.0F, 1.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(-1.0F, -47.0F, -1.0F, -1.5708F, 0.0F, 0.0F)); partdefinition.addOrReplaceChild("step_r8", CubeListBuilder.create().texOffs(0, 0).addBox(-4.0F, -8.0F, 24.0F, 10.0F, 3.0F, 1.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(-1.0F, -39.0F, 1.25F, -1.5708F, 0.0F, 0.0F)); partdefinition.addOrReplaceChild("step_r9", CubeListBuilder.create().texOffs(0, 0).addBox(-4.0F, -8.0F, 24.0F, 10.0F, 3.0F, 1.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(-1.0F, -31.0F, 3.25F, -1.5708F, 0.0F, 0.0F)); partdefinition.addOrReplaceChild("support_r1", CubeListBuilder.create().texOffs(0, 0).addBox(4.0F, -7.0F, -7.0F, 2.0F, 2.0F, 39.0F, new CubeDeformation(0.0F)) .texOffs(0, 0).addBox(-8.0F, -7.0F, -7.0F, 2.0F, 2.0F, 39.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(1.0F, -29.0F, -3.0F, -1.309F, 0.0F, 0.0F)); partdefinition.addOrReplaceChild("support_r2", CubeListBuilder.create().texOffs(0, 0).addBox(4.0F, -7.0F, -7.0F, 2.0F, 2.0F, 39.0F, new CubeDeformation(0.0F)) .texOffs(0, 0).addBox(16.0F, -7.0F, -7.0F, 2.0F, 2.0F, 39.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(-11.0F, -5.0F, -3.0F, 1.309F, 0.0F, 0.0F)); return LayerDefinition.create(meshdefinition, 16, 16); } @Override public void renderToBuffer(PoseStack poseStack, VertexConsumer vertexConsumer, int packedLight, int packedOverlay, float red, float green, float blue, float alpha) { head.render(poseStack, vertexConsumer, packedLight, packedOverlay, red, green, blue, alpha); } @Override public void setupAnim(Type pEntity, float pLimbSwing, float pLimbSwingAmount, float pAgeInTicks, float pNetHeadYaw, float pHeadPitch) { } } Renderer Class public class LadderRenderer<T extends LadderEntity> extends EntityRenderer<T> { private static final ResourceLocation _texture = new ResourceLocation(LadderMod.MODID, "textures/entity/ladder.png"); protected final EntityModel<T> model; public LadderRenderer(EntityRendererProvider.Context pContext) { super(pContext); this.model = new LadderModel<>(pContext.bakeLayer(LadderModel.LAYER_LOCATION)); } @Override public ResourceLocation getTextureLocation(LadderEntity pEntity) { return _texture; } }
  6. Unfortunately, I really need those extra hitboxes. But anyways, I was fiddling with the ender dragon code a few hours ago and ended up finding what i needed there. Which is exactly what you said. So thanks for the help, I guess
  7. So i've added a simple (mob) entity to my game, but is there a way to change or add more shapes to the collision box?
  8. Working perfectly! Thank you! In case someone else needs it, I also had to change "layers" to "children".
  9. I do have a few blocks that have transluscent and solid parts Before 1.19, I could merge both models with "loader": "forge:multi-layer" like that (just an example) { "loader": "forge:multi-layer", "layers": { "solid": { "parent": "modid:block/example_solid_model" }, "translucent": { "parent": "modid:block/example_translucent_model" } } } After I updated to 1.19 I received a warning stating "Model loader 'forge:multi-layer' not found" and also displayed the registered loaders Registered loaders: forge:elements, forge:obj, forge:fluid_container, forge:composite, forge:item-layers, forge:separate_transforms, forge:empty, forge:item_layers, forge:bucket, minecraft:elements, forge:separate-perspective Does it not work like that anymore? or perhaps the way to do it has changed? forge 1.19.2-43.0.16
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.