mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-19 03:49:14 +00:00
Forge 1.19
* Bump pack.mcmeta formats * 1.19 biome modifiers * Mark ClientPlayerNetworkEvent.LoggedOutEvent's getters as nullable * Add docs and package-info to client extension interfaces package * Move RenderBlockOverlayEvent hooks to ForgeHooksClient * Add package-infos to client events package * Rename SoundLoadEvent to SoundEngineLoadEvent This reduces confusion from consumers which may think the name SoundLoadEvent refers to an individual sound being loaded rather than the sound engine. * Document and change SoundLoadEvent to fire on mod bus Previously, it fired on both the mod bus and the Forge bus, which is confusing for consumers. * Delete SoundSetupEvent Looking at its original implementation shows that there isn't an appropriate place in the new sound code to reinsert the event, and the place of 'sound engine/manager initialization event' is taken already by SoundLoadEvent. * Perform some cleanup on client events - Removed nullable annotations from ClientPlayerNetworkEvent - Renamed #getPartialTicks methods to #getPartialTick, to be consistent with vanilla's naming of the partial tick - Cleanup documentation to remove line breaks, use the spelling 'cancelled' over 'canceled', and improve docs on existing and new methods. * Remove EntityEvent.CanUpdate Closes MinecraftForge/MinecraftForge#6394 * Switch to Jetbrains nullability annotations * New PlayLevelSoundEvent; replaces old PlaySoundAtEntityEvent * Remove ForgeWorldPresetScreens * Remove IForgeRegistryEntry * Remove use of List<Throwable> in FML's CompletableFutures * Add docs to mod loading stages, stages, and phases * Gradle 7.4.2 * Use SLF4J in FMLLoader and other subprojects * Switch dynamic versions in subprojects to pinned ones * Switch ForgeRoot and MDK to FG plugin markers * Configure Forge javadoc task The task now uses a custom stylesheet with MCForge elements, and configured to combine the generation from the four FML subprojects (fmlloader, fmlcore, javafmllanguage, mclanguage) and the Forge project into the javadoc output. * Update docs/md files, for 1.19 update and the move away from IRC to Discord. * Make "Potentially dangerous alternative prefix" a debug warning, not info. Co-authored-by: Curle <[email protected]> Co-authored-by: sciwhiz12 <[email protected]> Signed-off-by: SizableShrimp <[email protected]>
This commit is contained in:
1 parent
270e778ac5
commit
4ed9117799
1485 files changed
+14960
-15446
No files matched your search
@@ -0,0 +1,212 @@
|
||||
/*
|
||||
* Copyright (c) Forge Development LLC and contributors
|
||||
* SPDX-License-Identifier: LGPL-2.1-only
|
||||
*/
|
||||
|
||||
package net.minecraftforge.event;
|
||||
|
||||
import net.minecraft.client.player.LocalPlayer;
|
||||
import net.minecraft.sounds.SoundEvent;
|
||||
import net.minecraft.sounds.SoundSource;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.eventbus.api.Cancelable;
|
||||
import net.minecraftforge.eventbus.api.Event;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* PlayLevelSoundEvent is fired when a sound is played on a {@link Level}.
|
||||
* This event is fired from {@link Level#playSound}, {@link Level#playSeededSound}, and {@link LocalPlayer#playSound}.
|
||||
* <p>
|
||||
* {@link #getLevel()} contains the level the sound is being played in.
|
||||
* {@link #getSound()} contains the sound event to be played.
|
||||
* {@link #getOriginalVolume()} contains the original volume for the sound to be played at.
|
||||
* {@link #getOriginalPitch()} contains the original pitch for the sound to be played at.
|
||||
* {@link #getNewVolume()} contains the volume the sound will be played at.
|
||||
* {@link #getNewPitch()} contains the pitch the sound will be played at.
|
||||
* <p>
|
||||
* This event is {@link Cancelable cancelable}.
|
||||
* If this event is canceled, the sound is not played.
|
||||
* <p>
|
||||
* This event does not have a result.
|
||||
* <p>
|
||||
* This event is fired on the {@link MinecraftForge#EVENT_BUS}.
|
||||
*/
|
||||
@Cancelable
|
||||
public class PlayLevelSoundEvent extends Event
|
||||
{
|
||||
private final Level level;
|
||||
private final float originalVolume;
|
||||
private final float originalPitch;
|
||||
private SoundEvent sound;
|
||||
private SoundSource source;
|
||||
private float newVolume;
|
||||
private float newPitch;
|
||||
|
||||
public PlayLevelSoundEvent(@NotNull Level level, @NotNull SoundEvent sound, @NotNull SoundSource source, float volume, float pitch)
|
||||
{
|
||||
this.level = level;
|
||||
this.sound = sound;
|
||||
this.source = source;
|
||||
this.originalVolume = volume;
|
||||
this.originalPitch = pitch;
|
||||
this.newVolume = volume;
|
||||
this.newPitch = pitch;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@return the level the sound is being played in}
|
||||
*/
|
||||
@NotNull
|
||||
public Level getLevel()
|
||||
{
|
||||
return this.level;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@return the sound event to be played}
|
||||
*/
|
||||
@Nullable
|
||||
public SoundEvent getSound()
|
||||
{
|
||||
return this.sound;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the sound event to be played.
|
||||
*/
|
||||
public void setSound(@Nullable SoundEvent sound)
|
||||
{
|
||||
this.sound = sound;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@return the sound source}
|
||||
*/
|
||||
@NotNull
|
||||
public SoundSource getSource()
|
||||
{
|
||||
return this.source;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the sound source.
|
||||
*/
|
||||
public void setSource(@NotNull SoundSource source)
|
||||
{
|
||||
Objects.requireNonNull(source, "Sound source cannot be null");
|
||||
this.source = source;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@return the original volume for the sound to be played at}
|
||||
*/
|
||||
public float getOriginalVolume()
|
||||
{
|
||||
return this.originalVolume;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@return the original pitch for the sound to be played at}
|
||||
*/
|
||||
public float getOriginalPitch()
|
||||
{
|
||||
return this.originalPitch;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@return the volume the sound will be played at}
|
||||
*/
|
||||
public float getNewVolume()
|
||||
{
|
||||
return this.newVolume;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the volume the sound will be played at.
|
||||
*/
|
||||
public void setNewVolume(float newVolume)
|
||||
{
|
||||
this.newVolume = newVolume;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@return the pitch the sound will be played at}
|
||||
*/
|
||||
public float getNewPitch()
|
||||
{
|
||||
return this.newPitch;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the pitch the sound will be played at.
|
||||
*/
|
||||
public void setNewPitch(float newPitch)
|
||||
{
|
||||
this.newPitch = newPitch;
|
||||
}
|
||||
|
||||
/**
|
||||
* PlayLevelSoundEvent.AtEntity is fired when a sound is played on the {@link Level} at an {@link Entity Entity}'s position.
|
||||
* This event is fired from {@link Level#playSound}, {@link Level#playSeededSound}, and {@link LocalPlayer#playSound}.
|
||||
* <p>
|
||||
* This event is {@link Cancelable cancelable}.
|
||||
* If this event is canceled, the sound is not played.
|
||||
* <p>
|
||||
* This event does not have a result.
|
||||
* <p>
|
||||
* This event is fired on the {@link MinecraftForge#EVENT_BUS}.
|
||||
*/
|
||||
public static class AtEntity extends PlayLevelSoundEvent
|
||||
{
|
||||
private final Entity entity;
|
||||
|
||||
public AtEntity(Entity entity, SoundEvent sound, SoundSource source, float volume, float pitch)
|
||||
{
|
||||
super(entity.level, sound, source, volume, pitch);
|
||||
this.entity = entity;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@return the entity the sound is being played on}
|
||||
*/
|
||||
public Entity getEntity()
|
||||
{
|
||||
return this.entity;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* PlayLevelSoundEvent.AtPosition is fired when a sound is played on the {@link Level} at a specific position.
|
||||
* This event is fired from {@link Level#playSound} and {@link Level#playSeededSound}.
|
||||
* <p>
|
||||
* This event is {@link Cancelable cancelable}.
|
||||
* If this event is canceled, the sound is not played.
|
||||
* <p>
|
||||
* This event does not have a result.
|
||||
* <p>
|
||||
* This event is fired on the {@link MinecraftForge#EVENT_BUS}.
|
||||
*/
|
||||
public static class AtPosition extends PlayLevelSoundEvent
|
||||
{
|
||||
private final Vec3 position;
|
||||
|
||||
public AtPosition(Level level, Vec3 position, SoundEvent sound, SoundSource source, float volume, float pitch)
|
||||
{
|
||||
super(level, sound, source, volume, pitch);
|
||||
this.position = position;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@return the position the sound is being played at}
|
||||
*/
|
||||
public Vec3 getPosition()
|
||||
{
|
||||
return this.position;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user