mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-14 01:04:24 +00:00
* Revert "Allow safely registering RenderType predicates at any time (#8685)"
This reverts commit be7275443f.
* Renderable API refactors
- Rename "render values" to "context"
- Rename SimpleRenderable to CompositeRenderable to better reflect its use
- Remove IMultipartRenderValues since it doesn't have any real use
- Add extensive customization options to BakedModelRenderable
* ClientRegistry and MinecraftForgeClient refactors
- Add sprite loader manager and registration event
- Add spectator shader manager and registration event
- Add client tooltip factory manager and registration event
- Add recipe book manager and registration event
- Add key mapping registration event
- Remove ClientRegistry, as everything has been moved out of it
- Remove registration methods from MinecraftForgeClient, as they have dedicated events now
* Dimension special effects refactors
- Fold handlers into an extension class and remove public mutable fields
- Add dimension special effects manager and registration event
* HUD overlay refactors
- Rename to IGuiOverlay match vanilla (instead of Ingame)
- Add overlay manager and registration event
- Move vanilla overlays to a standalone enum
* Model loader refactors
- Rename IModelLoader to IGeometryLoader
- Add loader manager and registration event
- Fold all model events into one
- Move registration of additionally loaded models to an event
- Remove ForgeModelBakery and related classes as they served no purpose anymore
* Render properties refactors
- Rename all render properties to client extensions and relocate accordingly
- Move lookups to the respective interfaces
* Model data refactors
- Convert model data to a final class backed by an immutable map and document mutability requirements. This addresses several thread-safety issues in the current implementation which could result in race conditions
- Transfer ownership of the data manager to the client level. This addresses several issues that arise when multiple levels are used at once
* GUI and widget refactors
- Move all widgets to the correct package
- Rename GuiUtils and children to match vanilla naming
* New vertex pipeline API
- Move to vanilla's VertexConsumer
- Roll back recent PR making VertexConsumer format-aware. This is the opposite of what vanilla does, and should not be relevant with the updated lighting pipeline
* Lighting pipeline refactors
- Move to dedicated lighting package
- Separate flat and smooth lighters
- Convert from a vertex pipeline transformer to a pure vertex source (input is baked quads)
* Model geometry API refactors
- Rename IModelGeometry to IUnbakedGeometry
- Rename IModelConfiguration to IGeometryBakingContext
- Rename other elements to match vanilla naming
- Remove current changes to ModelState, as they do not belong there. Transforms should be specified through vanilla's system. ModelState is intended to transfer state from the blockstate JSON
- Remove multipart geometries and geometry parts. After some discussion, these should not be exposed. Instead, geometries should be baked with only the necessary parts enabled
* Make render types a first-class citizen in baked models
- Add named render types (block + entity + fabulous entity)
- Add named render type manager + registration event
- Make BakedModel aware of render types and transfer control over which ones are used to it instead of ItemBlockRenderTypes (fallback)
- (additional) Add concatenated list view. A wrapper for multiple lists that iterates through them in order without the cost of merging them. Useful for merging lists of baked quads
* General event refactors
- Several renames to either match vanilla or improve clarity
- Relocate client chat event dispatching out of common code
* Forge model type refactors
- Rename SeparatePerspectiveModel to SeparateTransformsModel
- Rename ItemModelMesherForge to ForgeItemModelShaper
- Rename DynamicBucketModel to DynamicFluidContainerModel
- Prefix all OBJ-related classes with "Obj" and decouple parsing from construction
- Extract ElementsModel from model loader registry
- Add EmptyModel (baked, unbaked and loader)
- Refactor CompositeModel to take over ItemMultiLayerBakedModel
- Remove FluidModel as it's not used and isn't compatible with the new fluid rendering in modern versions
- Move model loader registration to a proper event handler
- Update names of several JSON fields (backwards-compatible)
- Update datagens to match
* Miscellaneous changes and overlapping patches
- Dispatch all new registration events
- Convert ExtendedServerListData to a record
- Add/remove hooks from ForgeHooksClient as necessary
* Update test mods
* Fix VertexConsumerWrapper returning parent instead of itself
* Additional event cleanup pass
As discussed on Discord:
- Remove "@hidden" and "@see <callsite>" javadoc annotations from all client events and replace them with @ApiStatus.Internal annotation
- Make all events that shouldn't be fired directly into abstract classes with protected constructors
- Another styling pass, just in case (caught some missed classes)
* Add proper deprecation javadocs and de-dupe some vertex consumer code
* Replace sets of chunk render types with a faster BitSet-backed collection
This largely addresses potential performance concerns that using a plain HashSet might involve by making lookups and iteration as linear as they can likely be (aside from using a plain byte/int/long for bit storage). Further performance concerns related to the implementation may be addressed separately, as all the implementation details are hidden from the end user
* Requested changes
- Remove MinecraftForgeClient and move members to Minecraft, IForgeMinecraft and StencilManager
- Allow non-default elements to be passed into VertexConsumer and add support to derived classes
- Move array instantiation out of quad processing in lighting pipeline
- Fix flipped fluid container model
- Set default UV1 to the correct values in the remapping pipeline
- Minor documentation changes
* Add/update EXC entries and fix AT comment
* Add test mod as per Orion's request
* Additional requested changes
* Allow custom model types to request the particle texture to be loaded
* Even more requested changes
* Improve generics in ConcatenatedListView and add missing fallbacks
* Fix fluid render types being bound to the fluid and not its holder
* Remove non-contractual nullability in ChunkRenderTypeSet and add isEmpty
Additionally, introduce chunk render type checks in ItemBlockRenderTypes
Co-authored-by: Dennis C <xfacthd@gmx.de>
154 lines
4.4 KiB
Java
154 lines
4.4 KiB
Java
/*
|
|
* Copyright (c) Forge Development LLC and contributors
|
|
* SPDX-License-Identifier: LGPL-2.1-only
|
|
*/
|
|
|
|
package net.minecraftforge.client;
|
|
|
|
import net.minecraft.Util;
|
|
import net.minecraft.advancements.Advancement;
|
|
import net.minecraft.client.Minecraft;
|
|
import net.minecraft.commands.CommandSource;
|
|
import net.minecraft.commands.CommandSourceStack;
|
|
import net.minecraft.core.RegistryAccess;
|
|
import net.minecraft.network.chat.Component;
|
|
import net.minecraft.resources.ResourceKey;
|
|
import net.minecraft.resources.ResourceLocation;
|
|
import net.minecraft.server.MinecraftServer;
|
|
import net.minecraft.server.level.ServerLevel;
|
|
import net.minecraft.world.entity.Entity;
|
|
import net.minecraft.world.item.crafting.RecipeManager;
|
|
import net.minecraft.world.level.Level;
|
|
import net.minecraft.world.phys.Vec2;
|
|
import net.minecraft.world.phys.Vec3;
|
|
import net.minecraft.world.scores.Scoreboard;
|
|
|
|
import java.util.Collection;
|
|
import java.util.Set;
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Stream;
|
|
|
|
/**
|
|
* overrides for {@link CommandSourceStack} so that the methods will run successfully client side
|
|
*/
|
|
public class ClientCommandSourceStack extends CommandSourceStack
|
|
{
|
|
|
|
public ClientCommandSourceStack(CommandSource source, Vec3 position, Vec2 rotation, int permission, String plainTextName, Component displayName,
|
|
Entity executing)
|
|
{
|
|
super(source, position, rotation, null, permission, plainTextName, displayName, null, executing);
|
|
}
|
|
|
|
/**
|
|
* Sends a success message without attempting to get the server side list of admins
|
|
*/
|
|
@Override
|
|
public void sendSuccess(Component message, boolean sendToAdmins)
|
|
{
|
|
Minecraft.getInstance().player.sendSystemMessage(message);
|
|
}
|
|
|
|
/**
|
|
* {@return the list of teams from the client side}
|
|
*/
|
|
@Override
|
|
public Collection<String> getAllTeams()
|
|
{
|
|
return Minecraft.getInstance().level.getScoreboard().getTeamNames();
|
|
}
|
|
|
|
/**
|
|
* {@return the list of online player names from the client side}
|
|
*/
|
|
@Override
|
|
public Collection<String> getOnlinePlayerNames()
|
|
{
|
|
return Minecraft.getInstance().getConnection().getOnlinePlayers().stream().map((player) -> player.getProfile().getName()).collect(Collectors.toList());
|
|
}
|
|
|
|
/**
|
|
* {@return a {@link Stream} of recipe ids that are available on the client}
|
|
*/
|
|
@Override
|
|
public Stream<ResourceLocation> getRecipeNames()
|
|
{
|
|
return Minecraft.getInstance().getConnection().getRecipeManager().getRecipeIds();
|
|
}
|
|
|
|
/**
|
|
* {@return a set of {@link ResourceKey} for levels from the client side}
|
|
*/
|
|
@Override
|
|
public Set<ResourceKey<Level>> levels()
|
|
{
|
|
return Minecraft.getInstance().getConnection().levels();
|
|
}
|
|
|
|
/**
|
|
* {@return the {@link RegistryAccess} from the client side}
|
|
*/
|
|
@Override
|
|
public RegistryAccess registryAccess()
|
|
{
|
|
return Minecraft.getInstance().getConnection().registryAccess();
|
|
}
|
|
|
|
/**
|
|
* {@return the scoreboard from the client side}
|
|
*/
|
|
@Override
|
|
public Scoreboard getScoreboard()
|
|
{
|
|
return Minecraft.getInstance().level.getScoreboard();
|
|
}
|
|
|
|
/**
|
|
* {@return the advancement from the id from the client side where the advancement needs to be visible to the player}
|
|
*/
|
|
@Override
|
|
public Advancement getAdvancement(ResourceLocation id)
|
|
{
|
|
return Minecraft.getInstance().getConnection().getAdvancements().getAdvancements().get(id);
|
|
}
|
|
|
|
/**
|
|
* {@return the {@link RecipeManager} from the client side}
|
|
*/
|
|
@Override
|
|
public RecipeManager getRecipeManager()
|
|
{
|
|
return Minecraft.getInstance().getConnection().getRecipeManager();
|
|
}
|
|
|
|
/**
|
|
* {@return the level from the client side}
|
|
*/
|
|
@Override
|
|
public Level getUnsidedLevel()
|
|
{
|
|
return Minecraft.getInstance().level;
|
|
}
|
|
|
|
/**
|
|
* @throws UnsupportedOperationException
|
|
* because the server isn't available on the client
|
|
*/
|
|
@Override
|
|
public MinecraftServer getServer()
|
|
{
|
|
throw new UnsupportedOperationException("Attempted to get server in client command");
|
|
}
|
|
|
|
/**
|
|
* @throws UnsupportedOperationException
|
|
* because the server side level isn't available on the client side
|
|
*/
|
|
@Override
|
|
public ServerLevel getLevel()
|
|
{
|
|
throw new UnsupportedOperationException("Attempted to get server level in client command");
|
|
}
|
|
|
|
}
|