Differentiation
Members-
Posts
606 -
Joined
-
Last visited
-
Days Won
1
Everything posted by Differentiation
-
Ahh, I see. I never knew that there could be a client mod and a server mod and common (both) mod. Now I know the differences. Thanks! And I have another question: What is client thread's role in LivingAttackEvent. Shouldn't it be a server event only?
-
The first paragraph sounds like something no-one will like to do. Instead, I think it is best for OP to allow a server-side mod. Server-side is useful for SO many things, I don't understand why you would not like to have it, ESPECIALLY when you use LivingAttackEvent... one should 100% know that that has to have server-side running >.> This is just my opinion. And I have another question: What is client thread's role in LivingAttackEvent. Shouldn't it be a server event only?
-
Hello! I was wondering, if I call a method in a server-side method where only the server thread runs, will the contents in the method be run by the server and not the client? For example: public void onCommand(EntityPlayer playerIn) { World worldIn = playerIn.worldObj; worldIn.playSound(null, playerIn.getPosition(), SoundEvents.BLOCK_CLOTH_BREAK, SoundCategory.PLAYERS, 1.0F, 1.0F); Random rand = worldIn.rand; worldIn.spawnParticle(EnumParticleTypes.CLOUD, playerIn.posX + (double)(rand.nextFloat() * playerIn.width * 2.5F) - (double)playerIn.width, playerIn.posY + 0.5D + (double)(rand.nextFloat() * playerIn.height) - 1.25D, playerIn.posZ + (double)(rand.nextFloat() * playerIn.width * 2.5F) - (double)playerIn.width, rand.nextGaussian() * 0.025D, rand.nextGaussian() * 0.025D, rand.nextGaussian() * 0.025D, 1 ); DinocraftPlayer player = DinocraftPlayer.getEntityPlayer(playerIn); if (player != null) { player.setMaxHealth(playerIn.getMaxHealth() + 1.0F); } } @Override public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException { EntityPlayer playerIn = getCommandSenderAsPlayer(sender); this.onCommand(playerIn); // when I call this method, will the contents inside the method run on the server-thread, client-thread, or common (client and server-side)? } This is just a quick example. Any help will be welcome. Thanks!
-
You need to make a custom player capability, and then set it to false onItemRightClick(); to check for the very first time a player right clicks with this weapon. I have a custom player capability class and this is how I would do it: @Override public ActionResult<ItemStack> onItemRightClick(ItemStack stack, World worldIn, EntityPlayer playerIn, EnumHand hand) { DinocraftPlayer player = DinocraftPlayer.getEntityPlayer(playerIn); DinocraftPlayerActions actions = player.getActions(); if (actions.isFirstTimeWeapon2 /* or whatever name */) { actions.setIsFirstTimeWeapon2(false); /* do things */ // will never fire again until player respawns } }
-
Remove possibility to place string (tripwire)
Differentiation replied to Newww's topic in Modder Support
That's not how you get the item being used. The event provides it for you if you are using a proper Minecraft version (aka 1.9 +) ItemStack stack = event.item; or something along these lines. -
Remove possibility to place string (tripwire)
Differentiation replied to Newww's topic in Modder Support
It's not supposed to, just don't use static in this case... -
Remove possibility to place string (tripwire)
Differentiation replied to Newww's topic in Modder Support
Don't use static, you don't have to have that modifier. -
Remove possibility to place string (tripwire)
Differentiation replied to Newww's topic in Modder Support
Please PROPERLY set up the mod and proxies, etc. before doing anything else... -
Remove possibility to place string (tripwire)
Differentiation replied to Newww's topic in Modder Support
******* @SubscribeEvent public void onPlayerUseItem(PlayerUseItemEvent event) { ... } Properly SUBSCRIBE to the event, THEN do things when it is fired. -
My mod is client-side only??? Minecraft provides you with both sides. I don't understand what is the problem...
-
how to properly change the world from a client event?
Differentiation replied to JoeStrout's topic in Modder Support
What is in this method? Please show the contents. Thanks! -
I can't help, the only suggestion I will give is to update to a newer version such as 1.10.2.
-
I don't mod on 1.12, so I can't help you any further. This should be pretty simple to figure out...
-
EntityPlayer playerIn = (EntityPlayer) event.entity; World worldIn = playerIn.world; worldIn.playSound(playerIn, playerIn.getPosition(), /* here you have to put a SoundEvent instance, NOT a String */, SoundCategory.PLAYERS, 5.0F, 1.0F);
-
Hi, no problem. EntityPlayer is the simplest to get, silly Answer: EntityPlayer playerIn = (EntityPlayer) event.entity;
-
You're confused between sides. Please read about sides and then try to understand what each thread is responsible for. You don't need to have anything with the client-side in LivingAttackEvent...
-
@SubscribeEvent public void onAttack(LivingAttackEvent event) { if (event.getEntity() instanceof EntityPlayer) { Entity attackerIn = event.getSource().getSourceOfDamage(); // this is your attacker instance, the entity attacking the target EntityPlayer targetIn = (EntityPlayer) event.getEntity(); // this is your target instance, the entity being attacked by the attacker /* * Here, you do whatever you want with your attacker and target. * You can make the target set on flame, add potion effects, etc. * Make sure you properly handle sides */ } } It's as simple as that, can't get any simpler, my friend, if you want lines to fire on the client, then send packets.
-
I'm not quite understanding what you're trying to ask. LivingAttackEvent will fire when you're in a Singleplayer world by yourself and Multiplayer server.
-
What do you mean? You would have to send packets to the EntityPlayerMP's client. Simple
-
If you do: @Override public void onAttack(LivingAttackEvent event) { if (event.getEntity().worldObj.isRemote) { ... } } nothing will happen...
-
It won't fire. This event is fired by the server-side.
-
The LivingAttackEvent is fired by the server. If the mod is not present in the server, this event will not fire.
-
OH! I see. If the server does not have the mod installed, nothing will work on the clients. The event in this case will NOT be fired.
-
Well what do you mean "server - no mod?"
-
"The LivingAttackEvent is a Forge event that fires whenever an EntityLivingBase attacks another EntityLivingBase"