Jump to content

Tschipp

Forge Modder
  • Posts

    307
  • Joined

  • Last visited

Everything posted by Tschipp

  1. Not sure... it always seems to return false for some reason, even if a path is available: boolean result = (boolean) isDirectPathBetweenPoints.invoke(nav, new Vec3d(start.getX(), start.getY(), start.getZ()), new Vec3d(end.getX(), end.getY(), end.getZ()), (int)entity.width, (int)entity.height, (int)entity.width);
  2. isDirectPathBetweenPoints is protected, but I'll try reflecting it and see if it doesn't impact performance too much. My plan is of course to only make the entity walk to the position, if it is actually reachable.
  3. I'm writing some entity AI, which searches for blocks in a certain range and moves to them if it finds them. It works good, but the problem that I'm facing now is that the entity also moves to the block, even if it's in a position that it can never reach (completely encased behind walls). To try exclude these positions from valid ones, I added a check that calls entity.getNavigator().getPathToPos(pos) and checks if the path is null (because I thought it would be null if there was no available path). Sadly, that doesn't work. The entity now just walks against the wall and stays there until I remove it. Is there a way of checking if valid path to a position can be made before walking to it?
  4. That's what I also was thinking... well I guess I'll just stick around for the OreDictionary rewrite for 1.13
  5. I just tested it by changing the recipe in pam's assets, but it still only crafts when the item is undamaged... Is this a limitation by oredict?
  6. Thing is, it's not my recipe. It's from pam's harvestcraft.
  7. I've made an item that acts as a water bucket but is damageable. I added it to the ore dictionary entry "listAllwater", added by Pam's harvestcraft. However, when I craft something, it only works when the item is undamaged. I registred the item to oredict like this: OreDictionary.registerOre("listAllwater", new ItemStack(ItemList.waterTalisman, 1, OreDictionary.WILDCARD_VALUE)); OreDictionary.registerOre("listAllwater", ItemList.waterTalisman); Both methods don't seem to work when the item is damaged. What am I doing wrong? (btw, I'm crafting this recipe from Pam's Harvestcraft): { "result": { "item": "harvestcraft:saltitem" }, "ingredients": [ { "type": "forge:ore_dict", "ore": "toolPot" }, { "type": "forge:ore_dict", "ore": "listAllwater" } ], "type": "forge:ore_shapeless" }
  8. I think I actually just found a solution. I "borrowed" this code from CraftingManager.class and edited it a bit: FileSystem filesystem = null; URL url = MainModClass.class.getResource("/assets/modid/lang/"); try { if (url != null) { URI uri = url.toURI(); Path path = null; if ("file".equals(uri.getScheme())) { path = Paths.get(MainModClass.class.getResource("/assets/modid/lang").toURI()); } else { filesystem = FileSystems.newFileSystem(uri, Collections.emptyMap()); path = filesystem.getPath("/assets/modid/lang"); } Iterator<Path> it = Files.walk(path).iterator(); while(it.hasNext()) System.out.println(it.next()); } } catch (Exception e) { e.printStackTrace(); } This now prints out all files in the lang folder. Works in the dev environment and when the mod is built into a jar, just tested.
  9. You sure? Doing both Minecraft.getMinecraft().getResourceManager().getAllResources(new ResourceLocation(MODID, "assets.modid.lang")); or Minecraft.getMinecraft().getResourceManager().getAllResources(new ResourceLocation(MODID, "lang")); results in the same exception as before
  10. Doesn't seem to do it, unless I'm doing it wrong. As a test, I tried to list all files in the lang folder of my mod, I tried both this: Minecraft.getMinecraft().getResourceManager().getAllResources(new ResourceLocation(MODID, "assets/modid/lang/")); and this: Minecraft.getMinecraft().getResourceManager().getAllResources(new ResourceLocation(MODID, "lang/")); Both threw a FileNotFoundException
  11. I'm trying to get (and read the content) of all files contained in a custom asset folder. The folders location is something like: "assets/modid/customfolder/" The files of the folder can change have names that cannot be hardcoded. I'd like to somehow get all these files and read their content. I know that I can get the input stream from any resource using Minecraft.getMinecraft().getResourceManager().getResource(resourceLocation).getInputStream(); but this doesn't work for folders. Is it possible to get all the contents of the folder?
  12. Good Idea with the replace, I actually moved them offscreen just before
  13. I'm trying to completely remove the inventory crafting matrix, meaning the 2x2 slots, the arrow, the "Crafting" text and the output slot. I did a small test to see if it was possible to get the slots of the inventory. I also tried to remove the output slot, but realized very quickly that that was a bad idea, because the slot indices get all messed up. (Here's the code for that) @SubscribeEvent public void onGuiInit(GuiScreenEvent.InitGuiEvent.Post event) { if(event.getGui() instanceof GuiInventory) { GuiInventory inv = (GuiInventory) event.getGui(); ContainerPlayer container = (ContainerPlayer) inv.inventorySlots; for(int i = 0; i < container.inventorySlots.size(); i++) { Slot s = container.inventorySlots.get(i); if(s instanceof SlotCrafting) container.inventorySlots.remove(i); } } } I think I need to approach this differently. Do I need to make a custom inventory gui and container and then override the vanilla gui? I'm afraid that that would cause severe incompatibilities with other mods though. If anyone has any ideas, I'd be glad to hear them!
  14. I'm adding several different milk fluids, and I'd like to add the milk buckets to the OreDictionary. However, I've found that it doesn't care about NBT of the UniversalBucket, only about meta (and item name ofc). That means that all UniversalBuckets get registered to the OreDictionary. Is there a way to only register my liquids, or is it not possible (without having to create a new bucket item)?
  15. Yeah I guess you can’t expect much more from a person that adds „raw_poop“ and „cooked_poop“ items
  16. Oh, really? I didn't know, seemed to me like he was just registering the item with the wrong name
  17. public class ItemBase extends Item implements IHasModel { public ItemBase(String name) { setUnlocalizedName(name); setRegistryName(name); setCreativeTab(CreativeTabs.MATERIALS); ItemsInit.ITEMS.add(this); } @Override public void registerModels() { Main.proxy.registerItemRender(this, 0, "inventory"); } } You need to set the correct registryName. Do setRegistryName(ref.MODID, name); instead of setRegistryName(name);
  18. the place where you keep the textures needs to be called textures/items, and your model folder needs to be models/item
  19. Thanks! Can your hologram properly render stained glass? I tried it with the blend function you used, but it didn't seem to work for me.
  20. I get the default transparency that the glass block has, but I can’t go any lower than that
  21. I tried it, but sadly the solid blocks like wood are still not transparent... The solution you suggested above might be the best one. do you mean this statement? GL14.glBlendColor(1f, 1f, 1f, 0.8f); I replaced it with this GlStateManager.color(1f, 1f, 1f, 0.8f); but that didn't change anything.
×
×
  • Create New...

Important Information

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