Everything posted by GrigLog
-
Event is not called on client after being canceled on server
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.)
-
Event is not called on client after being canceled on server
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
-
Event is not called on client after being canceled on server
Found a solution. Just pass a player as null and the sound gets played for everyone.
-
Event is not called on client after being canceled on server
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?
-
Problems with Capabilities
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...
-
Get mod folder
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)...
-
503 from curseforge maven
Nvm, using vpn can help sometimes (50/50)
-
503 from curseforge maven
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
IPS spam blocked by CleanTalk.