-
Posts
9 -
Joined
-
Last visited
sillypantscoder's Achievements
Tree Puncher (2/8)
0
Reputation
-
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.
-
[1.20.1] Get list of all the recipes
sillypantscoder replied to sillypantscoder's topic in Modder Support
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. -
[1.20.1] Get list of all the recipes
sillypantscoder replied to sillypantscoder's topic in Modder Support
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? -
sillypantscoder started following Create a GUI , [1.20.1] Get list of all the recipes , Detect if the player would have been exploded and 2 others
-
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.
-
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?
-
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.
-
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
-
I have tried that but it is really complicated and confusing.
-
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.