Jump to content


  • Posts

  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

GhostGaming's Achievements

Tree Puncher

Tree Puncher (2/8)



  1. I finally got it working! For anyone wanting to achieve this in the future: public void render(CustomBlockEntity blockEntity, float partialTick, PoseStack poseStack, MultiBufferSource bufferSource, int packedLight, int packedOverlay) { VertexConsumer vertexConsumer = VertexMultiConsumer.create(bufferSource.getBuffer(RenderType.glintDirect()), bufferSource.getBuffer(RenderType.solid())); BlockState blockState = CustomBlocks.CUSTOM_BLOCK.get().defaultBlockState(); Level level = blockEntity.getLevel(); BakedModel model = this.blockRenderer.getBlockModel(blockState); this.modelRenderer.tesselateBlock(level, model, blockState, blockEntity.getBlockPos(), poseStack, vertexConsumer, false, level.getRandom(), 0, packedOverlay); } @warjort, thank you so much again!
  2. Well, I'm actually trying to draw the enchanting glint over a block and that turned out way more difficult than it should be But I think your answer pushed me in the right direction. Thanks!
  3. I have a custom block entity and whenever it renders something it appears completely dark. In it's render method, the value of packedLight is always 0. @Override public void render(CustomBlockEntity blockEntity, float partialTick, PoseStack poseStack, MultiBufferSource bufferSource, int packedLight, int packedOverlay) { // packedLight is always 0? } If I disable ambient occlusion in the corresponding block's properties, the block entity doesn't render dark anymore but the lighting still isn't correct. I'm basically only trying to render a solid block. Can anyone help me with this?
  4. I simply mean this effect: This effect is achieved by using TntMinecartRenderer.renderWhiteSolidBlock(this.blockRenderer, this.tntBlock.defaultBlockState(), poseStack, bufferSource, packedLight, i / 5 % 2 == 0); which executes following code int i; if (p_234667_) { i = OverlayTexture.pack(OverlayTexture.u(1.0F), 10); } else { i = OverlayTexture.NO_OVERLAY; } p_234662_.renderSingleBlock(p_234663_, p_234664_, p_234665_, p_234666_, i); but using OverlayTexture.pack(OverlayTexture.u(1.0F), 10); in ItemRenderer::renderStatic like so this.itemRenderer.renderStatic(stack, ItemTransforms.TransformType.FIXED, packedLight, OverlayTexture.pack(OverlayTexture.u(1.0F), 10), poseStack, bufferSource, pos); does not add a white overlay to the rendererd item. Would you know, how to achieve this?
  5. I have an entity that uses ItemRenderer::renderStatic to render an item. Now, how would I render an overlay effect, like the mob damage or TNT flashing effects, onto said item? I've tried a lot of different things from the OverlayTexture class but nothing worked.
  6. I'm currently trying to render the enchanting glint on a custom block model. Using the different enchanting glint RenderTypes on the model obviously doesn't work because they are not of type DefaultVertexFormat.BLOCK. Does anyone have an idea on how I would need to tackle this? Thanks in advance!
  7. I added a custom BlockItem for my block and now I want it to be enchantable with sword enchantments. I tried overwriting canApplyAtEnchantingTable but this doesn't work. Here is the whole class: public class SwordBlockItem extends BlockItem { public SwordBlockItem(Block block, Properties properties) { super(block, properties); } @Override public boolean canApplyAtEnchantingTable(ItemStack stack, Enchantment enchantment) { return true; } @Override public boolean isEnchantable(ItemStack stack) { return true; } @Override public boolean isBookEnchantable(ItemStack stack, ItemStack book) { return true; } } For testing purposes I made all three of those methods return true. Applying books in an anvil works completely fine. It's just that no enchantment shows up in the enchantment table.
  8. Hi all, I have a problem with shrinking the player. I'm using EntityEvent.Size to shrink the player's bounding box and lower the eye height and therefore the camera position. This is really simple and all working fine (and basically all of the mod's code), but whenever I get close to blocks, the camera starts clipping through them. I have looked at other shrinking mods but all of them use mixin which I preferably don't want to use. I hope someone can help me, thanks!
  9. In the constructor of the block and by using DispenserBlock.registerDispenseBehavior() DispenserBlock.registerDispenseBehavior(this, new DefaultDispenseItemBehavior() { protected ItemStack dispenseStack(IBlockSource source, ItemStack stack) { World world = source.getWorld(); BlockPos blockpos = source.getBlockPos().offset(source.getBlockState().get(DispenserBlock.FACING)); BlockTNTGhostsExplosives block = (BlockTNTGhostsExplosives) ((BlockItem) stack.getItem()).getBlock(); if (block.getProperties().isIgnitableByDispensers()) { EntityTNTGhostsExplosives tntentity = new EntityTNTGhostsExplosives(world, (double) blockpos.getX() + 0.5D, (double) blockpos.getY(), (double) blockpos.getZ() + 0.5D, (LivingEntity) null, block.getProperties()); world.addEntity(tntentity); world.playSound(null, tntentity.getPosX(), tntentity.getPosY(), tntentity.getPosZ(), SoundEvents.ENTITY_TNT_PRIMED, SoundCategory.BLOCKS, 1.0F, 1.0F); stack.shrink(1); } else { Direction direction = source.getBlockState().get(DispenserBlock.FACING); IPosition iposition = DispenserBlock.getDispensePosition(source); ItemStack itemstack = stack.split(1); doDispense(source.getWorld(), itemstack, 6, direction, iposition); } return stack; } });
  10. I've examined what exactly caused the problem and it had nothing to do with the registry event but instead with registering the dispense behavior. I don't understand why this is happening but as soon as I register any sort of dispense behavior, even the default one, it won't show up in the creative inventory anymore. Really weird
  11. So my blocks are being registered again just by subscribing to the registry event? Interesting, I though that event was just called after all blocks have been registered. But anyways, thanks for your help ?
  12. Well... I got my project back running and the issue still exists. Here is the github repository
  13. I tried using GitHub Desktop to publish my repository but it looks like it completely wrecked my project because all my source files are gone, so I'm gonna cry now for a few days and maybe I'll come back here after I've implemented everything back ?
  • Create New...

Important Information

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