Added spotless back and reformatted
This commit is contained in:
@@ -28,11 +28,11 @@ import java.util.function.Function;
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
import net.fabricmc.fabric.api.renderer.v1.mesh.QuadEmitter;
|
||||
import net.minecraft.client.util.SpriteIdentifier;
|
||||
import net.minecraft.client.texture.SpriteAtlasTexture;
|
||||
import net.minecraft.client.texture.Sprite;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.client.texture.SpriteAtlasTexture;
|
||||
import net.minecraft.client.util.SpriteIdentifier;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.math.Direction;
|
||||
|
||||
import appeng.api.util.AECableType;
|
||||
import appeng.api.util.AEColor;
|
||||
@@ -216,7 +216,7 @@ class CableBuilder {
|
||||
}
|
||||
|
||||
public void addConstrainedGlassConnection(Direction facing, AEColor cableColor, int distanceFromEdge,
|
||||
QuadEmitter emitter) {
|
||||
QuadEmitter emitter) {
|
||||
|
||||
// Glass connections reach only 6 voxels from the edge
|
||||
if (distanceFromEdge >= 6) {
|
||||
@@ -307,7 +307,7 @@ class CableBuilder {
|
||||
}
|
||||
|
||||
public void addConstrainedCoveredConnection(Direction facing, AEColor cableColor, int distanceFromEdge,
|
||||
QuadEmitter emitter) {
|
||||
QuadEmitter emitter) {
|
||||
// The core of a covered cable reaches up to 5 voxels from the block edge, so
|
||||
// drawing a connection can only occur from there onwards
|
||||
if (distanceFromEdge >= 5) {
|
||||
@@ -374,8 +374,7 @@ class CableBuilder {
|
||||
addCoveredCableSizedCube(facing, cubeBuilder);
|
||||
}
|
||||
|
||||
public void addStraightSmartConnection(Direction facing, AEColor cableColor, int channels,
|
||||
QuadEmitter emitter) {
|
||||
public void addStraightSmartConnection(Direction facing, AEColor cableColor, int channels, QuadEmitter emitter) {
|
||||
CubeBuilder cubeBuilder = new CubeBuilder(emitter);
|
||||
|
||||
Sprite texture = this.connectionTextures.get(AECableType.SMART).get(cableColor);
|
||||
@@ -401,7 +400,7 @@ class CableBuilder {
|
||||
}
|
||||
|
||||
public void addConstrainedSmartConnection(Direction facing, AEColor cableColor, int distanceFromEdge, int channels,
|
||||
QuadEmitter emitter) {
|
||||
QuadEmitter emitter) {
|
||||
// Same as with covered cables, the smart cable's core extends up to 5 voxels
|
||||
// away from the edge.
|
||||
// Drawing a connection to any point before that point is fruitless
|
||||
@@ -515,7 +514,7 @@ class CableBuilder {
|
||||
}
|
||||
|
||||
public void addStraightDenseSmartConnection(Direction facing, AEColor cableColor, int channels,
|
||||
QuadEmitter emitter) {
|
||||
QuadEmitter emitter) {
|
||||
CubeBuilder cubeBuilder = new CubeBuilder(emitter);
|
||||
|
||||
Sprite texture = this.connectionTextures.get(AECableType.DENSE_SMART).get(cableColor);
|
||||
|
||||
@@ -18,10 +18,18 @@
|
||||
|
||||
package appeng.client.render.cablebus;
|
||||
|
||||
import appeng.api.parts.IDynamicPartBakedModel;
|
||||
import appeng.api.parts.IPartModel;
|
||||
import appeng.api.util.AECableType;
|
||||
import appeng.api.util.AEColor;
|
||||
import java.util.ArrayList;
|
||||
import java.util.EnumMap;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Random;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
import net.fabricmc.fabric.api.renderer.v1.Renderer;
|
||||
@@ -45,16 +53,10 @@ import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.world.BlockRenderView;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.EnumMap;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Random;
|
||||
import java.util.function.Supplier;
|
||||
import appeng.api.parts.IDynamicPartBakedModel;
|
||||
import appeng.api.parts.IPartModel;
|
||||
import appeng.api.util.AECableType;
|
||||
import appeng.api.util.AEColor;
|
||||
|
||||
@Environment(EnvType.CLIENT)
|
||||
public class CableBusBakedModel implements BakedModel, FabricBakedModel {
|
||||
@@ -72,8 +74,8 @@ public class CableBusBakedModel implements BakedModel, FabricBakedModel {
|
||||
|
||||
private final Sprite particleTexture;
|
||||
|
||||
CableBusBakedModel(CableBuilder cableBuilder, FacadeBuilder facadeBuilder,
|
||||
Map<Identifier, BakedModel> partModels, Sprite particleTexture) {
|
||||
CableBusBakedModel(CableBuilder cableBuilder, FacadeBuilder facadeBuilder, Map<Identifier, BakedModel> partModels,
|
||||
Sprite particleTexture) {
|
||||
this.cableBuilder = cableBuilder;
|
||||
this.facadeBuilder = facadeBuilder;
|
||||
this.partModels = partModels;
|
||||
@@ -97,7 +99,8 @@ public class CableBusBakedModel implements BakedModel, FabricBakedModel {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void emitBlockQuads(BlockRenderView blockView, BlockState state, BlockPos pos, Supplier<Random> randomSupplier, RenderContext context) {
|
||||
public void emitBlockQuads(BlockRenderView blockView, BlockState state, BlockPos pos,
|
||||
Supplier<Random> randomSupplier, RenderContext context) {
|
||||
|
||||
CableBusRenderState renderState = getRenderState(blockView, pos);
|
||||
|
||||
@@ -131,8 +134,7 @@ public class CableBusBakedModel implements BakedModel, FabricBakedModel {
|
||||
if (bakedModel instanceof IDynamicPartBakedModel) {
|
||||
((IDynamicPartBakedModel) bakedModel).emitQuads(blockView, state, pos, randomSupplier, context,
|
||||
facing, partModelData);
|
||||
}
|
||||
else if (bakedModel instanceof FabricBakedModel) {
|
||||
} else if (bakedModel instanceof FabricBakedModel) {
|
||||
((FabricBakedModel) bakedModel).emitBlockQuads(blockView, state, pos, randomSupplier, context);
|
||||
} else {
|
||||
context.fallbackConsumer().accept(bakedModel);
|
||||
@@ -253,8 +255,7 @@ public class CableBusBakedModel implements BakedModel, FabricBakedModel {
|
||||
|
||||
switch (cableType) {
|
||||
case GLASS:
|
||||
this.cableBuilder.addGlassConnection(facing, cableColor, connectionType, cableBusAdjacent,
|
||||
emitter);
|
||||
this.cableBuilder.addGlassConnection(facing, cableColor, connectionType, cableBusAdjacent, emitter);
|
||||
break;
|
||||
case COVERED:
|
||||
this.cableBuilder.addCoveredConnection(facing, cableColor, connectionType, cableBusAdjacent,
|
||||
@@ -323,7 +324,6 @@ public class CableBusBakedModel implements BakedModel, FabricBakedModel {
|
||||
return particleTexture instanceof MissingSprite;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean useAmbientOcclusion() {
|
||||
return true;
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
package appeng.client.render.cablebus;
|
||||
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
import net.minecraft.client.particle.ParticleTextureSheet;
|
||||
import net.minecraft.client.particle.SpriteBillboardParticle;
|
||||
import net.minecraft.client.texture.Sprite;
|
||||
import net.minecraft.client.world.ClientWorld;
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
|
||||
// Derived from Vanilla's BreakingParticle, but allows
|
||||
// a texture to be specified directly rather than via an itemstack
|
||||
@@ -16,7 +16,7 @@ public class CableBusBreakingParticle extends SpriteBillboardParticle {
|
||||
private final float field_217572_F;
|
||||
|
||||
public CableBusBreakingParticle(ClientWorld world, double x, double y, double z, double speedX, double speedY,
|
||||
double speedZ, Sprite sprite) {
|
||||
double speedZ, Sprite sprite) {
|
||||
super(world, x, y, z, speedX, speedY, speedZ);
|
||||
this.setSprite(sprite);
|
||||
this.gravityStrength = 1.0F;
|
||||
|
||||
@@ -18,11 +18,15 @@
|
||||
|
||||
package appeng.client.render.cablebus;
|
||||
|
||||
import appeng.api.util.AEColor;
|
||||
import appeng.client.render.BasicUnbakedModel;
|
||||
import appeng.core.AELog;
|
||||
import appeng.core.features.registries.PartModels;
|
||||
import java.util.Collection;
|
||||
import java.util.Map;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
import net.minecraft.client.render.model.BakedModel;
|
||||
@@ -32,11 +36,10 @@ import net.minecraft.client.texture.Sprite;
|
||||
import net.minecraft.client.util.SpriteIdentifier;
|
||||
import net.minecraft.util.Identifier;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Collection;
|
||||
import java.util.Map;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Stream;
|
||||
import appeng.api.util.AEColor;
|
||||
import appeng.client.render.BasicUnbakedModel;
|
||||
import appeng.core.AELog;
|
||||
import appeng.core.features.registries.PartModels;
|
||||
|
||||
/**
|
||||
* The built-in model for the cable bus block.
|
||||
@@ -63,7 +66,8 @@ public class CableBusModel implements BasicUnbakedModel {
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public BakedModel bake(ModelLoader loader, Function<SpriteIdentifier, Sprite> textureGetter, ModelBakeSettings rotationContainer, Identifier modelId) {
|
||||
public BakedModel bake(ModelLoader loader, Function<SpriteIdentifier, Sprite> textureGetter,
|
||||
ModelBakeSettings rotationContainer, Identifier modelId) {
|
||||
Map<Identifier, BakedModel> partModels = this.loadPartModels(loader, rotationContainer);
|
||||
|
||||
CableBuilder cableBuilder = new CableBuilder(textureGetter);
|
||||
@@ -77,9 +81,7 @@ public class CableBusModel implements BasicUnbakedModel {
|
||||
return new CableBusBakedModel(cableBuilder, facadeBuilder, partModels, particleTexture);
|
||||
}
|
||||
|
||||
|
||||
private Map<Identifier, BakedModel> loadPartModels(ModelLoader loader,
|
||||
ModelBakeSettings rotationContainer) {
|
||||
private Map<Identifier, BakedModel> loadPartModels(ModelLoader loader, ModelBakeSettings rotationContainer) {
|
||||
ImmutableMap.Builder<Identifier, BakedModel> result = ImmutableMap.builder();
|
||||
|
||||
for (Identifier location : this.partModels.getModels()) {
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
package appeng.client.render.cablebus;
|
||||
|
||||
import appeng.core.AppEng;
|
||||
import appeng.core.features.registries.PartModels;
|
||||
import net.fabricmc.fabric.api.client.model.ModelProviderContext;
|
||||
import net.fabricmc.fabric.api.client.model.ModelProviderException;
|
||||
import net.fabricmc.fabric.api.client.model.ModelResourceProvider;
|
||||
import net.minecraft.client.render.model.UnbakedModel;
|
||||
import net.minecraft.util.Identifier;
|
||||
|
||||
import appeng.core.AppEng;
|
||||
import appeng.core.features.registries.PartModels;
|
||||
|
||||
public class CableBusModelLoader implements ModelResourceProvider {
|
||||
|
||||
private static final Identifier CABLE_BUS_MODEL = AppEng.makeId("block/cable_bus");
|
||||
@@ -19,7 +20,8 @@ public class CableBusModelLoader implements ModelResourceProvider {
|
||||
}
|
||||
|
||||
@Override
|
||||
public UnbakedModel loadModelResource(Identifier resourceId, ModelProviderContext context) throws ModelProviderException {
|
||||
public UnbakedModel loadModelResource(Identifier resourceId, ModelProviderContext context)
|
||||
throws ModelProviderException {
|
||||
if (CABLE_BUS_MODEL.equals(resourceId)) {
|
||||
CableBusBakedModel.clearCache();
|
||||
return new CableBusModel(partModels);
|
||||
|
||||
@@ -25,9 +25,9 @@ import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.util.math.Box;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Box;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.world.BlockRenderView;
|
||||
|
||||
import appeng.api.parts.IPartModel;
|
||||
|
||||
@@ -23,8 +23,8 @@ import java.util.Map;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
|
||||
import net.minecraft.client.util.SpriteIdentifier;
|
||||
import net.minecraft.client.texture.SpriteAtlasTexture;
|
||||
import net.minecraft.client.util.SpriteIdentifier;
|
||||
import net.minecraft.util.Identifier;
|
||||
|
||||
import appeng.api.util.AECableType;
|
||||
|
||||
@@ -26,8 +26,8 @@ import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
import net.fabricmc.fabric.api.renderer.v1.mesh.QuadEmitter;
|
||||
import net.minecraft.client.render.*;
|
||||
import net.minecraft.client.util.math.Vector4f;
|
||||
import net.minecraft.client.texture.Sprite;
|
||||
import net.minecraft.client.util.math.Vector4f;
|
||||
import net.minecraft.util.math.Direction;
|
||||
|
||||
/**
|
||||
@@ -87,8 +87,7 @@ public class CubeBuilder {
|
||||
Sprite texture = this.textures.get(face);
|
||||
|
||||
QuadEmitter emitter = this.emitter;
|
||||
emitter.colorIndex(-1)
|
||||
.nominalFace(face);
|
||||
emitter.colorIndex(-1).nominalFace(face);
|
||||
|
||||
UvVector uv = new UvVector();
|
||||
|
||||
@@ -155,8 +154,8 @@ public class CubeBuilder {
|
||||
this.vertexIndex = 0;
|
||||
}
|
||||
|
||||
private UvVector getDefaultUv(Direction face, Sprite texture, float x1, float y1, float z1, float x2,
|
||||
float y2, float z2) {
|
||||
private UvVector getDefaultUv(Direction face, Sprite texture, float x1, float y1, float z1, float x2, float y2,
|
||||
float z2) {
|
||||
|
||||
UvVector uv = new UvVector();
|
||||
|
||||
@@ -202,8 +201,8 @@ public class CubeBuilder {
|
||||
return uv;
|
||||
}
|
||||
|
||||
private UvVector getStandardUv(Direction face, Sprite texture, float x1, float y1, float z1, float x2,
|
||||
float y2, float z2) {
|
||||
private UvVector getStandardUv(Direction face, Sprite texture, float x1, float y1, float z1, float x2, float y2,
|
||||
float z2) {
|
||||
UvVector uv = new UvVector();
|
||||
switch (face) {
|
||||
case DOWN:
|
||||
@@ -376,8 +375,7 @@ public class CubeBuilder {
|
||||
}
|
||||
}
|
||||
|
||||
public void setTextures(Sprite up, Sprite down, Sprite north,
|
||||
Sprite south, Sprite east, Sprite west) {
|
||||
public void setTextures(Sprite up, Sprite down, Sprite north, Sprite south, Sprite east, Sprite west) {
|
||||
this.textures.put(Direction.UP, up);
|
||||
this.textures.put(Direction.DOWN, down);
|
||||
this.textures.put(Direction.NORTH, north);
|
||||
|
||||
@@ -23,8 +23,8 @@ import javax.annotation.Nullable;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.entity.BlockEntity;
|
||||
import net.minecraft.fluid.FluidState;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.world.BlockRenderView;
|
||||
import net.minecraft.world.chunk.light.LightingProvider;
|
||||
import net.minecraft.world.level.ColorResolver;
|
||||
|
||||
@@ -18,15 +18,19 @@
|
||||
|
||||
package appeng.client.render.cablebus;
|
||||
|
||||
import appeng.api.util.AEAxisAlignedBB;
|
||||
import appeng.core.Api;
|
||||
import appeng.mixins.MinecraftClientAccessor;
|
||||
import appeng.parts.misc.CableAnchorPart;
|
||||
import appeng.thirdparty.codechicken.lib.model.pipeline.transformers.QuadClamper;
|
||||
import appeng.thirdparty.codechicken.lib.model.pipeline.transformers.QuadCornerKicker;
|
||||
import appeng.thirdparty.codechicken.lib.model.pipeline.transformers.QuadFaceStripper;
|
||||
import appeng.thirdparty.codechicken.lib.model.pipeline.transformers.QuadReInterpolator;
|
||||
import appeng.thirdparty.codechicken.lib.model.pipeline.transformers.QuadTinter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.EnumMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.fabricmc.fabric.api.renderer.v1.Renderer;
|
||||
import net.fabricmc.fabric.api.renderer.v1.RendererAccess;
|
||||
import net.fabricmc.fabric.api.renderer.v1.mesh.Mesh;
|
||||
@@ -51,17 +55,15 @@ import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.util.math.Direction.Axis;
|
||||
import net.minecraft.world.BlockRenderView;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.EnumMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Supplier;
|
||||
import appeng.api.util.AEAxisAlignedBB;
|
||||
import appeng.core.Api;
|
||||
import appeng.mixins.MinecraftClientAccessor;
|
||||
import appeng.parts.misc.CableAnchorPart;
|
||||
import appeng.thirdparty.codechicken.lib.model.pipeline.transformers.QuadClamper;
|
||||
import appeng.thirdparty.codechicken.lib.model.pipeline.transformers.QuadCornerKicker;
|
||||
import appeng.thirdparty.codechicken.lib.model.pipeline.transformers.QuadFaceStripper;
|
||||
import appeng.thirdparty.codechicken.lib.model.pipeline.transformers.QuadReInterpolator;
|
||||
import appeng.thirdparty.codechicken.lib.model.pipeline.transformers.QuadTinter;
|
||||
|
||||
/**
|
||||
* The FacadeBuilder builds for facades..
|
||||
@@ -75,21 +77,15 @@ public class FacadeBuilder {
|
||||
public static final double THICK_THICKNESS = 2D / 16D;
|
||||
public static final double THIN_THICKNESS = 1D / 16D;
|
||||
|
||||
public static final Box[] THICK_FACADE_BOXES = new Box[]{
|
||||
new Box(0.0, 0.0, 0.0, 1.0, THICK_THICKNESS, 1.0),
|
||||
new Box(0.0, 1.0 - THICK_THICKNESS, 0.0, 1.0, 1.0, 1.0),
|
||||
new Box(0.0, 0.0, 0.0, 1.0, 1.0, THICK_THICKNESS),
|
||||
new Box(0.0, 0.0, 1.0 - THICK_THICKNESS, 1.0, 1.0, 1.0),
|
||||
new Box(0.0, 0.0, 0.0, THICK_THICKNESS, 1.0, 1.0),
|
||||
new Box(1.0 - THICK_THICKNESS, 0.0, 0.0, 1.0, 1.0, 1.0)};
|
||||
public static final Box[] THICK_FACADE_BOXES = new Box[] { new Box(0.0, 0.0, 0.0, 1.0, THICK_THICKNESS, 1.0),
|
||||
new Box(0.0, 1.0 - THICK_THICKNESS, 0.0, 1.0, 1.0, 1.0), new Box(0.0, 0.0, 0.0, 1.0, 1.0, THICK_THICKNESS),
|
||||
new Box(0.0, 0.0, 1.0 - THICK_THICKNESS, 1.0, 1.0, 1.0), new Box(0.0, 0.0, 0.0, THICK_THICKNESS, 1.0, 1.0),
|
||||
new Box(1.0 - THICK_THICKNESS, 0.0, 0.0, 1.0, 1.0, 1.0) };
|
||||
|
||||
public static final Box[] THIN_FACADE_BOXES = new Box[]{
|
||||
new Box(0.0, 0.0, 0.0, 1.0, THIN_THICKNESS, 1.0),
|
||||
new Box(0.0, 1.0 - THIN_THICKNESS, 0.0, 1.0, 1.0, 1.0),
|
||||
new Box(0.0, 0.0, 0.0, 1.0, 1.0, THIN_THICKNESS),
|
||||
new Box(0.0, 0.0, 1.0 - THIN_THICKNESS, 1.0, 1.0, 1.0),
|
||||
new Box(0.0, 0.0, 0.0, THIN_THICKNESS, 1.0, 1.0),
|
||||
new Box(1.0 - THIN_THICKNESS, 0.0, 0.0, 1.0, 1.0, 1.0)};
|
||||
public static final Box[] THIN_FACADE_BOXES = new Box[] { new Box(0.0, 0.0, 0.0, 1.0, THIN_THICKNESS, 1.0),
|
||||
new Box(0.0, 1.0 - THIN_THICKNESS, 0.0, 1.0, 1.0, 1.0), new Box(0.0, 0.0, 0.0, 1.0, 1.0, THIN_THICKNESS),
|
||||
new Box(0.0, 0.0, 1.0 - THIN_THICKNESS, 1.0, 1.0, 1.0), new Box(0.0, 0.0, 0.0, THIN_THICKNESS, 1.0, 1.0),
|
||||
new Box(1.0 - THIN_THICKNESS, 0.0, 0.0, 1.0, 1.0, 1.0) };
|
||||
|
||||
private final Map<Direction, Mesh> cableAnchorStilts;
|
||||
|
||||
@@ -98,8 +94,8 @@ public class FacadeBuilder {
|
||||
}
|
||||
|
||||
/**
|
||||
* Build a map of pre-rotated cable anchor stilts, which are the shortened cable anchors that
|
||||
* will still be visible for facades attached to a cable.
|
||||
* Build a map of pre-rotated cable anchor stilts, which are the shortened cable
|
||||
* anchors that will still be visible for facades attached to a cable.
|
||||
*/
|
||||
private Map<Direction, Mesh> buildCableAnchorStems(ModelLoader modelLoader) {
|
||||
Map<Direction, Mesh> stems = new EnumMap<>(Direction.class);
|
||||
@@ -139,9 +135,8 @@ public class FacadeBuilder {
|
||||
return stems;
|
||||
}
|
||||
|
||||
public Mesh getFacadeMesh(CableBusRenderState renderState,
|
||||
Supplier<Random> rand,
|
||||
Function<Identifier, BakedModel> modelLookup) {
|
||||
public Mesh getFacadeMesh(CableBusRenderState renderState, Supplier<Random> rand,
|
||||
Function<Identifier, BakedModel> modelLookup) {
|
||||
boolean transparent = Api.instance().partHelper().getCableRenderMode().transparentFacades;
|
||||
Map<Direction, FacadeRenderState> facadeStates = renderState.getFacades();
|
||||
List<Box> partBoxes = renderState.getBoundingBoxes();
|
||||
@@ -257,7 +252,8 @@ public class FacadeBuilder {
|
||||
|
||||
// Prebake the color tint into the quad
|
||||
if (quad.getColorIndex() != -1) {
|
||||
quadTinter = new QuadTinter(blockColors.getColor(blockState, facadeAccess, pos, quad.getColorIndex()));
|
||||
quadTinter = new QuadTinter(
|
||||
blockColors.getColor(blockState, facadeAccess, pos, quad.getColorIndex()));
|
||||
}
|
||||
|
||||
for (Box box : holeStrips) {
|
||||
@@ -311,15 +307,15 @@ public class FacadeBuilder {
|
||||
MeshBuilder meshBuilder = renderer.meshBuilder();
|
||||
QuadEmitter emitter = meshBuilder.getEmitter();
|
||||
|
||||
BakedModel model = MinecraftClient.getInstance().getItemRenderer().getHeldItemModel(textureItem, null,
|
||||
null);
|
||||
BakedModel model = MinecraftClient.getInstance().getItemRenderer().getHeldItemModel(textureItem, null, null);
|
||||
List<BakedQuad> modelQuads = model.getQuads(null, null, new Random());
|
||||
|
||||
//FIXME BakedPipeline pipeline = this.pipelines.get();
|
||||
// FIXME BakedPipeline pipeline = this.pipelines.get();
|
||||
//FIXME Quad collectorQuad = this.collectors.get();
|
||||
|
||||
// Grab pipeline elements.
|
||||
// FIXME QuadClamper clamper = pipeline.getElement("clamper", QuadClamper.class);
|
||||
// FIXME QuadClamper clamper = pipeline.getElement("clamper",
|
||||
// QuadClamper.class);
|
||||
// FIXME QuadTinter tinter = pipeline.getElement("tinter", QuadTinter.class);
|
||||
|
||||
QuadReInterpolator interpolator = new QuadReInterpolator();
|
||||
@@ -362,15 +358,18 @@ public class FacadeBuilder {
|
||||
for (BakedQuad quad : modelQuads) {
|
||||
|
||||
// Lookup the CachedFormat for this quads format.
|
||||
// FIXME CachedFormat format = CachedFormat.lookup(VertexFormats.POSITION_COLOR_TEXTURE_LIGHT_NORMAL);
|
||||
// FIXME CachedFormat format =
|
||||
// CachedFormat.lookup(VertexFormats.POSITION_COLOR_TEXTURE_LIGHT_NORMAL);
|
||||
// Reset the pipeline.
|
||||
// FIXME pipeline.reset(format);
|
||||
// Reset the collector.
|
||||
//FIXME collectorQuad.reset(format);
|
||||
// FIXME collectorQuad.reset(format);
|
||||
// If we have a tint index, setup the tinter and enable it.
|
||||
// FIXME if (quad.hasTintIndex()) {
|
||||
// FIXME tinter.setTint(MinecraftClient.getInstance().getItemColors().getColor(textureItem, quad.getColorIndex()));
|
||||
// FIXME pipeline.enableElement("tinter");
|
||||
// FIXME
|
||||
// tinter.setTint(MinecraftClient.getInstance().getItemColors().getColor(textureItem,
|
||||
// quad.getColorIndex()));
|
||||
// FIXME pipeline.enableElement("tinter");
|
||||
// FIXME }
|
||||
// Disable elements we don't need for items.
|
||||
// FIXME pipeline.disableElement("face_stripper");
|
||||
@@ -383,7 +382,7 @@ public class FacadeBuilder {
|
||||
// FIXME quad.pipe(pipeline);
|
||||
// FIXME // Check the collector for data and add the quad if there was.
|
||||
// FIXME if (collectorQuad.full) {
|
||||
// FIXME facadeQuads.add(collectorQuad.bake());
|
||||
// FIXME facadeQuads.add(collectorQuad.bake());
|
||||
// FIXME }
|
||||
}
|
||||
return meshBuilder.build();
|
||||
|
||||
@@ -1,11 +1,15 @@
|
||||
|
||||
package appeng.client.render.cablebus;
|
||||
|
||||
import appeng.api.parts.IDynamicPartBakedModel;
|
||||
import appeng.api.util.AEColor;
|
||||
import appeng.util.Platform;
|
||||
import java.util.Random;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import com.google.common.cache.Cache;
|
||||
import com.google.common.cache.CacheBuilder;
|
||||
|
||||
import net.fabricmc.fabric.api.renderer.v1.Renderer;
|
||||
import net.fabricmc.fabric.api.renderer.v1.RendererAccess;
|
||||
import net.fabricmc.fabric.api.renderer.v1.mesh.Mesh;
|
||||
@@ -19,10 +23,9 @@ import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.world.BlockRenderView;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Random;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.function.Supplier;
|
||||
import appeng.api.parts.IDynamicPartBakedModel;
|
||||
import appeng.api.util.AEColor;
|
||||
import appeng.util.Platform;
|
||||
|
||||
public class P2PTunnelFrequencyBakedModel implements IDynamicPartBakedModel {
|
||||
|
||||
@@ -32,15 +35,15 @@ public class P2PTunnelFrequencyBakedModel implements IDynamicPartBakedModel {
|
||||
|
||||
private final static Cache<Long, Mesh> modelCache = CacheBuilder.newBuilder().maximumSize(100).build();
|
||||
|
||||
private static final int[][] QUAD_OFFSETS = new int[][]{{4, 10, 2}, {10, 10, 2}, {4, 4, 2}, {10, 4, 2}};
|
||||
private static final int[][] QUAD_OFFSETS = new int[][] { { 4, 10, 2 }, { 10, 10, 2 }, { 4, 4, 2 }, { 10, 4, 2 } };
|
||||
|
||||
public P2PTunnelFrequencyBakedModel(final Sprite texture) {
|
||||
this.texture = texture;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void emitQuads(BlockRenderView blockView, BlockState state, BlockPos pos, Supplier<Random> randomSupplier, RenderContext context,
|
||||
Direction partSide, @Nullable Object modelData) {
|
||||
public void emitQuads(BlockRenderView blockView, BlockState state, BlockPos pos, Supplier<Random> randomSupplier,
|
||||
RenderContext context, Direction partSide, @Nullable Object modelData) {
|
||||
if (!(modelData instanceof Long)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
package appeng.client.render.cablebus;
|
||||
|
||||
import appeng.client.render.BasicUnbakedModel;
|
||||
import appeng.core.AppEng;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.client.render.model.BakedModel;
|
||||
import net.minecraft.client.render.model.ModelBakeSettings;
|
||||
import net.minecraft.client.render.model.ModelLoader;
|
||||
@@ -10,9 +13,8 @@ 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;
|
||||
import appeng.client.render.BasicUnbakedModel;
|
||||
import appeng.core.AppEng;
|
||||
|
||||
public class P2PTunnelFrequencyModel implements BasicUnbakedModel {
|
||||
|
||||
@@ -21,7 +23,8 @@ public class P2PTunnelFrequencyModel implements BasicUnbakedModel {
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public BakedModel bake(ModelLoader loader, Function<SpriteIdentifier, Sprite> textureGetter, ModelBakeSettings rotationContainer, Identifier modelId) {
|
||||
public BakedModel bake(ModelLoader loader, Function<SpriteIdentifier, Sprite> textureGetter,
|
||||
ModelBakeSettings rotationContainer, Identifier modelId) {
|
||||
final Sprite texture = textureGetter.apply(TEXTURE);
|
||||
return new P2PTunnelFrequencyBakedModel(texture);
|
||||
}
|
||||
|
||||
@@ -18,7 +18,8 @@
|
||||
|
||||
package appeng.client.render.cablebus;
|
||||
|
||||
import appeng.client.render.FacingToRotation;
|
||||
import java.util.EnumMap;
|
||||
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
import net.fabricmc.fabric.api.renderer.v1.mesh.MutableQuadView;
|
||||
@@ -28,7 +29,7 @@ import net.minecraft.client.util.math.Vector3f;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.util.math.Quaternion;
|
||||
|
||||
import java.util.EnumMap;
|
||||
import appeng.client.render.FacingToRotation;
|
||||
|
||||
/**
|
||||
* Assuming a default-orientation of forward=NORTH and up=UP, this class rotates
|
||||
@@ -39,8 +40,8 @@ public class QuadRotator implements RenderContext.QuadTransform {
|
||||
|
||||
public static final RenderContext.QuadTransform NULL_TRANSFORM = quad -> true;
|
||||
|
||||
private static final EnumMap<FacingToRotation, RenderContext.QuadTransform> TRANSFORMS
|
||||
= new EnumMap<>(FacingToRotation.class);
|
||||
private static final EnumMap<FacingToRotation, RenderContext.QuadTransform> TRANSFORMS = new EnumMap<>(
|
||||
FacingToRotation.class);
|
||||
|
||||
static {
|
||||
for (FacingToRotation rotation : FacingToRotation.values()) {
|
||||
|
||||
@@ -23,9 +23,9 @@ import java.util.function.Function;
|
||||
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
import net.minecraft.client.util.SpriteIdentifier;
|
||||
import net.minecraft.client.texture.SpriteAtlasTexture;
|
||||
import net.minecraft.client.texture.Sprite;
|
||||
import net.minecraft.client.texture.SpriteAtlasTexture;
|
||||
import net.minecraft.client.util.SpriteIdentifier;
|
||||
import net.minecraft.util.Identifier;
|
||||
|
||||
import appeng.core.AppEng;
|
||||
|
||||
Reference in New Issue
Block a user