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.

sillypantscoder

Members
  • Joined

  • Last visited

Everything posted by sillypantscoder

  1. How do I have a block run a function every few ticks while it is on the world? I have looked at the Hopper and Repeater blocks and I can't figure it out. It looks like the "tick" method on a Block is deprecated, but it doesn't say anything about what to replace it with.
  2. It looks like `getAllRecipesFor` is returning a List of CraftingRecipe, because this is valid: List<CraftingRecipe> recipes = world.getRecipeManager().getAllRecipesFor(RecipeType.CRAFTING); for (CraftingRecipe recipe : recipes) { // ... } I have tried doing this: Item result = recipe.getResultItem(RegistryAccess.EMPTY).getItem(); NonNullList<Ingredient> in = recipe.getIngredients(); for (Ingredient i : in) { for (ItemStack stack : i.getItems()) { Item ingredient = stack.getItem(); } } But this seems like a roundabout way of doing this, and I'm not sure whether it works. And I'm not sure why each Ingredient contains a list of items.
  3. Then what? List<CraftingRecipe> recipes = world.getRecipeManager().getAllRecipesFor(RecipeType.CRAFTING); for (CraftingRecipe recipe : recipes) { // ... } How do I get Item objects for the ingredients and result?
  4. I want to get a list of all the recipes, even ones defined in other mods. I found net.minecraft.world.item.crafting.Recipe, but I have no idea how to get a list of these. I have searched online, but most answers mention ForgeRegistries.RECIPES, which doesn't exist anymore.
  5. I'm trying to display some text in the player's action bar: player.displayClientMessage(SomeComponent, true); But I'm having trouble creating a newline (that would create two lines of text). I tried this, but it doesn't work: Component.literal("\n") Anyone have any idea how to do this?
  6. I want to know if a player would have taken damage from a TNT block. The only thing is, the player may or may not be in Creative.
  7. I want to make the player jump. Simple as that. I have tried already: net.minecraft.world.entity.player.Player player; player.jumpFromGround(); // doesn't work player.setJumping(true); // doesn't work
  8. I have tried that but it is really complicated and confusing.
  9. I can't believe no one has already asked this... How do I create a GUI with text and buttons, like you see in MCreator? Note: Text and buttons are the only two things I am going to want to add.

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.