Differentiation
Members-
Posts
606 -
Joined
-
Last visited
-
Days Won
1
Everything posted by Differentiation
-
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 } ] } }
-
Then just set the workspace in the file where you want your mod to be with all the libraries and stuff.
-
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.
-
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
-
Perhaps you're missing the reference libraries
-
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)?
-
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'
-
EntityProjectile disappears when server shutdown/restart
Differentiation replied to poopoodice's topic in Modder Support
That shouldn't happen... show you code maybe? You might be spawning a fake one on the client side. -
[SOLVED] [1.12.2] Making entities spawn with mod items?
Differentiation replied to Differentiation's topic in Modder Support
Thanks Also, do you happen to know in what class MC spawns mobs with armor and what are the chances? -
[SOLVED] [1.12.2] Making entities spawn with mod items?
Differentiation replied to Differentiation's topic in Modder Support
So... EntityJoinWorldEvent is the better way out? -
[SOLVED] [1.12.2] Making entities spawn with mod items?
Differentiation replied to Differentiation's topic in Modder Support
@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? -
[SOLVED] [1.12.2] Making entities spawn with mod items?
Differentiation replied to Differentiation's topic in Modder Support
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... -
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.