-
Posts
1773 -
Joined
-
Last visited
-
Days Won
61
Everything posted by V0idWa1k3r
-
[SOLVED] [1.12.2] Compatibility with Optifine (Forge 14.23.4.2729)
V0idWa1k3r replied to Cadiboo's topic in Modder Support
Well, optifine uses notch names. That complicates things. Try this, might still work. The last paragraph of the readme is the important part here. I don't know if it still works now, but it worked for OF for 1.11.2(I've browsed OF's issue tracker to confirm, here is the relevant issue - the OP had it working after following the instructions) -
Well, yes, but it doesn't really make sense to modify the registry before any recipe has been loaded. And yes, vanilla recipes also get loaded basically at that event(it loads vanilla recipes first, then fires the event). And yes, the recipe registry happens after pre-init but before init, just as any other registry. See Loader#initializeMods. And while you could in theory modify the registry in the init or post-init after it has been initialized it won't work with any mod that grabs a reference for recipes, like JEI for example. It won't even work with the recipe book actually since it builds the recipe table after the registry event but before the init. So the registry being modifiable doesn't really mean you can do whatever you want with it whenever you want without consequences or incompatibilities. Besides the registry event just seems like the most logical place to modify the registry.
-
Well, you can see how vanilla did their furnace at TileEntityFurnace. Just don't use IInventory like it does, use capabilities. I have yet to see a minecraft modding tutorial video that would at least be "ok". Most of them are pretty bad. Actually every single one I've seen so far was pretty bad. So don't expect to find anything good on youtube for a while, although I've heard that @Animefan8888 is planning on making a series on his channel once 1.13 forge comes out.
-
This is the wrong time to be removing recipes. You need to remove them at the appropriate registry event. Yes, recipes are a IForgeRegistryEntry. Also don't do this Item item = r.getRecipeOutput().getItem(); if (item == Items.SHIELD) { recipeRegistry.register(RecipeEdit.get(r)); } check whether the recipe you need removed is the one by comparing it's registry name. Why does it even have the output itemstack if it outputs an empty stack when asked? And it doesn't even matter since it doesn't fit any crafting grid. Also it doesn't override the recipe you desire to override since it's registry name will never equal the recipe you are overriding.
-
IntelliJ Idea, Eclipse
-
Well there are official forge docs. You can also look at repositories of mods by other people, like here, here and here for example. Your IDE, of course.
-
You need to use the language file to set the names for your items. The tile.whatever.name is the language key. The value you assign to it will be what's displayed in the game. IHasModel is stupid. All items need models, no exceptions and nothing about model registration requires access to private/protected things of the item. Register your models in the ModelRegistryEvent directly.
-
Apart from that, yeah, learn java first. There are plenty of online courses/books. Don't. That is the worst choice anywone who wants to do minecraft modding can make. As an example as to why recipes must be made using json, not java. And even if you use java for some god forsaken reason do it in the appropriate registry event, but not in the PreInit.
-
public static boolean isPlayer(Entity entity) { Minecraft.getMinecraft().getIntegratedServer() return entity instanceof EntityPlayer; } Uhh... fitst of all this code doesn't even compile. Secondly there is exactly zero need to get a server to determine whether the entity is a player. Even in this snippet you've provided getting the server does absolutely nothing. instanceof in java8+ is one of the fastest operations the JVM can perform. It is kinda useless for the MinecraftServer class itself but different implementations of that class may override the method to do something else. If you want the DedicatedServer you can use FMLServerHandler#getServer, that one is pretty much guaranteed to return a DedicatedServer. However remember that DedicatedServer class only exists on the physical server, so if you access it in any way you need to do it in your server proxy. In a lot of cases a simple MinecraftServer will suffice and you can get that through FMLCommonHander#getMinecraftServerInstance which will return either an IntegratedServer(client) or a DedicatedServer(server). Again though, you do not need a server instance for your issue. Object.this has nothing to do with what you are talking about, it's just a way to access the parent instance of inner non-static class instances.
-
Well, show your recipe json. If the recipe doesn't work at all with any saw whatsoever(damaged or not) then show the launch log.
-
World#setBlockState. For the flags parameter description refer to the javadoc on the method. To get the IBlockState you can use Block#getDefaultState and then change the properties(if needed) of that state.
-
What would you need a custom factory for? This is perfectly acheivable with MC's default factories - see here and here. @AlmightyElement Either use OreDictonary if you want all logs to be accepted from all mods(that register their logs to the dictionary that is) or specify two items in your ingredient(example) because the game has 2 separate items that represent itemblocks for logs for whatever reason with the data set to the wildcard value. Edit: if you want a separate result per log then you will need one recipe per log, with the data property being incremented by one for each variant. And yes 2 of your recipes will have a different item name than the other 4(for vanilla)
-
[SOLVED] [1.12.2] Compatibility with Optifine (Forge 14.23.4.2729)
V0idWa1k3r replied to Cadiboo's topic in Modder Support
I don't think that matters. Forge will automatically remap obfuscated references in mods in your workspace as far as I am aware. And in any case it shouldn't make your code "uncompilable" because you are not compiling OF, you re using it as a library. -
In your client proxy/client only class after the item has been initialized.
-
[1.12] Mod drop loot, am I doing this right?
V0idWa1k3r replied to TheGoldenProof's topic in Modder Support
You need to rethink your approach. If you don't understand something you need to learn it, not avoid it like a plague. Minecraft is getting more and more data driven and utilizes json for more and more of it's things. If you wish to continue modding you need to learn to use json. It's not very difficult. You've learned to use java after all, that's way more difficult than some json. -
[1.12] Mod drop loot, am I doing this right?
V0idWa1k3r replied to TheGoldenProof's topic in Modder Support
If your entry is the only one then the weight does not matter. If you want to add new drops to the pool use json, there is no need to do it from code. Read the official docs on the matter. -
This makes no sense. ModelShield is a BipedModel which has nothing to do with baked models. You don't even need to extend ModelShield here at all. First of all the ItemOverrideList has nothing to do with a TEISR. Second of all most models have empty ItemOverrideLists and work just fine. You can't do this in the item's constructor because this method is client-side only. It will crash the server. No I didn't. I told you that you need to register your IBakedModel as the item's new model using either a custom ICustomModelLoader implementation or a ModelBakeEvent. But now when I see your registry... Don't ever use static initializers. Instantinate your things directly in the registry event. IHasModel is stupid and yes, this is a renamed IHasModel. All items need models, no exception and nothing about model registration requires access to private/protected data of the item. Register your models in the ModelRegistryEvent directly.
-
Don't use GL11 directly, use GlStateManager otherwise you are screwing up minecraft's state machine. Well, what if the player isn't the camera? What if the player spectates as a zombie? Use Minecraft#getRenderViewEntity instead. Any reason you are rendering your box in 6 passes? Do it in one. Draw calls are expensive. That's what the OP is doing: If you translate by -camerapos then you get the world's 0,0,0 origin. I am actually unable to replicate the issue with the code provided, the cube renders in the correct spot for me...
-
Why is your Item an instance of IBakedModel? That makes no sense. First of all IBakedModel is client-only while items are common, this will crash the server. Second of all items are not models. You can't return null here, you need to return ItemOverrideList.NONE. You can't return null here, you need to return a particle texture of some kind. At least a TextureMap#getMissingSprite. You can't return null here, return a Collections.EMPTY_LIST. Well, good job. For whatever reason you've overridden the setter for a TEISR. It used to set the TEISR of the item to the one passed as it's parameter. Now it sets the local teisr variable to a new WeaponTeisr. Which gets discarded immediately because that's not how java works. And even if it somehow worked this way you are not even calling this method from anywhere. And you have also provided no code responsible for registering the item's model. You need to do that too.
-
It depends on which TextureAtlasSprite you want. Do you want a block's/item's texture? Use BakedQuad#getSprite. Do you want a custom sprite? Use TextureStitchEvent, register your sprite using TextureMap#registerSprite, it will return you a TextureAtlasSprite you can store and reference later.
-
Well you need to update to a modern version of the game. As far as I am aware versions below 1.9 are no longer supported on this forum and you've discovered one of the many reasons as to why.
-
https://en.wikipedia.org/wiki/Serialization Similar to how the game does that with any other object properties - create the tag and write all fields that you want serialized into the tag. Is the field a primitive? Write it as one using one of the methods provided by NBTTagCompound. Is it an object? Create a new NBTTagCompound, do this procedure for that object. With enough depth anything can be broken down into primitives that can be serialized. Well your IStorage implementation should provide one. You are the one creating the implementation though. The same way you would get anything else from an NBT - with the corresponding get method(NBTTagCompound#getCompoundTag for example). Well, you will have all the data that your capability holds in that tag. Just read the data from the tag and set the fields in your capability to that data. That's called deserialization. You may use those methods, sure. It doesn't really matter which methods you use. No. Don't send the entire stack. Use whatever the base implementation is + your capability data. Well, finish creating the implementation for those methods. You need to write just enough data to be able to reconstruct your capability in the read method. If you are having issues with the concept of NBT and (de)serializing it you may want to try something else, like TIleEntities for example to get the idea on how it works.
-
What did you not understand? You need to override two methods in your Item class, the Item#getNBTShareTag and Item#readNBTShareTag. In Item#getNBTShareTag you need to serialize your capability to an NBT tag and append that tag to the one provided by the method. In Item#readNBTShareTag you will get the NBT the client received, grab your capability's NBT that you've appended to it and read the capability from it. If you are using the share tag approach the game will do everything for you. You only need to (de)serialize the data in the methods I've told you about.
-
Is your capability provider an instance of ICapabilitySerializable? When the ItemStack of the EntityItem is added to the player's inventory it's cloned and capabilities are cloned by serializing them in the old stack and deserializing them in the new stack. If your capability provider isn't an instance of INBTSerializable(which ICapabilitySerializable extends) then the capability data will be lost. Capabilities by default are never synced between client and the server but both may have the capability attached. You need to sync the capability yourself. Either use packets or in case of an ItemStack where the item of that stack is an item provided by your mod you can override Item#getNBTShareTag to save the capability into NBT that gets sent to the client and override Item#readNBTShareTag to deserialize the capability from the NBT you've received from the server. If you are not the owner of the Item's class then you have to use packets.
-
But that commit fixes the issue. You don't need to fix what's already fixed. If a new version isn't released yet then wait for it to be released(although that commit is more than a year old so I would imagine a new version is already out). Or compile the mod from sources yourself, they even have a documentation on how to do that on their github.