Fluorescent Flamingo
Members-
Posts
10 -
Joined
-
Last visited
Recent Profile Visitors
The recent visitors block is disabled and is not being shown to other users.
Fluorescent Flamingo's Achievements
Tree Puncher (2/8)
2
Reputation
-
Yesterday Eclipse suddenly stopped working for me, and I don't know why. I didn't mess around with anything, and I've never had this problem before in years of using the software. When I try to close the program it gives this error: An error has occurred. See error log for more details. Could not initialize class com.sun.org.apache.xml.internal.serializer.Encodings Upon checking the error log: I can't close Eclipse at all without using Task Manager now. This is only the most visible of many bugs and errors that have suddenly popped up in the program. There are lots of other dialog boxes that pop up with these similar errors when I try to do various tasks. Such as: At first I could still run my mod from inside Eclipse, but now I get an InvocationTargetException when I try to view the run configurations and cannot select runClient. What I have tried: deleting the .metadata folder in my workspace and reopening Eclipse; deleting the entire ForgeGradle project, rerunning ForgeGradle setup, reimporting my sources and recreating the project; completely uninstalling and redownloading Eclipse, and then recreating the project. None of these have worked. I'd really appreciate some help!
-
How to exactly use IItemTier [1.15.2]
Fluorescent Flamingo replied to Harry12OK's topic in Modder Support
You need to create your own class (preferably enum, it’ll be easier) and let it implement IItemTier as an interface. You’ll need to override all the methods of IItemTier in your new class - look at what the vanilla one does, and just replicate its functionality. Then you can just use your MyModItemTier.SOME_MATERIAL in the constructor of your new tool Items. -
[1.15] Question about Recipes and Advancements
Fluorescent Flamingo posted a topic in Modder Support
I only just noticed the existence of a whole sub-folder full of recipe advancements. Having added plenty of custom recipes which apparently work just fine, I am now wondering if it's essential to create recipe advancements for them all too - is it functionally required or does it just have some effect on the recipe book? Also, why do all the recipe advancements for complex, multi-item recipes unlock depending only on a single ingredient? -
I'm trying to create an item that uses the standard 2D sprite model in the inventory, but for handheld rendering uses a different model. This item isn't a block. The only vanilla example of this is, I believe, the trident, but I can't figure out how to hook into the code for that in ItemRenderer. I thought it was as simple as adding another model called, e.g. "special_item#inventory.json", but no. After some searching I've found loads of old forum threads on how to achieve this in previous versions, such as 1.12, or 1.8 (here), but it seems the relevant methods (ModelLoader#setCustomModelResourceLocation, or ModelLoader#registerItemVariants) no longer exist in 1.15. How do you make an item model point to a different model file for the inventory variant? EDIT: SOLVED - for anyone else who's interested, here's the solution I managed to find. When Minecraft bakes all the models, it appends "#inventory" to every item model, so the model for your "special_item" is registered as "special_item#inventory". Using ModelBakeEvent, you can exploit this knowledge to retrieve an item's IBakedModel from the registry map, with the key "special_item#inventory". Having previously created a special handheld model, and saved it as "special_item_handheld.json" in the models folder (or any other name you like - it doesn't have to be "_handheld"), you can use FMLClientSetupEvent in your SidedProxy to call ModelLoader.addSpecialModel(new ModelResourceLocation("special_item" + "_handheld")); - this tells the game that it needs to load your handheld model as well. Finally, in the ModelBakeEvent, you can now retrieve from the map both the default model ("special_item#inventory") and the as-yet-unassociated-to-any-item handheld model ("special_item_handheld#inventory") [remember that all item models get #inventory appended], and using these objects, declare a new anonymous extension of IBakedModel which delegates all its methods to the default model object, except for in handlePerspective() where you switch models according to TransformType. Then, shove this new wrapper model back into the map! Example code for illustration. public class ClientProxy implements SidedProxy { @SubscribeEvent public void onLoad(FMLClientSetupEvent event) { ModelLoader.addSpecialModel(new ModelResourceLocation(ModItems.SPECIAL_ITEM.get().getRegistryName() + "_handheld", "inventory")); } @SubscribeEvent public void onModelBake(ModelBakeEvent event) { Map<ResourceLocation, IBakedModel> map = event.getModelRegistry(); ResourceLocation specialItem = ModItems.SPECIAL_ITEM.get().getRegistryName(); ResourceLocation specialItem_inventory = new ModelResourceLocation(specialItem, "inventory"); ResourceLocation specialItem_hand = new ModelResourceLocation(specialItem + "_handheld", "inventory"); IBakedModel specialItemModel_default = map.get(specialItem_inventory); IBakedModel specialItemModel_hand = map.get(specialItem_hand); IBakedModel specialItemModel_wrapper = new IBakedModel() { @Override public List<BakedQuad> getQuads(BlockState state, Direction side, Random rand) { return specialItemModel_default.getQuads(state, side, rand); } @Override public boolean isAmbientOcclusion() { return specialItemModel_default.isAmbientOcclusion(); } @Override public boolean isGui3d() { return specialItemModel_default.isGui3d(); } @Override public boolean func_230044_c_() { return specialItemModel_default.func_230044_c_(); } @Override public boolean isBuiltInRenderer() { return specialItemModel_default.isBuiltInRenderer(); } @Override public TextureAtlasSprite getParticleTexture() { return specialItemModel_default.getParticleTexture(); } @Override public ItemOverrideList getOverrides() { return specialItemModel_default.getOverrides(); } @Override public IBakedModel handlePerspective(ItemCameraTransforms.TransformType transformType, MatrixStack mat) { IBakedModel modelToUse = specialItemModel_default; if (transformType == TransformType.FIRST_PERSON_LEFT_HAND || transformType == TransformType.FIRST_PERSON_RIGHT_HAND || transformType == TransformType.THIRD_PERSON_LEFT_HAND || transformType == TransformType.THIRD_PERSON_RIGHT_HAND) { modelToUse = specialItemModel_hand; } return ForgeHooksClient.handlePerspective(modelToUse, transformType, mat); } }; map.put(specialItem_inventory, specialItemModel_wrapper); } }
-
[1.15.2] A question about Tags
Fluorescent Flamingo replied to Fluorescent Flamingo's topic in Modder Support
Ohhh.... so the code is a development tool for Mojang and modders to use, to avoid having to manually write the JSONs? That's very good to know. -
Hello everyone, After browsing the code for the Block and Item Tags system, and successfully having implemented my own item tag, something has me confused. Tags, and recipes, are defined in JSON files but there's a duplicate implementation of all of this in the actual code. In the BlockTagsProvider class, all those same vanilla tags which exist as JSONs are created dynamically, and the same for the Forge Tags in ForgeBlockTagsProvider. Ditto for items. And each of the hundreds of JSON crafting recipes are also duplicated in the code of RecipeProvider! Why does the game have both a code-driven and data-driven implementation of these things, and will I need to do the same in my mod? Is it something to do with separate client/server shenanigans? I've only used JSONs for my mod's tags and recipes and clearly there are no problems - although I haven't tested it in a dedicated server environment yet. But I was under the impression that datapacks are loaded by servers too.
-
Blocks and BlockItems
Fluorescent Flamingo replied to Fluorescent Flamingo's topic in Modder Support
Ah. I wouldn't claim it's agonising, but it becomes a bit tedious if you have quite a long list of blocks. And we programmers like to avoid code reuse wherever possible, don't we? My first thought was a method like this: private static RegistryObject<Item> registerBlockItem(RegistryObject<Block> block, ItemGroup group) { return ITEMS.register(block.get().getRegistryName().getPath(), () -> new BlockItem(block.get(), new Item.Properties().group(group))); } but of course it failed because the RegistryObject's value doesn't exist at that point. -
Just wondering, is there a less intensive way to generate BlockItems from Blocks than manually declaring the whole block list in item form? In earlier versions you declared your Block, and when you registered it automatically created the associated ItemBlock. Now you have to declare all the Blocks and BlockItems separately, maintaining two lists of the same thing. It seems like the sort of thing that could be automated away with a convenience method.
-
EDIT: SOLVED by fixing my Java JDK installation. Gradle was trying to use an old Java version that didn't exist, so I downloaded the newest Java 8 JDK, and added the line 'org.gradle.java.home=C:/Program Files/AdoptOpenJDK/jdk-8.0.242.08-hotspot' to my gradle.properties file. Hi everyone, In trying to setup Forge for 1.15.2 (Eclipse) I keep running into the same problem. This is what I've done: Downloaded the Forge MDK (latest version, 1.15.2 - 31.1.27 - though I also tried with the Recommended version) Extracted all the files into my development folder Downloaded Gradle for Eclipse, and imported the development folder into Eclipse as a Gradle project Run gradlew eclipse in the development folder The problem is that when I open Eclipse, none of the Minecraft or Forge classes are on the build path, and I can't view any of the game source code in package explorer. The issue seems to be that it can't download the source code. This is the error log that I get when I run gradlew --refresh-dependencies: I also get errors in Eclipse showing that the project is missing the Forge source as a required library. Here is my build.gradle file attached (I haven't edited it at all yet) I've tried recreating the entire setup multiple times from scratch, using both the latest and recommended versions, and each time I get this error. I've read the instructions at https://mcforge.readthedocs.io/en/latest/gettingstarted/ but it doesn't seem to cover how you get the project up and running. I've looked around other threads on this forum but to no avail. What am I doing wrong? Any help would be very highly appreciated.