Jump to content

ctbe

Members
  • Posts

    85
  • Joined

  • Last visited

Everything posted by ctbe

  1. Check the answer of user @V0idWa1k3r here: To see if the JSON there helps as an example.
  2. Check that the obj file is decorated at some point with the field usemtl itemsonicscrewdriver and that the mtl is decorated with the field newmtl itemsonicscrewdriver and that there is a definition for said material. To rule out whether it is a problem taking root in the way the JSON file is written or a problem in the obj and mtl files, remove temporarily the application of the texture in the JSON file and try to apply the texture in the mtl file instead by decorating at the end of the material definition (in the mtl file) with map_Kd operationbluebox:items/sonicscrewdrivertexture. Edit: Does your object extends from item or from block? Because the model appears to be loaded from the block models according to the log, but the naming used gives the impression that it is an item. If it is a block, it also needs to be registered as an item as far as I'm concerned. Sometimes, when one fails to register the item form of a block, the texture appears well in the inventory and when in hand, but when the block is placed in the world, the texture is purple and black. And no error appears on the log. That's why I ask.
  3. Minecraft offers an option to reload resource packs while using the key combination SHIFT + F3 + T. In many cases one wants to adjust how the model looks in any of the rendering types (firstperson_righthand, gui, etc). If one modifies the original JSON file that has the transform information in the IDE and presses SHIFT + F3 + T in Minecraft, nothing happens. One has to recompile everything and start again Minecraft to see the changes. But that is only because one is modifying the source and not the resource JSON that Minecraft is loading into memory. If you modify the one that is being loaded into memory, the changes will be displayed once you press SHIFT + F3 + T in the game. Eclipse: Modify your JSON file containing the transformations and copy paste it in its respective place under classes/production/[YOURPROJECTNAME]_main/assets. Overwrite the existing one. Press SHIFT + F3 + T in the game to reload the resource pack. For example, let's say I am making a mod whose root directory is named Tutorial. I have an item whose model is located in Tutorial/src/main/resources/assets/tutorialmodid/blockstates/item3dmodel.json. I would modify that file and while the game is running I would copy paste it in Tutorial/classes/production/Tutorial_main/assets/tutorialmodid/blockstates/item3dmodel.json. Then I would press SHIFT + F3 + T in the game to reload the resource pack which would show my changes. IntelliJ IDEA: Modify your JSON file containing the transformations, go to the Build menu, and click Recompile '[nameofyourmodel.json]'. Press SHIFT + F3 + T in the game to reload the resource pack. Alternatively you can right click the JSON file either at the project view or in the tabs and hit Recompile.
      • 2
      • Like
  4. This is probably a silly report, but in 1.12, the method shouldRefresh from the class TileEntity has a variable named newSate instead of newState. The variable is of type IBlockState. It doesn't affect the functionality. It's just a typo.
  5. How did I ended up messing it like that. Thanks, it's fixed and it works now. The final code looks like so override def getDrops(drops: NonNullList[ItemStack], world: IBlockAccess, pos: BlockPos, state: IBlockState, fortune: Int): Unit = { var tileEntity : TileEntity = world.getTileEntity(pos) if (tileEntity != null && tileEntity.isInstanceOf[TestContainerTileEntity]) { // Get the tile entity var testContainerTileEntity : TestContainerTileEntity = tileEntity.asInstanceOf[TestContainerTileEntity] // Make an nbt tag compund for the tile entity var tileEntityNbtTagCompound = new NBTTagCompound() // Step 1: Write tile entity to NBT testContainerTileEntity.writeToNbt(tileEntityNbtTagCompound) // Step 2: Create the item stack that will be dropped var itemstack = new ItemStack(Item.getItemFromBlock(this)) // Step 3: Set the key "BlockEntityTag" of the item stack compound to the compound tag that contains the tile entity data itemstack.setTagInfo("BlockEntityTag", tileEntityNbtTagCompound) // Step 4: Add the ItemStack to the drops list drops.add(itemstack) } } Now it keeps the inventory when I break it and put it again in the world.
  6. I must be missing something. I mine my block, harvest the drop I get from the overriden getDrops method, but when I place it back in the world, the items are not there. override def getDrops(drops: NonNullList[ItemStack], world: IBlockAccess, pos: BlockPos, state: IBlockState, fortune: Int): Unit = { var tileEntity : TileEntity = world.getTileEntity(pos) if (tileEntity.isInstanceOf[TestContainerTileEntity]) { // Get the tile entity var testContainerTileEntity : TestContainerTileEntity = tileEntity.asInstanceOf[TestContainerTileEntity] // Make an nbt tag compund for the tile entity var tileEntityNbtTagCompound = new NBTTagCompound() // Step 1: Write tile entity to NBT testContainerTileEntity.saveToNbt(tileEntityNbtTagCompound) // Step 2: Create the item stack that will be dropped var itemstack = new ItemStack(Item.getItemFromBlock(this)) // Make an NBTTagCompound for the item stack var itemStackNbtTagCompound = new NBTTagCompound() itemstack.writeToNBT(itemStackNbtTagCompound) // Step 3: Set the key "BlockEntityTag" of the item stack compound to the compound tag that contains the tile entity data itemStackNbtTagCompound.setTag("BlockEntityTag", tileEntityNbtTagCompound) // Step 4: Add the ItemStack to the drops lists drops.add(itemstack) } } I debugged and all the NBTTagCompounds have the data on them before the method ends. Do I have to modify the loadFromNBT() or readFromNBT() methods to be different that what they were in the tutorial so that it populates the items as they were before the block got broken? Or is the problem here in my code?
  7. I followed this tutorial: https://wiki.mcjty.eu/modding/index.php/GUI-1.12 and have been reading about Name Binary Tags to understand them. I checked the ShulkerBox class and its respective TileEntity, but it is very different from what is used in the tutorial. I have been wondering if it is possible for a simple TileEntity to save the inventory when the block is mined by the player such that when the player places it again in the world, it has the inventory. As of now, the inventory that was stored disappears if the block is broken. I cannot identify which part of the ShulkerBox makes the inventory persistent. What steps does one need to follow to make the inventory persist when a block gets broken?
  8. When I ask a question and it successfully gets solved, is there anyway I can mark the thread as solved? I see other users putting a [SOLVED] string on theirs. Don't know if users can do it so I ask.
  9. Thank you. That solved it. The final recipe looks like so { "type": "forge:ore_shapeless", "group": "magenta_dye", "ingredients": [ { "type": "forge:ore_dict", "ore": "dyeWhite" }, { "type": "forge:ore_dict", "ore": "dyeMagenta" } ], "result": { "item": "minecraft:dye", "data": 6, "count": 2 } }
  10. I don't understand. It still doesn't work. I am talking about OreDictionary recipes. The following was no success with JSON: { "type": "forge:shapeless_ore", "group": "magenta_dye", "ingredients": [ { "item": "dyeMagenta" }, { "item": "dyeWhite" } ], "result": { "item": "minecraft:dye", "data": 6, "count": 2 } } I get JsonSyntaxException: Unknown recipe type: forge:shapeless_ore. I understand then that there is no such thing as type forge:shapeless_ore. But then, what is there to use OreDictionary recipes?
  11. In the past I did it by calling GameRegistry.addRecipe(...) and passed the ShapelessOreRecipe. The method no longer exists. I have tried registering a recipe like one normally would, but creating a ShapelessOreRecipe and then getting the ingredients with shapelessOreRecipe.getIngredients() one by one. Didn't work. I also tried CraftingHelper.getIngredient() with the string of the ore recipe. Didn't work either. How would I go about it?
  12. Thank you! That one works.
  13. Try this, it will fix the texture: event.getRenderer().bindTexture(event.getRenderer().getEntityTexture((AbstractClientPlayer)player)); At least it did for me in 1.12 version, where I was getting the weird texture things you describe. Although your code doesn't work entirely for me as intended. It rotates, but I have to eliminate the code that hides the arm in the Pre event or I get nothing rendered at all. But if I do I get two arms rendered. The second one out of position. Weird. But I won't ask in this thread for help since I don't want to hijack your thread. Hope it helps.
  14. I have tried two tutorials: here and here. The problem is that I can't get them to work for 1.12 as some methods changed their signatures and a lot of code changes as consequence. On the first link there is a for loop in the class that extends Container that causes a null pointer exception and crashes the game when addSlotToContainer is called. Without the for loop that adds the slots to the container, it works more or less, but I have many other troubles. For example, when the GUI opens, which is the normal crafting table texture, it draws over it the silhouettes of the player armour slots and the shield silhouttes. I don't understand why it is doing it. It is like it overlays it. So instead of asking for anyone to see my code which is as huge as the one in those tutorials to see if they can spot the errors, it's better if I ask if there are any recent tutorials on the block gui concept. I am practicing with tutorials to understand the concepts because I eventually would like to add a custom crafting table to my mod that has custom recipes and also keep the inventory when the player exits the gui. But I can't get those tutorials to work.
  15. As far as I am concerned, you cannot do it through the JSONS if you are using an OBJ model as everything will be overridden when the OBJ gets loaded. Corrections are always welcome. In the JSON you would only specify the path to the model and the OBJ will specify the materials through the MTL file. But you can specify more than one material and assign it to specific parts of your model in your modeling tool. Then, in the MTL file, you would write at the end of each material, the texture you would want for it like so map_Kd progressiveg:items/ak47_oak If in the modeling tool you chose more than one material for different parts of your item, then you would have various map_Kd fields in the MTL file, each pointing to the texture of your choice.
  16. Finished trying. Nothing happens :(. But thanks to that tip I debugged on both events, Pre and Post and noticed that once one sets the rotation to whatever value, as soon as the event ends, the rotation value that one had set gets overridden by the Minecraft animation. When the player stands stills the arms sort of move a little. It is that small almost unnoticeable movement that is overriding the values one sets manually.
  17. Thanks for the information. I will not use the unlocalized name for it then. After debugging deeper I take that what you say is correct. While debugging I get that player.getActiveItemStack().getItem() is returning an object of class ItemAir. No matter what item the player has in in the active hand or in the rest of the inventory. Don't know why. I am sad no one knows how to achieve the rotation of the arm. I have tried so many things with no success. Modifying the offset works, but modifying the rotation doesn't. At one point I don't even know how, but I got all the mobs to float in the air and swing as the player walked. They were moving with the same rotation of the player's arm as it walked. It was funny to watch the sheeps float and swing in the air in synchrony as I walked. But the player's arm where unaffected.
  18. Did you manage to solve it? I am also interested in knowing how to achieve this. I did notice that the comparison with instanceof always yields false since you are asking if Item (what is returned) is an instance of ItemSpear. It is not. ItemSpear may be an instance of Item, not the other way around. Meaning the code inside the if will never run. However, I tried by making a comparison with an item's unlocalized name and the code ran, yet it didn't do anything like you said. I don't understand why rotateAngleX, or rotateAngleY, or rotateAngleZ do nothing. The method renderWithRotation does nothing either. Only when one modifies the offsetX, offsetY, or offsetZ fields one sees the arm offsetting away, but not rotating. Edit: Fix your code in the if statement. Use player.getHeldItem(EnumHand.MAIN_HAND).getUnlocalizedName().toLowerCase().contains("ItemSpear".toLowerCase()) and replace "ItemSpear" with the unlocalized name of your item. Then the code inside the if will run. But like I said, the code still does nothing. It does not rotate the player's arm.
  19. It's supposed to be Blocks.DIRT.getDefaultState().withProperty(BlockDirt.VARIANT, BlockDirt.DirtType.COARSE_DIRT) according to the method signature.
  20. I have the same question. It'd be nice to know what are the plans. I think, though I could be wrong, that they are working on making another way for adding crafting recipes as the TODO comments talk about making IRecipe a registry. If whatever comes new doesn't use the same name for methods (addShapedRecipe, addShapelessRecipe, etc), then your RecipeManager class would need a substantial re-writing. For the moment being I think it is better to keep it for reference and re-write it when the time comes, if it ever comes. If once this forge version comes out of beta it results that there is no similar way to add recipes in code then I would remove it. But I'd keep it for now. Just for reference until then.
  21. I'd use encapsulation. Make a class for each energy type that contains within it the data. The following code is an example from mind and I have not tested it. It is just to show the idea. It's been a while since I have written Java code so forgive if I forget a keyword in the following example. Interface CustomEnergy.java public interface CustomEnergy { public int getCurrentEnergyValue(); public int getMaxEnergyValue(); } Class FireEnergy.java public class FireEnergy implements CustomEnergy { private int currentEnergyValue; private int maxEnergyValue; public FireEnergy(int currentEnergyValue, int maxEnergyValue) { this.currentEnergyValue = currentEnergyValue; this.maxEnergyValue = maxEnergyValue; } //Getters @Override public int getCurrentEnergyValue(){ return this.currentEnergyValue; } @Override public int getMaxEnergyValue(){ return this.maxEnergyValue; } } Class WaterEnergy.java public class WaterEnergy implements CustomEnergy { private int currentEnergyValue; private int maxEnergyValue; public WaterEnergy(int currentEnergyValue, int maxEnergyValue) { this.currentEnergyValue = currentEnergyValue; this.maxEnergyValue = maxEnergyValue; } //Getters @Override public int getCurrentEnergyValue(){ return this.currentEnergyValue; } @Override public int getMaxEnergyValue(){ return this.maxEnergyValue; } } Then you would do anywhere else in your code the following Map<Chunk, CustomEnergy> hashMap = new HashMap<Chunk, CustomEnergy>(); BlockPos somePos = new BlockPos(30, 20, 10); BlockPos anotherPos = new BlockPos(100, 64, 100); Chunk someChunk = world.getChunkFromBlockCoords(pos); Chunk anotherChunk = world.getChunkFromBlockCoords(anotherPos); FireEnergy someFireEnergy = new FireEnergy(10, 100); WaterEnergy someWaterEnergy = new WaterEnergy(5, 100); hashMap.put(someChunk, someFireEnergy); hashMap.put(anotherChunk, someWaterEnergy); And handle it that way. One thing I am not sure though is if each Chunk will get the same hash if you for example query it once from the world and then query it again to pass it to the get() function of the HashMap. If it is the case, then the HashMap would allow for an efficient find. Otherwise it won't work at all. Also you cannot use CustomEnergy as a key, it always has to be a value in the HashMap. If you want to use it as key, then each energy class would need to implement the hashCode() and equals() methods. I hope this helps. As to how you would save that data between game sessions I have no idea.
  22. Simple question. How does one add a crafting recipe while modding in the 1.12 version that is currently in beta? I understand that this version of forge is in beta for which I'd understand if I am told that it is incomplete and recipes cannot be added. I can see the method signatures changed and the methods got marked as deprecated. Guessing the first parameter is probably for the json. As of now there is a TODO comment and all the addShapelessRecipe method does is throw a RunTimeException. Just want to know if maybe there is another new way to do it and if it is available. No problem if I am told it is under construction and as of now there is no way.
×
×
  • Create New...

Important Information

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