Merge remote-tracking branch 'origin/master' into fabric-1.16
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2013 AlgorithmX2
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
* this software and associated documentation files (the "Software"), to deal in
|
||||
* the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
package appeng.api.networking;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
/**
|
||||
* A factory for grid cache implementations.
|
||||
*/
|
||||
@FunctionalInterface
|
||||
public interface IGridCacheFactory<T extends IGridCache> {
|
||||
|
||||
/**
|
||||
* Creates a grid cache for the given grid.
|
||||
*
|
||||
* @param grid The grid for which the cache should be created.
|
||||
* @return A new grid cache instance.
|
||||
*/
|
||||
@Nonnull
|
||||
T createCache(IGrid grid);
|
||||
|
||||
}
|
||||
@@ -83,7 +83,7 @@ public class CableBusBlock extends AEBaseTileBlock<CableBusBlockEntity> implemen
|
||||
public CableBusBlock() {
|
||||
super(defaultProps(AEGlassMaterial.INSTANCE)
|
||||
.nonOpaque()
|
||||
.dropsNothing());
|
||||
.dropsNothing().variableOpacity());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -63,7 +63,7 @@ public class DriveBakedModel extends DelegateBakedModel {
|
||||
|
||||
DriveSlotsState slotsState = driveModelData.getSlotsState();
|
||||
|
||||
if (side == null && slotsState != null) {
|
||||
if (slotsState != null) {
|
||||
for (int row = 0; row < 5; row++) {
|
||||
for (int col = 0; col < 2; col++) {
|
||||
Matrix4f transform = new Matrix4f();
|
||||
@@ -80,7 +80,7 @@ public class DriveBakedModel extends DelegateBakedModel {
|
||||
// Add the drive chassis
|
||||
Item cell = slotsState.getCell(slot);
|
||||
BakedModel cellChassisModel = getCellChassisModel(cell);
|
||||
addModel(state, rand, extraData, result, cellChassisModel, transform);
|
||||
addModel(state, rand, extraData, result, side, cellChassisModel, transform);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -112,9 +112,9 @@ public class DriveBakedModel extends DelegateBakedModel {
|
||||
}
|
||||
|
||||
private static void addModel(@Nullable BlockState state, @Nonnull Random rand, @Nonnull IModelData extraData,
|
||||
List<BakedQuad> result, BakedModel bakedCell, Matrix4f transform) {
|
||||
List<BakedQuad> result, Direction side, IBakedModel bakedCell, Matrix4f transform) {
|
||||
MatrixVertexTransformer transformer = new MatrixVertexTransformer(transform);
|
||||
for (BakedQuad bakedQuad : bakedCell.getQuads(state, null, rand, extraData)) {
|
||||
for (BakedQuad bakedQuad : bakedCell.getQuads(state, side, rand, extraData)) {
|
||||
BakedQuadBuilder builder = new BakedQuadBuilder();
|
||||
transformer.setParent(builder);
|
||||
transformer.setVertexFormat(builder.getVertexFormat());
|
||||
|
||||
@@ -7,6 +7,9 @@ import net.minecraft.client.render.VertexConsumer;
|
||||
import net.minecraft.client.render.block.entity.BlockEntityRenderDispatcher;
|
||||
import net.minecraft.client.render.block.entity.BlockEntityRenderer;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import com.mojang.blaze3d.vertex.IVertexBuilder;
|
||||
|
||||
import net.minecraft.client.render.VertexConsumerProvider;
|
||||
import net.minecraft.client.renderer.RenderState;
|
||||
@@ -14,7 +17,6 @@ import net.minecraft.client.util.math.Vector3f;
|
||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
import net.minecraftforge.fml.common.ObfuscationReflectionHelper;
|
||||
|
||||
import appeng.block.storage.DriveSlotState;
|
||||
import appeng.client.render.FacingToRotation;
|
||||
@@ -26,6 +28,14 @@ import appeng.tile.storage.DriveBlockEntity;
|
||||
@Environment(EnvType.CLIENT)
|
||||
public class DriveLedTileEntityRenderer extends BlockEntityRenderer<DriveBlockEntity> {
|
||||
|
||||
private static final RenderState.TransparencyState TRANSLUCENT_TRANSPARENCY = new RenderState.TransparencyState(
|
||||
"translucent_transparency", () -> {
|
||||
RenderSystem.enableBlend();
|
||||
RenderSystem.defaultBlendFunc();
|
||||
}, () -> {
|
||||
RenderSystem.disableBlend();
|
||||
});
|
||||
|
||||
private static final EnumMap<DriveSlotState, Vector3f> STATE_COLORS;
|
||||
|
||||
// Color used for the cell indicator for blinking during recent activity
|
||||
@@ -80,11 +90,9 @@ public class DriveLedTileEntityRenderer extends BlockEntityRenderer<DriveBlockEn
|
||||
FacingToRotation.get(drive.getForward(), drive.getUp()).push(ms);
|
||||
ms.translate(-0.5, -0.5, -0.5);
|
||||
|
||||
RenderState.TransparencyState TRANSLUCENT_TRANSPARENCY = ObfuscationReflectionHelper
|
||||
.getPrivateValue(RenderState.class, null, "field_228515_g_");
|
||||
RenderLayer rt = RenderLayer.makeType("ae_drive_leds", DefaultVertexFormats.POSITION_COLOR, 7, 32565, false, true,
|
||||
RenderLayer.State.getBuilder().transparency(TRANSLUCENT_TRANSPARENCY).build(false));
|
||||
VertexConsumer buffer = buffers.getBuffer(STATE);
|
||||
RenderType rt = RenderType.makeType("ae_drive_leds", DefaultVertexFormats.POSITION_COLOR, 7, 32565, false, true,
|
||||
RenderType.State.getBuilder().transparency(TRANSLUCENT_TRANSPARENCY).build(false));
|
||||
IVertexBuilder buffer = buffers.getBuffer(STATE);
|
||||
|
||||
for (int row = 0; row < 5; row++) {
|
||||
for (int col = 0; col < 2; col++) {
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"textures": {
|
||||
"cell": "appliedenergistics2:block/drive/item_cell"
|
||||
},
|
||||
"elements": [
|
||||
{
|
||||
"name": "Cell Backdrop",
|
||||
"from": [9, 13, 1],
|
||||
"to": [15, 15, 3],
|
||||
"rotation": { "angle": 0, "axis": "y", "origin": [9, 8, 8] },
|
||||
"faces": {
|
||||
"north": {
|
||||
"uv": [0, 2, 6, 4],
|
||||
"texture": "#cell",
|
||||
"cullface": "north"
|
||||
},
|
||||
"up": { "uv": [0, 0, 6, 2], "texture": "#cell", "cullface": "north" },
|
||||
"down": { "uv": [0, 4, 6, 6], "texture": "#cell", "cullface": "north" }
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user