Jump to content

urbanxx001

Members
  • Posts

    200
  • Joined

  • Last visited

Everything posted by urbanxx001

  1. So after attempting to refresh dependencies, the library isn't downloaded, even though the implementation and repository lines are correct. The error: Could not find curse.maven:quark:3024740_mapped_snapshot_20200514-1.16. Searched in the following locations: - https://files.minecraftforge.net/maven/curse/maven/quark/3024740_mapped_snapshot_20200514-1.16/quark-3024740_mapped_snapshot_20200514-1.16.pom - https://files.minecraftforge.net/maven/curse/maven/quark/3024740_mapped_snapshot_20200514-1.16/quark-3024740_mapped_snapshot_20200514-1.16.jar - file:/C:/Users/Name/.gradle/caches/forge_gradle/bundeled_repo/curse/maven/quark/3024740_mapped_snapshot_20200514-1.16/quark-3024740_mapped_snapshot_20200514-1.16.pom - file:/C:/Users/Name/.gradle/caches/forge_gradle/bundeled_repo/curse/maven/quark/3024740_mapped_snapshot_20200514-1.16/quark-3024740_mapped_snapshot_20200514-1.16.jar - https://libraries.minecraft.net/curse/maven/quark/3024740_mapped_snapshot_20200514-1.16/quark-3024740_mapped_snapshot_20200514-1.16.jar - https://repo.maven.apache.org/maven2/curse/maven/quark/3024740_mapped_snapshot_20200514-1.16/quark-3024740_mapped_snapshot_20200514-1.16.pom - https://repo.maven.apache.org/maven2/curse/maven/quark/3024740_mapped_snapshot_20200514-1.16/quark-3024740_mapped_snapshot_20200514-1.16.jar
  2. Thanks. compile and deobfCompile are deprecated though. Since that link doesn't say where to find the fileID, for anyone else lost, it's part of the URL for it's location on curseforge. Details here.
  3. The following is a tutorial for Intellij by an accomplished mod developer. The tutorial is 2 years old, but the workflow should still be relevant
  4. I'm implementing a soft dependency (gradle calls it module) in build.gradle. For instance, I looked at another mod's source that adds content associated with the quark mod: dependencies { implementation fg.deobf("curse.maven:quark:3024740") } However, I don't know what the number represents and where to find it for other mods. It doesn't seem related to the version number.
  5. Most of the code for 1.16 will apply to 1.15.2. I'm not sure what 25 refers to, but for armor items, they have values like toughness and damage reduction amount. This is determined by what tier the armor is (i.e., if it's iron, gold, etc.) So you'll want to create your own tier.
  6. That did the trick, thanks for your help yesterday and now today. I wonder why it wasn't that way in the tutorial. Fixed Layer0 by using fillItemGroup, I first avoided it as I thought it would register 2 instances of the item.
  7. The method is definitely called, again layer0 is dyeable, and the dyeing recipe uses getItemColor, it's just the default color is applied to layer1 instead of 0.
  8. Yeah. In the main class: eventBus.addListener(ColorHandler::registerItemColors); With: public class ColorHandler { public static void registerItemColors(ColorHandlerEvent.Item event) { event.getItemColors().register(DyeableBackpackItem::getItemColor, ModItems.LEATHER_BACKPACK); } }
  9. After following a tutorial I still have a small problem (I know the anti-tut ppl will berate me). Layer0 is dyeable but returns a black color, and layer1 (overlay) returns the default color that layer0 should be. The layer0 texture is properly grayscale. Item code below. It's probably due to getItemColor, but I've toyed with it with no success
  10. If you want to do it that way, you'll need AT or reflection to access it
  11. Ah ok, thanks!
  12. So i was referring to the docs and vanilla item classes, and realized addPropertyOverride no longer works in 1.16. Do I need to create and register a custom ItemModelsProperties class?
  13. They call it a crafting pad, but yeah the code shouldn't be overwhelming. hohserg mentioned another good place, although that mod's in 1.12.
  14. Originally used for updating the Blockstate Y position in another loop. Was playing around with the loop, but removed it. The world null line is just to suppress a message that pops up in the editor. Flag is a good name as that's what they're used for. But I guess what you're saying is that their purpose isn't immediately obvious to someone else reviewing the code. You're right it should tp around that position instead, thanks for catching that. Will fix it.
  15. The Vanilla Tweaks mod implements this. I'd recommend taking a look at how they coded it. I believe it uses the same crafting gui, with small custom item and container classes.
  16. In the following effect method, I'd like the player to teleport to a block that's within their line of site. It does so by iterating over positions in the sight vector over a distance (16 in this case). There's no response in game however. Alternatively, I tested setPositionAndUpdate without flag3, which is the raw function used in attemptTeleport, but this gives wild results, with teleports that don't match the line of sight and often clip under the world. Any help is appreciated. @Override public void performEffect(LivingEntity entityLiving, int amplifier) { Minecraft instance = Minecraft.getInstance(); final Vector3d vLook = entityLiving.getLook(1.0F); int d = 16; for (int i = 1; i <= d; i++) { double bX = vLook.getX() * i; double bY = vLook.getY() * i; double bZ = vLook.getY() * i; BlockPos.Mutable blockpos$mutable = new BlockPos.Mutable(bX, bY, bZ); assert instance.world != null; boolean flag1 = instance.world.getBlockState(blockpos$mutable).getMaterial().blocksMovement(); boolean flag2 = i == d; boolean flag3 = entityLiving.attemptTeleport(bX, bY, bZ, true); if ((flag1 || flag2) && flag3) { //entityLiving.setPositionAndUpdate(bX, bY, bZ); SoundEvent soundevent = SoundEvents.ITEM_CHORUS_FRUIT_TELEPORT; instance.world.playSound(null, entityLiving.prevPosX, entityLiving.prevPosY, entityLiving.prevPosZ, soundevent, SoundCategory.PLAYERS, 1.0F, 1.0F); entityLiving.playSound(soundevent, 1.0F, 1.0F); } } }
  17. I'm not sure if this will hide the effect names like you want, but try: public static final DeferredRegister<Effect> EFFECTS = DeferredRegister.create(ForgeRegistries.POTIONS, Main.MOD_ID); public static RegistryObject<Effect> INVULNERABILITY = EFFECTS.register("invulnerability", InvulnerabilityEffect::new); (Yes, ForgeRegistries.POTIONS). And then, in the InvulnerabilityEffect class: public class InvulnerabilityEffect extends Effect { public InvulnerabilityEffect() { super(EffectType.BENEFICIAL, color); } @Override public void performEffect(LivingEntity entityLivingBaseIn, int amplifier) { entityLivingBaseIn.addPotionEffect(new EffectInstance(Effects.REGENERATION, 432, 1)); entityLivingBaseIn.addPotionEffect(new EffectInstance(Effects.RESISTANCE, 432, 1)); entityLivingBaseIn.addPotionEffect(new EffectInstance(Effects.FIRE_RESISTANCE, 432, 1)); } @Override public void affectEntity(@Nullable Entity source, @Nullable Entity indirectSource, LivingEntity entityLivingBaseIn, int amplifier, double health) { this.performEffect(entityLivingBaseIn, amplifier); } Where color must be replaced with a hex number. Then the item food properties will accept it with: ModEffects.INVULNERABILITY.get() If this doesn't work, you'll probably need to delve in the source code and replicate the 3 effects that way. You're right that heal() is tied to regeneration. Resistance and fire resistance are handled by attackEntityfrom() and applyPotionDamageCalculation() methods, respectively.
  18. Did it work for you?
  19. That's why they usually launch the code in the test environment to show viewers that it works. The Documentation is good for reference, but they "avoid examples in lieu of more thorough explanations" (from the github). This is great from the perspective of someone who already knows the basics and needs to brush up, but it feels disconnected when just starting out. Right now it's only for 1.15 as well (although most of that can apply to 1.16).
  20. I'd have to disagree a little. That's like saying go read a textbook without attending class. The point of tutorials is to teach it in a way that's more streamlined. But if tutorials don't exist for something, then yest it's good to look at the source or another mod. In the link below I go over a custom potion effect. If you have questions after that, ask them here though, not in that post. Invulnerability Effect help
  21. Ohh I gotcha, sorry. In that case, register the effect like a potion in my first reply, and then access it in the food properties like: public static final Food ITEM_NAME = new Food.Builder().hunger(1).saturation(0.8f).effect(new EffectInstance(ModEffects.EFFECT_NAME, 1200, 3), 1.0F).build(); Where ModEffects is the class you registered the effect in. Edit: fixed the line from being cut-off.
  22. It should give you them all at the same time. I tested it myself and it works. Have you done anything else related to effects, like a custom item class, that's affecting it?
  23. When you register it as a potion without a brewing recipe, it's technically just an effect, because there's no way to access it in-game.So normally when you want to register an effect on it's own, you do it as a potion. In that case, we can register items with effects attached. To do so, we add the effects as part of the item's food properties. First the item: public static final DeferredRegister<Item> ITEMS = DeferredRegister.create(ForgeRegistries.ITEMS, Reference.MOD_ID); public static final RegistryObject<Item> ITEM_NAME = ITEMS.register("item_name", () -> new Item(new Item.Properties().food(ModFood.ITEM_NAME).group(ItemGroup.FOOD))); And now we add the food properties in a separate class, ModFood: public static final Food ITEM_NAME = new Food.Builder().hunger(1).saturation(2.0f).effect(new EffectInstance(Effects.RESISTANCE, 1200, 3), 1.0F).effect(new EffectInstance(Effects.REGENERATION, 300, 2), 1.0F).effect(new EffectInstance(Effects.FIRE_RESISTANCE, 300, 1), 1.0F).build(); When modifying the effects, (we'll look at resistance as an example), the first value is the duration, the second is the amplifier (Resistance I, Resistance II, etc.), and the last is the probability it will occur upon eating (a value between 0 and 1).
  24. Ah ok I'll look into the stack, thank you so much!
  25. That makes sense. I asked about 2 handlers at the bottom of the first post lol. Wasn't sure how to use one with the other though.
×
×
  • Create New...

Important Information

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