Jump to content

Differentiation

Members
  • Posts

    606
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by Differentiation

  1. bounce.ogg I guess this is one of the sound files.. I don't really understand which files you're talking about
  2. Sounds are .ogg files. DinocraftSoundEvents.java public class DinocraftSoundEvents { public static final SoundEvent GRAB; public static final SoundEvent CHARM; public static final SoundEvent HARP; public static final SoundEvent CRUNCH; public static final SoundEvent SHOT; public static final SoundEvent GUN_SHOT; public static final SoundEvent SHOTGUN_SHOT; public static final SoundEvent RAY_GUN_SHOT; public static final SoundEvent SEED_SHOT; public static final SoundEvent HIT; public static final SoundEvent CRACK; public static final SoundEvent BOUNCE; static { GRAB = new SoundEvent(new ResourceLocation(Reference.MODID, "grab")).setRegistryName("grab"); CHARM = new SoundEvent(new ResourceLocation(Reference.MODID, "charm")).setRegistryName("charm"); HARP = new SoundEvent(new ResourceLocation(Reference.MODID, "harp")).setRegistryName("harp"); CRUNCH = new SoundEvent(new ResourceLocation(Reference.MODID, "crunch")).setRegistryName("crunch"); SHOT = new SoundEvent(new ResourceLocation(Reference.MODID, "shot")).setRegistryName("shot"); GUN_SHOT = new SoundEvent(new ResourceLocation(Reference.MODID, "gun_shot")).setRegistryName("gun_shot"); SHOTGUN_SHOT = new SoundEvent(new ResourceLocation(Reference.MODID, "shotgun_shot")).setRegistryName("shotgun_shot"); RAY_GUN_SHOT = new SoundEvent(new ResourceLocation(Reference.MODID, "ray_gun_shot")).setRegistryName("ray_gun_shot"); SEED_SHOT = new SoundEvent(new ResourceLocation(Reference.MODID, "seed_shot")).setRegistryName("seed_shot"); HIT = new SoundEvent(new ResourceLocation(Reference.MODID, "hit")).setRegistryName("hit"); CRACK = new SoundEvent(new ResourceLocation(Reference.MODID, "crack")).setRegistryName("crack"); BOUNCE = new SoundEvent(new ResourceLocation(Reference.MODID, "bounce")).setRegistryName("bounce"); } @EventBusSubscriber public static class RegistrationHandler { @SubscribeEvent public static void register(Register<SoundEvent> event) { event.getRegistry().registerAll(GRAB, CHARM, HARP, CRUNCH, SHOT, GUN_SHOT, SHOTGUN_SHOT, RAY_GUN_SHOT, SEED_SHOT, HIT, CRACK, BOUNCE); Utils.getLogger().info("Registered all sounds"); } } } sounds.json { "grab": { "category": "entity", "subtitle": "item.grab", "sounds": [ { "name": "dinocraft:grab", "stream": true } ] }, "charm": { "category": "random", "subtitle": "charm", "sounds": [ { "name": "dinocraft:charm", "stream": true } ] }, "harp": { "category": "random", "subtitle": "harp", "sounds": [ { "name": "dinocraft:harp", "stream": true } ] }, "crunch": { "category": "random", "subtitle": "crunch", "sounds": [ { "name": "dinocraft:crunch", "stream": true } ] }, "shot": { "category": "random", "subtitle": "shot", "sounds": [ { "name": "dinocraft:shot", "stream": true } ] }, "shotgun_shot": { "category": "random", "subtitle": "shotgun_shot", "sounds": [ { "name": "dinocraft:shotgun_shot", "stream": true } ] }, "ray_gun_shot": { "category": "random", "subtitle": "ray_gun_shot", "sounds": [ { "name": "dinocraft:ray_gun_shot", "stream": true } ] }, "gun_shot": { "category": "random", "subtitle": "gun_shot", "sounds": [ { "name": "dinocraft:gun_shot", "stream": true } ] }, "hit": { "category": "random", "subtitle": "hit", "sounds": [ { "name": "dinocraft:hit", "stream": true } ] }, "crack": { "category": "random", "subtitle": "crack", "sounds": [ { "name": "dinocraft:crack", "stream": true } ] }, "bounce": { "category": "random", "subtitle": "bounce", "sounds": [ { "name": "dinocraft:bounce", "stream": true } ] }, "seed_shot": { "category": "random", "subtitle": "seed_shot", "sounds": [ { "name": "dinocraft:seed_shot", "stream": true } ] } }
  3. Just tried with BLOCK_ENDERCHEST_CLOSE (Minecraft) and BOUNCE (Modded) and RAY_GUN_SHOT (Modded). The modded ones give errors; Minecraft doesn't. Must be something with my mod then ;/ I have no idea what it is though. Maybe it has to do with the fact that the sounds are streamed?
  4. It only happens if the sound is played too frequently. Apparently, if the method fires every 4 ticks the errors don't occur, but 3 and below the errors start occurring frequently. This never happened before for any sound.
  5. Then just set the workspace in the file where you want your mod to be with all the libraries and stuff.
  6. All of the Forge API. Did you install Forge MDK? Go to Forge website and download the latest version of forge for whichever MC version you're using and download its MDK.
  7. if (!world.isRemote) { EntityRayBullet ball = new EntityRayBullet(player, 0.001F); Vec3d vector = player.getLookVec(); double x = vector.x; double y = vector.y; double z = vector.z; ball.shoot(player, player.rotationPitch, player.rotationYaw, 0.0F, 3.33F, 0.5F); ball.setRotationYawHead(player.rotationYawHead); ball.setPositionAndUpdate(player.posX - (x * 0.75D), player.posY + player.eyeHeight, player.posZ - (z * 0.75D)); world.spawnEntity(ball); //if (entityliving.ticksExisted % 3 == 0) ///{ world.playSound(null, player.getPosition(), DinocraftSoundEvents.RAY_GUN_SHOT, SoundCategory.NEUTRAL, 3.0F, world.rand.nextFloat() + 0.5F); // } } in onUsingTick method
  8. Perhaps you're missing the reference libraries
  9. Okay, now the server gets notified. However, the only thing that's bothering me is this error I get when using the item continuously. [14:24:19] [Thread-6/ERROR] [minecraft/SoundManager]: Error in class 'ChannelLWJGL OpenAL' [14:24:19] [Thread-6/ERROR] [minecraft/SoundManager]: Invalid enumerated parameter value. [14:24:19] [Thread-6/ERROR] [minecraft/SoundManager]: Error in class 'ChannelLWJGL OpenAL' [14:24:19] [Thread-6/ERROR] [minecraft/SoundManager]: Error creating buffers in method 'preLoadBuffers' It doesn't, however, affect my game or anything... Is there a reason why this is happening? Maybe it's the fact that I'm playing a sound every 2 ticks (too frequently)?
  10. EntityPlayer::sendMessage will send a message to the player. To send a message from the player you'd have to concatenate a bunch of Strings (including the player's username and the message), and sending it to all players in PlayerList.
  11. It's basic Java. You don't have to make a reference variable, meaning you basically wrote the same thing as the OP.
  12. I don't believe that Item::damageItem() changes my ItemStack... doesn't it just... damage the current ItenStack?
  13. ? This is so wrong. You don't need the instance if you're only gonna use it once...
  14. Okay so this is what I have. public class ItemRayGun extends Item { public ItemRayGun(String name) { this.setUnlocalizedName(name); this.setMaxStackSize(1); this.setMaxDamage(1000); this.setRegistryName(new ResourceLocation(Reference.MODID, name)); } @Override public int getMaxItemUseDuration(ItemStack stack) { return 72000; } @Override public EnumAction getItemUseAction(ItemStack stack) { return EnumAction.BOW; } @Override public void onUsingTick(ItemStack stack, EntityLivingBase entityliving, int count) { if (entityliving.ticksExisted % 2 == 0) { EntityPlayer player = (EntityPlayer) entityliving; World world = player.world; DinocraftEntity dinoEntity = DinocraftEntity.getEntity(player); DinocraftServer.getSide(world); if (player.isCreative() || dinoEntity.hasAmmo(DinocraftItems.RAY_BULLET)) { if (!player.isCreative()) { dinoEntity.consumeAmmo(DinocraftItems.RAY_BULLET, 1); stack.damageItem(1, player); } if (!world.isRemote) { EntityRayBullet ball = new EntityRayBullet(player, 0.001F); Vec3d vector = player.getLookVec(); double x = vector.x; double y = vector.y; double z = vector.z; ball.shoot(player, player.rotationPitch, player.rotationYaw, 0.0F, 3.33F, 0.0F); ball.setRotationYawHead(player.rotationYawHead); ball.setPositionAndUpdate(player.posX - (x * 0.75D), player.posY + player.eyeHeight, player.posZ - (z * 0.75D)); world.spawnEntity(ball); world.playSound(null, player.getPosition(), DinocraftSoundEvents.RAY_GUN_SHOT, SoundCategory.NEUTRAL, 3.0F, world.rand.nextFloat() + 0.5F); } DinocraftEntity.getEntity(player).recoil(0.1F, 1.25F, true); } else if (!world.isRemote) { dinoEntity.sendActionbarMessage(TextFormatting.RED + "Out of ammo!"); world.playSound(null, player.getPosition(), SoundEvents.BLOCK_DISPENSER_DISPENSE, SoundCategory.NEUTRAL, 0.5F, 5.0F); } super.onUsingTick(stack, player, count); } } @Override public ActionResult<ItemStack> onItemRightClick(World worldIn, EntityPlayer playerIn, EnumHand handIn) { playerIn.setActiveHand(EnumHand.MAIN_HAND); return super.onItemRightClick(worldIn, playerIn, handIn); } } All goes well, but when I stop right-clicking, sometimes, the server thread doesn't get notified and it keeps running onUsingTick even though I'm not right clicking. The client side doesn't have this bug. Also, when this fires, I get the following errors continuously. Not sure what they mean. [22:01:36] [Thread-6/ERROR] [minecraft/SoundManager]: Error in class 'ChannelLWJGL OpenAL' [22:01:36] [Thread-6/ERROR] [minecraft/SoundManager]: Invalid enumerated parameter value. [22:01:36] [Thread-6/ERROR] [minecraft/SoundManager]: Error in class 'ChannelLWJGL OpenAL' [22:01:36] [Thread-6/ERROR] [minecraft/SoundManager]: Error creating buffers in method 'preLoadBuffers'
  15. Do "<" + EntityPlayer::getName() + ">" + TextFormatting.RED + "text". I don't think there's any way to send a message from the player.
  16. That shouldn't happen... show you code maybe? You might be spawning a fake one on the client side.
  17. Thanks Also, do you happen to know in what class MC spawns mobs with armor and what are the chances?
  18. @SubscribeEvent public static void onLivingSpawn(LivingSpawnEvent event) { EntityLivingBase entityliving = event.getEntityLiving(); Random rand = entityliving.world.rand; EnumDifficulty difficulty = entityliving.world.getDifficulty(); if (entityliving instanceof EntityZombie) { int i = rand.nextInt(difficulty == difficulty.EASY ? 20000 : difficulty == difficulty.NORMAL ? 15000 : 10000); int j = rand.nextInt(difficulty == difficulty.EASY ? 20000 : difficulty == difficulty.NORMAL ? 15000 : 10000); if (i < 1 && entityliving.getHeldItemMainhand().isEmpty()) { entityliving.setHeldItem(EnumHand.MAIN_HAND, new ItemStack(DinocraftItems.LEAFERANG)); } } } For some reason I see a zombie spawning with this item once in 3-ish nights. What is the chance that they spawn with Iron or Diamond swords and stuff?
  19. I tried to do this with LivingSpawnEvent and having zombies spawn with a certain item only 1/10000 chance but it's still very frequent...
  20. Hey, I was wondering if there's any way to make any entity spawn holding/wearing an item from my mod. any help appreciated. Thanks
  21. I tried running the code in onPlayerStoppedUsing and it's just a mess (fires sometimes on server thread, sometimes on client, idek anymore) it's very buggy and doesn't abide by getMaxItemUseDuration for shit. Anyways, I give up because it's way to hard to understand how the methods work together and I'm not stressing myself over something that's not even that important.
×
×
  • Create New...

Important Information

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