Jump to content

Capricocious

Members
  • Posts

    12
  • Joined

  • Last visited

Everything posted by Capricocious

  1. Notes for self and anyone else it might help: the main forge event bus has several screen-related events, the vanilla Minecraft code also has an event for 'RenderGuiOverlayEvent' (Pre and Post), may be able to insert status bar as the vanilla gui is rendered and potentially manipulate gui elements from there.
  2. That's because overridden methods need to have the same signature as their supertype, you can't just go specifying your own new parameters and returns otherwise it becomes a different method.
  3. These are some good resources: https://www.mcjty.eu/docs/intro https://forge.gemwire.uk/wiki/Main_Page Mostly people learn by looking at vanilla code, I think. The parameter names are a bit weird, but they're usually accompanied by a type - e.g., int p_282557_ (so we know this parameter is an integer) - when you trace the parameter back to where it is first declared in a method/class.
  4. It is dependent on the geckolib mod, make sure you have the correct version of that installed too.
  5. I have a custom IGuiOverly defined to show the players hydration levels. Preferably, I would like it to appear between the hunger level tracker and the air bubble tracker. Currently I have manually positioned it above hunger with the RenderSystem and the GuiGraphics.blit method and it is just being drawn on top of the air tracker if a player submerges themselves. public static final IGuiOverlay HUD_THIRST = ((gui, guiGraphics, partialTick, screenWidth, screenHeight) -> { int x = screenWidth / 2; int y = screenHeight; RenderSystem.setShader(GameRenderer::getPositionTexShader); RenderSystem.setShaderColor(1.0f, 1.0f, 1.0f, 1.0f); RenderSystem.setShaderTexture(0, EMPTY_THIRST); for(int i = 0; i < 10; i++) { guiGraphics.blit(EMPTY_THIRST, x + 8 + (i * 8), y -51, 0, 0, 13, 12, 13, 12); } RenderSystem.setShaderTexture(0, FILLED_THIRST); for(int i = 0; i < 10; i++) { if(ClientThirstData.get() > i) { guiGraphics.blit(FILLED_THIRST, x + 8 + (i * 8), y -51, 0, 0, 13, 12, 13, 12); } else { break; } } }); Is there a way to bump the air bubble tracker up a few few pixels or make my GUI overlay known to the vanilla classes to prevent overlapping?
  6. Editing the vanilla source is obviously not possible since it is read only, and in my experience (and from my first question here lol) trying to get vanilla items from the registers and manipulate them has caused some major issues. It might be easier to create the unbreakable tools and armor as new items and then make a data pack to override the loot tables to force the new items to be the ones dropped/built rather than the vanilla ones?
  7. If you look at the first line in the dump you can see that there is an issue with the Geode Plus mod: You should probably uninstall that and try to run again.
  8. public static void onKeyInput(InputEvent.Key event) { if (KeyBinding.DRINK.consumeClick()) { Player player = Minecraft.getInstance().player; Level level = Minecraft.getInstance().level; final Vec3 vec3 = player.getEyePosition(1.0F); final Vec3 vec31 = player.getViewVector(1.0F); final int reach = (int) Math.round(player.getBlockReach()); for (int i = 1; i <= reach; i++) { Vec3 vec32 = vec3.add(vec31.x * i, vec31.y * i, vec31.z * i); BlockPos blockpos = new BlockPos((int) vec32.x, (int) vec32.y, (int) vec32.z); FluidState blockstate = level.getBlockState(blockpos).getFluidState(); if (blockstate.getType() == Fluids.WATER) { player.sendSystemMessage(Component.literal(blockstate.toString())); } } } } This solution appears to be working for now, I receive a message when I click on water. Help from the final comment on this post, and also looking and the vanilla lilypad block net.minecraft.world.level.block.waterlilyblock.
  9. Hi, I'm trying to detect if a block is water or not however I'm getting results for the block that is highlighted in the crosshair, not the water blocks on top/around it. Here is the method I'm testing this out in so far: is there a method or function that I can use that will treat water as a solid block instead of allowing it to be clicked through? Thanks! public static void onKeyInput(InputEvent.Key event) { if (KeyBinding.DRINK.consumeClick()) { double x = Minecraft.getInstance().player.getViewVector(1.0F).x() + Minecraft.getInstance().player.blockPosition().getX(); double y = Minecraft.getInstance().player.getViewVector(1.0F).y() + Minecraft.getInstance().player.blockPosition().getY(); double z = Minecraft.getInstance().player.getViewVector(1.0F).z() + Minecraft.getInstance().player.blockPosition().getZ(); Minecraft.getInstance().player.sendSystemMessage(Component.literal("X: " + x + ", Y: " + y + ", Z: " + z)); BlockPos blockpos = new BlockPos((int) Math.round(x), (int) Math.round(y), (int) Math.round(z)); FluidState isWater = Minecraft.getInstance().level.getFluidState(blockpos); Minecraft.getInstance().player.sendSystemMessage(Component.literal(isWater.toString())); } } Update: I've also had a look at the vanilla bucket item class, but I can't seem to figure out where I'm supposed to be looking. The BlockHitResult function only returns MISS, ENTITY or BLOCK. I'm guessing interaction result pass means to do nothing if the his result is a miss or not a block, but where in the final else statement does it determine that there is water?
  10. Hi warjort, thanks for the input! Is there a better way to turn off culling for blocks surrounding the vanilla crafting table rather than trying to overwrite the registries? I'd like to just use a resource pack to reskin it if I can, but I wasn't able to find a way to stop the faces of the surrounding blocks from culling. Or is it most sensible to just create my table as a new block?
  11. Hi, I'm creating a mod that involved reskinning the default crafting table to look like a real table, I have re-registered the item with the method .noOcclusion() so you can't see the rest of the world under the table legs: public static final RegistryObject<Block> CraftingTableBlock = VANILLA_BLOCKS.register("crafting_table", () -> new Block(BlockBehaviour.Properties.of(Material.WOOD).destroyTime(5).sound(SoundType.WOOD).noOcclusion())); However, on right-click the table no longer brings up the crafting menu. I've had to re-register the crafting table block item to ensure it shows up in the creative menu. I have looked in the java file for the craftingTableBlock and found the use and getMenuProvider methods, but I'm not sure how to call them. Is it a similar task I need to do to re-register the crafting menu so it can be opened? If anyone could provide some guidance it would be much appreciated <3 Minecraft version: 1.19.2 Forge version: 43.1.7
×
×
  • Create New...

Important Information

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