Pattern Rendering and other Rendering

This commit is contained in:
Sebastian Hartte
2020-07-20 20:13:20 +02:00
parent d053c9b1bc
commit 019f570331
69 changed files with 994 additions and 1398 deletions
@@ -0,0 +1,311 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
*
* Applied Energistics 2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Applied Energistics 2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
package appeng.client.render.crafting;
import java.util.Collections;
import java.util.EnumSet;
import java.util.List;
import java.util.Random;
import java.util.function.Supplier;
import javax.annotation.Nullable;
import net.fabricmc.fabric.api.renderer.v1.model.FabricBakedModel;
import net.fabricmc.fabric.api.renderer.v1.render.RenderContext;
import net.fabricmc.fabric.api.rendering.data.v1.RenderAttachedBlockView;
import net.minecraft.block.BlockState;
import net.minecraft.client.render.model.BakedModel;
import net.minecraft.client.render.model.BakedQuad;
import net.minecraft.client.render.model.json.ModelOverrideList;
import net.minecraft.client.render.model.json.ModelTransformation;
import net.minecraft.client.texture.Sprite;
import net.minecraft.item.ItemStack;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
import net.minecraft.world.BlockRenderView;
import appeng.client.render.cablebus.CubeBuilder;
import appeng.tile.crafting.CraftingCubeModelData;
import appeng.util.Platform;
/**
* The base model for baked models used by components of the crafting cube
* multi-block in it's formed state. Primarily this base class handles adding
* the "ring" that frames the multi-block structure and delegates rendering of
* the "inner" part of each block to the subclasses of this class.
*/
abstract class CraftingCubeBakedModel implements BakedModel, FabricBakedModel {
private final Sprite ringCorner;
private final Sprite ringHor;
private final Sprite ringVer;
CraftingCubeBakedModel(Sprite ringCorner, Sprite ringHor, Sprite ringVer) {
this.ringCorner = ringCorner;
this.ringHor = ringHor;
this.ringVer = ringVer;
}
@Override
public boolean isVanillaAdapter() {
return false;
}
@Override
public void emitBlockQuads(BlockRenderView blockView, BlockState state, BlockPos pos, Supplier<Random> randomSupplier, RenderContext context) {
CraftingCubeModelData modelData = getModelData(blockView, pos);
EnumSet<Direction> connections = modelData.getConnections();
CubeBuilder builder = new CubeBuilder(context.getEmitter());
for (Direction side : Direction.values()) {
builder.setDrawFaces(EnumSet.of(side));
// Add the quads for the ring that frames the entire multi-block structure
this.addRing(builder, side, connections);
// Calculate the bounds of the "inner" block that is framed by the border drawn
// above
float x2 = connections.contains(Direction.EAST) ? 16 : 13.01f;
float x1 = connections.contains(Direction.WEST) ? 0 : 2.99f;
float y2 = connections.contains(Direction.UP) ? 16 : 13.01f;
float y1 = connections.contains(Direction.DOWN) ? 0 : 2.99f;
float z2 = connections.contains(Direction.SOUTH) ? 16 : 13.01f;
float z1 = connections.contains(Direction.NORTH) ? 0 : 2.99f;
// On the axis of the side that we're currently drawing, extend the dimensions
// out to the outer face of the block
switch (side) {
case DOWN:
case UP:
y1 = 0;
y2 = 16;
break;
case NORTH:
case SOUTH:
z1 = 0;
z2 = 16;
break;
case WEST:
case EAST:
x1 = 0;
x2 = 16;
break;
}
this.addInnerCube(side, state, modelData, builder, x1, y1, z1, x2, y2, z2);
}
}
@Override
public void emitItemQuads(ItemStack stack, Supplier<Random> randomSupplier, RenderContext context) {
}
@Override
public List<BakedQuad> getQuads(@Nullable BlockState state, @Nullable Direction face, Random random) {
return Collections.emptyList();
}
@Override
public ModelTransformation getTransformation() {
return ModelTransformation.NONE;
}
private void addRing(CubeBuilder builder, Direction side, EnumSet<Direction> connections) {
// Fill in the corners
builder.setTexture(this.ringCorner);
this.addCornerCap(builder, connections, side, Direction.UP, Direction.EAST, Direction.NORTH);
this.addCornerCap(builder, connections, side, Direction.UP, Direction.EAST, Direction.SOUTH);
this.addCornerCap(builder, connections, side, Direction.UP, Direction.WEST, Direction.NORTH);
this.addCornerCap(builder, connections, side, Direction.UP, Direction.WEST, Direction.SOUTH);
this.addCornerCap(builder, connections, side, Direction.DOWN, Direction.EAST, Direction.NORTH);
this.addCornerCap(builder, connections, side, Direction.DOWN, Direction.EAST, Direction.SOUTH);
this.addCornerCap(builder, connections, side, Direction.DOWN, Direction.WEST, Direction.NORTH);
this.addCornerCap(builder, connections, side, Direction.DOWN, Direction.WEST, Direction.SOUTH);
// Fill in the remaining stripes of the face
for (Direction a : Direction.values()) {
if (a == side || a == side.getOpposite()) {
continue;
}
// Select the horizontal or vertical ring texture depending on which side we're
// filling in
if ((side.getAxis() != Direction.Axis.Y)
&& (a == Direction.NORTH || a == Direction.EAST || a == Direction.WEST || a == Direction.SOUTH)) {
builder.setTexture(this.ringVer);
} else if (side.getAxis() == Direction.Axis.Y && (a == Direction.EAST || a == Direction.WEST)) {
builder.setTexture(this.ringVer);
} else {
builder.setTexture(this.ringHor);
}
// If there's an adjacent crafting cube block on side a, then the core of the
// block already extends
// fully to this side. So only bother drawing the stripe, if there's no
// connection.
if (!connections.contains(a)) {
// Note that since we're drawing something that "looks" 2-dimensional,
// two of the following will always be 0 and 16.
float x1 = 0, y1 = 0, z1 = 0, x2 = 16, y2 = 16, z2 = 16;
switch (a) {
case DOWN:
y1 = 0;
y2 = 3;
break;
case UP:
y1 = 13.0f;
y2 = 16;
break;
case WEST:
x1 = 0;
x2 = 3;
break;
case EAST:
x1 = 13;
x2 = 16;
break;
case NORTH:
z1 = 0;
z2 = 3;
break;
case SOUTH:
z1 = 13;
z2 = 16;
break;
}
// Constraint the stripe in the two directions perpendicular to a in case there
// has been a corner
// drawn in those directions. Since a corner is drawn if the three touching
// faces dont have adjacent
// crafting cube blocks, we'd have to check for a, side, and the perpendicular
// direction. But in this
// block, we've already checked for side (due to face culling) and a (see
// above).
Direction perpendicular = Platform.rotateAround(a, side);
for (Direction cornerCandidate : EnumSet.of(perpendicular, perpendicular.getOpposite())) {
if (!connections.contains(cornerCandidate)) {
// There's a cap in this direction
switch (cornerCandidate) {
case DOWN:
y1 = 3;
break;
case UP:
y2 = 13;
break;
case NORTH:
z1 = 3;
break;
case SOUTH:
z2 = 13;
break;
case WEST:
x1 = 3;
break;
case EAST:
x2 = 13;
break;
}
}
}
builder.addCube(x1, y1, z1, x2, y2, z2);
}
}
}
/**
* Adds a 3x3x3 corner cap to the cube builder if there are no adjacent crafting
* cubes on that corner.
*/
private void addCornerCap(CubeBuilder builder, EnumSet<Direction> connections, Direction side, Direction down,
Direction west, Direction north) {
if (connections.contains(down) || connections.contains(west) || connections.contains(north)) {
return;
}
// Only add faces for sides that can actually be seen (the outside of the cube)
if (side != down && side != west && side != north) {
return;
}
float x1 = (west == Direction.WEST ? 0 : 13);
float y1 = (down == Direction.DOWN ? 0 : 13);
float z1 = (north == Direction.NORTH ? 0 : 13);
float x2 = (west == Direction.WEST ? 3 : 16);
float y2 = (down == Direction.DOWN ? 3 : 16);
float z2 = (north == Direction.NORTH ? 3 : 16);
builder.addCube(x1, y1, z1, x2, y2, z2);
}
// Retrieve the cube connection state from the block state
// If none is present, just assume there are no adjacent crafting cube blocks
private static CraftingCubeModelData getModelData(BlockRenderView blockRenderView, BlockPos pos) {
if (!(blockRenderView instanceof RenderAttachedBlockView)) {
return null;
}
Object attached = ((RenderAttachedBlockView) blockRenderView).getBlockEntityRenderAttachment(pos);
if (attached instanceof CraftingCubeModelData) {
return (CraftingCubeModelData) attached;
}
return null;
}
protected abstract void addInnerCube(Direction facing, BlockState state, CraftingCubeModelData modelData, CubeBuilder builder,
float x1, float y1, float z1, float x2, float y2, float z2);
@Override
public boolean useAmbientOcclusion() {
return false;
}
@Override
public boolean hasDepth() {
return false;
}
@Override
public boolean isBuiltin() {
return false;
}
@Override
public Sprite getSprite() {
return this.ringCorner;
}
@Override
public boolean isSideLit() {
return false;
}
@Override
public ModelOverrideList getOverrides() {
return ModelOverrideList.EMPTY;
}
}
@@ -0,0 +1,118 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
*
* Applied Energistics 2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Applied Energistics 2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
package appeng.client.render.crafting;
import appeng.block.crafting.AbstractCraftingUnitBlock;
import appeng.client.render.BasicUnbakedModel;
import appeng.core.AppEng;
import net.minecraft.client.render.model.BakedModel;
import net.minecraft.client.render.model.ModelBakeSettings;
import net.minecraft.client.render.model.ModelLoader;
import net.minecraft.client.texture.Sprite;
import net.minecraft.client.texture.SpriteAtlasTexture;
import net.minecraft.client.util.SpriteIdentifier;
import net.minecraft.util.Identifier;
import javax.annotation.Nullable;
import java.util.function.Function;
import java.util.stream.Stream;
/**
* The built-in model for the connected texture crafting cube.
*/
public class CraftingCubeModel implements BasicUnbakedModel {
private final static SpriteIdentifier RING_CORNER = texture("ring_corner");
private final static SpriteIdentifier RING_SIDE_HOR = texture("ring_side_hor");
private final static SpriteIdentifier RING_SIDE_VER = texture("ring_side_ver");
private final static SpriteIdentifier UNIT_BASE = texture("unit_base");
private final static SpriteIdentifier LIGHT_BASE = texture("light_base");
private final static SpriteIdentifier ACCELERATOR_LIGHT = texture("accelerator_light");
private final static SpriteIdentifier STORAGE_1K_LIGHT = texture("1k_storage_light");
private final static SpriteIdentifier STORAGE_4K_LIGHT = texture("4k_storage_light");
private final static SpriteIdentifier STORAGE_16K_LIGHT = texture("16k_storage_light");
private final static SpriteIdentifier STORAGE_64K_LIGHT = texture("64k_storage_light");
private final static SpriteIdentifier MONITOR_BASE = texture("monitor_base");
private final static SpriteIdentifier MONITOR_LIGHT_DARK = texture("monitor_light_dark");
private final static SpriteIdentifier MONITOR_LIGHT_MEDIUM = texture("monitor_light_medium");
private final static SpriteIdentifier MONITOR_LIGHT_BRIGHT = texture("monitor_light_bright");
private final AbstractCraftingUnitBlock.CraftingUnitType type;
public CraftingCubeModel(AbstractCraftingUnitBlock.CraftingUnitType type) {
this.type = type;
}
@Override
public Stream<SpriteIdentifier> getAdditionalTextures() {
return Stream.of(RING_CORNER, RING_SIDE_HOR, RING_SIDE_VER, UNIT_BASE, LIGHT_BASE, ACCELERATOR_LIGHT,
STORAGE_1K_LIGHT, STORAGE_4K_LIGHT, STORAGE_16K_LIGHT, STORAGE_64K_LIGHT, MONITOR_BASE,
MONITOR_LIGHT_DARK, MONITOR_LIGHT_MEDIUM, MONITOR_LIGHT_BRIGHT);
}
@Nullable
@Override
public BakedModel bake(ModelLoader loader, Function<SpriteIdentifier, Sprite> textureGetter, ModelBakeSettings rotationContainer, Identifier modelId) {
// Retrieve our textures and pass them on to the baked model
Sprite ringCorner = textureGetter.apply(RING_CORNER);
Sprite ringSideHor = textureGetter.apply(RING_SIDE_HOR);
Sprite ringSideVer = textureGetter.apply(RING_SIDE_VER);
switch (this.type) {
case UNIT:
return new UnitBakedModel(ringCorner, ringSideHor, ringSideVer, textureGetter.apply(UNIT_BASE));
case ACCELERATOR:
case STORAGE_1K:
case STORAGE_4K:
case STORAGE_16K:
case STORAGE_64K:
return new LightBakedModel(ringCorner, ringSideHor, ringSideVer, textureGetter.apply(LIGHT_BASE),
getLightTexture(textureGetter, this.type));
case MONITOR:
return new MonitorBakedModel(ringCorner, ringSideHor, ringSideVer, textureGetter.apply(UNIT_BASE),
textureGetter.apply(MONITOR_BASE), textureGetter.apply(MONITOR_LIGHT_DARK),
textureGetter.apply(MONITOR_LIGHT_MEDIUM), textureGetter.apply(MONITOR_LIGHT_BRIGHT));
default:
throw new IllegalArgumentException("Unsupported crafting unit type: " + this.type);
}
}
private static Sprite getLightTexture(Function<SpriteIdentifier, Sprite> textureGetter,
AbstractCraftingUnitBlock.CraftingUnitType type) {
switch (type) {
case ACCELERATOR:
return textureGetter.apply(ACCELERATOR_LIGHT);
case STORAGE_1K:
return textureGetter.apply(STORAGE_1K_LIGHT);
case STORAGE_4K:
return textureGetter.apply(STORAGE_4K_LIGHT);
case STORAGE_16K:
return textureGetter.apply(STORAGE_16K_LIGHT);
case STORAGE_64K:
return textureGetter.apply(STORAGE_64K_LIGHT);
default:
throw new IllegalArgumentException("Crafting unit type " + type + " does not use a light texture.");
}
}
private static SpriteIdentifier texture(String name) {
return new SpriteIdentifier(SpriteAtlasTexture.BLOCK_ATLAS_TEX,
new Identifier(AppEng.MOD_ID, "block/crafting/" + name));
}
}
@@ -0,0 +1,64 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
*
* Applied Energistics 2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Applied Energistics 2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
package appeng.client.render.crafting;
import net.fabricmc.api.Environment;
import net.minecraft.client.render.block.entity.BlockEntityRenderDispatcher;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.client.render.VertexConsumerProvider;
import net.minecraft.client.render.block.entity.BlockEntityRenderer;
import net.minecraft.util.math.Direction;
import net.fabricmc.api.EnvType;
import appeng.api.storage.data.IAEItemStack;
import appeng.client.render.TesrRenderHelper;
import appeng.tile.crafting.CraftingMonitorBlockEntity;
/**
* Renders the item currently being crafted
*/
@Environment(EnvType.CLIENT)
public class CraftingMonitorTESR extends BlockEntityRenderer<CraftingMonitorBlockEntity> {
public CraftingMonitorTESR(BlockEntityRenderDispatcher rendererDispatcherIn) {
super(rendererDispatcherIn);
}
@Override
public void render(CraftingMonitorBlockEntity te, float partialTicks, MatrixStack matrixStack,
VertexConsumerProvider buffers, int combinedLight, int combinedOverlay) {
Direction facing = te.getForward();
IAEItemStack jobProgress = te.getJobProgress();
if (jobProgress != null) {
matrixStack.push();
matrixStack.translate(0.5, 0.5, 0.5); // Move to the center of the block
TesrRenderHelper.rotateToFace(matrixStack, facing, (byte) 0);
matrixStack.translate(0, 0.08, 0.5);
TesrRenderHelper.renderItem2dWithAmount(matrixStack, buffers, jobProgress, 0.3f, -0.18f, 15728880,
combinedOverlay);
matrixStack.pop();
}
}
}
@@ -0,0 +1,59 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
*
* Applied Energistics 2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Applied Energistics 2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
package appeng.client.render.crafting;
import appeng.tile.crafting.CraftingCubeModelData;
import net.minecraft.block.BlockState;
import net.minecraft.client.texture.Sprite;
import net.minecraft.util.math.Direction;
import appeng.block.crafting.AbstractCraftingUnitBlock;
import appeng.client.render.cablebus.CubeBuilder;
/**
* Crafting cube baked model that adds a full-bright light texture on top of a
* normal base texture onto the inner cube. The light texture is only drawn
* fullbright if the multiblock is currently powered.
*/
class LightBakedModel extends CraftingCubeBakedModel {
private final Sprite baseTexture;
private final Sprite lightTexture;
LightBakedModel(Sprite ringCorner, Sprite ringHor, Sprite ringVer,
Sprite baseTexture, Sprite lightTexture) {
super(ringCorner, ringHor, ringVer);
this.baseTexture = baseTexture;
this.lightTexture = lightTexture;
}
@Override
protected void addInnerCube(Direction facing, BlockState state, CraftingCubeModelData modelData, CubeBuilder builder, float x1,
float y1, float z1, float x2, float y2, float z2) {
builder.setTexture(this.baseTexture);
builder.addCube(x1, y1, z1, x2, y2, z2);
boolean powered = state.get(AbstractCraftingUnitBlock.POWERED);
builder.setRenderFullBright(powered);
builder.setTexture(this.lightTexture);
builder.addCube(x1, y1, z1, x2, y2, z2);
}
}
@@ -0,0 +1,104 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
*
* Applied Energistics 2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Applied Energistics 2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
package appeng.client.render.crafting;
import appeng.tile.crafting.CraftingCubeModelData;
import net.minecraft.block.BlockState;
import net.minecraft.client.texture.Sprite;
import net.minecraft.util.math.Direction;
import appeng.api.util.AEColor;
import appeng.block.crafting.CraftingMonitorBlock;
import appeng.client.render.cablebus.CubeBuilder;
import appeng.tile.crafting.CraftingMonitorModelData;
/**
* The baked model for the crafting monitor. Please note that this model doesn't
* handle the item being displayed. That is handled by a TESR. Instead, this
* model adds 3 layered light textures using the [dark|medium|bright] color
* variants of the attached bus color. The textures are full-bright if the cube
* is powered.
*/
public class MonitorBakedModel extends CraftingCubeBakedModel {
private final Sprite chassisTexture;
private final Sprite baseTexture;
private final Sprite lightDarkTexture;
private final Sprite lightMediumTexture;
private final Sprite lightBrightTexture;
MonitorBakedModel(Sprite ringCorner, Sprite ringHor, Sprite ringVer,
Sprite chassisTexture, Sprite baseTexture, Sprite lightDarkTexture,
Sprite lightMediumTexture, Sprite lightBrightTexture) {
super(ringCorner, ringHor, ringVer);
this.chassisTexture = chassisTexture;
this.baseTexture = baseTexture;
this.lightDarkTexture = lightDarkTexture;
this.lightMediumTexture = lightMediumTexture;
this.lightBrightTexture = lightBrightTexture;
}
@Override
protected void addInnerCube(Direction side, BlockState state, CraftingCubeModelData modelData, CubeBuilder builder, float x1,
float y1, float z1, float x2, float y2, float z2) {
Direction forward = modelData.getForward();
// For sides other than the front, use the chassis texture
if (side != forward) {
builder.setTexture(this.chassisTexture);
builder.addCube(x1, y1, z1, x2, y2, z2);
return;
}
builder.setTexture(this.baseTexture);
builder.addCube(x1, y1, z1, x2, y2, z2);
// Now add the three layered light textures
AEColor color = getColor(modelData);
boolean powered = state.get(CraftingMonitorBlock.POWERED);
builder.setRenderFullBright(powered);
builder.setColorRGB(color.whiteVariant);
builder.setTexture(this.lightBrightTexture);
builder.addCube(x1, y1, z1, x2, y2, z2);
builder.setColorRGB(color.mediumVariant);
builder.setTexture(this.lightMediumTexture);
builder.addCube(x1, y1, z1, x2, y2, z2);
builder.setColorRGB(color.blackVariant);
builder.setTexture(this.lightDarkTexture);
builder.addCube(x1, y1, z1, x2, y2, z2);
}
private static AEColor getColor(CraftingCubeModelData modelData) {
if (modelData instanceof CraftingMonitorModelData) {
return ((CraftingMonitorModelData) modelData).getColor();
}
return AEColor.TRANSPARENT;
}
}
@@ -0,0 +1,48 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
*
* Applied Energistics 2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Applied Energistics 2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
package appeng.client.render.crafting;
import appeng.tile.crafting.CraftingCubeModelData;
import net.minecraft.block.BlockState;
import net.minecraft.client.texture.Sprite;
import net.minecraft.util.math.Direction;
import appeng.client.render.cablebus.CubeBuilder;
/**
* A simple crafting unit model that uses an un-lit texture for the inner block.
*/
class UnitBakedModel extends CraftingCubeBakedModel {
private final Sprite unitTexture;
UnitBakedModel(Sprite ringCorner, Sprite ringHor, Sprite ringVer,
Sprite unitTexture) {
super(ringCorner, ringHor, ringVer);
this.unitTexture = unitTexture;
}
@Override
protected void addInnerCube(Direction facing, BlockState state, CraftingCubeModelData modelData, CubeBuilder builder, float x1,
float y1, float z1, float x2, float y2, float z2) {
builder.setTexture(this.unitTexture);
builder.addCube(x1, y1, z1, x2, y2, z2);
}
}