Jump to content

sillypantscoder

Members
  • Posts

    9
  • Joined

  • Last visited

sillypantscoder's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  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.
×
×
  • Create New...

Important Information

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