Jump to content

jredfox

Members
  • Posts

    660
  • Joined

  • Last visited

Everything posted by jredfox

  1. Nope Need to learn eventually
  2. because jar mods ruined any chance of compatibility between mods if two files were the same. You replace the class another mod replaces the class woops now the game force crashes instantly.
  3. It shows a stone block and then when placing it crashes. It isn't showing the right texutre it's showing stone and sometimes crashes when I place the block block.json: { "parent": "block/cube_all", "textures": { "all": "blocks/default" } } CrashReport: https://pastebin.com/fC6yidec What I am trying to do: make them have whatever texture location from the registry name. I returned the right texture atlis sprite from my model I think so I don't understand why this isn't working. It's got to be dynamic I don't want to be messing with 10,000 jsons everytime I want a single Item I am trying to make a model that works with everything. This eventually is going to have one model per default type, one for default blocks, one for stairs, one for slabs, one for pickaxe, one for item etc.. I just need help in how to accomplish this. I want a model with a dynamic texture that is default like it was in < 1.8 without this it requires 4,000+ jsons for a decent mod and all they do is change the texture location no actual custom model ridiculous @SubscribeEvent(priority=EventPriority.HIGHEST) public void registerModels(ModelRegistryEvent event) { for(IBasicItem i : MainJava.items) { if(i.registerModel()) { Item item = (Item)i; ModelLoader.setCustomModelResourceLocation(item, 0, new ModelResourceLocation(MainJava.MODID + ":" + "block", "inventory")); } } for(IBasicBlock i : MainJava.blocks) { if(i.registerModel()) { Block b = (Block)i; ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(b), 0, new ModelResourceLocation(MainJava.MODID + ":" + "block", "inventory")); } } } @SubscribeEvent(priority=EventPriority.HIGH) public void modeltest(ModelBakeEvent event) { Set<ResourceLocation> locs = new HashSet<>(); for(IBasicBlock b : MainJava.blocks) { Block block = (Block)b; locs.add(BlockApi.getBlockString(block)); } for(IBasicItem i : MainJava.items) { Item item = (Item)i; locs.add(BlockApi.getItemString(item)); } IRegistry<ModelResourceLocation, IBakedModel> reg = event.getModelRegistry(); for(ModelResourceLocation strm : reg.getKeys()) { ResourceLocation key = new ResourceLocation(strm.getResourceDomain() + ":" + strm.getResourcePath()); if(locs.contains(key)) { System.out.println("overring model:" + key); reg.putObject(strm, new BasicModel(reg.getObject(new ModelResourceLocation(new ResourceLocation(MainJava.MODID + ":" + "block").toString(),strm.getVariant())),key) ); } } } Here is the model itself: package com.EvilNotch.lib.util.minecraft.content.client.models; import java.util.List; import com.EvilNotch.lib.Api.MCPMappings; import com.EvilNotch.lib.Api.ReflectionUtil; import net.minecraft.block.state.IBlockState; import net.minecraft.client.renderer.block.model.BakedQuad; import net.minecraft.client.renderer.block.model.IBakedModel; import net.minecraft.client.renderer.block.model.ItemOverrideList; import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.util.EnumFacing; import net.minecraft.util.ResourceLocation; public class BasicModel implements IBakedModel{ IBakedModel model = null; TextureAtlasSprite sprite = null; public BasicModel(IBakedModel m,ResourceLocation texture){ this.model = m; this.setTexture(texture); } public void setTexture(ResourceLocation loc){ sprite = new TextureAtlasSpriteFixed(loc); } @Override public List<BakedQuad> getQuads(IBlockState state, EnumFacing side, long rand) { return this.model.getQuads(state,side,rand); } @Override public boolean isAmbientOcclusion() { return this.model.isAmbientOcclusion(); } @Override public boolean isGui3d() { return this.model.isGui3d(); } @Override public boolean isBuiltInRenderer() { return this.model.isBuiltInRenderer(); } @Override public TextureAtlasSprite getParticleTexture() { // System.out.println(ReflectionUtil.getObject(model, TextureAtlasSprite.class,"iconName")); return this.sprite; } @Override public ItemOverrideList getOverrides() { return this.model.getOverrides(); } } My Block model: C:\Users\jredfox\Documents\MDK\EvilNotchLib\src\main\resources\assets\evilnotchlib\models\block\block.json Block Image: C:\Users\jredfox\Documents\MDK\EvilNotchLib\src\main\resources\assets\evilnotchlib\blocks\spider.png
  4. is this in the entity renders now? Should I pull and cache the values there?
  5. entity get shadow size is missing I used this for rendering entities in inventory based on the item's nbt similar to nei and that's how I scaled the entity for open gl based on that shadow size. How am I suppose to do this in 1.12.2 with no IItemRender and no shadow size? yes this is missing no workaround for object orientation just hard code shadowsize = ent.height / 2.0F;
  6. great now it's officially untraceable whether or not a mob has bossdata or is suppose to have one
  7. The interface that enderdragon and wither use to implement that I use to check to see if a mob was a boss appears to be gone. What do I check now if a mob is a boss mob?
  8. using different block materials and sounds from other mods
  9. Should I post a pull to forge even if the soundTypes are client only people should have to register them so other mods know what is and isn't there same with Block Materials. I would also say force resource location if it's going to be global since other mods might come up with the same name like "tropical" material
  10. I don't think there is a way because even if that's possible what is the user suppose to call to identify it? There needs to be a registry between string and material and string and soundtype?
  11. Best Way for Deserializing and Serializing SoundType and BlockMaterials. I want the string to be simple as possible since The end user has to configure the string in order to change a block sound and or block material. I could have a registry between long strings to a readable name for users but, the main goal I hope to achieve is mod support for both block sounds and materials. The issues are: they are not required to be static they are not enums so I can't get an array of them no toString() I could make one using all values but, still can't get around other two issues hard coding only vanilla would make mods incompatible for any modded material and sound type. I see no possible way to grab the object besides iterating through all blocks in post init way after I am suppose to be registering the auto configurable blocks in preinit. Here is what I got so far but, it only supports vanilla period: /** * Only supports vanilla */ public static Material getMat(String s) { s = s.toUpperCase(); if(s.equals("AIR")) return Material.AIR; else if(s.equals("ANVIL")) return Material.ANVIL; else if(s.equals("BARRIER")) return Material.BARRIER; else if(s.equals("CACTUS")) return Material.CACTUS; else if(s.equals("CAKE")) return Material.CAKE; else if(s.equals("CIRCUITS")) return Material.CIRCUITS; else if(s.equals("CARPET")) return Material.CARPET; else if(s.equals("CLAY")) return Material.CLAY; else if(s.equals("CLOTH")) return Material.CLOTH; else if(s.equals("CORAL")) return Material.CORAL; else if(s.equals("CRAFTED_SNOW")) return Material.CRAFTED_SNOW; else if(s.equals("DRAGON_EGG")) return Material.DRAGON_EGG; else if(s.equals("FIRE")) return Material.FIRE; else if(s.equals("GLASS")) return Material.GLASS; else if(s.equals("GOURD")) return Material.GOURD; else if(s.equals("GRASS")) return Material.GRASS; else if(s.equals("GROUND")) return Material.GROUND; else if(s.equals("ICE")) return Material.ICE; else if(s.equals("IRON")) return Material.IRON; else if(s.equals("LAVA")) return Material.LAVA; else if(s.equals("LEAVES")) return Material.LEAVES; else if(s.equals("PACKED_ICE")) return Material.PACKED_ICE; else if(s.equals("PISTON")) return Material.PISTON; else if(s.equals("PLANTS")) return Material.PLANTS; else if(s.equals("PORTAL")) return Material.PORTAL; else if(s.equals("REDSTONE_LIGHT")) return Material.REDSTONE_LIGHT; else if(s.equals("ROCK")) return Material.ROCK; else if(s.equals("SAND")) return Material.SAND; else if(s.equals("SNOW")) return Material.SNOW; else if(s.equals("SPONGE")) return Material.SPONGE; else if(s.equals("STRUCTURE_VOID")) return Material.STRUCTURE_VOID; else if(s.equals("TNT")) return Material.TNT; else if(s.equals("VINE")) return Material.VINE; else if(s.equals("WATER")) return Material.WATER; else if(s.equals("WEB")) return Material.WEB; else if(s.equals("WOOD")) return Material.WOOD; return null; } public static SoundType getSoundType(String s) { s = s.toUpperCase(); if(s.equals("ANVIL")) return SoundType.ANVIL; else if(s.equals("CLOTH")) return SoundType.CLOTH; else if(s.equals("GLASS")) return SoundType.GLASS; else if(s.equals("GROUND")) return SoundType.GROUND; else if(s.equals("LADDER")) return SoundType.LADDER; else if(s.equals("METAL")) return SoundType.METAL; else if(s.equals("PLANT")) return SoundType.PLANT; else if(s.equals("SAND")) return SoundType.SAND; else if(s.equals("SLIME")) return SoundType.SLIME; else if(s.equals("SNOW")) return SoundType.SNOW; else if(s.equals("STONE")) return SoundType.STONE; else if(s.equals("WOOD")) return SoundType.WOOD; return null; }
  12. if you must know it's so it will make modding easier for me in the future. For my actual mods I make one-two lines of code for an item and texture as well as generated textures. I could make a block generator if I felt like 10k where each block has a random pattern color and random name. I plan on using this lazy modding for coalification,vanilla life, charcoal block mod
  13. Well after looking at some code I think it's possible to manually call everything, one for language, one for images, one for models. I just succeeded in a first hard coded lang file test. If it's possible with lang it should be possible with everything else. Best parts is ms is 10-12k less between 0-5ms /** * Manually refresh resources */ public void init() { if(lang == null) lang = (LanguageMap) ReflectionUtil.getObject(null, I18n.class, MCPMappings.getField(I18n.class, "localizedName")); try { lang.inject(new FileInputStream(new File(this.rootDir,"assets/evilnotchlib/lang/en_us.lang")) ); } catch (FileNotFoundException e) { e.printStackTrace(); } }
  14. My code I sent you earlier doesn't even work when it's in preinit i still have to refresh it in game what am I suppose to call to make miencraft load it the first time into the game? File dir = new File(Config.cfg.getParent(),"resourcepacks/customResourcePack"); IResourcePack pack = new CustomResourcePack(dir); list.add(pack); Also the mods load after me editing an mcmeta/json would be highly unoptimized rather then the core doing the work all at once it would be load file edit file save file for every single thing. There has got to be an optimized way to force the resource loaded from my pack into minecraft after preinit
  15. register IResourcePack preinit other mods call me other mods dependond upon me so their preinit fires after me. Registering something to generate from other mods calling me would do nothing for the IResourcepack since evil notch's lib preinit has been done that would mean I would have to generate everything from my lib after If I made each mod generate the files I wouldn't be an api the other mods requiring me would become the api
  16. but, the mods will fire after evil notch lib that will depend upon it so then I would have to have a before pre init now you see my issue?
  17. I plan on generating resources from mods that depend on my mod when does it load after or during preint, images, etc...? Could I register it in preinit but, my resources won't be done generating from other mods until preinit is guaranteed to be done? How do I get around this? Is there something inbetween preinit and the model event?
  18. Then how is seasons doing it maybe I should be doing it to?
  19. The Seasons Mod refreshes a couple single resources in game and it takes like 20ms not even a second later it changes the blocks textures. I have my reasons on why it needs to be later then preinit. Otherewise I would have to make another mod extract it during asm and then let forge load it because it needs to fire after my initial mods preinit. Trying to make a dynamic resource pack like the seasons mod A: so I can use it for my lib B: so when I make another mod that uses it It doesn't take 10 whole seconds to reload a couple textures for like a holiday mod https://minecraft.curseforge.com/projects/the-seasons-mod/files/2453185 And it was done with 1.7.10-1.8 and worked with modded blocks so It can't be the model thing using dynamic textures because it there was no model event and I kind of browsed the code couldn't figure out where it was refreshing it but, I did find that it wasn't using any custom models to do so.
  20. So how do I refresh only my resource pack I tried calling this code but, it didn't do anything I had to refresh manually in game? This is in my client proxy's post init. I already added it to the default list but, I only want to refresh my own SimpleReloadableResourceManager manager = (SimpleReloadableResourceManager) Minecraft.getMinecraft().getResourceManager(); manager.reloadResourcePack(pack);
  21. Yeah well it's kind of hard to do anything if the names don't tell you their function where it's looking and no documentation on this. I got this working though I can't take all the credit I cheated by looking at other mods resource directories that had IResourcePack. Code: https://gist.github.com/jredfox/1f3057d86627648d9eef67b5b9db4f1f So I finally figured out why it wasn't working the resources were not getting loaded but, I was calling this at init I thought forge use to call reload resource packs at post init or after post init why the change of order? So how do I refresh/forceload and only my custom IResourcePack into minecraft's system after preinit? I also tried printing the ms for refreshing the mc resources this way it's horrible: Done Refreshing:9185ms Client Proxy: @Override public void init() { File dir = new File(Config.cfg.getParent(),"resourcepacks/customResourcePack"); IResourcePack pack = new CustomResourcePack(dir); list.add(pack); Minecraft.getMinecraft().refreshResources(); }
  22. They don't then why does the regular defualt show up to the right menu? How can I verify if it's even loading any resources what directory should I be feeding it? am I doing something wrong? You know what that's fine I guess but, for the future I want to know how to get it in the menu and right now I need to know how I can verify it's loading the right directory. "DefaultResourcePack" because, I looked at the implementation from the interface and made almost no sense as no direct directory was there
  23. public class LangPack extends DefaultResourcePack{ public static Set<String> domains = new HashSet(); protected ResourceIndex resourceIndex = null; public LangPack(ResourceIndex resourceIndexIn) { super(resourceIndexIn); domains.add(MainJava.MODID); } @Override public Set<String> getResourceDomains() { return domains; } @Override public String getPackName() { return "Lang Pack"; } } I did and it's not working. I don't know what file it's looking for of the ResourceIndex and what's going on with that I tried many file locations. I also verified that I was adding it to the resource pack default list. It's not even showing up on the menu if it was I could start debugging Client Proxy Pre-Init: List<IResourcePack> list = (List<IResourcePack>)ReflectionUtil.getObject(Minecraft.getMinecraft(), Minecraft.class,MCPMappings.getField(Minecraft.class, "defaultResourcePacks")); File dir = new File(Config.cfg.getParent(),"resourcepacks/langpack"); dir.mkdirs(); System.out.println(dir); IResourcePack pack = new LangPack(new ResourceIndexFolder(dir) ); list.add(pack);
  24. Ok then how do I get an IResourcePack working then? I have been looking for an hour and I can't seem to find the method to pointing the interface into the directory of the new location since it's not in resourcepacks folder
  25. They don't have to have coding language to change anything. It's also in vanilla lang format otherwise I would have to do serious work but, yes it does the line library stuff I said before. A: Coder inputs default line B: User inputs modified display name > located at "configs/evilnotchlib/resourcepack/lang/yourlang.lang" C: User overrides original Code D: the lang entries get converted into "tile.modid.block.name=value" in a lang file exterior to the jar for safety precautions If you won't help that's fine but, I will find a way
×
×
  • Create New...

Important Information

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