mirror of
https://github.com/GTNewHorizons/Angelica.git
synced 2026-11-27 23:46:01 +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]>
56 lines
1.8 KiB
Java
56 lines
1.8 KiB
Java
package com.gtnewhorizons.angelica.models;
|
|
|
|
import com.gtnewhorizons.angelica.api.BlockPos;
|
|
import com.gtnewhorizons.angelica.api.QuadBuilder;
|
|
import com.gtnewhorizons.angelica.api.QuadProvider;
|
|
import com.gtnewhorizons.angelica.api.QuadView;
|
|
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
|
import it.unimi.dsi.fastutil.objects.ObjectImmutableList;
|
|
import net.minecraft.block.Block;
|
|
import net.minecraft.util.IIcon;
|
|
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 class DynamicCubeModel implements QuadProvider {
|
|
|
|
/*
|
|
* By the power of ~~theft~~ inspiration, this class is wayyy simpler.
|
|
* It's also a basic example of dynamic model building.
|
|
*/
|
|
|
|
public static final ThreadLocal<DynamicCubeModel> INSTANCE = ThreadLocal.withInitial(DynamicCubeModel::new);
|
|
private final NdQuadBuilder builder = new NdQuadBuilder();
|
|
private static final List<QuadView> EMPTY = ObjectImmutableList.of();
|
|
private final List<QuadView> ONE = new ObjectArrayList<>(1);
|
|
|
|
public DynamicCubeModel() {
|
|
|
|
this.ONE.add(null);
|
|
}
|
|
|
|
@Override
|
|
public boolean isDynamic() {
|
|
return true;
|
|
}
|
|
|
|
@Override
|
|
public List<QuadView> getQuads(IBlockAccess world, BlockPos pos, Block block, int meta, ForgeDirection dir, Random random, int color, Supplier<QuadView> quadPool) {
|
|
|
|
if (dir == ForgeDirection.UNKNOWN)
|
|
return EMPTY;
|
|
|
|
this.builder.square(dir, 0, 0, 1, 1, 0);
|
|
final IIcon tex = block.getIcon(dir.ordinal(), meta);
|
|
this.builder.spriteBake(tex, QuadBuilder.BAKE_LOCK_UV);
|
|
|
|
this.builder.setColors(color);
|
|
|
|
ONE.set(0, this.builder.build(quadPool.get()));
|
|
return ONE;
|
|
}
|
|
}
|