Jump to content

DovahOfKiin

Members
  • Posts

    9
  • Joined

  • Last visited

Everything posted by DovahOfKiin

  1. This happens automatically. Any registered PotionType produces an entry in the creative tab. Thanks for all the help
  2. It can be anything. It is simply an identifier for the IItemPropertyGetter so that the ItemOverride can reference it. You can name it whatever you want as long as you keep your ModID as the resource domain (to avoid clashes). Gotcha. Thanks for explaining everything to me. Also, Do I need to call this method from somewhere, or is it automatically done?
  3. Right. ItemPotion does this in getSubItems. It iterates all registered PotionTypes and adds them to the creative tab. I actually did some investigation again and the following hack should work: Create a static final field holding a ResourceLocation . Call it something like "mymod:is_xyz_potion". Create a class implementing IItemPropertyGetter . From the sole method inside it return 1 if the passed in ItemStack is your potion, 0 otherwise. Register a new instance of this class from preInit in your client proxy using Items.potionitem.addPropertyOverride(<RL from step 1>, <property getter instance>) . Subscribe to ModelBakeEvent . In there get the vanilla potion model using event.getModelRegistry().getModel(new ModelResourceLocation("bottle_drinkable", "inventory")) . Get it's ItemOverrideList using getOverrides . Reflectively get the field ItemOverrideList#overrides and add your own ItemOverride into it. To create the ItemOverride use new ItemOverride(<ModelResourceLocation that points to your desired potion model>, ImmutableMap.of(<RL from step 1>, 1f)) . Tell Minecraft to load your model by calling ModelBakery.registerItemVariants with the ModelResourceLocation for your model in preInit from your ClientProxy. So that RL from step 1 can be anything? Does it need to correspond to some name?
  4. If you were to have e.g. MyPotion I and MyPotion II (different amplifiers): Yes. isReady does not have the entity available or anything. isReady is designed to allow use-cases like "this potion does something every 10 ticks". Then you can keep this counting logic out of performEffect. But technically only performEffect is needed. I just mention isReady because it returns false by default for non-vanilla potions, so your performEffect will never be called if you do not override isReady. Yes. What do you mean by "create"? There is not an easy (compatible) way to set this except making your own item, which would not be a vanilla potion anymore. Override renderInventoryEffect in your Potion class. I suppose a good example for "create" would be Forge's UniversalBucket system, afaik there's a method in FluidRegistry that creates a UniversalBucket for you given a fluid. Is there a version of this with potions? Like it creates all the potion bottles given the PotionType(s)? Also I didn't really understand what you meant by "There is not an easy (compatible) way to set this except making your own item, which would not be a vanilla potion anymore.". Could you please explain again?
  5. Right, so I create a single potion, and I derive multiple PotionTypes from it? I got this, but what is the difference between isReady and performEffect? Well see here's the thing. I don't want my potion to be craftable by vanilla methods (crafting table/furnace/brewing stand), but I do want it to be craftable through my own methods. a) So would I create a PotionType or not? b) If not, how do I go about the registration stuff? c) Also, will registering automatically create the bottle(s) for me? I mean this: http://www.minecraftopia.com/images/blocks/potion_of_swiftness.png and also the potion effect icon, like in this: https://i.gyazo.com/3ce9e9d573bfe34cb599424877b50815.png To help you answer these questions, I'll try and tell you what I want to do. I want to create custom potion effects, with various amplifiers (I, II, III), durations (1:00, 2:00 etc), splash and lingering type, BUT I DON'T WANT IT TO BE BREWABLE/CRAFTABLE. I want to handle the crafting on my own, possibly through PotionUtils.addPotionToItemStack(new ItemStack(Items.potionitem), <PotionType>).
  6. But that only decides the recipe. What about the potion itself?
  7. How do I make custom potions? I want it to follow the bottle format ie be drinkable and then return an empty bottle. Here is what I want to do: 1) Decide how it is crafted 2) Decide its various duration and amplifiers (on my own, I don't want MCForge to just do it for me) 3) Decide what happens upon drinking the potion 4) Set my own textures
  8. So as a rule of thumb all Model* methods should go in my client proxy right?
  9. Alright. So I'm doing fluids in my mod for the first time. I couldn't find any tutorials, so I went with this German one (used youtube's caption translate tool): . As I hadn't done them before, I pretty much just straight up copied the methods from the video. There is one method I changed: ModelBakery#addVariantName -> ModelBakery#registerItemVariants, but apart from that it was all identical. I seem to be getting a multitude of exceptions. Crash report: http://pastebin.com/UCC0L4vn It seems like all of the exceptions are the same, but there is one NullPointerException at the bottom of the file. FluidRenderRegister: public class FluidRenderRegister { public static void init() { registerFluid(ModBlocks.bloodBlockFluid, "blood"); } private static void registerFluid(BlockFluidClassic block, String name) { Item item = Item.getItemFromBlock(block); ModelBakery.registerItemVariants(item); final ModelResourceLocation loc = new ModelResourceLocation(Constants.MODID + ":fluids.json", name); ModelLoader.setCustomMeshDefinition(item, new ItemMeshDefinition() { @Override public ModelResourceLocation getModelLocation(ItemStack stack) { return loc; } }); ModelLoader.setCustomStateMapper(block, new StateMapperBase() { @Override protected ModelResourceLocation getModelResourceLocation(IBlockState state) { return loc; } }); } } ModBlocks: public class ModBlocks { public static BreweryBlock breweryBlock; public static CatalystLiquidizerBlock catalystLiquidizerBlock; public static BloodBlockFluid bloodBlockFluid; public static void init() { registerBlockWithItem(breweryBlock = new BreweryBlock(Material.wood), Constants.MODID + ":" + Constants.BREWERYBLOCK_UNLOCALIZED); registerBlockWithItem(catalystLiquidizerBlock = new CatalystLiquidizerBlock(Material.wood), Constants.MODID + ":" + Constants.CATALYSTLIQUIDIZERBLOCK_UNLOCALIZED); GameRegistry.register(bloodBlockFluid = new BloodBlockFluid(ModFluids.bloodFluid, Material.water)); } private static void registerBlockWithItem(Block b, String s) { GameRegistry.register(b); ItemBlock i = new ItemBlock(b); ModelLoader.setCustomModelResourceLocation(i, 0, new ModelResourceLocation(s, "inventory")); GameRegistry.register(i.setRegistryName(b.getRegistryName())); } } ClientProxy: public class ClientProxy extends CommonProxy { @Override public void preInit(FMLPreInitializationEvent e) { super.preInit(e); } @Override public void init(FMLInitializationEvent e) { super.init(e); BlockRenderRegister.registerBlocks(); FluidRenderRegister.init(); } @Override public void postInit(FMLPostInitializationEvent e) { super.postInit(e); } } CommonProxy: public class CommonProxy { public void preInit(FMLPreInitializationEvent e) { ModFluids.init(); BreweryRecipeHelper.init(); ModTileEntities.init(); ModBlocks.init(); } public void init(FMLInitializationEvent e) { NetworkRegistry.INSTANCE.registerGuiHandler(Brewery.brewery, new BreweryGuiHandler()); } public void postInit(FMLPostInitializationEvent e) { } } ModFluids: public class ModFluids { public static Fluid bloodFluid; public static void init() { bloodFluid = new GenericFluid("fluid_blood", new ResourceLocation(Constants.MODID, "blocks/fluids/fluidblood_still"), new ResourceLocation(Constants.MODID, "blocks/fluids/fluidblood_flow")) .setViscosity(1500) .setLuminosity(5); FluidRegistry.registerFluid(bloodFluid); } } If you need more files, let me know. It looks like some model files are missing, but the tutorial guy didn't make them so I really don't have a clue as to what I'm supposed to do. Sorry for being Jon Snow (not knowing anything). Thanks
×
×
  • Create New...

Important Information

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