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

2 little problems porting from ssp to smp.


Jordanske
 Share

Recommended Posts

Hello,

 

I am porting my mod (Cart Mod) to smp and have 2 little problems that i do not know how to solve.

 

1. My items use onItemRightClick() and Minecraft.objectMouseOver to interact with an entity.

What the problem is that the server can't use objectMouseOver ofcourse, and other functions like "useItemOnEntity" i can't interact with the EntityPlayer.

 

 

 

2. In the getGuiElement() I need to return the GUI, and my GUI needs an inventory. how can i access the entity that the player is interacting with from my mod_*?

public Object getGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
	return new GuiChestCart(player.inventory, inventory1 , inventory2);
}

 

 

If need any more information just ask ;)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share



  • Recently Browsing

    No registered users viewing this page.

  • Posts

    • I am trying to spawn Fireball when player right clicks, I was following 1.12.2 tutorial but I am modding for 1.18.1. So I changed up code but it doesn't works This is my code:   package com.vamaka12.magiccraft.objects.tools; import net.minecraft.core.BlockPos; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.projectile.LargeFireball; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.Vec3; public class FireStaff extends Item { public FireStaff(Properties properties) { super(properties); } // @Override Gives error, It was in tutorial public InteractionResult use(BlockState state, Level level, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit) { ItemStack item = player.getItemInHand(hand); Vec3 aim = player.getLookAngle(); LargeFireball fireBall = new LargeFireball(level, player, 1, 1, 1); // gives error "Cannot resolve constructor", I don't know why fireBall.setPos(player.position().x + aim.x * 1.5D, player.position().y + aim.y * 1.5D, player.position().z + aim.z * 1.5D); // fireBall.accelerationX = aim.x * 0.1; fireBall.accelerationY = aim.y * 0.1; fireBall.accelerationZ = aim.z * 0.1; acceleration doesn't exists // level.spawnEntity doesn't exists item.setDamageValue(1); return InteractionResult.SUCCESS; } } Tutorial code: public class FireStaff extends ItemBase { public FireStaff(String name) { super(name); } @Override public ActionResult<ItemStack> onItemRightClick(World worldIn, EntityPlayer playerIn, EnumHand handIn) { ItemStack item = playerIn.getHeldItem(handIn); Vec3d aim = playerIn.getLookVec(); EntityLargeFireBall fireball = new EntityLargeFirball(worldIn, playerIn, 1, 1 , 1); fireball.setPosition(playerIn.posX + aim.x * 1.5D, playerIn.posY + aim.y * 1.5D, playerIn.posZ + aim.z * 1.5D); fireBall.accelerationX = aim.x * 0.1; fireBall.accelerationY = aim.y * 0.1; fireBall.accelerationZ = aim.z * 0.1; worldIn.spawnEntity(fireball); item.damageItem(1, playerIn); return new ActionResult<ItemStack>(EnumActionResult.SUCCESS, item); } } Somebody please help, I spended already 1 day
    • It is impossible to get this error with the latest 1.16.5 MDK.
    • I got the MDK directly from here didn't change a thing: https://files.minecraftforge.net/net/minecraftforge/forge/index_1.16.5.html
    • I got the MDK directly from here didn't change a thing: https://files.minecraftforge.net/net/minecraftforge/forge/index_1.16.5.html
    • Then clearly you have a different issue., Make your own thread and post logs.
  • Topics

  • Who's Online (See full list)

×
×
  • Create New...

Important Information

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