Jump to content

stepsword

Members
  • Posts

    81
  • Joined

  • Last visited

Everything posted by stepsword

  1. Think you can do Minecraft.getInstance().getRenderTypeBuffers().getBufferSource()
  2. So, I have some GL code in a custom RenderType, which I'm using as a wrapper for an actual RenderType. My overall goal is to apply clipping to a rendered entity. rendertype1 = new ClipWrappedRenderLayer(yaw, pitch, x,y,z,progress, rendertype1); IVertexBuilder ivertexbuilder = bufferIn.getBuffer(rendertype1); renderModel(modelIn, itemStackIn, combinedLightIn, combinedOverlayIn, matrixStackIn, ivertexbuilder); public ClipWrappedRenderLayer(double pitch, double yaw, double x,double y,double z, double p, RenderType delegate) { super(MahouTsukaiMod.modId + delegate.toString() + "_with_clip", delegate.getVertexFormat(), delegate.getDrawMode(), delegate.getBufferSize(), true, delegate.func_230041_s_(), () -> { DoubleBuffer eqn1 = BufferUtils.createDoubleBuffer(8).put(new double[]{0,1,1,p}); eqn1.flip(); GL11.glClipPlane(GL11.GL_CLIP_PLANE0, eqn1); GL11.glEnable(GL11.GL_CLIP_PLANE0); delegate.setupRenderState(); }, () -> { delegate.clearRenderState(); GL11.glDisable(GL11.GL_CLIP_PLANE0); }); this.delegate = delegate; } While the clipping does happen currently, it slides with the camera as opposed to being a static clip on the entity. Is there a way I can translate/rotate this clip to where the entity will be? Nothing I've tried in the way of translation seems to do anything except clip at a slightly different angle while still following the camera. I'm assuming this setup code is called on the outside of the translation, so alternatively if there were a way to call this code on the inside of the translation, that would be good also, as that is how I did it in 1.12.2.
  3. Thanks. Basically, I have a json model for an item which is similar to the bow model. As in, it reads a property off the item and swaps out a texture based on the property. That part works fine without any java implementation of the model. But I also want to display an openGL rendered animation while using the item, which is fairly complex and involves creating shapes in openGL. Since I have the code for rendering most/all of it from my other (non-item) classes I'd rather not try to turn it into an IModel, and as far as I know the only way to get an OpenGL context on items is to use the TileEntityItemStackRenderer.. So ideally I'd like to just use the JSON model I've written with a minimum implementation of java to enable a TileEntityItemStackRenderer
  4. Is it possible to change the "isBuiltInRenderer" described here https://mcforge.readthedocs.io/en/latest/models/advanced/ibakedmodel/ to true from the JSON model file? I want to use a TileEntityItemStackRenderer but doing "isBuiltInRenderer":true doesn't seem to work from the JSON file. Do I need to create a full IModel implementation just to set that one thing to true? If so, is there a way to load a JSON file as a "default" so I don't have to convert the JSON I've written for the non-custom-rendered bits to java?
  5. Thanks! Got it working after doing this. Had no idea that even existed.
  6. I think it's something with the slot index. Debugging further, on the client it says it's getting slot "5" but on the server it's getting slot "35". In the "slotClick()" method, that is.
  7. I'm trying to attach a 3-slot inventory to an ItemStack for one of the Items in my mod. So far I've got it rendering properly, and hovering over the squares highlights them in the right places and items from the player's inventory show in the right spots. But I can't pick up anything in the inventory - when I click something it gets picked up and placed back down immediately (and also, in the background, the "hitting" animation with the item fires). Here's the code for the Container: Here's the relevant code from the item class: I also register the capability in the attach capability event for ItemStacks. Is there something obvious I'm missing that would prevent me from picking items up? When I followed the "picking up" action in debug mode, it went through Container.slotClick() on both the client and server, and I could see the item being picked up on the client. But on the server it seemed to be picking up air. Also, shift clicking the item does successfully put move the item from the hotbar to the inventory, and then it disappears after I close the inventory, but that's probably a bug for after whatever is stopping me from picking things up in the first place.
  8. As an update this was because I hadn't correctly integrated gradle into IntelliJ. Solution was to find the build.gradle file and right click > Import Gradle project. Then I can run debug on Forge's runClient which allows me to load mods properly
  9. I haven't found anyone with a similar problem - the soft dependencies are there at compile time and the mod actually works both with and without the soft dependencies (after testing on Twitch). The "provided" keyword supposedly makes them optional at runtime. My main issue is that I can't seem to disable them at runtime in the intelliJ debug client (even though there seems to be a specific setting which ignores provided things at runtime). Well, I'll go look more at IntelliJ forums then, I realize this is more of a problem with IntelliJ than anything else but I was wondering if it was something specific to Minecraft since I don't really know at all how IntelliJ interacts with Forge to load mods in a debug environment
  10. As an update, running ".\gradlew idea" after "gradlew setupDecompWorkspace" fixed the bookshelf not loading issue, but I'm still having the "why is this even loading in the first place when it's set as 'provided' issue"
  11. So I have a soft dependency on GameStages where basically I am doing this: @Mod.EventHandler public void postInit(FMLPostInitializationEvent event) { if (Loader.isModLoaded("gamestages")) { gamestages = new GameStagesLoadedProxy(); } else { gamestages = new GameStagesProxy(); } } GameStagesLoadedProxy has references to GameStage's helper class. In my gradle file I've added GameStages as a "provided" dependency, which from the description should just be an optional dependency. When I try to run the debug client in IntelliJ, though, it tries to load GameStages and complains about Bookshelf (a dependency of GameStages) not being loaded. (net.minecraftforge.fml.common.MissingModsException: Mod gamestages (Game Stages) requires [bookshelf@[2.2.458,)]) I added Bookshelf as a provided dependency too, and get the same error. I also restarted IntelliJ and cleared the cache. I don't even know why GameStages is being loaded when I run it in the first place - it's a provided dependency which I thought would mean it doesn't get loaded unless I check the box "Include dependencies with Provided scope" which is not checked. Here is my full build.gradle file. Ideally I'd like to turn on and off whether GameStages runs when I'm debugging, but I'd settle for it both compiling and just not being included.. I just want to make sure I can debug the mod without any dependencies running at all, and can worry about doing it with dependencies from the twitch launcher. Anyone have any experience with this?
  12. Huh so there is. DimensionManager.getNextFreeDimId() Thanks!!
  13. I was hoping to avoid conflicts with other mods by allowing modpack creators to set this. Is that something I don't have to worry about?
  14. Perhaps a better question is - is there an event for when the config gets loaded from the file?Does ConfigChangedEvent.OnConfigChangedEvent cover that? If so I could just update the Config class when the file initially loads? But does dimension registering happen before or after the config is loaded?
  15. I'm a bit confused on syncing annotated config files. Guidance on this forum has generally been to send a packet to the client on PlayerLoggedIn and update a "client" config file. So let's say I have a ServerConfig class and a Config class, where the latter is the client's config that gets updated. If I want to register a dimension using an ID based on the config, I have to register it on both the client and server, right? Using DimensionType.register()? If I put this in my CommonProxy, it'll get called on both. Assuming Config is only updated when a player logs in, I can't use Config on the server. But I also can't use ServerConfig on the client cause the client could have the wrong thing in their config file. Anyone know the right way to do this?
  16. Nevermind, just learned this is a problem with Dynamic Texture in Optifine. DynamicTexture has an array 3x the size of what it should be when Optifine is installed... because Optifine is doing this new int[textureWidth * textureHeight * 3]
  17. My code: public static ResourceLocation location = new ResourceLocation(MahouTsukaiMod.modId + ":textures/block/mahoujin_changeable.png") IntBuffer colorBuf = BufferUtils.createIntBuffer(PIXEL_COUNT); MahoujinData image = new MahoujinData(order); this.bindTexture(location); GlStateManager.glGetTexImage(GL11.GL_TEXTURE_2D, 0, GL12.GL_BGRA, GL12.GL_UNSIGNED_INT_8_8_8_8_REV, colorBuf); colorBuf.get(image.colors); This crashes at the last line with a BufferUnderflowException, only when Optifine is installed. I believe this means the "remaining" integers in colorBuf is less than the length of image.colors, even though I allocate colorBuf and image.colors with the width*height of the bound texture. So this tells me that glGetTexImage may be working differently and returning less pixels than the actual image's size in Optifine? I think the more likely case is that it's returning 0 pixels for some reason, since I'm using int side_size = GlStateManager.glGetTexLevelParameteri(GL11.GL_TEXTURE_2D, 0, GL11.GL_TEXTURE_WIDTH) side_size = GlStateManager.glGetTexLevelParameteri(GL11.GL_TEXTURE_2D, 0, GL11.GL_TEXTURE_HEIGHT); to grab the width and height dynamically. Any ideas why it would do this?
  18. Sorry - I tried pasting/editing from the forum and it came out like that. I see what you mean now though - I didn't realize NBT was shared whether or not I overrode getNBTShareTag. Thanks for the help with this!
  19. When you say send all of the data do you mean with packets or just something like this? Edit: don't know what happened to my last code, seems like it all disappeared @Override public NBTTagCompound getNBTShareTag(ItemStack stack) { IGemMahou gemMahou = stack.getCapability(GemMahouProvider.MAHOU, null); NBTBase nbt = GemMahouProvider.MAHOU.getStorage().writeNBT(GemMahouProvider.MAHOU, gemMahou, null); return nbt; }
  20. Hopefully my last thread as this is the last TODO on my list before release.. NBT on items seems to be messed up for creative mode. It doesn't affect the host of the server, but for anyone else, switching to creative mode with /gamemode c seems to reset all the NBT of the items in their inventory. In particular, this happens only when they can see the item in their inventory. So in creative mode, when you press the "inventory button" it shows a big list of items for you to grab and hides your inner inventory, but shows your hotbar. Things on the hotbar have their NBT reset, but things in the inner inventory are fine.. until you switch to look at the inner inventory, and then they get their NBT reset. Also, it seems like this NBT reset happens so frequently that items on the hotbar gets stuck in the "use item" animation, making items with NBT essentially unusable in creative. I'm using getNBTShareTag and readNBTShareTag to sync capabilities, like this, cause I'm showing the data in the tooltip: @Override public boolean getShareTag() { return true; } @Override public NBTTagCompound getNBTShareTag(ItemStack stack) { IGemMahou gemMahou = stack.getCapability(GemMahouProvider.MAHOU, null); NBTBase nbt = GemMahouProvider.MAHOU.getStorage().writeNBT(GemMahouProvider.MAHOU, gemMahou, null); NBTTagCompound ret = super.getNBTShareTag(stack); if (ret == null) ret = new NBTTagCompound(); ret.setTag("mahou", nbt); return ret; } @Override public void readNBTShareTag(ItemStack stack, NBTTagCompound nbtt) { if (nbtt != null && nbtt.hasKey("mahou")) { IGemMahou gemMahou = stack.getCapability(GemMahouProvider.MAHOU, null); IGemMahou serverGemMahou = new GemMahou(); GemMahouProvider.MAHOU.getStorage().readNBT(GemMahouProvider.MAHOU, serverGemMahou, null, nbtt.getTag("mahou")); if (gemMahou != null) gemMahou.setStoredMana(serverGemMahou.getStoredMana()); } } I've only noticed this on items which have the ShareTag, but basically all my items which have NBT show it in the tooltip, so it may be unrelated, too. I've found only one thing which looks similar to my problem here: https://github.com/MinecraftForge/MinecraftForge/issues/4580 But this seems to be much less of a problem than mine. Even opening creative at all resets NBT, not just moving items around. Any ideas on what can be done to fix it?
  21. Thanks - it looks like the latest snapshot has mostly the same mappings as the oldest snapshot so I guess it's the same throughout
  22. Thanks for this - do you happen to know if 1.12 is sufficient for 1.12.2? I don't see any 1.12.2 on that site.
  23. OH. That explains a lot, thank you. I remember when I initially made that field, I saw someone else's code do p_12345 or something, but I assumed it was just patched to have the correct name in a later version of Forge. Do you happen to know how I can find the actual name of the variable I'm looking for? i.e. the original class before de-obfuscation?
  24. I'm constantly getting this error: The game crashed whilst unexpected error Error: net.minecraftforge.fml.relauncher.ReflectionHelper$UnableToAccessFieldException: net.minecraftforge.fml.relauncher.ReflectionHelper$UnableToFindFieldException: java.lang.NoSuchFieldException: renderPosX whenever I use ObfuscationReflectionHelper on the client (in several, unrelated classes). I do not get this error on the client side of the world host, either, and the reflection always go through properly. Any ideas why it doesn't work in the specific case of a player connecting to the world and trying to do the reflection? The fields in question were EntityArrow.inGround, and RenderManager.renderPosX. I had written off EntityArrow as something stupid with Arrows but then it happened again with the RenderManager.. the fields definitely exist, and both writes and reads fail. Edit: Tried debugging it with no luck.. I was connecting from Twitch -> Debug when I got the error, but going from Debug -> Twitch didnt throw this error.. So not sure what that means
  25. Thanks, I will look into siblings and children
×
×
  • Create New...

Important Information

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