net.minecraft.init.SoundEvents Java Examples
The following examples show how to use
net.minecraft.init.SoundEvents.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ItemTofuSlimeRadar.java From TofuCraftReload with MIT License | 7 votes |
@Override public ActionResult<ItemStack> onItemRightClick(World worldIn, EntityPlayer playerIn, EnumHand handIn) { boolean flag = playerIn.capabilities.isCreativeMode; if (flag || playerIn.getHeldItem(handIn).getItemDamage() <= playerIn.getHeldItem(handIn).getMaxDamage()) { if (!worldIn.isRemote) { boolean isSpawnChunk = playerIn.dimension == TofuMain.TOFU_DIMENSION.getId() || EntityTofuSlime.isSpawnChunk(playerIn.world, playerIn.posX, playerIn.posZ); if(isSpawnChunk) playerIn.sendMessage(new TextComponentTranslation("tofucraft.radar.result.success", new Object())); else playerIn.sendMessage(new TextComponentTranslation("tofucraft.radar.result.failed", new Object())); } if (!playerIn.capabilities.isCreativeMode && playerIn.getHeldItem(handIn).isItemStackDamageable()) { playerIn.getHeldItem(handIn).damageItem(1, playerIn); } playerIn.playSound(SoundEvents.UI_BUTTON_CLICK, 0.5F, 1.0F); } return super.onItemRightClick(worldIn, playerIn, handIn); }
Example #2
Source File: BlockSoulGlass.java From CommunityMod with GNU Lesser General Public License v2.1 | 6 votes |
public void neighborChanged(IBlockState state, World worldIn, BlockPos pos, Block blockIn, BlockPos fromPos) { boolean powered = worldIn.isBlockPowered(pos) || worldIn.isBlockPowered(pos.up()); if (powered) { if(!state.getValue(POWERED)) { worldIn.scheduleUpdate(pos, this, this.tickRate(worldIn)); worldIn.setBlockState(pos, state.withProperty(POWERED, true)); worldIn.playSound(null, pos, SoundEvents.BLOCK_GLASS_BREAK, SoundCategory.BLOCKS, 1F, 0.25F + worldIn.rand.nextFloat()); } } else { if(state.getValue(POWERED)) { worldIn.scheduleUpdate(pos, this, this.tickRate(worldIn)); worldIn.setBlockState(pos, state.withProperty(POWERED, false)); worldIn.playSound(null, pos, SoundEvents.BLOCK_NOTE_BASEDRUM, SoundCategory.BLOCKS, 1F, 0.25F + worldIn.rand.nextFloat()); } } }
Example #3
Source File: EntityMage.java From ToroQuest with GNU General Public License v3.0 | 6 votes |
protected void handleDrinkingPotionUpdate() { if (this.attackTimer-- <= 0) { this.world.playSound((EntityPlayer) null, this.posX, this.posY, this.posZ, SoundEvents.ENTITY_WITCH_DRINK, this.getSoundCategory(), 1.0F, 0.8F + this.rand.nextFloat() * 0.4F); this.setAggressive(false); ItemStack itemstack = this.getHeldItemOffhand(); this.setItemStackToSlot(EntityEquipmentSlot.OFFHAND, ItemStack.EMPTY); if (itemstack != null && itemstack.getItem() == Items.POTIONITEM) { List<PotionEffect> list = PotionUtils.getEffectsFromStack(itemstack); if (list != null) { for (PotionEffect potioneffect : list) { this.addPotionEffect(new PotionEffect(potioneffect)); } } } this.getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED).removeModifier(MODIFIER); } }
Example #4
Source File: TileEntityMSU.java From enderutilities with GNU Lesser General Public License v3.0 | 6 votes |
@Override public boolean onRightClickBlock(EntityPlayer player, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) { ItemStack stack = player.getHeldItem(hand); if (stack.isEmpty() == false && ItemEnderPart.itemMatches(stack, ItemPartType.CREATIVE_STORAGE_KEY)) { this.setCreative(! this.isCreative()); this.markDirty(); this.notifyBlockUpdate(this.getPos()); this.getWorld().playSound(null, this.getPos(), SoundEvents.ENTITY_ITEMFRAME_REMOVE_ITEM, SoundCategory.BLOCKS, 0.7f, 1f); return true; } return super.onRightClickBlock(player, hand, side, hitX, hitY, hitZ); }
Example #5
Source File: Materials.java From BaseMetals with GNU Lesser General Public License v2.1 | 6 votes |
protected static void registerMaterial(String name, MetalMaterial m){ allMaterials.put(name, m); String enumName = m.getEnumName(); String texName = m.getName(); int[] protection = m.getDamageReductionArray(); int durability = m.getArmorMaxDamageFactor(); ArmorMaterial am = EnumHelper.addArmorMaterial(enumName, texName, durability, protection, m.getEnchantability(), SoundEvents.ITEM_ARMOR_EQUIP_IRON, (m.hardness > 10 ? (int)(m.hardness / 5) : 0)); if(am == null){ // uh-oh FMLLog.severe("Failed to create armor material enum for "+m); } armorMaterialMap.put(m, am); FMLLog.info("Created armor material enum "+am); ToolMaterial tm = EnumHelper.addToolMaterial(enumName, m.getToolHarvestLevel(), m.getToolDurability(), m.getToolEfficiency(), m.getBaseAttackDamage(), m.getEnchantability()); if(tm == null){ // uh-oh FMLLog.severe("Failed to create tool material enum for "+m); } toolMaterialMap.put(m, tm); FMLLog.info("Created tool material enum "+tm); }
Example #6
Source File: ItemPetContract.java From enderutilities with GNU Lesser General Public License v3.0 | 6 votes |
private void signContract(ItemStack stack, EntityPlayer oldOwner, EntityLivingBase target) { NBTTagCompound nbt = NBTUtils.getCompoundTag(stack, null, true); UUID uuidOwner = oldOwner.getUniqueID(); nbt.setLong("OwnerM", uuidOwner.getMostSignificantBits()); nbt.setLong("OwnerL", uuidOwner.getLeastSignificantBits()); UUID uuidTarget = target.getUniqueID(); nbt.setLong("OwnableM", uuidTarget.getMostSignificantBits()); nbt.setLong("OwnableL", uuidTarget.getLeastSignificantBits()); nbt.setFloat("Health", target.getHealth()); String str = EntityList.getEntityString(target); if (str != null) { nbt.setString("EntityString", str); } if (target.hasCustomName()) { nbt.setString("CustomName", target.getCustomNameTag()); } oldOwner.getEntityWorld().playSound(null, oldOwner.getPosition(), SoundEvents.BLOCK_ENCHANTMENT_TABLE_USE, SoundCategory.PLAYERS, 0.5f, 1f); }
Example #7
Source File: GTTileCharcoalPit.java From GT-Classic with GNU Lesser General Public License v3.0 | 6 votes |
@SideOnly(Side.CLIENT) @Override public void randomTickDisplay(IBlockState stateIn, World worldIn, BlockPos pos, Random rand) { if (this.isActive) { if (rand.nextInt(16) == 0) { worldIn.playSound((double) ((float) pos.getX() + 0.5F), (double) ((float) pos.getY() + 0.5F), (double) ((float) pos.getZ() + 0.5F), SoundEvents.BLOCK_FIRE_AMBIENT, SoundCategory.BLOCKS, 1.0F + rand.nextFloat(), rand.nextFloat() * 0.7F + 0.3F, false); } for (int i = 0; i < 3; ++i) { double d0 = (double) pos.getX() + rand.nextDouble(); double d1 = (double) pos.getY() + rand.nextDouble() * 0.5D + 0.5D; double d2 = (double) pos.getZ() + rand.nextDouble(); worldIn.spawnParticle(EnumParticleTypes.SMOKE_LARGE, d0, d1, d2, 0.0D, 0.0D, 0.0D); } } }
Example #8
Source File: BlockConfusingCharge.java From EnderZoo with Creative Commons Zero v1.0 Universal | 6 votes |
public void explode(World world, BlockPos pos, IBlockState state, EntityLivingBase igniter) { if (!world.isRemote) { if (((Boolean) state.getValue(EXPLODE)).booleanValue()) { // EntityTNTPrimed entitytntprimed = new EntityTNTPrimed(worldIn, // (double)((float)pos.getX() + 0.5F), (double)((float)pos.getY() + // 0.5F), (double)((float)pos.getZ() + 0.5F), igniter); // worldIn.spawnEntityInWorld(entitytntprimed); // worldIn.playSoundAtEntity(entitytntprimed, "game.tnt.primed", 1.0F, // 1.0F); EntityPrimedCharge entity = new EntityPrimedCharge(this, world, pos.getX() + 0.5F, pos.getY() + 0.5F, pos.getZ() + 0.5F, igniter); world.spawnEntity(entity); world.playSound((EntityPlayer)null, entity.posX, entity.posY, entity.posZ, SoundEvents.ENTITY_TNT_PRIMED, SoundCategory.BLOCKS, 1, 1); world.updateEntity(entity); } } }
Example #9
Source File: BlockEnderFurnace.java From enderutilities with GNU Lesser General Public License v3.0 | 6 votes |
@Override public void randomDisplayTick(IBlockState state, World world, BlockPos pos, Random rand) { TileEntityEnderFurnace te = getTileEntitySafely(world, pos, TileEntityEnderFurnace.class); if (te != null && te.isBurningLast) { Effects.spawnParticlesAround(world, EnumParticleTypes.PORTAL, pos, 2, rand); if (rand.nextDouble() < 0.1D) { world.playSound((double)pos.getX() + 0.5D, (double)pos.getY(), (double)pos.getZ() + 0.5D, SoundEvents.BLOCK_FURNACE_FIRE_CRACKLE, SoundCategory.BLOCKS, 1.0F, 1.0F, false); } } }
Example #10
Source File: EntityEnderArrow.java From enderutilities with GNU Lesser General Public License v3.0 | 6 votes |
/** * Called by a player entity when they collide with an entity */ public void onCollideWithPlayer(EntityPlayer par1EntityPlayer) { if (this.getEntityWorld().isRemote == false && this.isDead == false && this.inGround && this.arrowShake <= 0 && this.canBePickedUp != 0) { // Normal pick up to inventory if (this.canBePickedUp == 1) { if (par1EntityPlayer.inventory.addItemStackToInventory(this.getArrowStack())) { this.playSound(SoundEvents.ENTITY_ITEM_PICKUP, 0.2F, ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.7F + 1.0F) * 2.0F); par1EntityPlayer.onItemPickup(this, 1); this.setDead(); } } // Creative mode fake pick up (no actual items given) else if (this.canBePickedUp == 2) { this.playSound(SoundEvents.ENTITY_ITEM_PICKUP, 0.2F, ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.7F + 1.0F) * 2.0F); this.setDead(); } } }
Example #11
Source File: DrinkSoymilkRamune.java From TofuCraftReload with MIT License | 6 votes |
public ItemStack onItemUseFinish(ItemStack stack, World worldIn, EntityLivingBase entityLiving) { if (entityLiving instanceof EntityPlayer) { EntityPlayer entityplayer = (EntityPlayer)entityLiving; entityplayer.getFoodStats().addStats(this, stack); worldIn.playSound((EntityPlayer)null, entityplayer.posX, entityplayer.posY, entityplayer.posZ, SoundEvents.ENTITY_PLAYER_BURP, SoundCategory.PLAYERS, 0.5F, worldIn.rand.nextFloat() * 0.1F + 0.9F); this.onFoodEaten(stack, worldIn, entityplayer); entityplayer.addStat(StatList.getObjectUseStats(this)); if (entityplayer instanceof EntityPlayerMP) { CriteriaTriggers.CONSUME_ITEM.trigger((EntityPlayerMP)entityplayer, stack); } } return new ItemStack(Items.GLASS_BOTTLE); }
Example #12
Source File: EntityMage.java From ToroQuest with GNU General Public License v3.0 | 6 votes |
protected void attackWithPotion(EntityLivingBase target) { double targetY = target.posY + (double) target.getEyeHeight() - 1.100000023841858D; double targetX = target.posX + target.motionX - this.posX; double d2 = targetY - this.posY; double targetZ = target.posZ + target.motionZ - this.posZ; float f = MathHelper.sqrt(targetX * targetX + targetZ * targetZ); PotionType potiontype = PotionTypes.HARMING; if (f >= 8.0F && !target.isPotionActive(MobEffects.SLOWNESS)) { potiontype = PotionTypes.SLOWNESS; } else if (target.getHealth() >= 8.0F && !target.isPotionActive(MobEffects.POISON)) { potiontype = PotionTypes.POISON; } else if (f <= 3.0F && !target.isPotionActive(MobEffects.WEAKNESS) && this.rand.nextFloat() < 0.25F) { potiontype = PotionTypes.WEAKNESS; } EntityPotion entitypotion = new EntityPotion(this.world, this, PotionUtils.addPotionToItemStack(new ItemStack(Items.SPLASH_POTION), potiontype)); entitypotion.rotationPitch -= -20.0F; entitypotion.shoot(targetX, d2 + (double) (f * 0.2F), targetZ, 0.75F, 8.0F); this.world.playSound((EntityPlayer) null, this.posX, this.posY, this.posZ, SoundEvents.ENTITY_WITCH_THROW, this.getSoundCategory(), 1.0F, 0.8F + this.rand.nextFloat() * 0.4F); this.world.spawnEntity(entitypotion); }
Example #13
Source File: GTTileMagicEnergyAbsorber.java From GT-Classic with GNU Lesser General Public License v3.0 | 6 votes |
public boolean isConvertingBookItem() { ItemStack inputStack = this.getStackInSlot(slotInput); int level = GTHelperStack.getBookEnchantmentLevel(inputStack); if (level > 0 && !this.isFull()) { int generate = world.rand.nextInt(20000 * level); ItemStack blankBook = GTMaterialGen.get(Items.BOOK); if (!GTHelperStack.canMerge(blankBook, this.getStackInSlot(slotOutput))) { return false; } this.addEnergy(generate); this.setStackInSlot(slotOutput, StackUtil.copyWithSize(blankBook, this.getStackInSlot(slotOutput).getCount() + 1)); inputStack.shrink(1); world.playSound((EntityPlayer) null, this.pos, SoundEvents.BLOCK_PORTAL_AMBIENT, SoundCategory.BLOCKS, 0.5F, 0.75F + world.rand.nextFloat()); return true; } return false; }
Example #14
Source File: SteamBoiler.java From GregTech with GNU Lesser General Public License v3.0 | 6 votes |
private void generateSteam() { if(currentTemperature >= 100) { if (getTimer() % getBoilingCycleLength() == 0) { int fillAmount = (int) (baseSteamOutput * (currentTemperature / (getMaxTemperate() * 1.0))); boolean hasDrainedWater = waterFluidTank.drain(1, true) != null; int filledSteam = 0; if (hasDrainedWater) { filledSteam = steamFluidTank.fill(ModHandler.getSteam(fillAmount), true); } if (this.hasNoWater && hasDrainedWater) { getWorld().setBlockToAir(getPos()); getWorld().createExplosion(null, getPos().getX() + 0.5, getPos().getY() + 0.5, getPos().getZ() + 0.5, 2.0f, true); } else this.hasNoWater = !hasDrainedWater; if (filledSteam == 0 && hasDrainedWater) { getWorld().playSound(null, getPos().getX() + 0.5, getPos().getY() + 0.5, getPos().getZ() + 0.5, SoundEvents.BLOCK_LAVA_EXTINGUISH, SoundCategory.BLOCKS, 1.0f, 1.0f); steamFluidTank.drain(4000, true); } } } else { this.hasNoWater = false; } }
Example #15
Source File: EntityAIMakingFood.java From TofuCraftReload with MIT License | 6 votes |
@Override public void updateTask() { super.updateTask(); this.tofunian.getLookHelper().setLookPosition((double) this.destinationBlock.getX() + 0.5D, (double) (this.destinationBlock.getY()), (double) this.destinationBlock.getZ() + 0.5D, 10.0F, (float) this.tofunian.getVerticalFaceSpeed()); if (this.getIsAboveDestination()) { ++tick; if (tick % 10 == 0) { this.tofunian.swingArm(EnumHand.MAIN_HAND); } if (tick == 60) { this.findSoy().shrink(1); this.tofunian.playSound(SoundEvents.ENTITY_ITEM_PICKUP, 0.6F, 0.65F); this.makeFood(); if (!this.tofunian.hasEnoughCraftedItem(2, 0) && !this.findSoy().isEmpty()) { tick = 0; } } } }
Example #16
Source File: NoDesyncModule.java From seppuku with GNU General Public License v3.0 | 6 votes |
@Listener public void receivePacket(EventReceivePacket event) { if (event.getStage() == EventStageable.EventStage.PRE) { if (event.getPacket() instanceof SPacketSoundEffect) { final SPacketSoundEffect packet = (SPacketSoundEffect) event.getPacket(); if (packet.getCategory() == SoundCategory.BLOCKS && packet.getSound() == SoundEvents.ENTITY_GENERIC_EXPLODE) { for (Entity e : Minecraft.getMinecraft().world.loadedEntityList) { if (e != null && e instanceof EntityEnderCrystal) { if (e.getDistance(packet.getX(), packet.getY(), packet.getZ()) <= 6.0f) { e.setDead(); } } } } } } }
Example #17
Source File: TileEntityBarrel.java From enderutilities with GNU Lesser General Public License v3.0 | 6 votes |
private boolean tryToggleLocked(ItemStack stack) { if (ItemEnderPart.itemMatches(stack, ItemPartType.STORAGE_KEY)) { this.itemHandlerLockable.setTemplateStackInSlot(0, this.itemHandlerLockable.getStackInSlot(0)); this.itemHandlerLockable.toggleSlotLocked(0); int[] ints = new int[] { this.itemHandlerLockable.isSlotLocked(0) ? 1 : 0 }; ItemStack[] stacks = new ItemStack[] { this.itemHandlerLockable.getTemplateStackInSlot(0) }; this.sendPacketToWatchers(new MessageSyncTileEntity(this.getPos(), ints, stacks)); this.getWorld().playSound(null, this.getPos(), SoundEvents.ENTITY_ITEMFRAME_REMOVE_ITEM, SoundCategory.BLOCKS, 0.7f, 1f); return true; } return false; }
Example #18
Source File: ItemGravityRay.java From Production-Line with MIT License | 6 votes |
/** * called when the player releases the use item button. Args: itemstack, world, entityplayer, itemInUseCount */ @Override public void onPlayerStoppedUsing(ItemStack itemStack, World world, EntityLivingBase player, int itemInUseCount) { if (ElectricItem.manager.getCharge(itemStack) >= 100) { int i = this.getMaxItemUseDuration(itemStack) - itemInUseCount; float damge = (float) i / 20.0F; damge = (damge * damge + damge * 2.0F) / 3.0F; if ((double)damge < 0.1D) { return; } if (damge > 1.0F) { damge = 1.0F; } world.playSound(null, player.posX, player.posY, player.posZ, SoundEvents.ENTITY_ARROW_SHOOT, SoundCategory.PLAYERS, 1.0F, 1.0F / (itemRand.nextFloat() * 0.4F + 1.2F) + damge * 0.5F); if (!(player instanceof EntityPlayer && ((EntityPlayer) player).capabilities.isCreativeMode)) { ElectricItem.manager.discharge(itemStack, 100, this.tier, false, true, false); } if (!world.isRemote) { world.spawnEntity(new EntityRay(world, player, damge * 2.0F)); } } }
Example #19
Source File: ItemRainStick.java From CommunityMod with GNU Lesser General Public License v2.1 | 6 votes |
@Override public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, EnumHand hand) { ItemStack heldStack = player.getHeldItem(hand); if (!player.capabilities.isCreativeMode) heldStack.shrink(1); world.playSound(null, player.posX, player.posY, player.posZ, SoundEvents.ENTITY_SKELETON_DEATH, SoundCategory.PLAYERS, 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F)); if (!world.isRemote) { WorldInfo worldinfo = world.getWorldInfo(); worldinfo.setCleanWeatherTime(0); worldinfo.setRainTime(1200); worldinfo.setThunderTime(1200); worldinfo.setRaining(true); worldinfo.setThundering(false); } else player.sendMessage(new TextComponentString("Dark clouds start forming in the sky")); return new ActionResult<ItemStack>(EnumActionResult.SUCCESS, heldStack); }
Example #20
Source File: EntityDabSquirrel.java From CommunityMod with GNU Lesser General Public License v2.1 | 6 votes |
@Override protected void playStepSound(BlockPos pos, Block blockIn) { if (!blockIn.getDefaultState().getMaterial().isLiquid()) { SoundType soundtype = blockIn.getSoundType(blockIn.getDefaultState(), this.world, pos, this); if (this.world.getBlockState(pos.up()).getBlock() == Blocks.SNOW_LAYER) { soundtype = Blocks.SNOW_LAYER.getSoundType(Blocks.SNOW_LAYER.getDefaultState(), this.world, pos, this); } if (this.isBeingRidden()) { ++this.gallopTime; if (this.gallopTime > 5 && this.gallopTime % 3 == 0) { this.playGallopSound(soundtype); } else if (this.gallopTime <= 5) { this.playSound(SoundEvents.ENTITY_HORSE_STEP_WOOD, soundtype.getVolume() * 0.15F, soundtype.getPitch()); } } else if (soundtype == SoundType.WOOD) { this.playSound(SoundEvents.ENTITY_HORSE_STEP_WOOD, soundtype.getVolume() * 0.15F, soundtype.getPitch()); } else { this.playSound(SoundEvents.ENTITY_HORSE_STEP, soundtype.getVolume() * 0.15F, soundtype.getPitch()); } } }
Example #21
Source File: ItemSheath.java From Sakura_mod with MIT License | 6 votes |
public void sheath_In(EntityPlayer player) { ItemStack item_l = player.getHeldItemMainhand(); ItemStack item_r = player.getHeldItemOffhand(); if(item_r.getItem()==ItemLoader.KATANA){ player.playSound(SoundEvents.BLOCK_ANVIL_HIT, 1F, 1F); player.setHeldItem(EnumHand.MAIN_HAND, ItemLoader.KATANA_SHEATH.setBlade(item_r)); player.setHeldItem(EnumHand.OFF_HAND, ItemStack.EMPTY); }else if(item_r.getItem()==ItemLoader.SAKURAKATANA){ player.playSound(SoundEvents.BLOCK_ANVIL_HIT, 1F, 1F); player.setHeldItem(EnumHand.MAIN_HAND, ItemLoader.SAKURAKATANA_SHEATH.setBlade(item_r)); player.setHeldItem(EnumHand.OFF_HAND, ItemStack.EMPTY); }else if(item_l.getItem()==ItemLoader.KATANA){ player.playSound(SoundEvents.BLOCK_ANVIL_HIT, 1F, 1F); player.setHeldItem(EnumHand.OFF_HAND, ItemLoader.KATANA_SHEATH.setBlade(item_l)); player.setHeldItem(EnumHand.MAIN_HAND, ItemStack.EMPTY); }else if(item_l.getItem()==ItemLoader.SAKURAKATANA){ player.playSound(SoundEvents.BLOCK_ANVIL_HIT, 1F, 1F); player.setHeldItem(EnumHand.OFF_HAND, ItemLoader.SAKURAKATANA_SHEATH.setBlade(item_l)); player.setHeldItem(EnumHand.MAIN_HAND, ItemStack.EMPTY); } }
Example #22
Source File: EntityEndermanFighter.java From enderutilities with GNU Lesser General Public License v3.0 | 6 votes |
protected boolean teleportTo(double x, double y, double z) { EnderTeleportEvent event = new EnderTeleportEvent(this, x, y, z, 0); if (MinecraftForge.EVENT_BUS.post(event)) { return false; } boolean success = this.attemptTeleport(event.getTargetX(), event.getTargetY(), event.getTargetZ()); if (success) { this.getEntityWorld().playSound(null, this.prevPosX, this.prevPosY, this.prevPosZ, SoundEvents.ENTITY_ENDERMEN_TELEPORT, this.getSoundCategory(), 1.0F, 1.0F); } return success; }
Example #23
Source File: RecipeLogicSteam.java From GregTech with GNU Lesser General Public License v3.0 | 6 votes |
protected void tryDoVenting() { BlockPos machinePos = metaTileEntity.getPos(); EnumFacing ventingSide = getVentingSide(); BlockPos ventingBlockPos = machinePos.offset(ventingSide); IBlockState blockOnPos = metaTileEntity.getWorld().getBlockState(ventingBlockPos); if (blockOnPos.getCollisionBoundingBox(metaTileEntity.getWorld(), ventingBlockPos) == Block.NULL_AABB) { metaTileEntity.getWorld() .getEntitiesWithinAABB(EntityLivingBase.class, new AxisAlignedBB(ventingBlockPos), EntitySelectors.CAN_AI_TARGET) .forEach(entity -> entity.attackEntityFrom(DamageSources.getHeatDamage(), 6.0f)); WorldServer world = (WorldServer) metaTileEntity.getWorld(); double posX = machinePos.getX() + 0.5 + ventingSide.getFrontOffsetX() * 0.6; double posY = machinePos.getY() + 0.5 + ventingSide.getFrontOffsetY() * 0.6; double posZ = machinePos.getZ() + 0.5 + ventingSide.getFrontOffsetZ() * 0.6; world.spawnParticle(EnumParticleTypes.SMOKE_LARGE, posX, posY, posZ, 7 + world.rand.nextInt(3), ventingSide.getFrontOffsetX() / 2.0, ventingSide.getFrontOffsetY() / 2.0, ventingSide.getFrontOffsetZ() / 2.0, 0.1); world.playSound(null, posX, posY, posZ, SoundEvents.BLOCK_LAVA_EXTINGUISH, SoundCategory.BLOCKS, 1.0f, 1.0f); setNeedsVenting(false); } else if (!ventingStuck) { setVentingStuck(true); } }
Example #24
Source File: GTTileMagicEnergyAbsorber.java From GT-Classic with GNU Lesser General Public License v3.0 | 6 votes |
public boolean isConvertingToolItem() { ItemStack inputStack = this.getStackInSlot(slotInput); int level = GTHelperStack.getItemStackEnchantmentLevel(inputStack); if (level > 0 && !this.isFull()) { int generate = world.rand.nextInt(20000 * level); ItemStack blankTool = inputStack.copy(); blankTool.getTagCompound().removeTag("ench"); if (!GTHelperStack.canMerge(blankTool, this.getStackInSlot(slotOutput))) { return false; } this.addEnergy(generate); this.setStackInSlot(slotOutput, StackUtil.copyWithSize(blankTool, this.getStackInSlot(slotOutput).getCount() + 1)); inputStack.shrink(1); world.playSound((EntityPlayer) null, this.pos, SoundEvents.BLOCK_PORTAL_AMBIENT, SoundCategory.BLOCKS, 0.5F, 0.75F + world.rand.nextFloat()); return true; } return false; }
Example #25
Source File: EntityEndermanFighter.java From enderutilities with GNU Lesser General Public License v3.0 | 5 votes |
public void playEndermanSound() { if (this.ticksExisted >= this.lastCreepySound + 400) { this.lastCreepySound = this.ticksExisted; if (this.isSilent() == false) { this.world.playSound(this.posX, this.posY + this.getEyeHeight(), this.posZ, SoundEvents.ENTITY_ENDERMEN_SCREAM, this.getSoundCategory(), 2.5F, 1.0F, false); } } }
Example #26
Source File: GTTileLamp.java From GT-Classic with GNU Lesser General Public License v3.0 | 5 votes |
@Override public boolean onRightClick(EntityPlayer player, EnumHand hand, EnumFacing enumFacing, Side side) { if (player.isSneaking() && player.getHeldItemMainhand().isEmpty()) { this.inverted = !this.inverted; this.shouldUpdate = true; if (this.isSimulating()) { String msg = this.inverted ? "Inverted" : "Not Inverted"; IC2.platform.messagePlayer(player, msg); } player.playSound(SoundEvents.UI_BUTTON_CLICK, 1.0F, 1.0F); return true; } return false; }
Example #27
Source File: EntityMonolithEye.java From ToroQuest with GNU General Public License v3.0 | 5 votes |
@Override protected void collideWithEntity(Entity entityIn) { super.collideWithEntity(entityIn); float damage = 6f; DamageSource ds = DamageSource.causeIndirectMagicDamage(this, this); entityIn.attackEntityFrom(ds, damage); entityIn.attackEntityFrom(DamageSource.causeMobDamage(this), (float) this.getEntityAttribute(SharedMonsterAttributes.ATTACK_DAMAGE).getAttributeValue()); this.world.setEntityState(this, (byte) 15); this.playSound(SoundEvents.ENTITY_GENERIC_EXPLODE, 1.0F, 1.0F / (this.getRNG().nextFloat() * 0.4F + 0.8F)); }
Example #28
Source File: BounceManager.java From Wizardry with GNU Lesser General Public License v3.0 | 5 votes |
@SubscribeEvent public static void onFall(LivingFallEvent event) { EntityLivingBase entity = event.getEntityLiving(); if (entity == null) return; if (!shouldBounce(entity)) return; INSTANCE.blocks.removeIf(bouncyBlock -> entity.world.getTotalWorldTime() - bouncyBlock.tickSpawned > bouncyBlock.expiry); boolean isClient = entity.getEntityWorld().isRemote; if (event.getDistance() > 0.5) { event.setDamageMultiplier(0); entity.fallDistance = 0; if (isClient) { entity.motionY *= -0.9; entity.isAirBorne = true; entity.onGround = false; double f = 0.95; entity.motionX /= f; entity.motionZ /= f; PacketHandler.NETWORK.sendToServer(new PacketBounce()); } else { event.setCanceled(true); } entity.playSound(SoundEvents.ENTITY_SLIME_SQUISH, 1f, 1f); BounceHandler.addBounceHandler(entity, entity.motionY); } }
Example #29
Source File: BlockElevator.java From enderutilities with GNU Lesser General Public License v3.0 | 5 votes |
@Override public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) { ItemStack stack = EntityUtils.getHeldItemOfType(player, ItemDye.class); if (stack.isEmpty() == false) { EnumDyeColor stackColor = EnumDyeColor.byDyeDamage(stack.getMetadata()); if (state.getValue(COLOR) != stackColor) { if (world.isRemote == false) { world.setBlockState(pos, state.withProperty(COLOR, stackColor), 3); world.playSound(null, pos, SoundEvents.ENTITY_ITEMFRAME_ADD_ITEM, SoundCategory.BLOCKS, 1f, 1f); if (player.capabilities.isCreativeMode == false) { stack.shrink(1); } } return true; } return false; } else { return super.onBlockActivated(world, pos, state, player, hand, side, hitX, hitY, hitZ); } }
Example #30
Source File: EntityEndermanFighter.java From enderutilities with GNU Lesser General Public License v3.0 | 5 votes |
@Override protected SoundEvent getAmbientSound() { if (this.isAIDisabled()) { return null; } return this.isScreaming() ? SoundEvents.ENTITY_ENDERMEN_SCREAM : SoundEvents.ENTITY_ENDERMEN_AMBIENT; }