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.

HixlePod

Members
  • Joined

  • Last visited

Everything posted by HixlePod

  1. Hello, I have a problem that's stumped me for a couple of days. I have successfully displayed a block outline at a specified position, the current problem is a secondary box appears that moves around based on the camera rotation and position. I have no idea what is causing this issue so any help would be appreciated. Also, a block is required at the position in order to display the outline if you are trying to reproduce the problem. Image of the issue https://drive.google.com/file/d/1SBh_XaHYCgcnJSRs1mh1fdi9Yg0bCf41/view?pli=1 Code: public static void drawBoxAtBlockPos(PoseStack matrixStack, AABB aabbIn, float red, float green, float blue, float alpha, BlockPos pos) { Vec3 cam = Minecraft.getInstance().gameRenderer.getMainCamera().getPosition(); double camX = cam.x, camY = cam.y, camZ = cam.z; PoseStack.Pose pose = matrixStack.last(); MultiBufferSource.BufferSource renderTypeBuffer = Minecraft.getInstance().renderBuffers().bufferSource(); VertexConsumer bufferIn = renderTypeBuffer.getBuffer(RenderType.lines()); VoxelShape voxelShape = Shapes.create(aabbIn); double originX = pos.getX() - camX, originY = pos.getY() - camY, originZ = pos.getZ() - camZ; matrixStack.pushPose(); GL11.glDisable(GL11.GL_DEPTH_TEST); voxelShape.forAllEdges((x0, y0, z0, x1, y1, z1) -> { bufferIn.vertex(pose.pose(), (float) (x0 + originX), (float) (y0 + originY), (float) (z0 + originZ)) .color(red, green, blue, alpha) .normal(pose.normal(), (float) (x1-x0), (float) (y1-y0), (float) (z1-z0)) .endVertex(); bufferIn.vertex(pose.pose(), (float) (x1 + originX), (float) (y1 + originY), (float) (z1 + originZ)) .color(red, green, blue, alpha) .normal(pose.normal(), (float) (x1-x0), (float) (y1-y0), (float) (z1-z0)) .endVertex(); }); renderTypeBuffer.endBatch(RenderType.lines()); GL11.glEnable(GL11.GL_DEPTH_TEST); matrixStack.popPose(); } @SubscribeEvent public static void onRenderWorldEvent(RenderLevelStageEvent event) { final GameRenderer gameRenderer = Minecraft.getInstance().gameRenderer; Player player = Minecraft.getInstance().player; gameRenderer.resetProjectionMatrix(event.getProjectionMatrix()); BlockPos thePos = new BlockPos(0, 67, 1); if (player.level.isClientSide) { if (player.level.getBlockState(thePos) != Blocks.AIR.defaultBlockState() && player.level.getBlockState(thePos) != Blocks.CAVE_AIR.defaultBlockState()) { AABB aabb = player.level.getBlockState(thePos).getShape(player.getLevel(), new BlockPos(0, 0, 0), CollisionContext.of(player)).optimize().bounds(); drawBoxAtBlockPos(event.getPoseStack(), aabb, 1.0F, 1.0F, 1.0F, 1.0F, thePos); } } }
  2. I am using the Caelus API to handle my elytra flight, so far it seems to have solved my issue. Thank you for your help though!!
  3. Hello, I'm having an issue with getting players to use elytra flight. They do not have any elytra armour on their chest plate but rather the elytra is rendered on the player. What I've got so far seems to make the server 'fight' with itself making the person with the elytra begin flying but immediately go back to non-flight. I'm checking if the player is off the ground and such client and server side using packets. Client code: @SubscribeEvent(priority = EventPriority.HIGHEST) public static void onKeyInput(InputEvent.Key event) { if (Minecraft.getInstance().options.keyJump.consumeClick()) { Player player = Minecraft.getInstance().player; if (!player.isOnGround() && !player.isFallFlying() && !player.isInWater() && !player.hasEffect(MobEffects.LEVITATION)) { NetworkManager.sendToServer(new ElytraAttemptFlyPacket()); } } } } Server code: public class ElytraAttemptFlyPacket { public ElytraAttemptFlyPacket(FriendlyByteBuf buf) { } public ElytraAttemptFlyPacket() { } public void toBytes(FriendlyByteBuf buf) { } public boolean handle(Supplier<NetworkEvent.Context> supplier) { NetworkEvent.Context context = supplier.get(); context.enqueueWork(() -> { //Server ServerPlayer player = context.getSender(); if (!player.isOnGround() && !player.isFallFlying() && !player.isInWater() && !player.hasEffect(MobEffects.LEVITATION)) { player.startFallFlying(); } }); return true; } } As I said before it kind of works but it looks like the server is fighting with itself putting the player in elytra mode and normal mode. Any suggestions would be appreciated!!

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.