Posted October 4, 201410 yr Hiya, I am trying to make a gun, or a musket more. I am currently messign around and I have encountered a strange problem. The bullet does not appear, I have other items that spawns it and even detects it where I shot the gun (as I haven't added movement yet) but it is not visible this is the spawning code I have in the musket, where it does not appear, I DO get the message that a bullet has been fired (and hear the sound) public void onPlayerStoppedUsing(ItemStack stack, World world, EntityPlayer player, int i) { if (!world.isRemote){ if (needReload){ this.reloading=false; int j = this.getMaxItemUseDuration(stack) - i; }else{ double x = player.posX; double y = player.posY+player.eyeHeight; double z = player.posZ; world.playSoundEffect(x, y, z, "random.explode", 3.0F, 1.0F / (0.7F)); ProjectileBullet bullet = new ProjectileBullet(world); bullet.setPosition(player.posX, player.posY, player.posZ); world.spawnEntityInWorld(bullet); System.out.println("bullet at-" + bullet.posX + "," + bullet.posY + "," + bullet.posZ); } System.out.println("stopped-" + this.needReload); this.needReload=!this.needReload; } } This is my "wrench" which I use for various tasks as I need it, it locates the bullet that was recently spawned AND spawns another one, when THIS item spawns a bullet it appears visible. public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) { System.out.println("Item Right Click"); List near = world.getLoadedEntityList(); for (int i = 0; i < near.size(); ++i) { Entity entity = (Entity)near.get(i); if (entity instanceof ProjectileBullet){ System.out.println("There's a bullet!: " + entity.posX + ":"+ entity.posY + ":" + entity.posZ); } } /*if (world.getBlock(x, y, z) instanceof Gases){ System.out.println("Gas Meta: " + world.getBlockMetadata(x, y, z)); System.out.println("X Y Z: " + x + ";" + y + ";" + z); }*/ ProjectileBullet bullet = new ProjectileBullet(world); bullet.setPosition( player.posX, player.posY, player.posZ); world.spawnEntityInWorld(bullet); return stack; } What could be the culprit?
October 4, 201410 yr Do you tell the client anywhere you spawned it, because from what I can see is your only spawning it on the server ans the server isn't responsible for rendering.
October 4, 201410 yr Are you registering a bullet renderer? Check out my mod, Realms of Chaos, here. If I helped you, be sure to press the "Thank You" button!
October 5, 201410 yr Author Client side was the issue, thanks. I really gotta learn how those things work.
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.