Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Sam__Wilde

Members
  • Joined

  • Last visited

  1. I figured out how to solve this problem. You need to make a custom renderToBuffer in the model file. Current Code: HeadRenderer public class MegovidHeadRenderer<T extends LivingEntity> extends RenderLayer<T, MegovidModel<T>> { private static final RenderType GATEWAY = RenderType.endGateway(); public MegovidHeadRenderer(RenderLayerParent<T, MegovidModel<T>> pRenderer) { super(pRenderer); } @Override public void render(PoseStack poseStack, MultiBufferSource multiBufferSource, int i, T t, float v, float v1, float v2, float v3, float v4, float v5) { this.getParentModel().renderToBufferCUSTOM( poseStack, multiBufferSource.getBuffer(GATEWAY), 15728640, OverlayTexture.NO_OVERLAY, 1.0F, 1.0F, 1.0F, 1.0F); } } Model file public void renderToBufferCUSTOM(PoseStack poseStack, VertexConsumer vertexConsumer, int packedLight, int packedOverlay, float red, float green, float blue, float alpha) { poseStack.translate(0,1.5,0); head.render(poseStack, vertexConsumer, packedLight, packedOverlay, red, green, blue, alpha); } Result:
  2. Hello, I want to make it so that a certain part of my mob model is rendered as a portal to the end. Using the second layer I was able to render a second model with the portal effect, but I don't need the whole model. How to fix this? (This is a test mob, I want to render its head as a portal). Current code: Constructor of Renderer public MegovidRenderer(EntityRendererProvider.Context pContext) { super(pContext, new MegovidModel<>(pContext.bakeLayer(ModModelLayers.MEGOVID_LAYER)), 0.5f); this.addLayer(new MegovidHeadRenderer(this)); } Register renderer @SubscribeEvent public static void onClientSetup(FMLClientSetupEvent event) { EntityRenderers.register(ModEntities.MEGOVID.get(), MegovidRenderer::new); } HeadRenderer public class MegovidHeadRenderer<T extends LivingEntity> extends RenderLayer<T, MegovidModel<T>> { private static final RenderType GATEWAY = RenderType.endGateway(); public MegovidHeadRenderer(RenderLayerParent<T, MegovidModel<T>> pRenderer) { super(pRenderer); } @Override public void render(PoseStack poseStack, MultiBufferSource multiBufferSource, int i, T t, float v, float v1, float v2, float v3, float v4, float v5) { poseStack.pushPose(); poseStack.translate(0,-2,0); this.getParentModel().renderToBuffer( poseStack, multiBufferSource.getBuffer(this.renderType()), 15728640, OverlayTexture.NO_OVERLAY, 1.0F, 1.0F, 1.0F, 1.0F); poseStack.popPose(); } private RenderType renderType() { return GATEWAY; } } Result:
  3. Sam__Wilde changed their profile photo
  4. Hello, I want to create an item that when used, generates a structure. (structure don't generates naturally in world) Now I am having trouble generating a structure (jigsaw). The code below works, BUT the structure does not appear in the world until I re-enter it. This is a significant flaw that I would like to get rid of. My current code: public class MineshaftSpawnerItem extends Item { public MineshaftSpawnerItem(Properties pProperties) { super(pProperties); } @Override public @NotNull InteractionResult useOn(UseOnContext pContext) { Level pLevel = pContext.getLevel(); Player pPlayer = pContext.getPlayer(); BlockPos pBlockPos = pContext.getClickedPos(); ItemStack item = pContext.getItemInHand(); if (!pLevel.isClientSide()) { assert pPlayer != null; item.setCount(0); String command = MessageFormat.format("place structure weirdoitems:mineshaft {0} {1} {2}", pBlockPos.getX(), pBlockPos.getY(), pBlockPos.getZ()); System.out.println(command); try { Objects.requireNonNull(pLevel.getServer()).getCommands().getDispatcher().execute(command, pLevel.getServer().createCommandSourceStack()); } catch (CommandSyntaxException e) { throw new RuntimeException(e); } } return InteractionResult.PASS; } } I know about the PlaceCommand.placeStructure() method, but I can't figure out how to use it, and I can't find any documentation or examples of how to use it on the internet. Edit: I searched and tried normal options to solve this problem for a very long time, but nothing. I ended up doing it like this. And it works (in my case). @Override public @NotNull InteractionResult useOn(UseOnContext pContext) { Level pLevel = pContext.getLevel(); BlockPos pBlockPos = pContext.getClickedPos(); ItemStack item = pContext.getItemInHand(); if (!pLevel.isClientSide()) { item.setCount(0); JigsawBlockEntity jigsawBlockEntity = new JigsawBlockEntity(pBlockPos, Blocks.JIGSAW.defaultBlockState()); jigsawBlockEntity.setPool(Pools.createKey("weirdoitems:mineshaft/tunnels")); jigsawBlockEntity.setName(new ResourceLocation("weirdoitems:tunnel")); jigsawBlockEntity.setTarget(new ResourceLocation("weirdoitems:tunnel")); jigsawBlockEntity.setFinalState("minecraft:oak_planks"); jigsawBlockEntity.generate((ServerLevel) pLevel, 7, false); } return InteractionResult.CONSUME; }

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.