mirror of
https://github.com/GTNewHorizons/Angelica.git
synced 2026-11-28 15:55:58 +00:00
* Remove ARR assets * Refactor leaf mixins * Refactor asset loading Introduces a resource reload in POSTINIT, just before loading models * Move lectern model to template * Unlink test blocks and injected QuadProviders Now they can be enabled or disabled separately * Replace log renderer * Fix JSON model culling * Actually fix culling this time * Update NdQuadBuilder.java * Remove unused method * Support tris Hasn't been tested * Pull QuadBuilder into an API * Move Variant and Loader to API * Glass QP and minor FluidRenderer improvement * Rename Loader * Move injected QuadProviders to a field This way they don't get inherited * Prioritize 7.10 textures over modern * Use JSON models for vanilla logs * Add a rewind method This doesn't fix the problem, but it looks interesting, maybe it's closer? * Fix texture loading * Reenable rewinding * FRAPI AO builds Still useless tho * Super broken, but maybe salvageable? * Revert "Super broken, but maybe salvageable?" This reverts commit ef4352f0d82f93039547bacdd38bddca65193743. * Revert "FRAPI AO builds" This reverts commit 7a4fd800831f973ea25c6a3c2b088afcf224770f. * Cleanroom Mojang's rewinder * Not-really-working-rewinding * Mark JSON API as beta * Ew, star imports * Update gtnh gradle * Update dependencies.gradle * Update dependencies.gradle --------- Co-authored-by: Jason Mitchell <[email protected]>
50 lines
2.0 KiB
Java
50 lines
2.0 KiB
Java
package com.gtnewhorizons.angelica.api;
|
|
|
|
import net.minecraft.block.Block;
|
|
import net.minecraft.world.IBlockAccess;
|
|
import net.minecraftforge.common.util.ForgeDirection;
|
|
|
|
import java.util.List;
|
|
import java.util.Random;
|
|
import java.util.function.Supplier;
|
|
|
|
public interface QuadProvider {
|
|
|
|
int R_MASK = 0xFF << 16;
|
|
int G_MASK = 0xFF << 8;
|
|
int B_MASK = 0xFF;
|
|
|
|
/**
|
|
* Called once per block and returns the color packed as ABGR. If you want to vary colors within a block, just
|
|
* ignore the color passed into {@link #getQuads} and use your own function, don't override this. But if you only
|
|
* want to change color once per block, like vanilla leaves, override this. The default vanilla adapter is
|
|
* {@link #getDefaultColor}
|
|
*/
|
|
default int getColor(IBlockAccess world, BlockPos pos, Block block, int meta, Random random) {
|
|
|
|
return -1;
|
|
}
|
|
|
|
static int getDefaultColor(IBlockAccess world, BlockPos pos, Block block) {
|
|
|
|
final int cin = block.colorMultiplier(world, pos.getX(), pos.getY(), pos.getZ());
|
|
return (0xFF << 24) | ((cin & B_MASK) << 16) | (cin & G_MASK) | ((cin & R_MASK) >>> 16);
|
|
}
|
|
|
|
/**
|
|
* If you need to allocate new quads, set this to true. If true, the quads returned by {@link #getQuads} are
|
|
* recycled, and you should not keep a reference to them. Example: stone can return a static list every time, but a
|
|
* modded block which adds or removes quads based on location would need dynamic quads.
|
|
*/
|
|
default boolean isDynamic() {
|
|
return false;
|
|
}
|
|
|
|
/**
|
|
* Provide quads to render. If you need new quads, they should be obtained with the passed supplier and
|
|
* {@link #isDynamic} overridden to return true. If so, all quads in the list are recycled and references to them
|
|
* should not be kept.
|
|
*/
|
|
List<QuadView> getQuads(IBlockAccess world, BlockPos pos, Block block, int meta, ForgeDirection dir, Random random, int color, Supplier<QuadView> quadPool);
|
|
}
|