Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

urbanxx001

Members
  • Posts

    181
  • Joined

  • Last visited

Everything posted by urbanxx001

  1. Yes but it needs to happen when the item, which is armor, is equiped, i.e. it's not in the hotbar.
  2. This post helped me when I was also tackling ItemModelProperties. You want to create a method in your item class that designates each itemstack change with a float, and register it with: DeferredWorkQueue.runLater(() -> { ItemModelsProperties.func_239418_a_( ModItems.YOUR_ITEM, new ResourceLocation(MOD_ID, "your_item"), (stack, world, entity) -> YourItemClass.yourMethod(stack)); }); And then specify the texture overrides in your item model json. Also you can find vanilla classes in External Libraries => Gradle net.minecraftforge:forge:[version]
  3. I have a RightClickEmpty event that needs to pass the server player into a method from an item class. However, event.getPlayer() only returns the client player. I heard that it should be done with packet handlers then, is that right? Alternatively, I could achieve the same thing with the onArmorTick method in the item class. But for that I would need to detect right clicking, which doesn't seem possible without an event.
  4. In terms of that, usually older versions will have more documentation (with the number of archived forum posts), but newer versions are easier to work with, such as with the new Deferred Registry system. That's probably obvious, but it's worth mentioning.
  5. A new latest.log isn't generated in run/logs, if you're referring to the separate file from the console log. Or I misunderstand. Edit: Everything is resolved after adding the cursemaven plugin: plugins { id "com.wynprice.cursemaven" version "2.1.1" } Thank you anyway though!
  6. 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
  7. 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.
  8. 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
  9. 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.
  10. 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.
  11. 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.
  12. 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.
  13. 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); } }
  14. 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
  15. If you want to do it that way, you'll need AT or reflection to access it
  16. 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?
  17. 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.
  18. 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.
  19. 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.
  20. 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); } } }
  21. 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.
  22. 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).
×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.