Jump to content

urbanxx001

Members
  • Posts

    200
  • Joined

  • Last visited

Recent Profile Visitors

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

urbanxx001's Achievements

Creeper Killer

Creeper Killer (4/8)

11

Reputation

  1. Figured it out, just had to add the following to the repositories: mavenCentral() Strange that it isn't there by default.
  2. Yeah I modified my reply while you were likely replying 🙃 See above again. Instanceof will be better than defaultinstance check.
  3. To have your custom crossbow only use your custom arrow, then you should override (in 1.20.1), one or both of the following methods in your crossbow class: public Predicate<ItemStack> getSupportedHeldProjectiles() { return ARROW_OR_FIREWORK; } public Predicate<ItemStack> getAllSupportedProjectiles() { return ARROW_ONLY; } And modify the return predicate to check for your arrow, something like: Predicate<ItemStack> CUSTOM_ARROW = (stack) -> {return stack.getItem() instanceof (custom arrow class)}; And if a special item is required to launch an arrow, then in the following method you'll just need to check if the player has the item in their inventory: public InteractionResultHolder<ItemStack> use(Level pLevel, Player pPlayer, InteractionHand pHand) { if (pPlayer.getInventory().items.contains(your custom item)) { (fire arrow) } }
  4. Hi gbln00, welcome to the forums! Some of the best resources for modding are the forge documentation and vanilla classes. From the documentation, I would start at menus and then look at screens below that: https://docs.minecraftforge.net/en/1.19.x/gui/menus/ Also: https://docs.minecraftforge.net/en/1.19.x/misc/keymappings/ Since you're using keymappings, it sounds like the custom GUI you want is related to some type of settings menu. In that case, I would start by looking at a vanilla class such as OptionsScreen.class, found (in 1.20.1): net.minecraft.client.gui.screens The easiest way to navigate here is to type OptionsScreen somewhere in your mod, import it, and then middle click it. Hope that helps.
  5. After a long hiatus in modding I'm updating a mod to 1.20.1. After downloading the appropriate Forge MDK and upgrading to Java 17 (through Adoptium JDK), I'm attempting to download sources but encounter this error: I've double checked that my system variables are correct and that the Intellij gradle JVM is pointing to the new Java version. This is likely a simple fix that's eluding me. Below are my build.gradle and settings.gradle. Any help is appreciated. build.gradle settings.gradle
  6. I have 2 blockstates for a block. One is for a static texture and the other is animated. On interaction, the blockstate changes to the animated one. But as far as I’m aware, you can’t define when the starting frame should actually start, as it loops indefinitely at all times. Is my approach to this impossible? Thanks.
  7. Meant to follow up on this, but I discovered that brewing recipes can also be registered to BrewingRecipeRegistry vs trying to swap out textures for potions. I was only familiar with the reflection method, but it's neat that there's two ways. Doesn't address the original problem, but code below for future visitors: Registry: private static void commonSetup(FMLCommonSetupEvent event) { event.enqueueWork(() -> { ModEffects.addBrews1(); }); ModEffects.addBrews2(); } Methods: public class ModEffects extends Effects { public static final DeferredRegister<Effect> EFFECTS = DeferredRegister.create(ForgeRegistries.POTIONS, Main.MOD_ID); public static final DeferredRegister<Potion> POTIONS = DeferredRegister.create(ForgeRegistries.POTION_TYPES, Main.MOD_ID); public static RegistryObject<Effect> MY_EFFECT = EFFECTS.register("my_effect", MyEffect::new); public static final RegistryObject<Potion> MY_POTION = POTIONS.register("my_potion", () -> new Potion(new EffectInstance(MY_EFFECT.get(), 1))); // Method 1 public static void addBrews1() { BrewingRecipeRegistry.addRecipe(Ingredient.of(ModItems.INPUT_ITEM), Ingredient.of(ModItems.INGREDIENT_ITEM), new ItemStack(ModItems.OUTPUT_ITEM)); } // Method 2 (vanilla-style, adds splash, lingering, and arrow variants) private static Method brewing_mixes; private static void addMix(Potion start, Item ingredient, Potion result) { if (brewing_mixes == null) { brewing_mixes = ObfuscationReflectionHelper.findMethod(PotionBrewing.class, "addMix", Potion.class, Item.class, Potion.class); brewing_mixes.setAccessible(true); } try { brewing_mixes.invoke(null, start, ingredient, result); } catch(IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { e.printStackTrace(); } } public static void addBrews2() { addMix(Potions.AWKWARD, ModItems.INGREDIENT_ITEM, MY_POTION.get()); } }
  8. Understood, the return for newList.resolve() should be oldModel.getOverrides().resolve(params). It didn't dawn on me that 'proceed as previously' in step 4 referred to the oldModel here as well instead of the method's super, but it makes sense since you specified it should in step 3. In newList.getOverrides, oldImmutableList already derives from oldModel.getOverrides, but I'll inline the variable if it makes a difference (oldModel.getOverrides().getOverrides())
  9. Welcome to the forum! In ServerPlayerEntity there should be a method to return the stats. In 1.16.5 it's called getStats() and returns the ServerStatisticsManager, but it may be called something different in 1.18.2
  10. Yeah I was confused and labeled both as newList. I'm returning: ImmutableList<ItemOverride> oldList = oldModel.getOverrides().getOverrides(); in newList1.getOverride now. I'm not sure what using oldList in newList1.resolve would do though, since the checks for the itemstack already exist, and new model is returned here. Unless it's for another form of check (what vanilla does). I also can't debug resolve as console outputs there don't work (or something's preventing it). I appreciate your help. I've read the forge docs and tried finding similar examples, but this event hack is something else.
  11. I've never created a fluid tank, but doing some research it seems like you'll want to attach an IFluidHandler capability to your block or item. You can find documentation for capabilities here
  12. Thanks. Sorry for the stupid mistake. The event is firing, but I'm not sure what to do with getOverrides(), unlike resolve() that has constructor parameters to check with. Trying to return or use newList0.getOverrides() here is null. The resource location should be correct.
  13. Following the method outlined by diesieben07 here, I'm attempting to override a texture for a custom potion. I (think?) I have the full ModelBakeEvent implemented, but I'm not sure if it's running, as I get no response similar to here. The new model is being added in the ModelRegistryEvent though. Below are my event classes and item model. Thanks!
×
×
  • Create New...

Important Information

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