-
Posts
307 -
Joined
-
Last visited
Posts posted by Tschipp
-
-
57 minutes ago, V0idWa1k3r said:
Look at PathNavigateGround#isDirectPathBetweenPoints, I think that one is a direct check of whether the entity can actually navigate to the point.
That said if you keep giving the entity an invalid path every time it asks for one then it will keep getting stuck. You need to check whtether the block is reachable before accepting it as a valid pathing target.
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.
-
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?
-
-
3 hours ago, diesieben07 said:
Looking at the code, this should work fine. If the ItemStack registered with the OreDictionary has a metadata of OreDictionary.WILDCARD_VALUE, any metadata should be accepted.
That's what I also was thinking... well I guess I'll just stick around for the OreDictionary rewrite for 1.13
-
5 hours ago, Cadiboo said:
You might want to try adding the data wildcard value
..."ore": "listAllWater", "data": 32767 }
((2^(16-1))-1)
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?
-
Thing is, it's not my recipe. It's from pam's harvestcraft.
-
-
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" }
-
1 hour ago, Spaceboy Ross said:
Well, then you cant do what you're trying to do.
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.
-
4 minutes ago, Spaceboy Ross said:
It should look something like this.
Minecraft.getMinecraft().getResourceManager().getAllResources(new ResourceLocation(MODID,"dir.subdir"));
You cannot access it like a path, you have to access it like a package.
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
-
5 minutes ago, Spaceboy Ross said:
getAllResources may be what you're looking for.
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
-
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?
-
Good Idea with the replace, I actually moved them offscreen just before
-
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!
-
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)?
-
37 minutes ago, Draco18s said:
What part of
Have you failed to understand after FIVE PAGES (and at least four people trying to help) of thread?
You have done fuckall to your folder names since I went to bed. Jesus mother foxing christ on a crutch.
Yeah I guess you can’t expect much more from a person that adds „raw_poop“ and „cooked_poop“ items
-
1 minute ago, Cadiboo said:
Currently in 1.12.2 Vanilla uses "/models/item" for models and "/textures/items" for textures
However in 1.13 Vanilla with be using "/models/item" and "/textures/item"
The texture folder can be called whatever you want. you just have to reference it correctly from code & JSON
wow TIL
-
Just now, Cadiboo said:
This is good practice, but since he's using EventSubscribers, Forge knows what mod is registering the item & will add his ModId to the domain of the resourceLocation
Oh, really? I didn't know, seemed to me like he was just registering the item with the wrong name
-
-
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);
-
4 minutes ago, Avanyt said:
https://github.com/ConderTeam/codeformod check for code on there you can see all code and logs
the place where you keep the textures needs to be called textures/items, and your model folder needs to be models/item
-
7 hours ago, Cadiboo said:
http://lessie2d.tumblr.com/post/28673280483/opengl-blend-function-cheat-sheet-well-this-is
https://www.andersriggelsen.dk/glblendfunc.php
Have a look at those, but you’ll be doing a lot of work by trial & error in the debugger.
feel free to look at all my rendering code here
(Hologram part)
https://github.com/Cadiboo/WIPTech/blob/master/src/main/java/cadiboo/wiptech/util/Utils.java
(renderStackWithColor and renderStackIntoGUIWithColor)
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.
-
I get the default transparency that the glass block has, but I can’t go any lower than that
-
7 hours ago, Animefan8888 said:
Try using this instead.
GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO);
I tried it, but sadly the solid blocks like wood are still not transparent... The solution you suggested above might be the best one.
QuoteAlso switch to using GLStateManager instead of direct OpenGL calls.
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.
[1.12.2] Checking if Path exists
in Modder Support
Posted
Not sure... it always seems to return false for some reason, even if a path is available: