ctbe
Members-
Posts
85 -
Joined
-
Last visited
Everything posted by ctbe
-
The mod quark does not wish to run in Minecraft version Minecraft 1.8. You will have to remove it to play. Perhaps that is the problem. I think you need to remove the quark mod as the version it was compiled for is different. Or so it gives the impression. I don't know about a best version as I think the word "best" is considered subjective in many places by many people and touching it is probably a hot button subject among players, but maybe you could try the latest minecraft version for which a stable version of forge exists.
-
Why thanks for the references and explanation. I know I said I'm leaving it, but just to show my whole problem, here is the rendering result of my code and the code itself that makes the linked video. Lid Rotation: https://vgy.me/EvxpWl Chest Body Rotation (how I wanted the lid to rotate): https://vgy.me/NOOLZg Code... (This code is quite a bit so don't worry if you don't look at it. I'm opting for going static.) TileEntity (TileEntitySimpleChest.kt) http://www.codesend.com/view/67ca9f38cda506bb1cbd0485d549aa8b/ Block properties http://www.codesend.com/view/b502d4257d3be71c3f7801d3dc34b0e1/ Block (BlockSimpleChest.kt) http://www.codesend.com/view/d1f28420c3518684918d930941e8e830/ TileEntitySpecialRenderer (TileEntitySimpleChestRenderer.kt) http://www.codesend.com/view/5248c50e70d83ba6b891a00e53100f45/ Blockstate JSON (blocksimplechest.json) http://www.codesend.com/view/2d66a1853026a2d6e1ce4a19aa08a7ea/ Chest Model (simple_chest.obj) http://www.codesend.com/view/4d62970462e21a83fd292d9f8c3d46ba/ Chest MTL (simple_chest.mtl) http://www.codesend.com/view/fbc3f45beb2651edde86582f9b83da82/ Lid Model (simple_chest_lid.obj) http://www.codesend.com/view/9715006f7c39b7dae56c42b795d0aa76/ Lid MTL (simple_chest_lid.mtl) http://www.codesend.com/view/dbf55dcb142c5aba6e9dee6ae2087c0e/ This was an extension of the tutorial: https://wiki.mcjty.eu/modding/index.php/Render_Block_TESR_/_OBJ-1.12 but I changed a lot of it to fit my purposes. Though the rendering code is pretty much a copy paste. No amount of transformation fixes the problem for me. The problem must be me and I could never identify what I was doing wrong. The code I provided here renders the first video only. The chest body rotation happens if one uses false for the IS_CHEST_LID property in the TileEntitySpecialRenderer... in case you wonder how I shifted from rotating the lid to rotate the chest body in the second video.
-
It's okay guys. I appreciate the intention on helping , but I'm really leaving it since this has been eating me for too long. If anyone asks me to add animation to my chests for when the lid opens and close I'll just tell them I don't know how to do it as I don't understand the GL. Don't worry . Here is an illustration in 2D of what I meant in my first post that is happening with the gl calls. In step 3, all the axes of reference get rotated. Meaning that any translation in the x axis afterwards, will be diagonal. This is 2D, but in minecraft, all 3 axes of reference get rotated together with the object (x, y, z).
-
Thanks for the answer, but I give up. I think no one has ever managed to do a custom chest in minecraft. If they did, they had a thorough understanding of what opengl is doing. I don't. I'll make my chest a simple static block. No animation or anything.
-
I previously asked this question and I was told to translate, rotate, then translate back. After many hours of debugging trying to understand what was going wrong, I have come to the conclusion that it doesn't work like that. When one rotates using GlStateManager.rotate, all the axes of the OBJ rotate as well. In other words, the final translation will translate in reference to the rotated axis, making it impossible to translate to it's previous position. For example: // Move in the x axis 0.5 (works fine) GlStateManager.translate(0.5, 0, 0) // Rotate around the z axis, 45 degrees (code breaks. the object rotates as intended, but all the axes get rotated as well) GlStateManager.rotate(45f, 0f, 0f, 1f) // Return the object to its previous position (Doesn't work, translates the object diagonally because the axes changed) GlStateManager.translate(-0.5, 0, 0) How would one rotate the OBJ without the OBJ axes being rotated?
-
The lightning got fixed by using this.setLightmapDisabled(true) as in the solution found here. But I feel I'm still doing something wrong since if I place more than one block, one lid renders normally lighted, and the other dark. Perhaps I should change the model of the block below the lid to be less than 1x1x1. After all, I have read various times it is not recommended to render anything bigger than 1x1x1. Edit: After a check, this doesn't solve the brightness issue. As when the chest and the player stand in a completely dark area, the lid can be seen clearly despite there being no source of light. After all, the lightmap was disabled.
-
I'm trying to use ModelChest to render a lid for my chest in a TESR. However, the lid renders dark and upside down. I don't know if calling render on a model from the overridden function is not the correct way to do it or recommended. I do know that when I tried this but while extending FastTESR, the code crashed because of some buffering issues and the crash was caused by the call of render(0.0625f) over the model. Not understanding how it works I might me doing something ridiculous here. This is my code: class TileEntitySimpleBoxRenderer : TileEntitySpecialRenderer<TileEntitySimpleBox>() { private val TEXTURE_NORMAL = ResourceLocation("textures/entity/chest/normal.png") private val simpleChest = ModelChest() override fun render(te: TileEntitySimpleBox, x: Double, y: Double, z: Double, partialTicks: Float, destroyStage: Int, alpha: Float) { // Store rendering flags GlStateManager.pushAttrib() // Store the viewport GlStateManager.pushMatrix() // Bind the chest texture this.bindTexture(TEXTURE_NORMAL) // Translate the location of the lid and knob GlStateManager.translate(x, y + 0.9, z) // Render the lid this.simpleChest.chestLid.render(0.0625f) // Render the knob this.simpleChest.chestKnob.render(0.0625F) // Restore the viewport GlStateManager.popMatrix() // Restore rendering flags GlStateManager.popAttrib() } } Result: Is there any way to make it normally bright, like a normal chest and flip it? By flipping it I mean maybe a method that takes care of it without having to use rotate and translate. If not I suppose I will have to use rotate and translate. I'm more concerned on fixing the brightness of the model rendered.
-
Oh no, it wasn't because I didn't want to write Java. I was okay with it . I was expecting to make a mod which when I finished planning it, it required me to use a lot of Collections, and with that expectation, I knew I could use Scala (from previous experience) to my advantage and their immutable collections for a little bit of additional performance if I were to program it correctly. But after writing a good amount of code for my mod in Scala I was like "Ugh, going back to Java". Right now yes, though I'm okay with it, I'm reluctant to use Java, but at first no. This is very true . Thanks for the Kotlin suggestion. I'll look into it. Because my mod is still small, I might as well re-write it in Java before it grows further and use the default language most of the community uses. That way I'm more in sync whenever I have a doubt. Thanks for the feedback, much appreciated.
-
The answers I look on this question would be answers that would be mostly based on opinion. But if you have predictable facts, that would be awesome. Yesterday I found out my project didn't compile and had to use Scorg to be able to compile it. I was thinking of re-writing it from scratch, but this time using Java because of fear that Scorg may stop being available in the future. I have been using Scala because I had many immutable collections which were providing me a slightly better performance although that wasn't always the case. In order to perform some operations, sometimes I had to make conversions from Scala collections to Java collections and those little pieces of code reduced my performance a little as well. Other times it was simply impossible to use some features of Forge due to the requirement of the use of static variables and/or classes which require you to do a little of workaround to get an equivalent in Scala. For example, I was unable to use the new @Config system with Scala. I had to use Java because no workaround got me a working config menu for my mod. Maybe if I had fiddled a little more with the code I could have gotten something working, but it was growing too ugly for the Scala style so I decided to use Java and combine it in the project. Previously I also had problems when using IProperty due to boxing concepts. I can't use Enums, but instead use objects that extends Enumeration. I cringe everytime I have to use equivalents to statics, but at the end have no options because of the way minecraft and forge were made. Something tells me I should just use Java which is what minecraft and forge were made with and save me all the workarounds and pain simply because I like the Scala style more and it offers me just a slight performance in some specific cases (in ocassions a cleaner look of code too). At this point I am trying to decide what to do. Simply use Java or stick to Scala and risk having to do many workarounds in the future to compile my project in case Scorg becomes unavailable or other kinds of workarounds to be able to use some features of Forge. What are your opinions, what would you do?
-
[1.11.2] Recommended way of checking KeyBindings for opening a GuiScreen
ctbe replied to ctbe's topic in Modder Support
Quite interesting. I was unaware of those details. Thanks. I will use the ClientTickEvent. -
I recently read somewhere in an answer to an old thread that rarely one should subscribe to KeyInputEvent when handling KeyBindings. That one should subscribe instead to ClientTickEvent. Of course, the answer was fitted to the context of that thread. In my case, in which all I do is open a GuiScreen menu should I subscribe with this @Subscribe def onKeyInput (keyInputEvent: KeyInputEvent): Unit = { // Do my logic here using KeyBinding.isKeyDown() } or with this @Subscribe def onClientTickEvent (clientTickEvent: ClientTickEvent): Unit = { // Do my logic here using KeyBinding.isKeyDown() } I have only one KeyBinding, the one for opening the gui. For my purposes, I currently find no use for the keyInputEvent variable. Also, will subscribing to check for key inputs on the ClientTickEvent consume more processing power than using KeyInputEvent? I somehow feel it does because while I am not moving or doing anything, minecraft would still be checking for the key binding state every tick.
-
Makes sense. Thanks for your reply.
-
I was so tired that I accidentally used sendChatMessage(String) instead of sendMessage(ITextComponent) which is what I really needed. (I know, programming while tired is not a good move) However, it surprised me that one cannot use color codes for sendChatMessage as they get filtered and the § character is treated as disallowed. The offender will get disconnected with the message: "Illegal characters in chat" on the screen. Would anyone happen to know of reasons for why sending chat messages with color is disallowed? I don't need to broadcast chat messages with color. I just need to display a colored message to the player performing an action and because said messages can display many times per player it would flood the chat if it is broadcasted. So I'm okay with sendMessage. I mean, imagine if I have 100 players online and at least 50 decide to perform a message displaying action at the same time or with 1-3 seconds of difference. It would be awful for all players to see 50 messages in such a short amount of time flooding their chat. Still, it made me curious as to why it is not allowed to use sendChatMessage with color. (Nothing occurs to me, I hope I am not touching a sensitive subject here, it's just curiosity)
-
I see. Then config is not the way to go for my purposes. I'll use GuiScreen with GuiButton then. To apply a custom property from my own mod to other items that may not necessarily come from my mod. If you take two of any, all properties would be mutually exclusive so I wanted a radio button. A GuiButton for example could work to remember only one property and then the player applies it to any item it wants in the game. But now I understand I'm doing the wrong approach. I'll use GuiScreen instead of a Gui config. Thanks.
-
My code is like this (source @Choonster): @Config(modid = TestMod3.MODID) @Config.LangKey("testmod3.config.title") public class ModConfig { @Config.Comment("This is an example boolean property.") public static boolean fooBar = false; @Mod.EventBusSubscriber private static class EventHandler { /** * Inject the new values and save to the config file when the config has been changed from the GUI. * * @param event The event */ @SubscribeEvent public static void onConfigChanged(ConfigChangedEvent.OnConfigChangedEvent event) { if (event.getModID().equals(TestMod3.MODID)) { ConfigManager.sync(TestMod3.MODID, Config.Type.INSTANCE); } } } } I'd like to know if one can have a button, radiobutton or checkbox in the config GUI. The following picture down to the right has a checkbox that says "Apply globally". Is it possible to use a checkbox like that in the GUI and if so, can buttons and radio buttons be used as well? If yes too, how? What data type or class should one use for a variable if it is that it already exist? Source
-
[1.12.1][SOLVED] Is it possible to change the rotation point of a OBJ model?
ctbe replied to ctbe's topic in Modder Support
That solves it. Thanks. -
Either ItemModelMesher or RenderItem is null. You can test which one of them is giving null by first getting each one of them into a variable and debugging to see which one of them is been null. To solve it and not debug anything, use ModelLoader instead of ModelMesher. ModelLoader.setCustomModelResourceLocation(item, 0, new ModelResourceLocation(item.getRegistryName(), "inventory"))
-
Been a couple of hours trying to change the rotation point of the handles in this code's TESR: https://wiki.mcjty.eu/modding/index.php/Render_Block_TESR_/_OBJ-1.12 The following GlStateManager.rotate(angle, 0, 1, 0); rotates around the origin of the OBJ model. I'd like to change the pivot point the rotate method will end up using. I'm originally practicing with this tutorial to understand the concepts to then make a custom chest, but if there is a way to change this it may also help me with another OBJ item I have in which the item rotates weirdly when thrown as an item into the world.
-
What is the name of the class that contains TESR code to render the animation when a chest opens and closes? Trying to make a custom chest. Edit: Nevermind. Found it. It's the TileEntityChestRenderer. -Source: https://minecraft.gamepedia.com/Talk:Chest
-
[1.12.1] [SOLVED] Problem with withProperty(...) arguments
ctbe replied to ctbe's topic in Modder Support
Thank you very much. It was that. I'm not an expert either, but I do know it automatically changes the Scala Boolean to a Java boolean (the primitive). Meaning it is not boxed. Got it working with any of the following: setDefaultState(blockState.getBaseState.withProperty(BlockProperties.IS_HANDLES, java.lang.Boolean.FALSE)) or setDefaultState(blockState.getBaseState.withProperty(BlockProperties.IS_HANDLES, false.asInstanceOf[java.lang.Boolean]) or setDefaultState(blockState.getBaseState.withProperty(BlockProperties.IS_HANDLES, Boolean.box(false)) Thanks. -
Probably simple, but it's eating me. I'm having trouble compiling this tutorial, but in scala: https://wiki.mcjty.eu/modding/index.php/Render_Block_TESR_/_OBJ-1.12 The line that goes setDefaultState(blockState.getBaseState().withProperty(IS_HANDLES, false)); In scala is the same, but without the semicolon at the end of course. As shown in the code, IS_HANDLES is of type PropertyBool as that is what the convenience implementation PropertyBool.create("") returns. Got a type mismatch exception found :net.minecraft.block.properties.PropertyBool required: net.minecraft.block.properties.IProperty[T] It is strange because if PropertyDirection is used instead, it works. But of course, we want a boolean here, not a facing like in other blocks.
-
[1.12] How to get crafting result from a custom crafting table?
ctbe replied to ctbe's topic in Modder Support
Oh. Then that defeats the purpose of having a custom crafting table. Given the circumstances I will use the workaround. Thanks. Edit: I will either use the workaround in my first post, or simply don't use an InventoryCrafting slot. The only reason I was using a InventoryCrafting slots was that it was the only way to trigger onCraftMatrixChanged method when the player did something in the custom table and update everything accordingly. Because normal slots didn't trigger that method. -
[1.12] How to get crafting result from a custom crafting table?
ctbe replied to ctbe's topic in Modder Support
Yes. I just found that out and edited my main post. I'll check how to fix it because my recipes are custom, but don't extend IRecipe. I was using another way of matching recipes, etc. Now I understand it wasn't the correct way. My question is though, if I register my custom recipes (as IRecipe) in the GameRegistry, will they be craftable in a normal crafting table? Because I want them only be craftable on my custom crafting table, not a normal one. -
I made a custom crafting table. In the Container it has a variable of type InventoryCrafting named craftMatrix, like the ContainerWorkbench class. It also has a variable of type InventoryCraftResult named craftResult. The thing is that that when I craft something and put the resulting ItemStack in the output slot, I can take it from it, but the ItemStacks in craftMatrix, increase twice in size. I debugged for hours to find what was going on and found that the responsible for said behavior was the method slotClick from the Container class. I overrode the slotClick method and canceled the call to super, but if I do that, I can't move items in or out the custom crafting table. Debugging was hard because the super slotClick method is huge and is not commented. It was hard to put so many breakpoints just to see what the code was doing and I still don't know why it does what it does. The call to super is doing this: Allows the player to take the item. Reduces the stack count in craftMatrix by one. It doubles the stack count in craftMatrix. So for example, if you had 4 planks in one slot on the craftMatrix (not the output), after taking the output of the crafting table, it leaves you with 3 planks, and then it converts those to 6 planks. If you take a result again, it reduces the planks to 5, then it makes them be 10. All that happens in the slotClick method of the Container class. I cannot identify why or how it is doing so. This is all my code in the overridden slotClick method override def slotClick(slotId: Int, dragType: Int, clickTypeIn: ClickType, player: EntityPlayer): ItemStack = { super.slotClick(slotId, dragType, clickTypeIn, player) } If I change that code to return the ItemStack of the slot that was clicked and cancel the call to super, nothing happens. I can't use the crafting table at all. Is there a way to get the result of the crafting table without the items in the craftMatrix being duplicated? Edit: I found what is duplicating the size, but don't know if it is a bug. The slotClick super method is calling the method onTake on the output slot (craftResult in this case). Inside there it gets two stacks in two variables. The stacks are the same ones. Each one represent a stack in the craftingMatrix, only that the code is getting the same stack in each variable. Then it compares if the ItemStacks are equal. If they are, it grows the stacks. Edit: I can finally see what is going on. It is a lengthy process. The reason it works on normal crafting tables and not on custom ones is that normal crafting tables deal with recipes of type IRecipe that are in the game registry. When that happens, the onTake method gets a list of empty stacks and as a consequence it doesn't grow the craftingMatrix of the ContainerWorkbench in the method. If you are making a custom crafting table so your table recipes are therefore custom and not registered in the game registry as IRecipe, you will get a list that is equal to that of the craftingMatrix. That causes the onTake method to decrease the stack size by one and then duplicate it. Only workarounds I find is either register my custom crafting table recipes as IRecipe in the game registry or remember the stack sizes before calling super in slotClick so that I can restore it after the call. But I don't know what will happen if I register my custom recipes in the game registry. I mean, the whole point of a custom crafting table is to have crafting that can be done only on that table. If the crafting can be done on a normal crafting table then the custom crafting table is useless.