Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

GrigLog

Members
  • Joined

  • Last visited

Everything posted by GrigLog

  1. I have to 1) change player's capability, 2) stop player from using an item. I do both things in a packet handle method, but it... takes too much space, and it would be better if the code was shared between both sides. Btw, do you know a way to do the second thing? Ive tried a player.stopActiveHand(), but it has a problem - if I hold the right button, item is used immediately after being stopped. (To be more specific, I want to add a special type of shield which you have to raise after each blocked attack, so that player cant just hold it. And with this method used its always up and player dont have to right-click.)
  2. Well, actually it doesnt help much, because there are some other things that I have to do there... At this moment Ive managed to sync client and server with packets, but its very clumsy and there should be a better way. I just need to fire the event on client too and execute the same code there, there must be a way
  3. Found a solution. Just pass a player as null and the sound gets played for everyone.
  4. What I want: under certain circumstances a player is considered immune to mobs' attacks. When he is supposed to get hit, he avoids it and a special sound is played. Ive subscribed to a LivingAttackEvent and made all the checks (for immunity), now I need to cancel the event and play the sound, something like this: SoundEvent sound = new SoundEvent(new ResourceLocation("soul", "sword_clash")); player.world.playSound(player, player.getPosition(), sound, SoundCategory.PLAYERS, 1, 1); event.setCanceled(true); But here is a problem. The event is first fired at server side, and if it gets canceled there, its not called on client. And the sound can only be called on client. How can I do both the cancel and the sound? Do I have to use packets or there is an easier way?
  5. First of all, I am unable to subscribe to AttachCapabilitiesEvent. In theory, it should be as simple as follows: @Mod.EventBusSubscriber public class CapabilityEvents { @SubscribeEvent public void playerCapability(final AttachCapabilitiesEvent<Entity> event){ Soul.LOGGER.info("attach capabilities"); if (event.getObject() instanceof PlayerEntity) { event.addCapability(new ResourceLocation("soul", "soul"), new SoulProvider()); } } } , but it does not get called. Secondly, I cant really understand what CapabilityProvider is, where it is used and what I should return in method implementation. From different sources in the internet Ive made the following class: public class SoulProvider implements ICapabilityProvider { @CapabilityInject(ISoul.class) public static Capability<ISoul> SOUL_CAP = null; private LazyOptional<ISoul> instance = LazyOptional.of(() -> new DefaultSoul()); @Nonnull @Override public <T> LazyOptional<T> getCapability(@Nonnull Capability<T> cap, @Nullable Direction side) { return cap == SOUL_CAP ? instance.cast() : LazyOptional.empty(); } @Nonnull @Override public <T> LazyOptional<T> getCapability(@Nonnull Capability<T> cap) { return cap == SOUL_CAP ? instance.cast() : LazyOptional.empty(); } } , but it looks like a total nonsense. Forge documentation is a cruel joke and doesnt contain any useful info/examples...
  6. Hi. How can I get the location of the current "mods" directory at the stage of coremods construction (before pre-initialization)? Tried new File(System.getProperty("user.dir") + "\\mods") but it only works for Windows users (mac os and linux filesystems are kinda scattered)...
  7. Nvm, using vpn can help sometimes (50/50)
  8. Hi, Im importing mods from git, and trying to build them, but it never succeds and I have to resolve all the dependencies manually (which is a pain). As gradle's logs says, the problem is that https://minecraft.curseforge.com/api/maven always returns 503 code... For example, importing Botania produces a lot of errors like this: Caused by: org.gradle.internal.resource.transport.http.HttpErrorStatusCodeException: Could not HEAD 'https://minecraft.curseforge.com/api/maven/top/theillusivec4/curios/curios/FORGE-1.16.1-3.0/curios-FORGE-1.16.1-3.0.pom'. Received status code 503 from server: Service Temporarily Unavailable (full log in attached file if youre interested) And its not a single event, this repo is never available for me, no matter what I do... May the server really be turned off/closed, or am I missing something? buildLog.txt

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.