diff --git a/src/main/java/appeng/block/storage/ChestBlock.java b/src/main/java/appeng/block/storage/ChestBlock.java index 91e6b117f..2f8efe227 100644 --- a/src/main/java/appeng/block/storage/ChestBlock.java +++ b/src/main/java/appeng/block/storage/ChestBlock.java @@ -25,7 +25,7 @@ import net.minecraft.block.BlockState; import net.minecraft.block.material.Material; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; -import net.minecraft.state.EnumProperty; +import net.minecraft.state.BooleanProperty; import net.minecraft.state.StateContainer; import net.minecraft.util.ActionResultType; import net.minecraft.util.Hand; @@ -42,18 +42,17 @@ import appeng.tile.storage.ChestTileEntity; public class ChestBlock extends AEBaseTileBlock { - private final static EnumProperty SLOT_STATE = EnumProperty.create("slot_state", - DriveSlotState.class); + private final static BooleanProperty LIGHTS_ON = BooleanProperty.create("lights_on"); public ChestBlock() { super(defaultProps(Material.IRON)); - this.setDefaultState(this.getDefaultState().with(SLOT_STATE, DriveSlotState.EMPTY)); + this.setDefaultState(this.getDefaultState().with(LIGHTS_ON, false)); } @Override protected void fillStateContainer(StateContainer.Builder builder) { super.fillStateContainer(builder); - builder.add(SLOT_STATE); + builder.add(LIGHTS_ON); } @Override @@ -68,7 +67,7 @@ public class ChestBlock extends AEBaseTileBlock { slotState = DriveSlotState.OFFLINE; } - return currentState.with(SLOT_STATE, slotState); + return currentState.with(LIGHTS_ON, slotState != DriveSlotState.EMPTY && slotState != DriveSlotState.OFFLINE); } @Override diff --git a/src/main/java/appeng/client/render/model/DriveBakedModel.java b/src/main/java/appeng/client/render/model/DriveBakedModel.java index 1f9823a89..14e71715d 100644 --- a/src/main/java/appeng/client/render/model/DriveBakedModel.java +++ b/src/main/java/appeng/client/render/model/DriveBakedModel.java @@ -28,6 +28,7 @@ import javax.annotation.Nullable; import net.minecraft.block.BlockState; import net.minecraft.client.renderer.Matrix4f; +import net.minecraft.client.renderer.Vector3f; import net.minecraft.client.renderer.model.BakedQuad; import net.minecraft.client.renderer.model.IBakedModel; import net.minecraft.item.Item; @@ -49,6 +50,19 @@ public class DriveBakedModel extends DelegateBakedModel { this.defaultCell = defaultCell; } + /** + * Calculates the origin of a drive slot for positioning a cell model into it. + */ + public static void getSlotOrigin(int row, int col, Vector3f translation) { + // Position this drive model copy at the correct slot. The transform is based on + // the cell-model being in slot 0,0,0 while the upper left slot's origin is at + // 9,13,1 + float xOffset = (9 - col * 8) / 16.0f; + float yOffset = (13 - row * 3) / 16.0f; + float zOffset = 1 / 16.0f; + translation.set(xOffset, yOffset, zOffset); + } + @Nonnull @Override public List getQuads(@Nullable BlockState state, @Nullable Direction side, @Nonnull Random rand, @@ -63,17 +77,14 @@ public class DriveBakedModel extends DelegateBakedModel { DriveSlotsState slotsState = driveModelData.getSlotsState(); + Vector3f slotTranslation = new Vector3f(); if (slotsState != null) { for (int row = 0; row < 5; row++) { for (int col = 0; col < 2; col++) { Matrix4f transform = new Matrix4f(); - // Position this drive model copy at the correct slot. The transform is based on - // the - // cell-model being in slot 0,0 at the top left of the drive. - float xOffset = -col * 8 / 16.0f; - float yOffset = -row * 3 / 16.0f; - transform.setTranslation(xOffset, yOffset, 0); + getSlotOrigin(row, col, slotTranslation); + transform.setTranslation(slotTranslation.getX(), slotTranslation.getY(), slotTranslation.getZ()); int slot = row * 2 + col; diff --git a/src/main/java/appeng/client/render/tesr/CellLedRenderer.java b/src/main/java/appeng/client/render/tesr/CellLedRenderer.java new file mode 100644 index 000000000..ab47d6332 --- /dev/null +++ b/src/main/java/appeng/client/render/tesr/CellLedRenderer.java @@ -0,0 +1,106 @@ +package appeng.client.render.tesr; + +import java.util.EnumMap; + +import com.mojang.blaze3d.matrix.MatrixStack; +import com.mojang.blaze3d.vertex.IVertexBuilder; + +import net.minecraft.client.renderer.RenderType; +import net.minecraft.client.renderer.Vector3f; +import net.minecraft.client.renderer.vertex.DefaultVertexFormats; + +import appeng.api.implementations.tiles.IChestOrDrive; +import appeng.block.storage.DriveSlotState; + +/** + * Utility class to render LEDs for storage cells from a Tile Entity Renderer. + */ +class CellLedRenderer { + + private static final EnumMap STATE_COLORS; + + // Color used for the cell indicator for blinking during recent activity + private static final Vector3f BLINK_COLOR = new Vector3f(1, 0.5f, 0.5f); + + static { + STATE_COLORS = new EnumMap<>(DriveSlotState.class); + STATE_COLORS.put(DriveSlotState.OFFLINE, new Vector3f(0, 0, 0)); + STATE_COLORS.put(DriveSlotState.ONLINE, new Vector3f(0, 1, 0)); + STATE_COLORS.put(DriveSlotState.NOT_EMPTY, new Vector3f(0f, 0.667f, 1)); + STATE_COLORS.put(DriveSlotState.TYPES_FULL, new Vector3f(1, 0.667f, 0)); + STATE_COLORS.put(DriveSlotState.FULL, new Vector3f(1, 0, 0)); + } + + // The positions are based on the upper left slot in a drive + private static final float L = 5 / 16.f; // left (x-axis) + private static final float R = 4 / 16.f; // right (x-axis) + private static final float T = 1 / 16.f; // top (y-axis) + private static final float B = -0.001f / 16.f; // bottom (y-axis) + private static final float FR = -0.001f / 16.f; // front (z-axis) + private static final float BA = 0.499f / 16.f; // back (z-axis) + + // Vertex data for the LED cuboid (has no back) + // Directions are when looking from the front onto the LED + private static final float[] LED_QUADS = { + // Front Face + R, T, FR, L, T, FR, L, B, FR, R, B, FR, + // Left Face + L, T, FR, L, T, BA, L, B, BA, L, B, FR, + // Right Face + R, T, BA, R, T, FR, R, B, FR, R, B, BA, + // Top Face + R, T, BA, L, T, BA, L, T, FR, R, T, FR, + // Bottom Face + R, B, FR, L, B, FR, L, B, BA, R, B, BA, }; + + public static final RenderType RENDER_LAYER = RenderType.makeType("ae_drive_leds", + DefaultVertexFormats.POSITION_COLOR, 7, 32565, false, true, RenderType.State.getBuilder().build(false)); + + public static void renderLed(IChestOrDrive drive, int slot, IVertexBuilder buffer, MatrixStack ms, + float partialTicks) { + + Vector3f color = getColorForSlot(drive, slot, partialTicks); + if (color == null) { + return; + } + + for (int i = 0; i < LED_QUADS.length; i += 3) { + float x = LED_QUADS[i]; + float y = LED_QUADS[i + 1]; + float z = LED_QUADS[i + 2]; + buffer.pos(ms.getLast().getMatrix(), x, y, z).color(color.getX(), color.getY(), color.getZ(), 1.f) + .endVertex(); + } + } + + private static Vector3f getColorForSlot(IChestOrDrive drive, int slot, float partialTicks) { + DriveSlotState state = DriveSlotState.fromCellStatus(drive.getCellStatus(slot)); + if (state == DriveSlotState.EMPTY) { + return null; + } + + if (!drive.isPowered()) { + return STATE_COLORS.get(DriveSlotState.OFFLINE); + } + + Vector3f col = STATE_COLORS.get(state); + if (drive.isCellBlinking(slot)) { + // 200 ms interval (100ms to get to red, then 100ms back) + long t = System.currentTimeMillis() % 200; + float f = (t - 100) / 200.0f + 0.5f; + f = easeInOutCubic(f); + col = col.copy(); + col.lerp(BLINK_COLOR, f); + } + + return col; + } + + private static float easeInOutCubic(float x) { + return x < 0.5f ? 4 * x * x * x : 1 - (float) Math.pow(-2 * x + 2, 3) / 2; + } + + private CellLedRenderer() { + } + +} diff --git a/src/main/java/appeng/client/render/tesr/ChestTileEntityRenderer.java b/src/main/java/appeng/client/render/tesr/ChestTileEntityRenderer.java new file mode 100644 index 000000000..667fe91ac --- /dev/null +++ b/src/main/java/appeng/client/render/tesr/ChestTileEntityRenderer.java @@ -0,0 +1,154 @@ +/* + * 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 . + */ + +package appeng.client.render.tesr; + +import java.util.ArrayList; +import java.util.List; +import java.util.Random; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +import com.mojang.blaze3d.matrix.MatrixStack; +import com.mojang.blaze3d.vertex.IVertexBuilder; + +import net.minecraft.block.BlockState; +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.BlockModelRenderer; +import net.minecraft.client.renderer.IRenderTypeBuffer; +import net.minecraft.client.renderer.RenderType; +import net.minecraft.client.renderer.model.BakedQuad; +import net.minecraft.client.renderer.model.IBakedModel; +import net.minecraft.client.renderer.model.ModelManager; +import net.minecraft.client.renderer.tileentity.TileEntityRenderer; +import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; +import net.minecraft.item.Item; +import net.minecraft.item.Items; +import net.minecraft.util.Direction; +import net.minecraft.util.ResourceLocation; +import net.minecraft.world.World; +import net.minecraftforge.client.model.data.EmptyModelData; +import net.minecraftforge.client.model.data.IModelData; + +import appeng.api.client.ICellModelRegistry; +import appeng.block.storage.DriveSlotsState; +import appeng.client.render.DelegateBakedModel; +import appeng.client.render.FacingToRotation; +import appeng.core.Api; +import appeng.tile.storage.ChestTileEntity; + +/** + * The tile entity renderer for ME chests takes care of rendering the right + * model for the inserted cell, as well as the LED. + */ +public class ChestTileEntityRenderer extends TileEntityRenderer { + + private final ICellModelRegistry cellModelRegistry = Api.instance().client().cells(); + + private final ModelManager modelManager; + + private final BlockModelRenderer blockRenderer; + + public ChestTileEntityRenderer(TileEntityRendererDispatcher rendererDispatcherIn) { + super(rendererDispatcherIn); + Minecraft client = Minecraft.getInstance(); + modelManager = client.getModelManager(); + blockRenderer = client.getBlockRendererDispatcher().getBlockModelRenderer(); + } + + @Override + public void render(ChestTileEntity chest, float partialTicks, MatrixStack matrices, IRenderTypeBuffer buffers, + int combinedLight, int combinedOverlay) { + + World world = chest.getWorld(); + if (world == null) { + return; + } + + DriveSlotsState driveSlotState = DriveSlotsState.fromChestOrDrive(chest); + + Item cellItem = driveSlotState.getCell(0); + if (cellItem == null || cellItem == Items.AIR) { + return; // No cell inserted into chest + } + + ResourceLocation cellModelLocation = cellModelRegistry.model(cellItem); + if (cellModelLocation == null) { + cellModelLocation = cellModelRegistry.getDefaultModel(); + } + + IBakedModel model = modelManager.getModel(cellModelLocation); + + matrices.push(); + matrices.translate(0.5, 0.5, 0.5); + FacingToRotation rotation = FacingToRotation.get(chest.getForward(), chest.getUp()); + rotation.push(matrices); + matrices.translate(-0.5, -0.5, -0.5); + + // The models are created for the top-left slot of the drive model, + // we need to move them into place for the slot on the ME chest + matrices.translate(5 / 16.0, 4 / 16.0, 0); + + // Render the cell model as-if it was a block model + IVertexBuilder buffer = buffers.getBuffer(RenderType.getCutout()); + // We "fake" the position here to make it use the light-value in front of the + // drive + FaceRotatingModel rotatedModel = new FaceRotatingModel(model, rotation); + blockRenderer.renderModel(world, rotatedModel, chest.getBlockState(), chest.getPos(), matrices, buffer, false, + new Random(), 0L, combinedOverlay, EmptyModelData.INSTANCE); + + IVertexBuilder ledBuffer = buffers.getBuffer(CellLedRenderer.RENDER_LAYER); + CellLedRenderer.renderLed(chest, 0, ledBuffer, matrices, partialTicks); + + matrices.pop(); + } + + /** + * The actual vertex data will be transformed using the matrix stack, but the + * faces will not be correctly rotated so the incorrect lighting data would be + * used to apply diffuse lighting and the lightmap texture. + */ + private static class FaceRotatingModel extends DelegateBakedModel { + private final FacingToRotation r; + + protected FaceRotatingModel(IBakedModel base, FacingToRotation r) { + super(base); + this.r = r; + } + + @Nonnull + @Override + public List getQuads(@Nullable BlockState state, @Nullable Direction side, @Nonnull Random rand, + @Nonnull IModelData extraData) { + if (side != null) { + side = r.rotate(side); // This fixes the incorrect lightmap position + } + List quads = new ArrayList<>(super.getQuads(state, side, rand, extraData)); + + for (int i = 0; i < quads.size(); i++) { + BakedQuad quad = quads.get(i); + quads.set(i, new BakedQuad(quad.getVertexData(), quad.getTintIndex(), r.rotate(quad.getFace()), + quad.func_187508_a(), quad.shouldApplyDiffuseLighting())); + } + + return quads; + } + } + +} diff --git a/src/main/java/appeng/client/render/tesr/DriveLedTileEntityRenderer.java b/src/main/java/appeng/client/render/tesr/DriveLedTileEntityRenderer.java index d410bd913..a583247fa 100644 --- a/src/main/java/appeng/client/render/tesr/DriveLedTileEntityRenderer.java +++ b/src/main/java/appeng/client/render/tesr/DriveLedTileEntityRenderer.java @@ -1,21 +1,17 @@ package appeng.client.render.tesr; -import java.util.EnumMap; - import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.vertex.IVertexBuilder; import net.minecraft.client.renderer.IRenderTypeBuffer; -import net.minecraft.client.renderer.RenderType; import net.minecraft.client.renderer.Vector3f; import net.minecraft.client.renderer.tileentity.TileEntityRenderer; import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; -import net.minecraft.client.renderer.vertex.DefaultVertexFormats; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; -import appeng.block.storage.DriveSlotState; import appeng.client.render.FacingToRotation; +import appeng.client.render.model.DriveBakedModel; import appeng.tile.storage.DriveTileEntity; /** @@ -24,44 +20,6 @@ import appeng.tile.storage.DriveTileEntity; @OnlyIn(Dist.CLIENT) public class DriveLedTileEntityRenderer extends TileEntityRenderer { - private static final EnumMap STATE_COLORS; - - // Color used for the cell indicator for blinking during recent activity - private static final Vector3f BLINK_COLOR = new Vector3f(1, 0.5f, 0.5f); - - static { - STATE_COLORS = new EnumMap<>(DriveSlotState.class); - STATE_COLORS.put(DriveSlotState.OFFLINE, new Vector3f(0, 0, 0)); - STATE_COLORS.put(DriveSlotState.ONLINE, new Vector3f(0, 1, 0)); - STATE_COLORS.put(DriveSlotState.NOT_EMPTY, new Vector3f(0f, 0.667f, 1)); - STATE_COLORS.put(DriveSlotState.TYPES_FULL, new Vector3f(1, 0.667f, 0)); - STATE_COLORS.put(DriveSlotState.FULL, new Vector3f(1, 0, 0)); - } - - private static final float L = 14 / 16.f; // left (x-axis) - private static final float R = 13 / 16.f; // right (x-axis) - private static final float T = 14 / 16.f; // top (x-axis) - private static final float B = 12.999f / 16.f; // bottom (x-axis) - private static final float FR = 0.999f / 16.f; // front (z-axis) - private static final float BA = 1.499f / 16.f; // back (z-axis) - - // Vertex data for the LED cuboid (has no back) - // Directions are when looking from the front onto the LED - private static final float[] LED_QUADS = { - // Front Face - R, T, FR, L, T, FR, L, B, FR, R, B, FR, - // Left Face - L, T, FR, L, T, BA, L, B, BA, L, B, FR, - // Right Face - R, T, BA, R, T, FR, R, B, FR, R, B, BA, - // Top Face - R, T, BA, L, T, BA, L, T, FR, R, T, FR, - // Bottom Face - R, B, FR, L, B, FR, L, B, BA, R, B, BA, }; - - private static final RenderType STATE = RenderType.makeType("ae_drive_leds", DefaultVertexFormats.POSITION_COLOR, 7, - 32565, false, true, RenderType.State.getBuilder().build(false)); - public DriveLedTileEntityRenderer(TileEntityRendererDispatcher rendererDispatcherIn) { super(rendererDispatcherIn); } @@ -79,32 +37,18 @@ public class DriveLedTileEntityRenderer extends TileEntityRenderer() { + @Override + @OnlyIn(Dist.CLIENT) + public void customize(TileEntityRendering rendering) { + rendering.tileEntityRenderer(ChestTileEntityRenderer::new); + } + }).build()) .rendering(new ChestRendering()).build(); this.iface = registry.block("interface", InterfaceBlock::new).features(AEFeature.INTERFACE) .tileEntity( diff --git a/src/main/java/appeng/tile/storage/ChestTileEntity.java b/src/main/java/appeng/tile/storage/ChestTileEntity.java index 5245d0ec8..4ccae94cf 100644 --- a/src/main/java/appeng/tile/storage/ChestTileEntity.java +++ b/src/main/java/appeng/tile/storage/ChestTileEntity.java @@ -29,6 +29,7 @@ import net.minecraft.entity.player.PlayerEntity; import net.minecraft.inventory.container.ContainerType; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; +import net.minecraft.item.Items; import net.minecraft.nbt.CompoundNBT; import net.minecraft.network.PacketBuffer; import net.minecraft.tileentity.ITickableTileEntity; @@ -42,44 +43,24 @@ import net.minecraftforge.fluids.IFluidTank; import net.minecraftforge.fluids.capability.CapabilityFluidHandler; import net.minecraftforge.fluids.capability.IFluidHandler; import net.minecraftforge.items.IItemHandler; +import net.minecraftforge.registries.ForgeRegistries; -import appeng.api.config.AccessRestriction; -import appeng.api.config.Actionable; -import appeng.api.config.PowerMultiplier; -import appeng.api.config.SecurityPermissions; -import appeng.api.config.Settings; -import appeng.api.config.SortDir; -import appeng.api.config.SortOrder; -import appeng.api.config.ViewItems; +import appeng.api.config.*; import appeng.api.implementations.tiles.IColorableTile; import appeng.api.implementations.tiles.IMEChest; import appeng.api.networking.GridFlags; import appeng.api.networking.IGrid; import appeng.api.networking.IGridNode; import appeng.api.networking.energy.IEnergyGrid; -import appeng.api.networking.events.MENetworkCellArrayUpdate; -import appeng.api.networking.events.MENetworkChannelsChanged; -import appeng.api.networking.events.MENetworkEventSubscribe; -import appeng.api.networking.events.MENetworkPowerStatusChange; -import appeng.api.networking.events.MENetworkPowerStorage; +import appeng.api.networking.events.*; import appeng.api.networking.events.MENetworkPowerStorage.PowerEventType; import appeng.api.networking.security.IActionHost; import appeng.api.networking.security.IActionSource; import appeng.api.networking.security.ISecurityGrid; import appeng.api.networking.storage.IBaseMonitor; import appeng.api.networking.storage.IStorageGrid; -import appeng.api.storage.IMEInventoryHandler; -import appeng.api.storage.IMEMonitor; -import appeng.api.storage.IMEMonitorHandlerReceiver; -import appeng.api.storage.IStorageChannel; -import appeng.api.storage.IStorageMonitorable; -import appeng.api.storage.IStorageMonitorableAccessor; -import appeng.api.storage.ITerminalHost; -import appeng.api.storage.cells.CellState; -import appeng.api.storage.cells.ICellGuiHandler; -import appeng.api.storage.cells.ICellHandler; -import appeng.api.storage.cells.ICellInventory; -import appeng.api.storage.cells.ICellInventoryHandler; +import appeng.api.storage.*; +import appeng.api.storage.cells.*; import appeng.api.storage.channels.IFluidStorageChannel; import appeng.api.storage.channels.IItemStorageChannel; import appeng.api.storage.data.IAEFluidStack; @@ -133,6 +114,10 @@ public class ChestTileEntity extends AENetworkPowerTileEntity private ChestMonitorHandler cellHandler; private Accessor accessor; private IFluidHandler fluidHandler; + // This is only used on the client to display the right cell model without + // synchronizing the entire + // cell's inventory when a chest comes into view. + private Item cellItem = Items.AIR; public ChestTileEntity(TileEntityType tileEntityTypeIn) { super(tileEntityTypeIn); @@ -273,6 +258,10 @@ public class ChestTileEntity extends AENetworkPowerTileEntity if (slot != 0) { return null; } + // Client-side we'll need to actually use the synced state + if (world == null || world.isRemote) { + return cellItem; + } ItemStack cell = getCell(); return cell.isEmpty() ? null : cell.getItem(); } @@ -364,6 +353,12 @@ public class ChestTileEntity extends AENetworkPowerTileEntity data.writeByte(this.state); data.writeByte(this.paintedColor.ordinal()); + + // Note that we trust that the change detection in recalculateDisplay will trip + // when it changes from + // empty->non-empty, so when the cell is changed, it should re-send the state + // because of that + data.writeRegistryIdUnsafe(ForgeRegistries.ITEMS, getCell().getItem().getRegistryName()); } @Override @@ -375,6 +370,7 @@ public class ChestTileEntity extends AENetworkPowerTileEntity this.state = data.readByte(); final AEColor oldPaintedColor = this.paintedColor; this.paintedColor = AEColor.values()[data.readByte()]; + this.cellItem = data.readRegistryIdUnsafe(ForgeRegistries.ITEMS); this.lastStateChange = this.world.getGameTime(); diff --git a/src/main/resources/assets/appliedenergistics2/blockstates/chest.json b/src/main/resources/assets/appliedenergistics2/blockstates/chest.json index b5a8459ea..d0cfbf744 100644 --- a/src/main/resources/assets/appliedenergistics2/blockstates/chest.json +++ b/src/main/resources/assets/appliedenergistics2/blockstates/chest.json @@ -7,7 +7,7 @@ }, { "when": { - "slot_state": "empty|offline" + "lights_on": false }, "apply": { "model": "appliedenergistics2:block/chest/lights_off" @@ -15,59 +15,11 @@ }, { "when": { - "slot_state": "online|not_empty|types_full|full" + "lights_on": true }, "apply": { "model": "appliedenergistics2:block/chest/lights_on" } - }, - { - "when": { - "slot_state": "empty" - }, - "apply": { - "model": "appliedenergistics2:block/chest/cell_state_empty" - } - }, - { - "when": { - "slot_state": "offline" - }, - "apply": { - "model": "appliedenergistics2:block/chest/cell_state_offline" - } - }, - { - "when": { - "slot_state": "online" - }, - "apply": { - "model": "appliedenergistics2:block/chest/cell_state_online" - } - }, - { - "when": { - "slot_state": "not_empty" - }, - "apply": { - "model": "appliedenergistics2:block/chest/cell_state_not_empty" - } - }, - { - "when": { - "slot_state": "types_full" - }, - "apply": { - "model": "appliedenergistics2:block/chest/cell_state_types_full" - } - }, - { - "when": { - "slot_state": "full" - }, - "apply": { - "model": "appliedenergistics2:block/chest/cell_state_full" - } } ] } diff --git a/src/main/resources/assets/appliedenergistics2/models/block/chest/base.json b/src/main/resources/assets/appliedenergistics2/models/block/chest/base.json index 88dc5b2a4..5af101397 100644 --- a/src/main/resources/assets/appliedenergistics2/models/block/chest/base.json +++ b/src/main/resources/assets/appliedenergistics2/models/block/chest/base.json @@ -1,12 +1,109 @@ { - "parent": "block/cube", + "credit": "Made with Blockbench", "textures": { - "particle": "appliedenergistics2:block/chest/side", + "4": "appliedenergistics2:block/drive/drive_inside", "up": "appliedenergistics2:block/chest/top", "down": "appliedenergistics2:block/chest/bottom", "north": "appliedenergistics2:block/chest/front", - "east": "appliedenergistics2:block/chest/side", - "south": "appliedenergistics2:block/chest/side", - "west": "appliedenergistics2:block/chest/side" - } + "particle": "appliedenergistics2:block/chest/side", + "east": "appliedenergistics2:block/chest/side" + }, + "elements": [ + { + "from": [0, 0, 0], + "to": [16, 16, 16], + "faces": { + "north": { "uv": [0, 0, 16, 16], "texture": "#north" }, + "east": { "uv": [0, 0, 16, 16], "texture": "#east" }, + "south": { "uv": [0, 0, 16, 16], "texture": "#east" }, + "west": { "uv": [0, 0, 16, 16], "texture": "#east" }, + "up": { "uv": [0, 0, 16, 16], "texture": "#up" }, + "down": { "uv": [0, 0, 16, 16], "texture": "#down" } + } + }, + { + "name": "inside_back", + "from": [5, 4, 7], + "to": [11, 7, 10], + "rotation": { "angle": 0, "axis": "y", "origin": [19, 11, 8] }, + "faces": { + "north": { "uv": [4, 1, 16, 14], "texture": "#4" } + } + }, + { + "name": "inside_left", + "from": [11, 1, 1], + "to": [14, 12, 11], + "rotation": { "angle": 0, "axis": "y", "origin": [18, 11, 3] }, + "faces": { + "north": { "uv": [2, 5, 2, 5], "texture": "#4" }, + "west": { "uv": [5, 1, 14, 12], "texture": "#4" } + } + }, + { + "name": "inside_top", + "from": [5, 6, 1], + "to": [11, 9, 11], + "rotation": { "angle": 0, "axis": "y", "origin": [15, 16, 3] }, + "faces": { + "north": { "uv": [2, 7, 2, 7], "texture": "#4" }, + "down": { "uv": [6, 4, 6, 4], "texture": "#4" } + } + }, + { + "name": "inside_bottom", + "from": [5, 1, 1], + "to": [11, 4, 11], + "rotation": { "angle": 0, "axis": "y", "origin": [15, 11, 3] }, + "faces": { + "north": { "uv": [2, 7, 2, 7], "texture": "#4" }, + "up": { "uv": [6, 3, 6, 3], "texture": "#4" } + } + }, + { + "name": "inside_border_bottom", + "from": [4, 0, 0], + "to": [12, 3, 9], + "rotation": { "angle": 0, "axis": "y", "origin": [15, 10, 1] }, + "faces": { + "up": { "uv": [0, 4, 9, 13], "rotation": 90, "texture": "#4" } + } + }, + { + "name": "inside_border_top", + "from": [5, 7, 0], + "to": [12, 10, 9], + "rotation": { "angle": 0, "axis": "y", "origin": [15, 17, 1] }, + "faces": { + "down": { "uv": [0, 4, 9, 13], "rotation": 270, "texture": "#4" } + } + }, + { + "name": "inside_border_left", + "from": [11, 3, 0], + "to": [12, 8, 1], + "rotation": { "angle": 0, "axis": "y", "origin": [15, 13, 1] }, + "faces": { + "west": { "uv": [0, 8, 1, 13], "texture": "#4" } + } + }, + { + "name": "inside_border_right", + "from": [4, 3, 0], + "to": [5, 8, 1], + "rotation": { "angle": 0, "axis": "y", "origin": [8, 13, 1] }, + "faces": { + "east": { "uv": [0, 6, 1, 11], "rotation": 180, "texture": "#4" } + } + }, + { + "name": "inside_right", + "from": [2, 1, 1], + "to": [5, 12, 11], + "rotation": { "angle": 0, "axis": "y", "origin": [9, 11, 3] }, + "faces": { + "east": { "uv": [5, 2, 14, 13], "texture": "#4" } + } + } + ] } diff --git a/src/main/resources/assets/appliedenergistics2/models/block/chest/cell_state_empty.json b/src/main/resources/assets/appliedenergistics2/models/block/chest/cell_state_empty.json deleted file mode 100644 index 72239d88d..000000000 --- a/src/main/resources/assets/appliedenergistics2/models/block/chest/cell_state_empty.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "textures": { - "state": "appliedenergistics2:block/chest/cell_state_empty" - }, - "elements": [ - { - "from": [0, 0, 0], - "to": [16, 16, 16], - "faces": { - "north": { - "texture": "#state" - } - } - } - ] -} diff --git a/src/main/resources/assets/appliedenergistics2/models/block/chest/cell_state_full.json b/src/main/resources/assets/appliedenergistics2/models/block/chest/cell_state_full.json deleted file mode 100644 index a5517ce02..000000000 --- a/src/main/resources/assets/appliedenergistics2/models/block/chest/cell_state_full.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "loader": "appliedenergistics2:uvlightmap", - "textures": { - "backdrop": "appliedenergistics2:block/chest/cell_state_backdrop", - "state": "appliedenergistics2:block/chest/cell_state_full" - }, - "elements": [ - { - "from": [0, 0, 0], - "to": [16, 16, 16], - "faces": { - "north": { - "texture": "#backdrop" - } - } - }, - { - "from": [0, 0, 0], - "to": [16, 16, 16], - "faces": { - "north": { - "texture": "#state", - "uvlightmap": { - "block": 0.007, - "sky": 0.007 - } - } - } - } - ] -} diff --git a/src/main/resources/assets/appliedenergistics2/models/block/chest/cell_state_not_empty.json b/src/main/resources/assets/appliedenergistics2/models/block/chest/cell_state_not_empty.json deleted file mode 100644 index cb3dcba8f..000000000 --- a/src/main/resources/assets/appliedenergistics2/models/block/chest/cell_state_not_empty.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "loader": "appliedenergistics2:uvlightmap", - "textures": { - "backdrop": "appliedenergistics2:block/chest/cell_state_backdrop", - "state": "appliedenergistics2:block/chest/cell_state_not_empty" - }, - "elements": [ - { - "from": [0, 0, 0], - "to": [16, 16, 16], - "faces": { - "north": { - "texture": "#backdrop" - } - } - }, - { - "from": [0, 0, 0], - "to": [16, 16, 16], - "faces": { - "north": { - "texture": "#state", - "uvlightmap": { - "block": 0.007, - "sky": 0.007 - } - } - } - } - ] -} diff --git a/src/main/resources/assets/appliedenergistics2/models/block/chest/cell_state_offline.json b/src/main/resources/assets/appliedenergistics2/models/block/chest/cell_state_offline.json deleted file mode 100644 index 800895391..000000000 --- a/src/main/resources/assets/appliedenergistics2/models/block/chest/cell_state_offline.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "textures": { - "state": "appliedenergistics2:block/chest/cell_state_offline" - }, - "elements": [ - { - "from": [0, 0, 0], - "to": [16, 16, 16], - "faces": { - "north": { - "texture": "#state" - } - } - } - ] -} diff --git a/src/main/resources/assets/appliedenergistics2/models/block/chest/cell_state_online.json b/src/main/resources/assets/appliedenergistics2/models/block/chest/cell_state_online.json deleted file mode 100644 index 5589251f0..000000000 --- a/src/main/resources/assets/appliedenergistics2/models/block/chest/cell_state_online.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "loader": "appliedenergistics2:uvlightmap", - "textures": { - "backdrop": "appliedenergistics2:block/chest/cell_state_backdrop", - "state": "appliedenergistics2:block/chest/cell_state_online" - }, - "elements": [ - { - "from": [0, 0, 0], - "to": [16, 16, 16], - "faces": { - "north": { - "texture": "#backdrop" - } - } - }, - { - "from": [0, 0, 0], - "to": [16, 16, 16], - "faces": { - "north": { - "texture": "#state", - "uvlightmap": { - "block": 0.007, - "sky": 0.007 - } - } - } - } - ] -} diff --git a/src/main/resources/assets/appliedenergistics2/models/block/chest/cell_state_types_full.json b/src/main/resources/assets/appliedenergistics2/models/block/chest/cell_state_types_full.json deleted file mode 100644 index fd0dd2185..000000000 --- a/src/main/resources/assets/appliedenergistics2/models/block/chest/cell_state_types_full.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "loader": "appliedenergistics2:uvlightmap", - "textures": { - "backdrop": "appliedenergistics2:block/chest/cell_state_backdrop", - "state": "appliedenergistics2:block/chest/cell_state_types_full" - }, - "elements": [ - { - "from": [0, 0, 0], - "to": [16, 16, 16], - "faces": { - "north": { - "texture": "#backdrop" - } - } - }, - { - "from": [0, 0, 0], - "to": [16, 16, 16], - "faces": { - "north": { - "texture": "#state", - "uvlightmap": { - "block": 0.007, - "sky": 0.007 - } - } - } - } - ] -} diff --git a/src/main/resources/assets/appliedenergistics2/models/block/drive/drive_cell.json b/src/main/resources/assets/appliedenergistics2/models/block/drive/drive_cell.json index 147637da8..297a751d4 100644 --- a/src/main/resources/assets/appliedenergistics2/models/block/drive/drive_cell.json +++ b/src/main/resources/assets/appliedenergistics2/models/block/drive/drive_cell.json @@ -1,12 +1,13 @@ { + "ambientocclusion": false, "textures": { "cell": "appliedenergistics2:block/drive/cells/default_cell" }, "elements": [ { "name": "Cell Backdrop", - "from": [9, 13, 1], - "to": [15, 15, 3], + "from": [0, 0, 0], + "to": [6, 2, 2], "rotation": { "angle": 0, "axis": "y", "origin": [9, 8, 8] }, "faces": { "north": { diff --git a/src/main/resources/assets/appliedenergistics2/models/block/drive/drive_cell_led_base.json b/src/main/resources/assets/appliedenergistics2/models/block/drive/drive_cell_led_base.json deleted file mode 100644 index c3efcc340..000000000 --- a/src/main/resources/assets/appliedenergistics2/models/block/drive/drive_cell_led_base.json +++ /dev/null @@ -1,55 +0,0 @@ -{ - "loader": "appliedenergistics2:uvlightmap", - "textures": { - "front": "appliedenergistics2:block/drive/drive/cell_state_offline" - }, - "elements": [ - { - "name": "Cell Light", - "from": [9.0, 13.0, 0.0], - "to": [14.0, 15.0, 1.0], - "faces": { - "north": { - "texture": "#front", - "uv": [0, 0, 16, 16], - "uvlightmap": { - "sky": 0.007, - "block": 0.007 - } - }, - "up": { - "texture": "#front", - "uv": [0, 0, 16, 16], - "uvlightmap": { - "sky": 0.007, - "block": 0.007 - } - }, - "down": { - "texture": "#front", - "uv": [0, 0, 16, 16], - "uvlightmap": { - "sky": 0.007, - "block": 0.007 - } - }, - "west": { - "texture": "#front", - "uv": [0, 0, 16, 16], - "uvlightmap": { - "sky": 0.007, - "block": 0.007 - } - }, - "east": { - "texture": "#front", - "uv": [0, 0, 16, 16], - "uvlightmap": { - "sky": 0.007, - "block": 0.007 - } - } - } - } - ] -} diff --git a/src/main/resources/assets/appliedenergistics2/textures/block/chest/front.png b/src/main/resources/assets/appliedenergistics2/textures/block/chest/front.png index 4e4e034e9..81fecf6e8 100644 Binary files a/src/main/resources/assets/appliedenergistics2/textures/block/chest/front.png and b/src/main/resources/assets/appliedenergistics2/textures/block/chest/front.png differ