From a8dc4f36229733e2c1c5e8e2784a32ea3eeb508d Mon Sep 17 00:00:00 2001 From: simibubi <31564874+simibubi@users.noreply.github.com> Date: Sun, 14 Mar 2021 21:12:02 +0100 Subject: [PATCH] Broken Breaking - Painful implementation of virtual block breaking overlay - Scenes for the Mechanical Drill --- .../create/foundation/ponder/PonderScene.java | 23 +- .../create/foundation/ponder/PonderUI.java | 2 +- .../create/foundation/ponder/PonderWorld.java | 16 ++ .../foundation/ponder/SceneBuilder.java | 17 +- .../ponder/content/MechanicalDrillScenes.java | 203 ++++++++++++++++++ .../ponder/content/MechanicalSawScenes.java | 38 ++++ .../ponder/content/PonderIndex.java | 26 ++- .../foundation/ponder/content/PonderTag.java | 7 +- .../ponder/content/TemplateScenes.java | 18 ++ .../ponder/elements/WorldSectionElement.java | 30 ++- .../ponder/mechanical_drill/breaker.nbt | Bin 0 -> 441 bytes .../ponder/mechanical_drill/contraption.nbt | Bin 0 -> 864 bytes .../ponder/mechanical_saw/breaker.nbt | Bin 0 -> 889 bytes .../ponder/mechanical_saw/contraption.nbt | Bin 0 -> 1276 bytes .../ponder/mechanical_saw/processing.nbt | Bin 0 -> 872 bytes 15 files changed, 365 insertions(+), 15 deletions(-) create mode 100644 src/main/java/com/simibubi/create/foundation/ponder/content/MechanicalDrillScenes.java create mode 100644 src/main/java/com/simibubi/create/foundation/ponder/content/MechanicalSawScenes.java create mode 100644 src/main/java/com/simibubi/create/foundation/ponder/content/TemplateScenes.java create mode 100644 src/main/resources/ponder/mechanical_drill/breaker.nbt create mode 100644 src/main/resources/ponder/mechanical_drill/contraption.nbt create mode 100644 src/main/resources/ponder/mechanical_saw/breaker.nbt create mode 100644 src/main/resources/ponder/mechanical_saw/contraption.nbt create mode 100644 src/main/resources/ponder/mechanical_saw/processing.nbt diff --git a/src/main/java/com/simibubi/create/foundation/ponder/PonderScene.java b/src/main/java/com/simibubi/create/foundation/ponder/PonderScene.java index f341d127f..592e50574 100644 --- a/src/main/java/com/simibubi/create/foundation/ponder/PonderScene.java +++ b/src/main/java/com/simibubi/create/foundation/ponder/PonderScene.java @@ -90,6 +90,7 @@ public class PonderScene { int currentTime; public PonderScene(PonderWorld world, ResourceLocation component, Collection tags) { + world.scene = this; pointOfInterest = Vec3d.ZERO; textIndex = 1; @@ -234,6 +235,7 @@ public class PonderScene { world.renderEntities(ms, buffer, info, pt); world.renderParticles(ms, buffer, info, pt); outliner.renderOutlines(ms, buffer, pt); + ms.pop(); } @@ -301,7 +303,7 @@ public class PonderScene { } public void markKeyframe(int offset) { - if (!stoppedCounting) + if (!stoppedCounting) keyframeTimes.add(totalTime + offset); } @@ -409,10 +411,10 @@ public class PonderScene { } public MatrixStack apply(MatrixStack ms) { - return apply(ms, AnimationTickHolder.getPartialTicks(world)); + return apply(ms, AnimationTickHolder.getPartialTicks(world), false); } - public MatrixStack apply(MatrixStack ms, float pt) { + public MatrixStack apply(MatrixStack ms, float pt, boolean overlayCompatible) { ms.translate(width / 2, height / 2, 200 + offset); MatrixStacker.of(ms) @@ -428,9 +430,18 @@ public class PonderScene { float f = 30 * scaleFactor; - ms.scale(f, -f, f); - ms.translate((basePlateSize + basePlateOffsetX) / -2f, -1f + yOffset, - (basePlateSize + basePlateOffsetZ) / -2f); + if (!overlayCompatible) { + ms.scale(f, -f, f); + ms.translate((basePlateSize + basePlateOffsetX) / -2f, -1f + yOffset, + (basePlateSize + basePlateOffsetZ) / -2f); + } else { + // For block breaking overlay; Don't ask + ms.scale(f, f, f); + ms.translate((basePlateSize + basePlateOffsetX) / -2f, -yOffset, + (basePlateSize + basePlateOffsetZ) / -2f); + float y = (float) (0.5065 * Math.pow(2.2975, Math.log(1 / scaleFactor) / Math.log(2))) / 30; + ms.scale(y, -y, -y); + } return ms; } diff --git a/src/main/java/com/simibubi/create/foundation/ponder/PonderUI.java b/src/main/java/com/simibubi/create/foundation/ponder/PonderUI.java index 4f4d8323c..07f36ba04 100644 --- a/src/main/java/com/simibubi/create/foundation/ponder/PonderUI.java +++ b/src/main/java/com/simibubi/create/foundation/ponder/PonderUI.java @@ -366,7 +366,7 @@ public class PonderUI extends AbstractSimiScreen { ms.push(); story.transform.updateScreenParams(width, height, slide); - story.transform.apply(ms, partialTicks); + story.transform.apply(ms, partialTicks, false); story.transform.updateSceneRVE(); story.renderScene(buffer, ms, partialTicks); buffer.draw(); diff --git a/src/main/java/com/simibubi/create/foundation/ponder/PonderWorld.java b/src/main/java/com/simibubi/create/foundation/ponder/PonderWorld.java index f9adefdfc..8f3e79564 100644 --- a/src/main/java/com/simibubi/create/foundation/ponder/PonderWorld.java +++ b/src/main/java/com/simibubi/create/foundation/ponder/PonderWorld.java @@ -47,8 +47,11 @@ import net.minecraftforge.registries.ForgeRegistries; public class PonderWorld extends SchematicWorld { + public PonderScene scene; + protected Map originalBlocks; protected Map originalTileEntities; + protected Map blockBreakingProgressions; protected List originalEntities; protected PonderWorldParticles particles; @@ -61,6 +64,7 @@ public class PonderWorld extends SchematicWorld { super(anchor, original); originalBlocks = new HashMap<>(); originalTileEntities = new HashMap<>(); + blockBreakingProgressions = new HashMap<>(); originalEntities = new ArrayList<>(); particles = new PonderWorldParticles(this); @@ -82,6 +86,7 @@ public class PonderWorld extends SchematicWorld { entities.clear(); blocks.clear(); tileEntities.clear(); + blockBreakingProgressions.clear(); renderedTileEntities.clear(); originalBlocks.forEach((k, v) -> blocks.put(k, v)); originalTileEntities.forEach((k, v) -> { @@ -225,6 +230,17 @@ public class PonderWorld extends SchematicWorld { } } } + + public void setBlockBreakingProgress(BlockPos pos, int damage) { + if (damage == 0) + blockBreakingProgressions.remove(pos); + else + blockBreakingProgressions.put(pos, damage - 1); + } + + public Map getBlockBreakingProgressions() { + return blockBreakingProgressions; + } public void addBlockDestroyEffects(BlockPos pos, BlockState state) { VoxelShape voxelshape = state.getShape(this, pos); diff --git a/src/main/java/com/simibubi/create/foundation/ponder/SceneBuilder.java b/src/main/java/com/simibubi/create/foundation/ponder/SceneBuilder.java index 25e9c1cd0..b96b7a61d 100644 --- a/src/main/java/com/simibubi/create/foundation/ponder/SceneBuilder.java +++ b/src/main/java/com/simibubi/create/foundation/ponder/SceneBuilder.java @@ -370,6 +370,21 @@ public class SceneBuilder { public class WorldInstructions { + public void incrementBlockBreakingProgress(BlockPos pos) { + addInstruction(scene -> { + PonderWorld world = scene.getWorld(); + int progress = world.getBlockBreakingProgressions() + .getOrDefault(pos, -1) + 1; + if (progress == 9) { + world.addBlockDestroyEffects(pos, world.getBlockState(pos)); + world.destroyBlock(pos, false); + world.setBlockBreakingProgress(pos, 0); + scene.forEach(WorldSectionElement.class, WorldSectionElement::queueRedraw); + } else + world.setBlockBreakingProgress(pos, progress + 1); + }); + } + public void showSection(Selection selection, Direction fadeInDirection) { addInstruction(new DisplayWorldSectionInstruction(15, fadeInDirection, selection, Optional.of(scene::getBaseWorldSection))); @@ -533,7 +548,7 @@ public class SceneBuilder { return itemEntity; }); } - + public ElementLink createGlueEntity(BlockPos pos, Direction face) { effects.superGlue(pos, face, false); return createEntity(world -> new SuperGlueEntity(world, pos, face.getOpposite())); diff --git a/src/main/java/com/simibubi/create/foundation/ponder/content/MechanicalDrillScenes.java b/src/main/java/com/simibubi/create/foundation/ponder/content/MechanicalDrillScenes.java new file mode 100644 index 000000000..bbfbc58f6 --- /dev/null +++ b/src/main/java/com/simibubi/create/foundation/ponder/content/MechanicalDrillScenes.java @@ -0,0 +1,203 @@ +package com.simibubi.create.foundation.ponder.content; + +import com.simibubi.create.foundation.ponder.ElementLink; +import com.simibubi.create.foundation.ponder.SceneBuilder; +import com.simibubi.create.foundation.ponder.SceneBuildingUtil; +import com.simibubi.create.foundation.ponder.Selection; +import com.simibubi.create.foundation.ponder.elements.EntityElement; +import com.simibubi.create.foundation.ponder.elements.InputWindowElement; +import com.simibubi.create.foundation.ponder.elements.WorldSectionElement; +import com.simibubi.create.foundation.utility.Pointing; + +import net.minecraft.block.Blocks; +import net.minecraft.entity.Entity; +import net.minecraft.entity.item.ItemEntity; +import net.minecraft.item.ItemStack; +import net.minecraft.item.Items; +import net.minecraft.util.Direction; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.Vec3d; + +public class MechanicalDrillScenes { + + public static void breaker(SceneBuilder scene, SceneBuildingUtil util) { + scene.title("mechanical_drill", "Breaking Blocks with the Mechanical Drill"); + scene.configureBasePlate(0, 0, 5); + + scene.world.setKineticSpeed(util.select.layer(0), -8); + scene.world.setKineticSpeed(util.select.layer(1), 16); + + scene.world.showSection(util.select.layer(0), Direction.UP); + scene.idle(5); + scene.world.showSection(util.select.fromTo(4, 1, 2, 5, 1, 2), Direction.DOWN); + scene.idle(10); + scene.world.showSection(util.select.position(3, 1, 2), Direction.EAST); + scene.idle(20); + + BlockPos breakingPos = util.grid.at(2, 1, 2); + + scene.world.showSection(util.select.position(2, 1, 2), Direction.DOWN); + scene.idle(5); + for (int i = 0; i < 10; i++) { + scene.idle(10); + scene.world.incrementBlockBreakingProgress(breakingPos); + if (i == 1) { + scene.overlay.showText(80) + .attachKeyFrame() + .placeNearTarget() + .pointAt(util.vector.topOf(breakingPos)) + .text("When given Rotational Force, a Mechanical Drill will break blocks directly in front of it"); + } + } + + scene.world.hideSection(util.select.position(breakingPos), Direction.UP); + ElementLink plankEntity = scene.world.createItemEntity(util.vector.centerOf(breakingPos), + util.vector.of(0, .1f, 0), new ItemStack(Items.OAK_PLANKS)); + scene.idle(20); + + scene.world.modifyKineticSpeed(util.select.everywhere(), f -> 4 * f); + scene.effects.rotationSpeedIndicator(breakingPos.east(3)); + + scene.idle(20); + scene.world.modifyEntity(plankEntity, Entity::remove); + scene.world.setBlock(breakingPos, Blocks.OAK_PLANKS.getDefaultState(), false); + scene.world.showSection(util.select.position(breakingPos), Direction.DOWN); + + scene.idle(5); + for (int i = 0; i < 10; i++) { + scene.idle(3); + scene.world.incrementBlockBreakingProgress(breakingPos); + if (i == 2) { + scene.overlay.showText(80) + .attachKeyFrame() + .placeNearTarget() + .pointAt(util.vector.topOf(breakingPos.east())) + .text("Its mining speed depends on the Rotational Input"); + } + } + + scene.world.createItemEntity(util.vector.centerOf(breakingPos), util.vector.of(0, .1f, 0), + new ItemStack(Items.OAK_PLANKS)); + } + + public static void contraption(SceneBuilder scene, SceneBuildingUtil util) { + scene.title("mechanical_drill_contraption", "Using Mechanical Drills on Contraptions"); + scene.configureBasePlate(0, 0, 6); + scene.world.showSection(util.select.layer(0), Direction.UP); + + Selection kinetics = util.select.fromTo(5, 1, 2, 5, 1, 6); + + scene.idle(5); + ElementLink pistonHead = + scene.world.showIndependentSection(util.select.fromTo(5, 1, 1, 7, 1, 1), Direction.DOWN); + scene.world.moveSection(pistonHead, util.vector.of(0, 0, 1), 0); + scene.world.showSection(kinetics, Direction.DOWN); + scene.idle(5); + ElementLink contraption = + scene.world.showIndependentSection(util.select.fromTo(4, 2, 3, 4, 1, 2), Direction.DOWN); + scene.idle(5); + scene.world.showSectionAndMerge(util.select.position(3, 1, 3), Direction.EAST, contraption); + scene.idle(5); + scene.world.showSectionAndMerge(util.select.position(3, 1, 2), Direction.EAST, contraption); + scene.world.showSectionAndMerge(util.select.position(3, 2, 3), Direction.EAST, contraption); + scene.idle(5); + scene.world.showSectionAndMerge(util.select.position(3, 2, 2), Direction.EAST, contraption); + + scene.overlay.showText(60) + .attachKeyFrame() + .placeNearTarget() + .pointAt(util.vector.topOf(util.grid.at(3, 2, 3))) + .text("Whenever Drills are moved as part of an animated Contraption..."); + scene.idle(70); + + Selection drills = util.select.fromTo(3, 1, 2, 3, 2, 3); + + Selection planks = util.select.fromTo(1, 1, 2, 1, 2, 3); + scene.world.showSection(planks, Direction.DOWN); + scene.world.setKineticSpeed(util.select.position(4, 0, 6), -8); + scene.world.setKineticSpeed(kinetics, 16); + scene.world.setKineticSpeed(drills, 16); + scene.world.moveSection(pistonHead, util.vector.of(-1, 0, 0), 20); + scene.world.moveSection(contraption, util.vector.of(-1, 0, 0), 20); + scene.idle(20); + scene.world.setKineticSpeed(drills, 64); + + BlockPos p1 = util.grid.at(1, 1, 2); + BlockPos p2 = util.grid.at(1, 1, 3); + BlockPos p3 = util.grid.at(1, 2, 2); + BlockPos p4 = util.grid.at(1, 2, 3); + + for (int i = 0; i < 10; i++) { + scene.idle(3); + scene.world.incrementBlockBreakingProgress(p1); + scene.world.incrementBlockBreakingProgress(p2); + scene.world.incrementBlockBreakingProgress(p3); + scene.world.incrementBlockBreakingProgress(p4); + if (i == 2) { + scene.overlay.showText(80) + .placeNearTarget() + .pointAt(util.vector.topOf(p3)) + .text("...they will break blocks the contraption runs them into"); + } + } + + Vec3d m = util.vector.of(-.1, 0, 0); + ItemStack item = new ItemStack(Items.OAK_PLANKS); + scene.world.createItemEntity(util.vector.centerOf(p1), m, item); + scene.world.createItemEntity(util.vector.centerOf(p2), m, item); + scene.world.createItemEntity(util.vector.centerOf(p3), m, item); + scene.world.createItemEntity(util.vector.centerOf(p4), m, item); + + scene.world.setKineticSpeed(drills, 16); + scene.world.moveSection(pistonHead, util.vector.of(-1, 0, 0), 20); + scene.world.moveSection(contraption, util.vector.of(-1, 0, 0), 20); + scene.idle(20); + scene.world.setKineticSpeed(drills, 0); + scene.idle(20); + + scene.world.modifyKineticSpeed(util.select.everywhere(), f -> -f); + scene.world.moveSection(pistonHead, util.vector.of(2, 0, 0), 40); + scene.world.moveSection(contraption, util.vector.of(2, 0, 0), 40); + scene.world.hideSection(planks, Direction.UP); + scene.idle(40); + + scene.world.setBlocks(planks, Blocks.OAK_PLANKS.getDefaultState(), false); + scene.world.modifyEntities(ItemEntity.class, Entity::remove); + scene.world.glueBlockOnto(util.grid.at(4, 3, 2), Direction.DOWN, contraption); + + scene.overlay.showText(60) + .attachKeyFrame() + .placeNearTarget() + .pointAt(util.vector.blockSurface(util.grid.at(4, 3, 2), Direction.WEST)) + .text("Inventories attached to the Contraption will pick up their drops automatically"); + scene.idle(70); + + scene.world.showSection(planks, Direction.DOWN); + scene.world.modifyKineticSpeed(util.select.everywhere(), f -> -f); + scene.world.setKineticSpeed(drills, 16); + scene.world.moveSection(pistonHead, util.vector.of(-1, 0, 0), 20); + scene.world.moveSection(contraption, util.vector.of(-1, 0, 0), 20); + + scene.idle(20); + scene.world.setKineticSpeed(drills, 64); + + for (int i = 0; i < 10; i++) { + scene.idle(3); + scene.world.incrementBlockBreakingProgress(p1); + scene.world.incrementBlockBreakingProgress(p2); + scene.world.incrementBlockBreakingProgress(p3); + scene.world.incrementBlockBreakingProgress(p4); + } + + scene.world.setKineticSpeed(drills, 16); + scene.world.moveSection(pistonHead, util.vector.of(-1, 0, 0), 20); + scene.world.moveSection(contraption, util.vector.of(-1, 0, 0), 20); + scene.idle(20); + scene.world.setKineticSpeed(drills, 0); + scene.idle(10); + scene.overlay.showControls(new InputWindowElement(util.vector.topOf(2, 3, 2), Pointing.DOWN) + .withItem(new ItemStack(Blocks.OAK_PLANKS)), 60); + scene.idle(20); + } + +} diff --git a/src/main/java/com/simibubi/create/foundation/ponder/content/MechanicalSawScenes.java b/src/main/java/com/simibubi/create/foundation/ponder/content/MechanicalSawScenes.java new file mode 100644 index 000000000..acac8c9a3 --- /dev/null +++ b/src/main/java/com/simibubi/create/foundation/ponder/content/MechanicalSawScenes.java @@ -0,0 +1,38 @@ +package com.simibubi.create.foundation.ponder.content; + +import com.simibubi.create.foundation.ponder.SceneBuilder; +import com.simibubi.create.foundation.ponder.SceneBuildingUtil; + +import net.minecraft.util.Direction; +import net.minecraft.util.math.BlockPos; + +public class MechanicalSawScenes { + + public static void processing(SceneBuilder scene, SceneBuildingUtil util) { + scene.title("mechanical_saw_processing", "Processing Items on the Mechanical Saw"); + scene.configureBasePlate(0, 0, 5); + scene.world.showSection(util.select.layer(0), Direction.UP); + + BlockPos shaftPos = util.grid.at(2, 1, 3); + + scene.idle(5); + scene.world.showSection(util.select.layersFrom(1), Direction.DOWN); + } + + public static void treeCutting(SceneBuilder scene, SceneBuildingUtil util) { + scene.title("mechanical_saw_breaker", "Cutting Trees with the Mechanical Saw"); + scene.configureBasePlate(0, 0, 5); + scene.world.showSection(util.select.layer(0), Direction.UP); + scene.idle(5); + scene.world.showSection(util.select.layersFrom(1), Direction.DOWN); + } + + public static void contraption(SceneBuilder scene, SceneBuildingUtil util) { + scene.title("mechanical_saw_contraption", "Using Mechanical Saws on Contraptions"); + scene.configureBasePlate(0, 0, 5); + scene.world.showSection(util.select.layer(0), Direction.UP); + scene.idle(5); + scene.world.showSection(util.select.layersFrom(1), Direction.DOWN); + } + +} diff --git a/src/main/java/com/simibubi/create/foundation/ponder/content/PonderIndex.java b/src/main/java/com/simibubi/create/foundation/ponder/content/PonderIndex.java index d536dfce7..88309ec71 100644 --- a/src/main/java/com/simibubi/create/foundation/ponder/content/PonderIndex.java +++ b/src/main/java/com/simibubi/create/foundation/ponder/content/PonderIndex.java @@ -79,14 +79,14 @@ public class PonderIndex { // Chassis & Super Glue PonderRegistry.forComponents(AllBlocks.LINEAR_CHASSIS, AllBlocks.SECONDARY_LINEAR_CHASSIS) - .addStoryBoard("chassis/linear_group", ChassisScenes::linearGroup) + .addStoryBoard("chassis/linear_group", ChassisScenes::linearGroup, PonderTag.CONTRAPTION_ASSEMBLY) .addStoryBoard("chassis/linear_attachment", ChassisScenes::linearAttachement); PonderRegistry.forComponents(AllBlocks.RADIAL_CHASSIS) - .addStoryBoard("chassis/radial", ChassisScenes::radial); + .addStoryBoard("chassis/radial", ChassisScenes::radial, PonderTag.CONTRAPTION_ASSEMBLY); PonderRegistry.forComponents(AllItems.SUPER_GLUE) - .addStoryBoard("super_glue", ChassisScenes::superGlue); + .addStoryBoard("super_glue", ChassisScenes::superGlue, PonderTag.CONTRAPTION_ASSEMBLY); PonderRegistry.forComponents(AllBlocks.STICKER) - .addStoryBoard("sticker", RedstoneScenes::sticker); + .addStoryBoard("sticker", RedstoneScenes::sticker, PonderTag.CONTRAPTION_ASSEMBLY); // Mechanical Piston PonderRegistry.forComponents(AllBlocks.MECHANICAL_PISTON, AllBlocks.STICKY_MECHANICAL_PISTON) @@ -129,7 +129,6 @@ public class PonderIndex { PonderTag.KINETIC_APPLIANCES, PonderTag.MOVEMENT_ANCHOR); PonderRegistry.addStoryBoard(AllBlocks.GANTRY_CARRIAGE, "gantry/intro", GantryScenes::introForPinion, PonderTag.KINETIC_APPLIANCES, PonderTag.MOVEMENT_ANCHOR); - PonderRegistry.forComponents(AllBlocks.GANTRY_SHAFT, AllBlocks.GANTRY_CARRIAGE) .addStoryBoard("gantry/redstone", GantryScenes::redstone) .addStoryBoard("gantry/direction", GantryScenes::direction) @@ -141,6 +140,14 @@ public class PonderIndex { .addStoryBoard("portable_interface/redstone", MovementActorScenes::psiRedstone); PonderRegistry.forComponents(AllBlocks.REDSTONE_CONTACT) .addStoryBoard("redstone_contact", RedstoneScenes::contact); + PonderRegistry.forComponents(AllBlocks.MECHANICAL_SAW) + .addStoryBoard("mechanical_saw/processing", MechanicalSawScenes::processing, PonderTag.KINETIC_APPLIANCES) + .addStoryBoard("mechanical_saw/breaker", MechanicalSawScenes::treeCutting) + .addStoryBoard("mechanical_saw/contraption", MechanicalSawScenes::contraption, PonderTag.CONTRAPTION_ACTOR); + PonderRegistry.forComponents(AllBlocks.MECHANICAL_DRILL) + .addStoryBoard("mechanical_drill/breaker", MechanicalDrillScenes::breaker, PonderTag.KINETIC_APPLIANCES) + .addStoryBoard("mechanical_drill/contraption", MechanicalDrillScenes::contraption, + PonderTag.CONTRAPTION_ACTOR); // Debug scenes, can be found in game via the Brass Hand if (EDITOR_MODE) @@ -273,6 +280,15 @@ public class PonderIndex { .add(AllBlocks.GANTRY_CARRIAGE) .add(AllBlocks.CART_ASSEMBLER); + PonderRegistry.tags.forTag(PonderTag.CONTRAPTION_ASSEMBLY) + .add(AllBlocks.LINEAR_CHASSIS) + .add(AllBlocks.SECONDARY_LINEAR_CHASSIS) + .add(AllBlocks.RADIAL_CHASSIS) + .add(AllItems.SUPER_GLUE) + .add(AllBlocks.STICKER) + .add(Blocks.SLIME_BLOCK) + .add(Blocks.field_226907_mc_); // honey block + PonderRegistry.tags.forTag(PonderTag.CONTRAPTION_ACTOR) .add(AllBlocks.MECHANICAL_HARVESTER) .add(AllBlocks.MECHANICAL_PLOUGH) diff --git a/src/main/java/com/simibubi/create/foundation/ponder/content/PonderTag.java b/src/main/java/com/simibubi/create/foundation/ponder/content/PonderTag.java index b0b7ba26c..bf649665d 100644 --- a/src/main/java/com/simibubi/create/foundation/ponder/content/PonderTag.java +++ b/src/main/java/com/simibubi/create/foundation/ponder/content/PonderTag.java @@ -2,6 +2,7 @@ package com.simibubi.create.foundation.ponder.content; import com.mojang.blaze3d.systems.RenderSystem; import com.simibubi.create.AllBlocks; +import com.simibubi.create.AllItems; import com.simibubi.create.foundation.gui.GuiGameElement; import com.simibubi.create.foundation.gui.IScreenRenderable; import com.simibubi.create.foundation.ponder.PonderLocalization; @@ -36,7 +37,7 @@ public class PonderTag implements IScreenRenderable { LOGISTICS = new PonderTag("logistics").item(Blocks.CHEST, true, false) .defaultLang("Item Transportation", "Components which help moving items around"), - + REDSTONE = new PonderTag("redstone").item(Items.REDSTONE, true, false) .defaultLang("Logic Components", "Components which help with redstone engineering"), @@ -54,6 +55,10 @@ public class PonderTag implements IScreenRenderable { .defaultLang("Contraption Actors", "Components which expose special behaviour when attached to a moving contraption"), + CONTRAPTION_ASSEMBLY = new PonderTag("contraption_assembly").item(AllItems.SUPER_GLUE.get(), true, false) + .defaultLang("Block Attachment Utility", + "Tools and Components used to assemble structures moved as an animated Contraption"), + // FLUID_TRANSFER = new PonderTag("fluid_transfer").idAsIcon(), // // OPEN_INVENTORY = new PonderTag("open_inventory").item(AllBlocks.BASIN.get() diff --git a/src/main/java/com/simibubi/create/foundation/ponder/content/TemplateScenes.java b/src/main/java/com/simibubi/create/foundation/ponder/content/TemplateScenes.java new file mode 100644 index 000000000..72fc1b7e5 --- /dev/null +++ b/src/main/java/com/simibubi/create/foundation/ponder/content/TemplateScenes.java @@ -0,0 +1,18 @@ +package com.simibubi.create.foundation.ponder.content; + +import com.simibubi.create.foundation.ponder.SceneBuilder; +import com.simibubi.create.foundation.ponder.SceneBuildingUtil; + +import net.minecraft.util.Direction; + +public class TemplateScenes { + + public static void templateMethod(SceneBuilder scene, SceneBuildingUtil util) { + scene.title("", ""); + scene.configureBasePlate(0, 0, 5); + scene.world.showSection(util.select.layer(0), Direction.UP); + scene.idle(5); + scene.world.showSection(util.select.layersFrom(1), Direction.DOWN); + } + +} diff --git a/src/main/java/com/simibubi/create/foundation/ponder/elements/WorldSectionElement.java b/src/main/java/com/simibubi/create/foundation/ponder/elements/WorldSectionElement.java index f1e05c489..66569c7af 100644 --- a/src/main/java/com/simibubi/create/foundation/ponder/elements/WorldSectionElement.java +++ b/src/main/java/com/simibubi/create/foundation/ponder/elements/WorldSectionElement.java @@ -2,12 +2,16 @@ package com.simibubi.create.foundation.ponder.elements; import java.util.ArrayList; import java.util.List; +import java.util.Map; +import java.util.Map.Entry; import java.util.Random; import org.lwjgl.opengl.GL11; import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.systems.RenderSystem; +import com.mojang.blaze3d.vertex.IVertexBuilder; +import com.mojang.blaze3d.vertex.MatrixApplyingVertexBuilder; import com.simibubi.create.CreateClient; import com.simibubi.create.foundation.ponder.PonderScene; import com.simibubi.create.foundation.ponder.PonderWorld; @@ -16,7 +20,6 @@ import com.simibubi.create.foundation.render.Compartment; import com.simibubi.create.foundation.render.SuperByteBuffer; import com.simibubi.create.foundation.render.SuperByteBufferCache; import com.simibubi.create.foundation.render.TileEntityRenderHelper; -import com.simibubi.create.foundation.renderState.SuperRenderTypeBuffer; import com.simibubi.create.foundation.utility.AnimationTickHolder; import com.simibubi.create.foundation.utility.MatrixStacker; import com.simibubi.create.foundation.utility.Pair; @@ -33,6 +36,7 @@ import net.minecraft.client.renderer.IRenderTypeBuffer; import net.minecraft.client.renderer.RenderType; import net.minecraft.client.renderer.RenderTypeLookup; import net.minecraft.client.renderer.WorldRenderer; +import net.minecraft.client.renderer.model.ModelBakery; import net.minecraft.client.renderer.texture.OverlayTexture; import net.minecraft.client.renderer.vertex.DefaultVertexFormats; import net.minecraft.fluid.IFluidState; @@ -274,7 +278,31 @@ public class WorldSectionElement extends AnimatedSceneElement { transformMS(ms, pt); world.pushFakeLight(light); renderTileEntities(world, ms, buffer, pt); + renderBlockBreakingProgress(world, ms, buffer, pt); world.popLight(); + + Map blockBreakingProgressions = world.getBlockBreakingProgressions(); + MatrixStack overlayMS = null; + + for (Entry entry : blockBreakingProgressions.entrySet()) { + BlockPos pos = entry.getKey(); + if (!section.test(pos)) + continue; + if (overlayMS == null) { + overlayMS = new MatrixStack(); + world.scene.getTransform() + .apply(overlayMS, pt, true); + transformMS(overlayMS, pt); + } + ms.push(); + ms.translate(pos.getX(), pos.getY(), pos.getZ()); + IVertexBuilder builder = new MatrixApplyingVertexBuilder( + buffer.getBuffer(ModelBakery.BLOCK_DESTRUCTION_RENDER_LAYERS.get(entry.getValue())), overlayMS.peek()); + Minecraft.getInstance() + .getBlockRendererDispatcher() + .renderModel(world.getBlockState(BlockPos.ZERO), pos, world, ms, builder, EmptyModelData.INSTANCE); + ms.pop(); + } } protected void renderStructure(PonderWorld world, MatrixStack ms, IRenderTypeBuffer buffer, RenderType type, diff --git a/src/main/resources/ponder/mechanical_drill/breaker.nbt b/src/main/resources/ponder/mechanical_drill/breaker.nbt new file mode 100644 index 0000000000000000000000000000000000000000..8d3766251fa160e691ed05500913432f7b5c60ac GIT binary patch literal 441 zcmV;q0Y?5GiwFP!000000JW6eO2aS|$4{GdcAKCVieC93UVA+RKWPBNkya#8|^5jdQ{=`AJnIVJS@ z9ETA&oWM!DoQ^f=iMkkJ7K|{9a~wwCZ~~_{PM8HJ%;Fq}5jcF5GXrLpfkD2&U3gWp zYCSW^UTVbEzC_5Moh=>u{WDMCdJ#|j{`{?8MNX1Ks#b6*9md_`$|Wb+M0w zou=P*bg#Cx#-dUNgOVd94#V)j50j0A$^IwI@RCiU=AsrFL%{Z*y~u$t#1`Rx8yV7x zb$DzxDqtb4i9w=MuekY9cw?Jl|5=ZnT2U3X7N+vCrdb?*jjsLWbC|4!RHg*ppbrPv zyRMim%8f8e3SE5Pfr0nDi7KaUS;qEcYoR?xgxDz$$?ibwuaV!xTz-eR>JZYF%?9z8 jiS#ql!j)}1I~IfalL+D+ombWXm!hW)H9j7!pE)T_8Tc7m5GpckFYHKhgu}LTJPTCjd}B5k4V4oi0RN zSz!e?P_{0#Z>3H~riU-@yFhYnoYA}ypvE%GD~n}K(4YxwnwAHLcyK}w4)x%;7HrT2 z4Vt>ImIsG;a6%6b_29VH^2k@qBVU_1#Df!haHt0-sGem_t6|LBG(n}?#@VKEjd;`# z@u;6o9OA(VJvh{ZEw#nT0-gQ!FDQ}p(D?6eY??uH+hRhgY8fIK4h81yn_&qqd zV8)(L5}sS3RRrCSI?J`fGZfzaIjK5WSmdEq3sWb zhdtU-Xnz?D47VSei?$vP`i#k~Z@B-T+&a-Ew+r;M<=O1+GlLywLh+l3UBmU#R^E!b_HMI9_Zkpa)+}y))xp6tu*Q>|D zY@yVw4-Ce0bRXYpYjp;pE$%on*aTNVFu`P1{Z{8d2TYp9*j;WU4w4nITQ{4A7rCId zGyN04MsQSmikZ|ZjR&H@8PvS2J=f}v_QohHq)t;Tsu^VAohn_}Au{cKj@}J^lM5d! z+rJOGiqXTI;x;5RM9{w><{@Q8T2@Os9&)~tGe6d$+s__Dsb$NBYgz+y^4oPOiHDr^ qAMa-lep7)f8h00=IL8}PdGqZ7`HbBrO2}Hg$OCayTT!1YihMibqZWKtBU~Vtk?@#Jo^K z2`)jmAq?*GGM&o=|NIyNsY=-n+BE`^R7~+^#32({n808{4;|v6Lp}Xag9$BuOomwe zxO8-^$Rn1?*kZYK+7|TWC$KPPenJl&Vqs{(!@2J^Vnk z7B0^wWAkh>HqR~{>fuMn8hFGq8Jp)L2h+CD<4g#9>L;`?gN`~3J)Ld z7kz$03uD`ZE}ga!k8_?lYTjhbJxDxssDre4h^W@B>YaxjdUp z*E#R-*5<$7EtifE4#Cg6Ov5d;%L!=QsFMZaThI6C{HeLNS4hwC4ElQi?^D^YL61 zT#3{O6E(|l_=zxV!VrjW_*&hGbPgMI9~EDHsmrY9Qg)e0VDMSwiq~5=Cku?9)@-US znWzJZK9q|WIJv5- zT=2;jLZhc>E=6ym$nL~~|M{ieC)?M$V><K(jcgC0_3d zS(K~s<_fFRj0;)uTHkJCh$jL=6)A_{J#Gc;m)L`)!w~a zEz-6h%%K|Cw)DQl`YXLY6vC0orn&rPktl%=@2fv&hzF`R3aG0V#$8&5?o6;M?#`4iCv zPiL$UDa*%rtUS-)al6fCINj$-oHY`=*;(p^JuYjG^|It@Kh7v8+=-)4OtJ5JVafte P&foAC>2n literal 0 HcmV?d00001 diff --git a/src/main/resources/ponder/mechanical_saw/contraption.nbt b/src/main/resources/ponder/mechanical_saw/contraption.nbt new file mode 100644 index 0000000000000000000000000000000000000000..f8a1daa01b62e50793fe6352453970d6dd821014 GIT binary patch literal 1276 zcmVr6XO~%j)w6pczg?< zz=9{V;Hmv`IxwyQqucTf7`Mf*E}p=E(e;EDJdU#0#CQh3bc}ECtB=P~y8CSD7?Z6& zo;qJ{N1R;)rmYTLi#qJ$2`qR*3m#DR+#cU`j2=VRfC*Z1+Qs8r=mF(_pJp9n(yU`l zn)`TsOFf~59vx%SW5YA(!PNEaS@fSKCTyu^&!Yc$7X7D7PiVp8D&LxzfdS)MV7wj- zDBrxEIO`Zar>+5`+wv@Ud<#9GV%?`%$Cxzh7?b8c9^X<=XrV{PnDq4VI8dFPE+jOJoOp$E$%jc$NBOsczgqs(B8T5Mk595}hc zm1490b2dgEX9VGoER{5mz-41NoHI_7oJ`~eVYvgrYq8+cL8fOF?A5${02}+|hEbAJ z3cS(fBjLa zA63icgUSW}2H#9evLOVQlFkd2pZy4x8EM|6hT8}o+$6b3(+?zFY(iIQKT_J089@<+ zp>B1?kz#BHc?5@VNg>~?5}HXSIM&H)G0y}?zu~*z&SXw_k>dWdi?hn$`E~~|nJUD){l9U&?;VtD;IV&YPFnG7%90Lh^&Z?*}+EgyTSk;~$x+%pLCvDVfni8iMO;Y|s8L zXhT7JpS+;Go`N<-wciQpJK+*Bi8><|SP%Xst6vpg$!zB8JapF<-wgiC7(CL}F(TTgder#YTN z^WJETt(WkGg7Xc|aeR))Rh9!oqiZM;T(!jswe=`J$26{qcztLMJ^e z@XXz<<69x6m{$~AUsotvtxJ*Z6^=5HqIQzUbqnuSt%^OIi+g-(@e^?-|9&X7~CaqflXyi0dB_C~)AwTjWhmgQO9&t^#UIErmZNj@!4`E)s> zG<_V`aXngV7DJs+X#R0=R9URUxT%dT@t19>if5FJKi*l2y7j5CoM8yR_6 m2W*& literal 0 HcmV?d00001 diff --git a/src/main/resources/ponder/mechanical_saw/processing.nbt b/src/main/resources/ponder/mechanical_saw/processing.nbt new file mode 100644 index 0000000000000000000000000000000000000000..35d6a03f6f09d13defbe199a724e97dd17771b93 GIT binary patch literal 872 zcmV-u1DE_CiwFP!000000M(aEZ__{!$H%YKamwQW5=Rbv33`DNKtw{Jq6Gm0!q%Q9 zt2$n5cS}l7{Zw2Ld@^PeI}hW8O$lndQsva1`R~qe#XXpWd`3s6`qX{8q znrn^<%xFU6FctB!is+vQP4IG|N~h`YAW)iVEIj6IoEjUaV&huqcosUog-$t~6*^9h zO;yLW(D5vEd<&g&xE7pU3(l)_JPRG)LT8!^3(lSe=T$nMg^q8bQx4yPvv0w9m5yhj zqiKo(PoNgeek=ly3ZnL?28i_<5C9)wmWJjOa_gYnDzC*Ac$bAi+UvFaR6bP zelT1%=FOqZqAV<1gJkNqAzC zqpCUJL;P`WcG+n1*xcB?Kfk(YAxm{#u$mNqL)GrCTkTbcYgFw{T^p`~4K~zb{~7Eh zw^+Z1O~aDSM%H$>eEaw?PqBAQufFE--&@F%jyAvbZ`E|PD;CG+WldmJ9M>Tq-u28! zZ&^O(k7r>ej-Th39!GgNd052pW!aH7n2V!%_3}}TV`)Bug}Q3OR?bq?8qF7M6jJMD zLxg*?gT!dSHTGhW(K5)Xw74^~P?;F@#-G7v2c>;IM`^y0sh`J_ejXgLR3W+MOlt5j zOX%4V(J;M!gi43Brj-038VJeHsHL-XI@LlGwwl2NDD}qXC{)~&JcQfql&c;~Mb_^f zajA4M^;D@$*AU|Y%XrMv9-WUaxNc+{XH%j7PcyVe^hBnj-^XM&jUfci*;L_Hp%9Dy yXn>erOl7-#4F*(m7n3MclQP*iC0#6s&aO|HW^Yj{E;4%UzQb<