Jump to content

kiou.23

Members
  • Posts

    444
  • Joined

  • Last visited

  • Days Won

    5

Posts posted by kiou.23

  1. Please, for the love of god, don't just paste your code as plain text, it's painfull to try and read it. The forums has a tool that you can use to post code, it will even do syntax highliting, you just click on the angle brackets that show up on the top of the textarea you use to make the post (near the smiley)

    Same goes for error logs, post them in something like gist or pastebin, or use the code thing, makes it waaay easier to read

     

    Don't register your blocks through Registry Events, the preferred way is to use DeferredRegisters, you can find more info on it in the docs

    It seems that you are trying to set some block state in getStateForPlacement, however your blocks has no block states, you need to set the defaultState in the constructor, and then override fillStateContainer, to "register" your states

    If fixing the blockstate, and using DeferredRegisters doesn't solve your issue, post your build.gradle file

  2. 16 minutes ago, L0raxeo said:

    2. What do you mean by re-run genIntelliJRuns?

    Quote

    For IntelliJ, run the genIntellijRuns gradle task (gradlew genIntellijRuns). This will generate the Run Configurations and download any required assets for the game to run. After this has finished edit your Configurations to fix the “module not specified” error by changing selecting your “main” module.

    From the getting started documentation: https://mcforge.readthedocs.io/en/1.16.x/gettingstarted/

     

    Also, post your build.gradle

    or if possible a repository

  3. in the Tile Entity, just constantly keep cooking whatever the input is, instead of checking for fuel, I don't see what the issue would be. honestly, making a furnace which needs fuel seems harder than one that doesn't

    maybe you could be more specific on what you're not able to accomplish, so we can help you

  4. which kind of recipe? you can get the recipe for an inventory through World#getRecipeManager()#getRecipe

    the implementation logic is not that complicated, but you will need to handle decreasing the stacks, shift-clicking, checking for container items, and serialization yourself

  5. I have 6 entities which all should render with obj models, I am registering the renderers in the client setup, but the models are not showing up correctly. I feel it must be a dumb mistake I made, but I am unable to find what it could be, I'd appreciate help

    the client setup listener: github/jvcmarcenes/dicehoard/client/ClientEventHandler.java#L42

    the entity renderer: github/jvcmarcenes/dicehoard/client/renderer/DiceRenderer.java

    currently all my entities are rendering with the dsix.obj model

  6. looks like it should work, are you sure sdd:straw and sdd:jerry_nest are the correct registry names for your items? if they are, make sure the recipe is under resources/assets/data/sdd/recipes/

     

    also: "sdd" is too short for a mod id, use something more unique

     

    EDIT: oh, nevermind, you've set the count as a string and not an integer, that's the issue

  7. I think that what you want can be solved with Layer Renderers. (I think, I'm not quite sure wha you want really)

    extend Layer Renderer for the PlayerEntity and PlayerModel generic type parameters, and then override the render method. the layer renderer will always try to render, so you'll need to handle the condition logic of wether it should render or not.

    to "register" this, just an instance of the layer to the player's renderer in the RenderPlayer event

  8. 58 minutes ago, SuperRuper1209 said:

    Parsing error loading recipe tds:marshmallow
    com.google.gson.JsonSyntaxException: Invalid or unsupported recipe type 'tds:crafting_special_marshmallow'

      Reveal hidden contents

    public static class MarshmallowRecipe extends SpecialRecipe { public static final IRecipeSerializer<MarshmallowRecipe> SERIALIZER = new SpecialRecipeSerializer<>(MarshmallowRecipe::new); public MarshmallowRecipe(ResourceLocation p_i48169_1_) { super(p_i48169_1_); } @Override public boolean matches(CraftingInventory p_77569_1_, World p_77569_2_) { boolean foundSeeds = false; boolean foundBottle = false; boolean foundPotato = false; boolean foundSugar = false; boolean notRight = false; for (int j = 0; j < p_77569_1_.getContainerSize(); ++j) { ItemStack itemStack = p_77569_1_.getItem(j); if (!itemStack.isEmpty()) { if (itemStack.sameItem(new ItemStack(Items.POTATO)) && !foundPotato) { foundPotato = true; } else if (foundPotato && itemStack.sameItem(new ItemStack(Items.POTATO))) { notRight = true; } if (itemStack.sameItem(new ItemStack(Items.SUGAR)) && !foundSugar) { foundSugar = true; } else if (foundSugar && itemStack.sameItem(new ItemStack(Items.SUGAR))) { notRight = true; } if (PotionUtils.getPotion(itemStack) != null && PotionUtils.getPotion(itemStack) == Potions.WATER && !foundBottle) { foundBottle = true; } else if (foundBottle && PotionUtils.getPotion(itemStack) != null && PotionUtils.getPotion(itemStack) == Potions.WATER) { notRight = true; } if (Tags.Items.SEEDS.getValues().contains(itemStack.getItem()) && !foundSeeds) { foundSeeds = true; } else if (foundSeeds && Tags.Items.SEEDS.getValues().contains(itemStack.getItem())) { notRight = true; } } } if (foundSeeds && foundBottle && foundPotato && foundSugar && !notRight) { return true; } return false; } @Override public ItemStack assemble(CraftingInventory p_77572_1_) { ItemStack stack = new ItemStack(SimpleItems.MARSHALLOW); stack.setCount(1); return stack; } @Override public boolean canCraftInDimensions(int p_194133_1_, int p_194133_2_) { return true; } @Override public NonNullList<ItemStack> getRemainingItems(CraftingInventory p_179532_1_) { NonNullList<ItemStack> list = NonNullList.withSize(0, ItemStack.EMPTY); list.set(0, PotionUtils.setPotion(new ItemStack(Items.POTION), Potions.EMPTY)); return list; } @Override public IRecipeSerializer<?> getSerializer() { return SERIALIZER; } }

      Reveal hidden contents

    { "type": "tds:crafting_special_marshmallow" }

      Reveal hidden contents

    Registry.register(Registry.RECIPE_SERIALIZER, new ResourceLocation("tds", "crafting_special_marshmallow"), Marshmallow.MarshmallowRecipe.SERIALIZER);

     

    it seems your problem is solved, but just a tip: when posting code to the forums, use the code block instead of the spoiler, it provides indendation and monospaced fonts which make the code actually readable

    • Thanks 1
  9. it depends on wether you want the vanilla water bottle always return en empty water bottle (for any recipe that uses a water bottle), or if there is some specific recipes from your mod that you want that behaviour on

    for the latter, the solution is using Special Recipes, you can look at the Book or Map cloning recipes for some example. you'll need to override the getRemainingItems method, and perform such logic there

    • Thanks 1
  10. 31 minutes ago, A Soulspark said:

    huh, that's clever, wonder why I went with such a difficult path for the detection xd

    I still need to figure out the placement logic. do I really have to copy all the code that vanilla uses for normal block placement?

    I'm not sure what you mean by copying the vanilla code. I believe you can just call World#setBlockState (in mcp mappings)

  11. Instead of subscribing event listeners like this:

    MinecraftForge.EVENT_BUS.addListener(CoolDownHandler::onAttachCapabilities);
    MinecraftForge.EVENT_BUS.addListener(CoolDownHandler::doCoolDown);

    you can annotate the event listener class with @Mod.EventBusSubscriber()

    and then anotate the event listener methods with @SubscribeEvent

     

    that is not the only way to do it, but it is the one I find easier, and it should solve your listener issue

    for documentation on events you can check out: https://mcforge.readthedocs.io/en/latest/events/intro/

    or: https://forge.gemwire.uk/wiki/Events#Event_Listeners

  12. 3 hours ago, zKryle said:

    Feels a little difficult to understand what i do have to change and the thing in general tho )=

    go through the code, understand it, and once you know how the code works, you'll know what to change

     

    making the Tile Entity is quite trivial, but making custom recipes can be very annoying, for my implementation of a custom crafting like recipe, I just copy and pasted the vanilla class, and went changing what I needed

    1- you'll need a recipe class, that keeps track of what the recipe actually is, and checks if a given inventory has the ingredients to match it. this implements IRecipe, you can then go through the logic of the overrides and add any other method that you may need. the IRecipe is generic, you need to give it the type of your custom inventory (which I'll talk about in step 4)

    2- a serializer, that reads json files and creates new instances of your recipe class. this is very boilerplaity, and the best way to learn how to write this is looking at the vanilla code, there are 3 methods you'll need to overwrite, two for packet buffer serialization (this data works kinda like a queue, so you have to make sure you read things in the same order you wrote them). and one for dealing with json deserialization (you can use of JSONUtils from net.minecraft.util, and com.google.gson)

    3- and an inventory, to keep the items. this is just a wrapper which extends IInventory, you shouldn't use IInventories for much since the capability system is preferred, but IRecipe requires it.

    4- you'll need to register the recipe type through IRecipeType.register, in the RecipeSerializers registration event. and register the recipe serializer (preferrebly through a deferred register)

    5- Optional: if you want to generate the recipe files with data generation, you'll have to write a Builder and an IFinishedRecipe which serializes the recipe to a json file

  13. 8 hours ago, Quaint34 said:

    Now I am getting an error about the .get method not being able to use static methods. Is this something I should care about? If so what can I do to fix it.

    he meant RegistryObject#get, but if you don't know what that message means you shold take some time to learn java first.

    your Sign BlockItem takes references to an Item, not to an RegistryObject, RegistryObjects work like Suppliers, you create them statically, you need to call .get() on the instance to get the object that it supplies. note that RegistryObjects only get populated after the registration events, therefore you can't call them before that (such as in statically initialization)

    registering custom signs is not a simple task, I had to go through it a while ago, I can point you towards the topic I made on this thread on some of the errors I was getting: https://forums.minecraftforge.net/topic/96417-solved-116-custom-sign-wont-render/

     

  14. 2 hours ago, Turtledove said:

    Ah sorry, you're right. I can refer you to the way Lycanites renders all of their .obj model entities, and best of all it's up to date for 1.16, but it is pretty complicated than just your standard java model. Depending on what you're doing it might not be worth it...

    https://gitlab.com/Lycanite/LycanitesMobs/-/tree/master/src/main/java/com/lycanitesmobs/client

    it does feel more complicated than what I may need, since my entity isn't actually a mob with animations and all that, just a static obj model would work, but I guess that if I go through and read how lycanitesmobs does it, I'll be able to extract what I need, thanks for the reference

  15. 9 minutes ago, Turtledove said:

    I haven't touched obj models in MC since 1.12.2 so I wouldn't know if anything changed, but with a TESR I recall I could just override the render method and make OpenGL transforms (which I'm sure has been replaced with matrixstacks) in it...

    wasn't TEST for item stacks, or tile entities?

    I know I have to extend an EntityRenderer, but I don't know how to get an obj to render from there

×
×
  • Create New...

Important Information

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