本文整理汇总了Java中net.minecraft.network.play.server.SPacketSoundEffect类的典型用法代码示例。如果您正苦于以下问题:Java SPacketSoundEffect类的具体用法?Java SPacketSoundEffect怎么用?Java SPacketSoundEffect使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SPacketSoundEffect类属于net.minecraft.network.play.server包,在下文中一共展示了SPacketSoundEffect类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: isCorrectSplashPacket
import net.minecraft.network.play.server.SPacketSoundEffect; //导入依赖的package包/类
private boolean isCorrectSplashPacket(SPacketSoundEffect packet) {
EntityPlayerSP me = getLocalPlayer();
return packet.getSound().equals(SoundEvents.ENTITY_BOBBER_SPLASH) &&
(
me != null &&
me.fishEntity != null &&
(
max_sound_distance.get() == 0 || // disables this check
(me.fishEntity.getPositionVector().distanceTo(new Vec3d(packet.getX(), packet.getY(), packet.getZ())) <= max_sound_distance.get())
)
);
}
示例2: onPacketIncoming
import net.minecraft.network.play.server.SPacketSoundEffect; //导入依赖的package包/类
@SubscribeEvent
public void onPacketIncoming(PacketEvent.Incoming.Pre event) {
if(event.getPacket() instanceof SPacketSoundEffect) {
SPacketSoundEffect packet = (SPacketSoundEffect)event.getPacket();
if(isCorrectSplashPacket(packet)) {
rightClick();
}
}
}
示例3: onReceivedPacket
import net.minecraft.network.play.server.SPacketSoundEffect; //导入依赖的package包/类
@Override
public void onReceivedPacket(PacketInputEvent event)
{
// check packet type
if(!(event.getPacket() instanceof SPacketSoundEffect))
return;
// check sound type
if(!WSoundEvents.isBobberSplash((SPacketSoundEffect)event.getPacket()))
return;
// catch fish
rightClick();
}
示例4: playSound
import net.minecraft.network.play.server.SPacketSoundEffect; //导入依赖的package包/类
public static void playSound(World worldObj, SoundEvent soundName, double x, double y, double z, double volume, double pitch) {
SPacketSoundEffect soundEffect = new SPacketSoundEffect(soundName, SoundCategory.BLOCKS, x, y, z, (float) volume, (float) pitch);
for (int j = 0; j < worldObj.playerEntities.size(); ++j) {
EntityPlayerMP entityplayermp = (EntityPlayerMP)worldObj.playerEntities.get(j);
double d7 = x - entityplayermp.posX;
double d8 = y - entityplayermp.posY;
double d9 = z - entityplayermp.posZ;
double d10 = d7 * d7 + d8 * d8 + d9 * d9;
if (d10 <= 256.0D) {
entityplayermp.connection.sendPacket(soundEffect);
}
}
}
示例5: isBobberSplash
import net.minecraft.network.play.server.SPacketSoundEffect; //导入依赖的package包/类
public static boolean isBobberSplash(SPacketSoundEffect soundEffect)
{
return SoundEvents.ENTITY_BOBBER_SPLASH.equals(soundEffect.getSound());
}
示例6: displayGUIChest
import net.minecraft.network.play.server.SPacketSoundEffect; //导入依赖的package包/类
/**
* Displays the GUI for interacting with a chest inventory.
*/
public void displayGUIChest(IInventory chestInventory)
{
if (chestInventory instanceof ILootContainer && ((ILootContainer)chestInventory).getLootTable() != null && this.isSpectator())
{
this.addChatComponentMessage((new TextComponentTranslation("container.spectatorCantOpen", new Object[0])).setStyle((new Style()).setColor(TextFormatting.RED)), true);
}
else
{
if (this.openContainer != this.inventoryContainer)
{
this.closeScreen();
}
if (chestInventory instanceof ILockableContainer)
{
ILockableContainer ilockablecontainer = (ILockableContainer)chestInventory;
if (ilockablecontainer.isLocked() && !this.canOpen(ilockablecontainer.getLockCode()) && !this.isSpectator())
{
this.connection.sendPacket(new SPacketChat(new TextComponentTranslation("container.isLocked", new Object[] {chestInventory.getDisplayName()}), (byte)2));
this.connection.sendPacket(new SPacketSoundEffect(SoundEvents.BLOCK_CHEST_LOCKED, SoundCategory.BLOCKS, this.posX, this.posY, this.posZ, 1.0F, 1.0F));
return;
}
}
this.getNextWindowId();
if (chestInventory instanceof IInteractionObject)
{
this.connection.sendPacket(new SPacketOpenWindow(this.currentWindowId, ((IInteractionObject)chestInventory).getGuiID(), chestInventory.getDisplayName(), chestInventory.getSizeInventory()));
this.openContainer = ((IInteractionObject)chestInventory).createContainer(this.inventory, this);
}
else
{
this.connection.sendPacket(new SPacketOpenWindow(this.currentWindowId, "minecraft:container", chestInventory.getDisplayName(), chestInventory.getSizeInventory()));
this.openContainer = new ContainerChest(this.inventory, chestInventory, this);
}
this.openContainer.windowId = this.currentWindowId;
this.openContainer.addListener(this);
}
}
示例7: handleSoundEffect
import net.minecraft.network.play.server.SPacketSoundEffect; //导入依赖的package包/类
public void handleSoundEffect(SPacketSoundEffect packetIn)
{
PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
this.gameController.world.playSound(this.gameController.player, packetIn.getX(), packetIn.getY(), packetIn.getZ(), packetIn.getSound(), packetIn.getCategory(), packetIn.getVolume(), packetIn.getPitch());
}
示例8: playSoundToAllNearExcept
import net.minecraft.network.play.server.SPacketSoundEffect; //导入依赖的package包/类
public void playSoundToAllNearExcept(@Nullable EntityPlayer player, SoundEvent soundIn, SoundCategory category, double x, double y, double z, float volume, float pitch)
{
this.mcServer.getPlayerList().sendToAllNearExcept(player, x, y, z, volume > 1.0F ? (double)(16.0F * volume) : 16.0D, this.theWorldServer.provider.getDimensionType().getId(), new SPacketSoundEffect(soundIn, category, x, y, z, volume, pitch));
}
示例9: playSoundToAllNearExcept
import net.minecraft.network.play.server.SPacketSoundEffect; //导入依赖的package包/类
public void playSoundToAllNearExcept(@Nullable EntityPlayer player, SoundEvent soundIn, SoundCategory category, double x, double y, double z, float volume, float pitch)
{
this.mcServer.getPlayerList().sendToAllNearExcept(player, x, y, z, volume > 1.0F ? (double)(16.0F * volume) : 16.0D, this.theWorldServer.provider.getDimension(), new SPacketSoundEffect(soundIn, category, x, y, z, volume, pitch));
}
示例10: displayGUIChest
import net.minecraft.network.play.server.SPacketSoundEffect; //导入依赖的package包/类
/**
* Displays the GUI for interacting with a chest inventory.
*/
public void displayGUIChest(IInventory chestInventory)
{
if (chestInventory instanceof ILootContainer && ((ILootContainer)chestInventory).getLootTable() != null && this.isSpectator())
{
this.addChatMessage((new TextComponentTranslation("container.spectatorCantOpen", new Object[0])).setStyle((new Style()).setColor(TextFormatting.RED)));
}
else
{
if (this.openContainer != this.inventoryContainer)
{
this.closeScreen();
}
if (chestInventory instanceof ILockableContainer)
{
ILockableContainer ilockablecontainer = (ILockableContainer)chestInventory;
if (ilockablecontainer.isLocked() && !this.canOpen(ilockablecontainer.getLockCode()) && !this.isSpectator())
{
this.connection.sendPacket(new SPacketChat(new TextComponentTranslation("container.isLocked", new Object[] {chestInventory.getDisplayName()}), (byte)2));
this.connection.sendPacket(new SPacketSoundEffect(SoundEvents.BLOCK_CHEST_LOCKED, SoundCategory.BLOCKS, this.posX, this.posY, this.posZ, 1.0F, 1.0F));
return;
}
}
this.getNextWindowId();
if (chestInventory instanceof IInteractionObject)
{
this.connection.sendPacket(new SPacketOpenWindow(this.currentWindowId, ((IInteractionObject)chestInventory).getGuiID(), chestInventory.getDisplayName(), chestInventory.getSizeInventory()));
this.openContainer = ((IInteractionObject)chestInventory).createContainer(this.inventory, this);
}
else
{
this.connection.sendPacket(new SPacketOpenWindow(this.currentWindowId, "minecraft:container", chestInventory.getDisplayName(), chestInventory.getSizeInventory()));
this.openContainer = new ContainerChest(this.inventory, chestInventory, this);
}
this.openContainer.windowId = this.currentWindowId;
this.openContainer.addListener(this);
net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.player.PlayerContainerEvent.Open(this, this.openContainer));
}
}
示例11: handleSoundEffect
import net.minecraft.network.play.server.SPacketSoundEffect; //导入依赖的package包/类
public void handleSoundEffect(SPacketSoundEffect packetIn)
{
PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
this.gameController.theWorld.playSound(this.gameController.thePlayer, packetIn.getX(), packetIn.getY(), packetIn.getZ(), packetIn.getSound(), packetIn.getCategory(), packetIn.getVolume(), packetIn.getPitch());
}
示例12: playSoundToAllNearExcept
import net.minecraft.network.play.server.SPacketSoundEffect; //导入依赖的package包/类
@Override
public void playSoundToAllNearExcept(EntityPlayer player, SoundEvent sound, SoundCategory category, double x, double y, double z, float volume, float pitch) {
double range = volume > 1.0F ? 16.0F * volume : 16.0;
this.server.getPlayerList().sendToAllNearExcept(player, x, y, z, range, this.blockSystem.provider.getDimension(), new SPacketSoundEffect(sound, category, x, y, z, volume, pitch));
}
示例13: execute
import net.minecraft.network.play.server.SPacketSoundEffect; //导入依赖的package包/类
@Override
public boolean execute(EntityPlayerMP target) {
SoundEvent sound = CollectionUtils.getRandom(sounds);
target.connection.sendPacket(new SPacketSoundEffect(sound, SoundCategory.MASTER, target.posX, target.posY, target.posZ, 1, 1));
return true;
}
示例14: handleSoundEffect
import net.minecraft.network.play.server.SPacketSoundEffect; //导入依赖的package包/类
void handleSoundEffect(SPacketSoundEffect packetIn);