use of blusunrize.immersiveengineering.common.blocks.BlockTypes_MetalsAll in project ImmersiveEngineering by BluSunrize.
the class ConveyorChute method modifyQuads.
@Override
@SideOnly(Side.CLIENT)
public List<BakedQuad> modifyQuads(List<BakedQuad> baseModel, @Nullable TileEntity tile, EnumFacing facing) {
if (!initTextures) {
for (BlockTypes_MetalsAll metal : BlockTypes_MetalsAll.values()) TEXTURE_GETTERS[metal.getMeta()] = rl -> Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite("immersiveengineering:blocks/sheetmetal_" + metal.getName());
initTextures = true;
}
if (this.sheetmetalType < 0 || this.sheetmetalType >= TEXTURE_GETTERS.length)
return baseModel;
Function<ResourceLocation, TextureAtlasSprite> textureGetter = TEXTURE_GETTERS[this.sheetmetalType];
if (chuteModel[this.sheetmetalType] == null)
try {
IModel iModel = ModelLoaderRegistry.getModel(new ResourceLocation("immersiveengineering:block/metal_device/chute.obj"));
chuteModel[this.sheetmetalType] = new IBakedModel[] { iModel.bake(new OBJState(ImmutableList.of("base"), true, ModelRotation.X0_Y180), DefaultVertexFormats.ITEM, textureGetter), iModel.bake(new OBJState(ImmutableList.of("base"), true, ModelRotation.X0_Y0), DefaultVertexFormats.ITEM, textureGetter), iModel.bake(new OBJState(ImmutableList.of("base"), true, ModelRotation.X0_Y90), DefaultVertexFormats.ITEM, textureGetter), iModel.bake(new OBJState(ImmutableList.of("base"), true, ModelRotation.X0_Y270), DefaultVertexFormats.ITEM, textureGetter) };
} catch (Exception ignored) {
}
float[] colour = { 1, 1, 1, 1 };
Matrix4 matrix = new Matrix4(facing);
baseModel.clear();
if (diagonal) {
IBlockState bs = tile != null && tile.getWorld() != null ? tile.getWorld().getBlockState(tile.getPos()) : IEContent.blockConveyor.getDefaultState();
if (chuteModel[this.sheetmetalType] != null && facing.ordinal() >= 2)
baseModel.addAll(chuteModel[this.sheetmetalType][facing.ordinal() - 2].getQuads(bs, null, 0));
} else {
Function<EnumFacing, TextureAtlasSprite> getSprite = f -> textureGetter.apply(null);
baseModel.addAll(ClientUtils.createBakedBox(new Vector3f(0, 0, 0), new Vector3f(.0625f, 1, .0625f), matrix, facing, getSprite, colour));
baseModel.addAll(ClientUtils.createBakedBox(new Vector3f(0, 0, .9375f), new Vector3f(.0625f, 1, 1), matrix, facing, getSprite, colour));
baseModel.addAll(ClientUtils.createBakedBox(new Vector3f(.9375f, 0, 0), new Vector3f(1, 1, .0625f), matrix, facing, getSprite, colour));
baseModel.addAll(ClientUtils.createBakedBox(new Vector3f(.9375f, 0, .9375f), new Vector3f(1, 1, 1), matrix, facing, getSprite, colour));
if (renderWall(tile, EnumFacing.NORTH, facing))
baseModel.addAll(ClientUtils.createBakedBox(new Vector3f(.0625f, 0, 0), new Vector3f(.9375f, 1, .0625f), matrix, facing, getSprite, colour));
if (renderWall(tile, EnumFacing.SOUTH, facing))
baseModel.addAll(ClientUtils.createBakedBox(new Vector3f(.0625f, 0, .9375f), new Vector3f(.9375f, 1, 1), matrix, facing, getSprite, colour));
if (renderWall(tile, EnumFacing.WEST, facing))
baseModel.addAll(ClientUtils.createBakedBox(new Vector3f(0, 0, .0625f), new Vector3f(.0625f, 1, .9375f), matrix, facing, getSprite, colour));
if (renderWall(tile, EnumFacing.EAST, facing))
baseModel.addAll(ClientUtils.createBakedBox(new Vector3f(.9375f, 0, .0625f), new Vector3f(1, 1, .9375f), matrix, facing, getSprite, colour));
}
return baseModel;
}
Aggregations