forked from FabricMC/fabric
commit
9b03381f03
44 changed files with 60 additions and 93 deletions
11
build.gradle
11
build.gradle
|
@ -41,6 +41,8 @@ allprojects {
|
|||
|
||||
group = "net.fabricmc.fabric-api"
|
||||
|
||||
|
||||
|
||||
dependencies {
|
||||
minecraft "com.mojang:minecraft:$Globals.mcVersion"
|
||||
mappings "net.fabricmc:yarn:${Globals.mcVersion}${Globals.yarnVersion}"
|
||||
|
@ -92,6 +94,14 @@ allprojects {
|
|||
classifier = 'sources'
|
||||
from sourceSets.main.allSource
|
||||
}
|
||||
|
||||
}
|
||||
javadoc{
|
||||
options.memberLevel = "PACKAGE"
|
||||
allprojects.each{
|
||||
source( it.sourceSets.main.allJava.srcDirs)
|
||||
}
|
||||
classpath = sourceSets.main.compileClasspath
|
||||
}
|
||||
|
||||
subprojects {
|
||||
|
@ -128,6 +138,7 @@ subprojects {
|
|||
}
|
||||
}
|
||||
|
||||
javadoc.enabled = false
|
||||
}
|
||||
|
||||
task remapMavenJar(type: net.fabricmc.loom.task.RemapJarTask, dependsOn: jar) {
|
||||
|
|
|
@ -62,7 +62,7 @@ public final class EventFactory {
|
|||
/**
|
||||
* Create an "array-backed" Event instance with a custom empty invoker.
|
||||
* <p>
|
||||
* Having a custom empty invoker (of type (...) -> {}) increases performance
|
||||
* Having a custom empty invoker (of type (...) -> {}) increases performance
|
||||
* relative to iterating over an empty array; however, it only really matters
|
||||
* if the event is executed thousands of times a second.
|
||||
*
|
||||
|
|
|
@ -20,11 +20,8 @@ import com.mojang.brigadier.CommandDispatcher;
|
|||
import net.fabricmc.fabric.impl.registry.CommandRegistryImpl;
|
||||
import net.minecraft.server.command.CommandManager;
|
||||
import net.minecraft.server.command.ServerCommandSource;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.Unique;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
|
|
@ -28,7 +28,7 @@ public interface ScreenProviderRegistry {
|
|||
ScreenProviderRegistry INSTANCE = ScreenProviderRegistryImpl.INSTANCE;
|
||||
|
||||
/**
|
||||
* Register a "Container -> ContainerScreen" factory. This is used only on the client side.
|
||||
* Register a "Container -> ContainerScreen" factory. This is used only on the client side.
|
||||
*
|
||||
* @param identifier a shared identifier, this identifier should also be used to register a container using {@link ContainerProviderRegistry}
|
||||
* @param containerScreenFactory the supplier that should be used to create the new gui
|
||||
|
@ -36,8 +36,8 @@ public interface ScreenProviderRegistry {
|
|||
<C extends Container> void registerFactory(Identifier identifier, ContainerScreenFactory<C> containerScreenFactory);
|
||||
|
||||
/**
|
||||
* Register a "packet -> ContainerScreen" factory. This is used only on the client side, and allows you
|
||||
* to override the default behaviour of re-using the existing "packet -> Container" logic.
|
||||
* Register a "packet -> ContainerScreen" factory. This is used only on the client side, and allows you
|
||||
* to override the default behaviour of re-using the existing "packet -> Container" logic.
|
||||
*
|
||||
* @param identifier a shared identifier, this identifier should also be used to register a container using {@link ContainerProviderRegistry}
|
||||
* @param factory the gui factory, this should return a new {@link AbstractContainerScreen}
|
||||
|
|
|
@ -29,7 +29,7 @@ public interface ContainerFactory<T> {
|
|||
* @param syncId The container synchronization ID.
|
||||
* @param identifier the Identifier is the name that was used when registering the factory
|
||||
* @param player the player that is opening the gui/container
|
||||
* @param buf the buffer contains the same data that was provided with {@Link ContainerProviderRegistry.openContainer}
|
||||
* @param buf the buffer contains the same data that was provided with {@link net.fabricmc.fabric.api.container.ContainerProviderRegistry#openContainer}
|
||||
* @return the new gui or container
|
||||
*/
|
||||
T create(int syncId, Identifier identifier, PlayerEntity player, PacketByteBuf buf);
|
||||
|
|
|
@ -31,7 +31,7 @@ public interface ContainerProviderRegistry {
|
|||
ContainerProviderRegistry INSTANCE = ContainerProviderImpl.INSTANCE;
|
||||
|
||||
/**
|
||||
* Register a "packet buffer -> container" factory. This is used both on the client and server side.
|
||||
* Register a "packet buffer -> container" factory. This is used both on the client and server side.
|
||||
*
|
||||
* @param identifier a shared identifier, this identifier should also be used to register a container using {@link ScreenProviderRegistry}
|
||||
* @param factory the ContainerFactory that should return a new {@link Container}
|
||||
|
|
|
@ -17,8 +17,8 @@
|
|||
package net.fabricmc.fabric.api.registry;
|
||||
|
||||
import net.fabricmc.fabric.impl.registry.LootEntryTypeRegistryImpl;
|
||||
import net.minecraft.world.loot.entry.LootEntry;
|
||||
|
||||
import net.minecraft.world.loot.entry.LootEntry;
|
||||
/**
|
||||
* @deprecated Use {@link net.fabricmc.fabric.api.loot.v1.LootEntryTypeRegistry}
|
||||
*/
|
||||
|
|
|
@ -17,24 +17,11 @@
|
|||
package net.fabricmc.fabric.api.loot.v1;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import net.minecraft.resource.Resource;
|
||||
import net.minecraft.resource.ResourceManager;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.JsonHelper;
|
||||
import net.minecraft.util.Lazy;
|
||||
import net.minecraft.world.loot.*;
|
||||
import net.minecraft.world.loot.condition.LootCondition;
|
||||
import net.minecraft.world.loot.entry.LootEntry;
|
||||
import net.minecraft.world.loot.function.LootFunction;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.Reader;
|
||||
import java.lang.reflect.Field;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Optional;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
public final class LootJsonParser {
|
||||
|
|
|
@ -25,7 +25,6 @@ import net.minecraft.util.Identifier;
|
|||
import net.minecraft.util.profiler.Profiler;
|
||||
import net.minecraft.world.loot.LootManager;
|
||||
import net.minecraft.world.loot.LootSupplier;
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
|
|
|
@ -26,7 +26,6 @@ import net.minecraft.util.Identifier;
|
|||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.Unique;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
|
|
|
@ -26,7 +26,7 @@ import java.util.Collection;
|
|||
/**
|
||||
* Event for listening to packet type registrations and unregistrations
|
||||
* (also known as "minecraft:register" and "minecraft:unregister")
|
||||
* in the client -> server direction.
|
||||
* in the client -> server direction.
|
||||
*/
|
||||
public interface C2SPacketTypeCallback {
|
||||
static final Event<C2SPacketTypeCallback> REGISTERED = EventFactory.createArrayBacked(
|
||||
|
|
|
@ -25,7 +25,7 @@ import java.util.Collection;
|
|||
/**
|
||||
* Event for listening to packet type registrations and unregistrations
|
||||
* (also known as "minecraft:register" and "minecraft:unregister")
|
||||
* in the server -> client direction.
|
||||
* in the server -> client direction.
|
||||
*/
|
||||
public interface S2CPacketTypeCallback {
|
||||
static final Event<S2CPacketTypeCallback> REGISTERED = EventFactory.createArrayBacked(
|
||||
|
|
|
@ -28,8 +28,8 @@ import net.minecraft.util.PacketByteBuf;
|
|||
* <p>
|
||||
* It is used for:
|
||||
* <p>
|
||||
* - registering client-side packet receivers (server -> client packets)
|
||||
* - sending packets to the server (client -> server packets).
|
||||
* - registering client-side packet receivers (server -> client packets)
|
||||
* - sending packets to the server (client -> server packets).
|
||||
*/
|
||||
public interface ClientSidePacketRegistry extends PacketRegistry {
|
||||
static final ClientSidePacketRegistry INSTANCE = new ClientSidePacketRegistryImpl();
|
||||
|
|
|
@ -30,8 +30,8 @@ import net.minecraft.util.PacketByteBuf;
|
|||
* <p>
|
||||
* It is used for:
|
||||
* <p>
|
||||
* - registering server-side packet receivers (client -> server packets)
|
||||
* - sending packets to clients (server -> client packets).
|
||||
* - registering server-side packet receivers (client -> server packets)
|
||||
* - sending packets to clients (server -> client packets).
|
||||
* <p>
|
||||
* For iterating over clients in a server, see {@link PlayerStream}.
|
||||
*/
|
||||
|
|
|
@ -23,7 +23,6 @@ import net.fabricmc.fabric.api.network.ClientSidePacketRegistry;
|
|||
import net.fabricmc.fabric.api.network.PacketContext;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.network.ClientPlayNetworkHandler;
|
||||
import net.minecraft.client.network.packet.CustomPayloadS2CPacket;
|
||||
import net.minecraft.network.Packet;
|
||||
import net.minecraft.server.network.packet.CustomPayloadC2SPacket;
|
||||
import net.minecraft.util.Identifier;
|
||||
|
|
|
@ -24,10 +24,8 @@ import net.fabricmc.fabric.api.network.ServerSidePacketRegistry;
|
|||
import net.minecraft.client.network.packet.CustomPayloadS2CPacket;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.network.Packet;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.server.network.ServerPlayNetworkHandler;
|
||||
import net.minecraft.server.network.ServerPlayerEntity;
|
||||
import net.minecraft.server.network.packet.CustomPayloadC2SPacket;
|
||||
import net.minecraft.server.network.packet.LoginQueryResponseC2SPacket;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.PacketByteBuf;
|
||||
|
|
|
@ -20,7 +20,6 @@ import net.fabricmc.api.EnvType;
|
|||
import net.fabricmc.fabric.api.network.ClientSidePacketRegistry;
|
||||
import net.fabricmc.fabric.api.network.PacketContext;
|
||||
import net.fabricmc.fabric.impl.network.ClientSidePacketRegistryImpl;
|
||||
import net.fabricmc.fabric.impl.network.PacketDebugOptions;
|
||||
import net.fabricmc.fabric.impl.network.PacketRegistryImpl;
|
||||
import net.fabricmc.fabric.impl.network.PacketTypes;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
|
|
|
@ -19,9 +19,7 @@ package net.fabricmc.fabric.mixin.network;
|
|||
import net.fabricmc.fabric.impl.network.ClientSidePacketRegistryImpl;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.gui.screen.Screen;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
|
||||
package net.fabricmc.fabric.mixin.network;
|
||||
|
||||
import net.fabricmc.fabric.api.network.PacketRegistry;
|
||||
import net.fabricmc.fabric.api.network.ServerSidePacketRegistry;
|
||||
import net.fabricmc.fabric.impl.network.PacketRegistryImpl;
|
||||
import net.fabricmc.fabric.impl.network.ServerSidePacketRegistryImpl;
|
||||
|
|
|
@ -20,7 +20,6 @@ import net.fabricmc.api.EnvType;
|
|||
import net.fabricmc.fabric.api.network.PacketContext;
|
||||
import net.fabricmc.fabric.api.network.ServerSidePacketRegistry;
|
||||
import net.fabricmc.fabric.impl.network.CustomPayloadC2SPacketAccessor;
|
||||
import net.fabricmc.fabric.impl.network.PacketDebugOptions;
|
||||
import net.fabricmc.fabric.impl.network.ServerSidePacketRegistryImpl;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
|
@ -28,7 +27,6 @@ import net.minecraft.server.network.ServerPlayNetworkHandler;
|
|||
import net.minecraft.server.network.ServerPlayerEntity;
|
||||
import net.minecraft.server.network.packet.CustomPayloadC2SPacket;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.PacketByteBuf;
|
||||
import net.minecraft.util.ThreadExecutor;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
|
|
|
@ -25,7 +25,7 @@ import java.util.HashMap;
|
|||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Registry for server->client entity tracking values.
|
||||
* Registry for server->client entity tracking values.
|
||||
*
|
||||
* @deprecated Use FabricEntityTypeBuilder methods
|
||||
*/
|
||||
|
|
|
@ -29,7 +29,7 @@ import java.util.function.Function;
|
|||
|
||||
/**
|
||||
* Extended version of {@link EntityType.Builder} with added registration for
|
||||
* server->client entity tracking values.
|
||||
* server->client entity tracking values.
|
||||
*
|
||||
* @param <T> Entity class.
|
||||
*/
|
||||
|
|
|
@ -32,7 +32,6 @@ import net.minecraft.util.Identifier;
|
|||
import net.minecraft.util.PacketByteBuf;
|
||||
import net.minecraft.util.registry.MutableRegistry;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import net.minecraft.util.registry.SimpleRegistry;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ public interface RemappableRegistry {
|
|||
*/
|
||||
enum RemapMode {
|
||||
/**
|
||||
* Any differences (local->remote, remote->local) are allowed. This should
|
||||
* Any differences (local->remote, remote->local) are allowed. This should
|
||||
* be used when a side is authoritative (f.e. loading a world on the server).
|
||||
*/
|
||||
AUTHORITATIVE,
|
||||
|
|
|
@ -16,14 +16,12 @@
|
|||
|
||||
package net.fabricmc.fabric.mixin.registry;
|
||||
|
||||
import net.fabricmc.fabric.impl.registry.ListenableRegistry;
|
||||
import net.fabricmc.fabric.impl.registry.trackers.*;
|
||||
import net.fabricmc.fabric.impl.registry.trackers.vanilla.BiomeParentTracker;
|
||||
import net.fabricmc.fabric.impl.registry.trackers.vanilla.BlockInitTracker;
|
||||
import net.fabricmc.fabric.impl.registry.trackers.vanilla.BlockItemTracker;
|
||||
import net.minecraft.Bootstrap;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.fluid.Fluid;
|
||||
import net.minecraft.fluid.Fluids;
|
||||
|
|
|
@ -25,10 +25,8 @@ import org.spongepowered.asm.mixin.Shadow;
|
|||
import org.spongepowered.asm.mixin.Unique;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.IdentityHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
@Mixin(IdList.class)
|
||||
public class MixinIdList implements RemovableIdList<Object> {
|
||||
|
|
|
@ -16,8 +16,6 @@
|
|||
|
||||
package net.fabricmc.fabric.mixin.registry;
|
||||
|
||||
import net.fabricmc.fabric.api.network.ServerSidePacketRegistry;
|
||||
import net.fabricmc.fabric.impl.network.PacketRegistryImpl;
|
||||
import net.fabricmc.fabric.impl.registry.RegistrySyncManager;
|
||||
import net.minecraft.network.ClientConnection;
|
||||
import net.minecraft.server.PlayerManager;
|
||||
|
|
|
@ -48,7 +48,7 @@ public interface MaterialFinder {
|
|||
|
||||
/**
|
||||
*
|
||||
* Reserved for future use. Behavior for values > 1 is currently undefined.
|
||||
* Reserved for future use. Behavior for values > 1 is currently undefined.
|
||||
*/
|
||||
MaterialFinder spriteDepth(int depth);
|
||||
|
||||
|
|
|
@ -75,7 +75,7 @@ public interface RenderMaterial {
|
|||
|
||||
/**
|
||||
* How many sprite color/uv coordinates are in the material.
|
||||
* Behavior for values > 1 is currently undefined.
|
||||
* Behavior for values > 1 is currently undefined.
|
||||
* See {@link MaterialFinder#spriteDepth(int)}
|
||||
*/
|
||||
int spriteDepth();
|
||||
|
|
|
@ -24,7 +24,7 @@ import net.fabricmc.fabric.api.renderer.v1.Renderer;
|
|||
* A bundle of one or more {@link QuadView} instances encoded by the renderer,
|
||||
* typically via {@link Renderer#meshBuilder()}.<p>
|
||||
*
|
||||
* Similar in purpose to the List<BakedQuad> instances returned by BakedModel, but
|
||||
* Similar in purpose to the {@code List<BakedQuad>} instances returned by BakedModel, but
|
||||
* affords the renderer the ability to optimize the format for performance
|
||||
* and memory allocation.<p>
|
||||
*
|
||||
|
|
|
@ -162,7 +162,7 @@ public interface MutableQuadView extends QuadView {
|
|||
MutableQuadView pos(int vertexIndex, float x, float y, float z);
|
||||
|
||||
/**
|
||||
* Same as {@link #pos(float, float, float)} but accepts vector type.
|
||||
* Same as {@link #pos(int, float, float, float)} but accepts vector type.
|
||||
*/
|
||||
default MutableQuadView pos(int vertexIndex, Vector3f vec) {
|
||||
return pos(vertexIndex, vec.getX(), vec.getY(), vec.getZ());
|
||||
|
@ -180,7 +180,7 @@ public interface MutableQuadView extends QuadView {
|
|||
MutableQuadView normal(int vertexIndex, float x, float y, float z);
|
||||
|
||||
/**
|
||||
* Same as {@link #normal(float, float, float, extra)} but accepts vector type.
|
||||
* Same as {@link #normal(int, float, float, float)} but accepts vector type.
|
||||
*/
|
||||
default MutableQuadView normal(int vertexIndex, Vector3f vec) {
|
||||
return normal(vertexIndex, vec.getX(), vec.getY(), vec.getZ());
|
||||
|
@ -210,12 +210,12 @@ public interface MutableQuadView extends QuadView {
|
|||
}
|
||||
|
||||
/**
|
||||
* Set sprite color. Behavior for spriteIndex values > 0 is currently undefined.
|
||||
* Set sprite color. Behavior for {@code spriteIndex > 0} is currently undefined.
|
||||
*/
|
||||
MutableQuadView spriteColor(int vertexIndex, int spriteIndex, int color);
|
||||
|
||||
/**
|
||||
* Convenience: set sprite color for all vertices at once. Behavior for spriteIndex values > 0 is currently undefined.
|
||||
* Convenience: set sprite color for all vertices at once. Behavior for {@code spriteIndex > 0} is currently undefined.
|
||||
*/
|
||||
default MutableQuadView spriteColor(int spriteIndex, int c0, int c1, int c2, int c3) {
|
||||
spriteColor(0, spriteIndex, c0);
|
||||
|
@ -226,7 +226,7 @@ public interface MutableQuadView extends QuadView {
|
|||
}
|
||||
|
||||
/**
|
||||
* Set sprite atlas coordinates. Behavior for spriteIndex values > 0 is currently undefined.
|
||||
* Set sprite atlas coordinates. Behavior for {@code spriteIndex > 0} is currently undefined.
|
||||
*/
|
||||
MutableQuadView sprite(int vertexIndex, int spriteIndex, float u, float v);
|
||||
|
||||
|
@ -234,7 +234,7 @@ public interface MutableQuadView extends QuadView {
|
|||
* Assigns sprite atlas u,v coordinates to this quad for the given sprite.
|
||||
* Can handle UV locking, rotation, interpolation, etc. Control this behavior
|
||||
* by passing additive combinations of the BAKE_ flags defined in this interface.
|
||||
* Behavior for spriteIndex values > 0 is currently undefined.
|
||||
* Behavior for {@code spriteIndex > 0} is currently undefined.
|
||||
*/
|
||||
MutableQuadView spriteBake(int spriteIndex, Sprite sprite, int bakeFlags);
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ import net.minecraft.util.math.MathHelper;
|
|||
* Specialized {@link MutableQuadView} obtained via {@link MeshBuilder#getEmitter()}
|
||||
* to append quads during mesh building.<p>
|
||||
*
|
||||
* Also obtained from {@link RenderContext#getEmitter(RenderMaterial)} to submit
|
||||
* Also obtained from {@link RenderContext#getEmitter()} to submit
|
||||
* dynamic quads one-by-one at render time.<p>
|
||||
*
|
||||
* Instances of {@link QuadEmitter} will practically always be
|
||||
|
|
|
@ -35,7 +35,7 @@ public interface QuadView {
|
|||
* vertex data in the given array and location.<p>
|
||||
*
|
||||
* @param spriteIndex The sprite to be used for the quad.
|
||||
* Behavior for values > 0 is currently undefined.
|
||||
* Behavior for values > 0 is currently undefined.
|
||||
*
|
||||
* @param target Target array for the baked quad data.
|
||||
*
|
||||
|
@ -49,9 +49,9 @@ public interface QuadView {
|
|||
|
||||
/**
|
||||
* Extracts all quad properties except material to the given {@link MutableQuadView} instance.
|
||||
* Must be used before calling {@link MutableQuadView#emit()} on the target instance.
|
||||
* Must be used before calling {link QuadEmitter#emit()} on the target instance.
|
||||
* Meant for re-texturing, analysis and static transformation use cases.
|
||||
*/
|
||||
*/
|
||||
void copyTo(MutableQuadView target);
|
||||
|
||||
/**
|
||||
|
@ -98,12 +98,12 @@ public interface QuadView {
|
|||
* Generates a new BakedQuad instance with texture
|
||||
* coordinates and colors from the given sprite.<p>
|
||||
*
|
||||
* @param source Data previously packed by {@link MeshBuilder}.
|
||||
* param source Data previously packed by {@link MeshBuilder}.
|
||||
*
|
||||
* @param sourceIndex Index where packed data starts.
|
||||
* param sourceIndex Index where packed data starts.
|
||||
*
|
||||
* @param spriteIndex The sprite to be used for the quad.
|
||||
* Behavior for values > 0 is currently undefined.
|
||||
* Behavior for {@code spriteIndex > 0} is currently undefined.
|
||||
*
|
||||
* @param sprite {@link MutableQuadView} does not serialize sprites
|
||||
* so the sprite must be provided by the caller.
|
||||
|
@ -130,7 +130,6 @@ public interface QuadView {
|
|||
/**
|
||||
* Pass a non-null target to avoid allocation - will be returned with values.
|
||||
* Otherwise returns a new instance.
|
||||
* See {@link VertexEditor#pos(float, float, float)}
|
||||
*/
|
||||
Vector3f copyPos(int vertexIndex, Vector3f target);
|
||||
|
||||
|
@ -157,7 +156,6 @@ public interface QuadView {
|
|||
/**
|
||||
* If false, no vertex normal was provided.
|
||||
* Lighting should use face normal in that case.
|
||||
* See {@link VertexEditor#normal(float, float, float, float)}
|
||||
*/
|
||||
boolean hasNormal(int vertexIndex);
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@ public interface FabricBakedModel {
|
|||
|
||||
* Fabric overrides to true for vanilla baked models.
|
||||
* Enhanced models that use this API should return false,
|
||||
* otherwise the API will not recognize the model.<p>
|
||||
* otherwise the API will not recognize the model. <p>
|
||||
*/
|
||||
boolean isVanillaAdapter();
|
||||
|
||||
|
@ -79,12 +79,12 @@ public interface FabricBakedModel {
|
|||
* parameter is normally initialized with the same seed prior to each face layer.
|
||||
* Model authors should note this method is called only once per block, and call the provided
|
||||
* Random supplier multiple times if re-seeding is necessary. For wrapped vanilla baked models,
|
||||
* it will probably be easier to use {@link RenderContext#fallbackModelConsumer()} which handles
|
||||
* it will probably be easier to use {@link RenderContext#fallbackConsumer} which handles
|
||||
* re-seeding per face automatically.<p>
|
||||
*
|
||||
* @param Access to world state. Using {@link TerrainBlockView#getCachedRenderData(BlockPos)} to
|
||||
* @param blockView Access to world state. Using {@link net.fabricmc.fabric.api.rendering.data.v1.RenderAttachedBlockView#getBlockEntityRenderAttachment(BlockPos)} to
|
||||
* retrieve block entity state unless thread safety can be guaranteed.
|
||||
* @param safeBlockEntityAccessor Thread-safe access to block entity data
|
||||
* param safeBlockEntityAccessor Thread-safe access to block entity data
|
||||
* @param state Block state for model being rendered.
|
||||
* @param pos Position of block for model being rendered.
|
||||
* @param randomSupplier Random object seeded per vanilla conventions. Call multiple times to re-seed.
|
||||
|
@ -92,7 +92,7 @@ public interface FabricBakedModel {
|
|||
* @param context Accepts model output.
|
||||
*/
|
||||
void emitBlockQuads(ExtendedBlockView blockView, BlockState state, BlockPos pos, Supplier<Random> randomSupplier, RenderContext context);
|
||||
|
||||
|
||||
/**
|
||||
* This method will be called during item rendering to generate both the static and
|
||||
* dynamic portions of an item model when the model implements this interface and
|
||||
|
@ -111,13 +111,13 @@ public interface FabricBakedModel {
|
|||
*
|
||||
* Implementing this method does NOT mitigate the need to implement a functional
|
||||
* {@link BakedModel#getItemPropertyOverrides()} method, because this method will be called
|
||||
* on the <em>result</em> of {@link #getItemPropertyOverrides()}. However, that
|
||||
* on the <em>result</em> of {@link BakedModel#getItemPropertyOverrides}. However, that
|
||||
* method can simply return the base model because the output from this method will
|
||||
* be used for rendering.<p>
|
||||
*
|
||||
* Renderer implementations should also use this method to obtain the quads used
|
||||
* for item enchantment glint rendering. This means models can put geometric variation
|
||||
* logic here, instead of returning every possible shape from {@link #getItemPropertyOverrides()}
|
||||
* logic here, instead of returning every possible shape from {@link BakedModel#getItemPropertyOverrides}
|
||||
* as vanilla baked models.
|
||||
*/
|
||||
void emitItemQuads(ItemStack stack, Supplier<Random> randomSupplier, RenderContext context);
|
||||
|
|
|
@ -51,7 +51,7 @@ public abstract class ModelHelper {
|
|||
* Use to decode a result from {@link #toFaceIndex(Direction)}.
|
||||
* Return value will be null if encoded value was null.
|
||||
* Can also be used for no-allocation iteration of {@link Direction#values()},
|
||||
* optionally including the null face. (Use < or <= {@link #NULL_FACE_ID}
|
||||
* optionally including the null face. (Use < or <= {@link #NULL_FACE_ID}
|
||||
* to exclude or include the null value, respectively.)
|
||||
*/
|
||||
public static Direction faceFromIndex(int faceIndex) {
|
||||
|
|
|
@ -75,7 +75,7 @@ public interface RenderContext {
|
|||
void pushTransform(QuadTransform transform);
|
||||
|
||||
/**
|
||||
* Removes the transformation added by the last call to {@link #pushTransform(Consumer)}.
|
||||
* Removes the transformation added by the last call to {@link #pushTransform(QuadTransform)}.
|
||||
* MUST be called before exiting from {@link FabricBakedModel} .emit... methods.
|
||||
*/
|
||||
void popTransform();
|
||||
|
|
|
@ -82,7 +82,7 @@ public abstract class ColorHelper {
|
|||
}
|
||||
|
||||
/**
|
||||
* Same results as {@link BakedQuadFactory#method_3456()}
|
||||
* Same results as {@link BakedQuadFactory#method_3456(Direction)}
|
||||
*/
|
||||
public static float diffuseShade(Direction direction) {
|
||||
return FACE_SHADE_FACTORS[direction.getId()];
|
||||
|
@ -110,7 +110,7 @@ public abstract class ColorHelper {
|
|||
|
||||
/**
|
||||
* Returns {@link #diffuseShade(Direction)} if quad is aligned to light face,
|
||||
* otherwise uses face normal and {@link #normalShade()}
|
||||
* otherwise uses face normal and {@link #normalShade}
|
||||
*/
|
||||
public static float faceShade(ShadeableQuad quad) {
|
||||
return quad.isFaceAligned() ? diffuseShade(quad.lightFace()) : normalShade(quad.faceNormal());
|
||||
|
|
|
@ -42,7 +42,7 @@ public abstract class EncodingFormat {
|
|||
public static final int NORMALS_OFFSET_VANILLA = VANILLA_STRIDE;
|
||||
// normals are followed by 0-2 sets of color/uv coordinates
|
||||
static final int TEXTURE_STRIDE = 12;
|
||||
/** is one tex stride less than the actual base, because when used tex index is >= 1 */
|
||||
/** is one tex stride less than the actual base, because when used tex index is >= 1 */
|
||||
static final int TEXTURE_OFFSET_MINUS = NORMALS_OFFSET + NORMALS_STRIDE - TEXTURE_STRIDE;
|
||||
static final int SECOND_TEXTURE_OFFSET = NORMALS_OFFSET + NORMALS_STRIDE;
|
||||
static final int THIRD_TEXTURE_OFFSET = SECOND_TEXTURE_OFFSET + TEXTURE_STRIDE;
|
||||
|
|
|
@ -25,7 +25,7 @@ import net.fabricmc.indigo.renderer.helper.GeometryHelper;
|
|||
/**
|
||||
* Our implementation of {@link MeshBuilder}, used for static mesh creation and baking.
|
||||
* Not much to it - mainly it just needs to grow the int[] array as quads are appended
|
||||
* and maintain/provide a properly-configured {@link MutableQuadView} instance.
|
||||
* and maintain/provide a properly-configured {@link net.fabricmc.fabric.api.renderer.v1.mesh.MutableQuadView} instance.
|
||||
* All the encoding and other work is handled in the quad base classes.
|
||||
* The one interesting bit is in {@link Maker#emit()}.
|
||||
*/
|
||||
|
|
|
@ -21,7 +21,7 @@ import net.minecraft.util.math.BlockPos;
|
|||
import net.minecraft.world.ExtendedBlockView;
|
||||
|
||||
/**
|
||||
* BlockView-extending interface to be used by {@link FabricBakedModel} for dynamic model
|
||||
* BlockView-extending interface to be used by {@link net.fabricmc.fabric.api.renderer.v1.model.FabricBakedModel} for dynamic model
|
||||
* customization. It ensures thread safety and exploits data cached in render
|
||||
* chunks for performance and data consistency.<p>
|
||||
*
|
||||
|
@ -29,7 +29,7 @@ import net.minecraft.world.ExtendedBlockView;
|
|||
*
|
||||
* BlockEntity implementations that provide data for model customization should implement
|
||||
* {@link RenderAttachmentBlockEntity} which will be queried on the main thread when a render
|
||||
* chunk is enqueued for rebuild. The model should retrieve the results via {@link #getCachedRenderData()}.
|
||||
* chunk is enqueued for rebuild. The model should retrieve the results via {@link #getBlockEntityRenderAttachment(BlockPos)}.
|
||||
* While {@link #getBlockEntity(net.minecraft.util.math.BlockPos)} is not disabled, it
|
||||
* is not thread-safe for use on render threads. Models that violate this guidance are
|
||||
* responsible for any necessary synchronization or collision detection.<p>
|
||||
|
@ -37,7 +37,7 @@ import net.minecraft.world.ExtendedBlockView;
|
|||
* {@link #getBlockState(net.minecraft.util.math.BlockPos)} and {@link #getFluidState(net.minecraft.util.math.BlockPos)}
|
||||
* will always reflect the state cached with the render chunk. Block and fluid states
|
||||
* can thus be different from main-thread world state due to lag between block update
|
||||
* application from network packets and render chunk rebuilds. Use of {@link #getCachedRenderData()}
|
||||
* application from network packets and render chunk rebuilds. Use of {link #getCachedRenderData()}
|
||||
* will ensure consistency of model state with the rest of the chunk being rendered.<p>
|
||||
*
|
||||
* Models should avoid using {@link ExtendedBlockView#getBlockEntity(BlockPos)}
|
||||
|
@ -48,6 +48,7 @@ import net.minecraft.world.ExtendedBlockView;
|
|||
*
|
||||
* This interface is only guaranteed to be present in the client environment.
|
||||
*/
|
||||
// XXX can not link net.fabricmc.fabric.api.renderer.v1.model.FabricBakedModel
|
||||
public interface RenderAttachedBlockView extends ExtendedBlockView {
|
||||
/**
|
||||
* For models associated with Block Entities that implement {@link RenderAttachmentBlockEntity}
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
|
||||
package net.fabricmc.fabric.mixin.tag;
|
||||
|
||||
import com.google.common.collect.Sets;
|
||||
import com.google.gson.JsonObject;
|
||||
import net.fabricmc.fabric.api.tag.FabricTagBuilder;
|
||||
import net.fabricmc.fabric.impl.tag.FabricTagHooks;
|
||||
|
@ -27,12 +26,10 @@ import org.spongepowered.asm.mixin.Shadow;
|
|||
import org.spongepowered.asm.mixin.Unique;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
@Mixin(Tag.Builder.class)
|
||||
public class MixinTagBuilder<T> implements FabricTagBuilder<T> {
|
||||
|
|
|
@ -22,7 +22,6 @@ import net.minecraft.client.texture.Sprite;
|
|||
import net.minecraft.client.texture.SpriteAtlasTexture;
|
||||
import net.minecraft.util.Identifier;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
|
|
|
@ -21,7 +21,6 @@ import net.fabricmc.fabric.api.event.EventFactory;
|
|||
import net.fabricmc.fabric.api.event.client.ClientSpriteRegistryCallback;
|
||||
import net.minecraft.util.Identifier;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.locks.Lock;
|
||||
|
|
|
@ -19,13 +19,10 @@ package net.fabricmc.fabric.mixin.client.texture;
|
|||
import com.google.common.base.Joiner;
|
||||
import net.fabricmc.fabric.api.client.texture.*;
|
||||
import net.fabricmc.fabric.api.event.client.ClientSpriteRegistryCallback;
|
||||
import net.fabricmc.fabric.impl.client.texture.FabricSprite;
|
||||
import net.fabricmc.fabric.impl.client.texture.SpriteAtlasTextureHooks;
|
||||
import net.fabricmc.fabric.impl.client.texture.SpriteRegistryCallbackHolder;
|
||||
import net.minecraft.client.resource.metadata.AnimationResourceMetadata;
|
||||
import net.minecraft.client.texture.Sprite;
|
||||
import net.minecraft.client.texture.SpriteAtlasTexture;
|
||||
import net.minecraft.client.util.PngFile;
|
||||
import net.minecraft.resource.ResourceManager;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.crash.CrashException;
|
||||
|
@ -39,7 +36,6 @@ import org.spongepowered.asm.mixin.Unique;
|
|||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.ModifyVariable;
|
||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
|
||||
import java.io.IOException;
|
||||
|
|
Loading…
Reference in a new issue