Jump to content


  • Posts

  • Joined

  • Last visited


  • Gender
  • Personal Text
    I am new!

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

ZDoctor's Achievements

Tree Puncher

Tree Puncher (2/8)



  1. # A dependency - use the . to indicate dependency for a specific modid. Dependencies are optional. [[dependencies.continfblocklib]] #optional # the modid of the dependency modId="forge" #mandatory # Does this dependency have to exist - if not, ordering below must be specified mandatory=true #mandatory # The version range of the dependency versionRange="[31,)" #mandatory # An ordering relationship for the dependency - BEFORE or AFTER required if the relationship is not mandatory ordering="NONE" # Side this dependency is applied on - BOTH, CLIENT or SERVER side="BOTH" # Here's another dependency [[dependencies.continfblocklib]] modId="minecraft" mandatory=true versionRange="[1.15.2]" ordering="NONE" side="BOTH" [[dependencies.continfblocklib]] modId="continfitemlib" mandatory=true versionRange="any" ordering="AFTER" side="BOTH" This is your code from you item-library mods.toml. Now please explain to me why you have 3 "[[dependencies.continfblocklib]]" and not only that, each has a different modid with the other two being "forge" and "minecraft" not to mention they have versions. Also if it crashing then it's best to figure out why, because that means you usually did something wrong. Before you even touch the gradle (because technically you shouldn't really need to) you should first get your mods able to be run.
  2. So if I understand correctly, your question has two parts, 1) how to reference another library (block reference items) and 2) reference loot tables from another mod. For the first part, I assume you correctly added it as a dependency to the mods.toml file so that it errors when it doesn't find the required mod. However, there still the problem of referencing the other mod in code and building it. There are a number of ways to do this and they all revolve around using the build.gradle file. After messing around with this myself for a while, I understand what a pain this could be and it took hours for me to figure out my setup, but I digress. Once you define in your build.gradle where it can find your library and refresh the gradle it will automatically add it to the external references which will let you reference it in code. There are a number of ways to define it in a gradle and supposedly (according the the build.gradle) there is supposed to be a built in way by putting in in the "libs" folder, but I've had no success trying that method. The next best thing going down that path (the libs folder) is to add "compile fileTree(dir: './libs', include: '*.jar')" or "compile files("./libs/name-of-jar-here.jar")" in the dependencies section of the build.gradle. Though this wasn't sufficient for my needs, but I again digress. For the second part, I'm not quite sure what you mean by referencing a loot table. If you mean referencing by reading the json file, then you'd need to use the resource manager and get the file as a stream using the resource location. If you mean overriding a loot table, then you'd need to create a loot table override, but I believe there should be tutorials about that already and a good reference here: https://minecraft.gamepedia.com/Loot_table#Data_packs Don't worry about it too much if you don't quite understand what I'm saying. As I see it, it isn't technically modding but using an external tool (gradle). You say you are new to modding so I'd suggest trying to first learn and practice making mods that are independent.
  3. May I direct your attention to the mods.toml file. https://mcforge.readthedocs.io/en/latest/gettingstarted/structuring/#the-modstoml-file With it you can declare mods that yours depends on and specify a version (i.e. a minimum or strict version). Doing so will show the user an error message telling them about the missing mods. If I understand your meaning, according to this page in the docs (https://mcforge.readthedocs.io/en/latest/concepts/sides/#writing-one-sided-mods) mods are expected to work regardless of what side they are on, and if they don't that is a problem the the mod author needs to address.
  4. Assuming you are using IntelliJ, once you import the gradle settings the Minecraft source code (along with all the other dependencies) would be under the "External Libraries" in your project. For the code it would be the 'net.minecraftforge:forge:1.X.X-X.X.X_mapped_snapshot' and for the assets (textures, json, etc.) it would be under the 'net.minecraft:client:extra:1.X.X' Intellij also provides shortcuts to getting to the source code of a file by holding control and left clicking the class, method or field. Eclipse is a somewhat similar process.
  5. Even if there isn't an error, the debug log could be useful.
  6. I would look into how redstone does it. Pretty sure you'll need to create a new TileEntity to do this.
  7. You should still get rid of the "value = Dist.CLIENT" pretty sure it will cause a ghost item if someone tried to use it on a server.
  8. And I went ahead and did it to prove I could. First the custom HorseInventoryContainer: public class TestHorseInventory extends HorseInventoryContainer { public TestHorseInventory(int id, PlayerInventory pInv, IInventory iinv, final AbstractHorseEntity horse) { super(id, pInv, iinv, horse); inventorySlots.set(0, new Slot(iinv, 0, 8, 18) { /** * Check if the stack is allowed to be placed in this slot, used for armor slots as well as furnace fuel. */ public boolean isItemValid(ItemStack stack) { return (stack.getItem() == Items.SADDLE || stack.getItem() == Items.DIAMOND) && !this.getHasStack() && horse.canBeSaddled(); } /** * Actualy only call when we want to render the white square effect over the slots. Return always True, except * for the armor slot of the Donkey/Mule (we can't interact with the Undead and Skeleton horses) */ @OnlyIn(Dist.CLIENT) public boolean isEnabled() { return horse.canBeSaddled(); } }); } } The overriding the server container: @Mod.EventBusSubscriber public static class CommonEvents { @SubscribeEvent public static void containerOpen(PlayerContainerEvent.Open event) { if (event.getContainer() instanceof HorseInventoryContainer) { LOGGER.info("Open Inventory"); ServerPlayerEntity player = (ServerPlayerEntity) event.getPlayer(); HorseInventoryContainer oldContainer = (HorseInventoryContainer) event.getContainer(); AbstractHorseEntity horse = ObfuscationReflectionHelper.getPrivateValue(HorseInventoryContainer.class, oldContainer, "horse"); IInventory horseInventory = ObfuscationReflectionHelper.getPrivateValue(HorseInventoryContainer.class, oldContainer, "horseInventory"); if (player != null && horse != null && horseInventory != null) { player.openContainer = new TestHorseInventory(player.currentWindowId, player.inventory, horseInventory, horse); player.openContainer.addListener(player); } } } } Then the HorseInventoryScreen: @Mod.EventBusSubscriber public static class TestClientEvents { @SubscribeEvent public static void openGui(GuiOpenEvent event) { if (event.getGui() instanceof HorseInventoryScreen) { ClientPlayerEntity player = Minecraft.getInstance().player; if (player != null) { HorseInventoryScreen oldGui = (HorseInventoryScreen) event.getGui(); HorseInventoryContainer oldContainer = oldGui.getContainer(); AbstractHorseEntity horse = ObfuscationReflectionHelper.getPrivateValue(HorseInventoryContainer.class, oldContainer, "horse"); IInventory horseInventory = ObfuscationReflectionHelper.getPrivateValue(HorseInventoryContainer.class, oldContainer, "horseInventory"); if (horse != null && horseInventory != null) { HorseInventoryContainer newContainer = new TestHorseInventory(oldContainer.windowId, player.inventory, horseInventory, horse); player.openContainer = newContainer; HorseInventoryScreen newGui = new HorseInventoryScreen(newContainer, player.inventory, horse); event.setGui(newGui); } } } } } The finished product:
  9. So looking into it, as I understand it, you'd need to do the following: 1) You would need to subscribe to the open container event, check if the container is an instance of HorseInventoryContainer and override the openContainer of the player (by casting to ServerPlayerEntity) with your own custom HorseInventoryContainer then add the listener. 1.5) Since the parameters horse and inventoryIn are not passed along with the event, and are private with no accessors, you'd probably have to use reflection to get those values and pass them to your new instance or make a constructor that does that for you. Look at ObfuscationReflectionHelper. 2) Subscribe to the GuiOpenEvent and wait for the ClientPlayNetHandler to open the HorseInventoryScreen(through call handleOpenHorseWindow) and in the event you'd want to set the gui to the new instance of the HorseInventoryScreen with your custom horsecontainer. And that should do it. 2.5) like 1.5 you'd need some parameters not passed by the event, so you'd need reflection again to get them from the old container.
  10. Thanks for the how-to. Took a while to get it working even when reading this. I don't know if I would have had the patience to figure it out without it. XD Just a few notes. 1. You need to press 'Ok' on Intellij to apply changes to plugins. I definitely didn't spend 20 minutes trying to figure this out. 2. The vm option doesn't seem to be needed. The hot swap plugin didn't seem needed either. Was able to hotswap without both, but DCEVM needs to be installed. 3. Under Build the 'Build Project' and 'Recompile' option (and their shortcuts) works just fine, so no need to remap keys. 4. Everything other than installing DCEVM is unnecessary.
  11. I am working with forge-1.15.2-31.1.46. The server runs just fine in Intellij, but when I try to make the forge server run outside of a dev environment it crashes. It is not due to any mods because I was running it without mods. Also, the server ran just fine without forge. Here is the Server Crash Report: https://pastebin.com/7F6WScAW And the Debug Log: https://pastebin.com/37s9LHnx Any ideas? Edit: For anyone wondering, this is my Java Version: java version "1.8.0_241" Java(TM) SE Runtime Environment (build 1.8.0_241-b07) Java HotSpot(TM) 64-Bit Server VM (build 25.241-b07, mixed mode) Edit 2: It should be using java 1.8, but looking at the logs it seems it's using 12? Looking into this. Edit 3: Seems like that was the issue. I had a java 12 also installed along with 1.8. After uninstalling 12 it works fine now.
  12. That's something I never understood as to why (but never bothered to look into it too hard) it happens, but what I do is just Rotate the gl 180 and that should fix it. I assume somewhere in the vanilla code something does that, but I haven't found it.
  13. From what I can see and understand, you are trying to use the default Minecraft player model as your base model, but you are using the default renderer to do it. You can use the MC player model, but you would need to copy it and change the relevant parts, such as what texture is bound to the gl, scale etc. And then render that instead. The renderer is connected to the default mc model which also hard codes it's texture. That's the easy way, or you can just code the model in yourself.
  14. Yeah, I was afraid of that. I tried pushing a fix, but it wasn't well received due to how it affected the patch file. It's too bad, I was hoping there was another way besides my patch. I made a pretty cool damage indicator above anything living that would show the status icons and the hearts would render just like a player's (animated and everything). It's pretty cool. Now if I want it to work like that I would need to learn to edit the files, probably with asm, and even then it would only work like that in single player mod unless the server had the same mod. I guess it would be an interesting skill to have.
  • Create New...

Important Information

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