diff --git a/src/main/java/com/simibubi/create/AllItems.java b/src/main/java/com/simibubi/create/AllItems.java index 698b61e36..7485830ae 100644 --- a/src/main/java/com/simibubi/create/AllItems.java +++ b/src/main/java/com/simibubi/create/AllItems.java @@ -68,6 +68,74 @@ public class AllItems { REGISTRATE.startSection(MATERIALS); } + public static final ItemEntry WHEAT_FLOUR = ingredient("wheat_flour"), DOUGH = ingredient("dough"), + CINDER_FLOUR = ingredient("cinder_flour"), POWDERED_OBSIDIAN = ingredient("powdered_obsidian"), + ROSE_QUARTZ = ingredient("rose_quartz"), POLISHED_ROSE_QUARTZ = ingredient("polished_rose_quartz"), + PROPELLER = ingredient("propeller"), WHISK = ingredient("whisk"), BRASS_HAND = ingredient("brass_hand"), + CRAFTER_SLOT_COVER = ingredient("crafter_slot_cover"), ELECTRON_TUBE = ingredient("electron_tube"), + INTEGRATED_CIRCUIT = ingredient("integrated_circuit"); + + public static final ItemEntry BLAZE_CAKE_BASE = + REGISTRATE.item("blaze_cake_base", HiddenIngredientItem::new) + .tag(AllItemTags.UPRIGHT_ON_BELT.tag) + .register(); + + public static final ItemEntry BLAZE_CAKE = REGISTRATE.item("blaze_cake", CombustibleItem::new) + .tag(AllItemTags.UPRIGHT_ON_BELT.tag) + .register(); + + public static final ItemEntry BAR_OF_CHOCOLATE = REGISTRATE.item("bar_of_chocolate", Item::new) + .properties(p -> p.food(new Food.Builder().hunger(6) + .saturation(0.3F) + .build())) + .lang("Bar of Chocolate") + .register(); + + public static final ItemEntry SWEET_ROLL = REGISTRATE.item("sweet_roll", Item::new) + .properties(p -> p.food(new Food.Builder().hunger(6) + .saturation(0.8F) + .build())) + .register(); + + public static final ItemEntry CHOCOLATE_BERRIES = REGISTRATE.item("chocolate_glazed_berries", Item::new) + .properties(p -> p.food(new Food.Builder().hunger(7) + .saturation(0.8F) + .build())) + .register(); + + public static final ItemEntry HONEYED_APPLE = REGISTRATE.item("honeyed_apple", Item::new) + .properties(p -> p.food(new Food.Builder().hunger(8) + .saturation(0.8F) + .build())) + .register(); + + public static final ItemEntry BUILDERS_TEA = REGISTRATE.item("builders_tea", BuildersTeaItem::new) + .tag(AllItemTags.UPRIGHT_ON_BELT.tag) + .properties(p -> p.maxStackSize(16)) + .lang("Builder's Tea") + .register(); + + public static final ItemEntry ANDESITE_ALLOY = ingredient("andesite_alloy"), + COPPER_INGOT = taggedIngredient("copper_ingot", forgeItemTag("ingots/copper"), CREATE_INGOTS.tag), + ZINC_INGOT = taggedIngredient("zinc_ingot", forgeItemTag("ingots/zinc"), CREATE_INGOTS.tag), + BRASS_INGOT = taggedIngredient("brass_ingot", forgeItemTag("ingots/brass"), CREATE_INGOTS.tag); + + public static final ItemEntry CHROMATIC_COMPOUND = + REGISTRATE.item("chromatic_compound", ChromaticCompoundItem::new) + .properties(p -> p.rarity(Rarity.UNCOMMON)) + .model(AssetLookup.existingItemModel()) + .onRegister(CreateRegistrate.itemColors(() -> ChromaticCompoundColor::new)) + .register(); + + public static final ItemEntry SHADOW_STEEL = REGISTRATE.item("shadow_steel", ShadowSteelItem::new) + .properties(p -> p.rarity(Rarity.UNCOMMON)) + .register(); + + public static final ItemEntry REFINED_RADIANCE = + REGISTRATE.item("refined_radiance", RefinedRadianceItem::new) + .properties(p -> p.rarity(Rarity.UNCOMMON)) + .register(); + public static final ItemEntry COPPER_NUGGET = taggedIngredient("copper_nugget", forgeItemTag("nuggets/copper"), NUGGETS.tag), ZINC_NUGGET = taggedIngredient("zinc_nugget", forgeItemTag("nuggets/zinc"), NUGGETS.tag), @@ -91,77 +159,6 @@ public class AllItems { CRUSHED_QUICKSILVER = compatCrushedOre("quicksilver"), CRUSHED_BAUXITE = compatCrushedOre("aluminum"), CRUSHED_URANIUM = compatCrushedOre("uranium"), CRUSHED_NICKEL = compatCrushedOre("nickel"); - public static final ItemEntry ANDESITE_ALLOY = ingredient("andesite_alloy"), - COPPER_INGOT = taggedIngredient("copper_ingot", forgeItemTag("ingots/copper"), CREATE_INGOTS.tag), - ZINC_INGOT = taggedIngredient("zinc_ingot", forgeItemTag("ingots/zinc"), CREATE_INGOTS.tag), - BRASS_INGOT = taggedIngredient("brass_ingot", forgeItemTag("ingots/brass"), CREATE_INGOTS.tag), - - WHEAT_FLOUR = ingredient("wheat_flour"), DOUGH = ingredient("dough"), CINDER_FLOUR = ingredient("cinder_flour"), - POWDERED_OBSIDIAN = ingredient("powdered_obsidian"), ROSE_QUARTZ = ingredient("rose_quartz"), - POLISHED_ROSE_QUARTZ = ingredient("polished_rose_quartz"), PROPELLER = ingredient("propeller"), - WHISK = ingredient("whisk"), BRASS_HAND = ingredient("brass_hand"), - CRAFTER_SLOT_COVER = ingredient("crafter_slot_cover"); - - public static final ItemEntry BLAZE_CAKE_BASE = - REGISTRATE.item("blaze_cake_base", HiddenIngredientItem::new) - .tag(AllItemTags.UPRIGHT_ON_BELT.tag) - .register(); - - public static final ItemEntry BLAZE_CAKE = REGISTRATE.item("blaze_cake", CombustibleItem::new) - .tag(AllItemTags.UPRIGHT_ON_BELT.tag) - .register(); - - public static final ItemEntry BAR_OF_CHOCOLATE = REGISTRATE.item("bar_of_chocolate", Item::new) - .properties(p -> p.food(new Food.Builder().hunger(5) - .saturation(0.6F) - .build())) - .lang("Bar of Chocolate") - .register(); - - public static final ItemEntry SWEET_ROLL = REGISTRATE.item("sweet_roll", Item::new) - .properties(p -> p.food(new Food.Builder().hunger(6) - .saturation(1.0F) - .build())) - .register(); - - public static final ItemEntry CHOCOLATE_BERRIES = REGISTRATE.item("chocolate_glazed_berries", Item::new) - .properties(p -> p.food(new Food.Builder().hunger(7) - .saturation(0.7F) - .build())) - .register(); - - public static final ItemEntry HONEYED_APPLE = REGISTRATE.item("honeyed_apple", Item::new) - .properties(p -> p.food(new Food.Builder().hunger(8) - .saturation(0.6F) - .build())) - .register(); - - public static final ItemEntry BUILDERS_TEA = REGISTRATE.item("builders_tea", BuildersTeaItem::new) - .tag(AllItemTags.UPRIGHT_ON_BELT.tag) - .properties(p -> p.maxStackSize(16)) - .lang("Builder's Tea") - .register(); - - public static final ItemEntry CHROMATIC_COMPOUND = - REGISTRATE.item("chromatic_compound", ChromaticCompoundItem::new) - .properties(p -> p.rarity(Rarity.UNCOMMON)) - .model(AssetLookup.existingItemModel()) - .onRegister(CreateRegistrate.itemColors(() -> ChromaticCompoundColor::new)) - .register(); - - public static final ItemEntry SHADOW_STEEL = REGISTRATE.item("shadow_steel", ShadowSteelItem::new) - .properties(p -> p.rarity(Rarity.UNCOMMON)) - .register(); - - public static final ItemEntry REFINED_RADIANCE = - REGISTRATE.item("refined_radiance", RefinedRadianceItem::new) - .properties(p -> p.rarity(Rarity.UNCOMMON)) - .register(); - - public static final ItemEntry - - ELECTRON_TUBE = ingredient("electron_tube"), INTEGRATED_CIRCUIT = ingredient("integrated_circuit"); - // Kinetics static { @@ -184,6 +181,12 @@ public class AllItems { .model(AssetLookup.customItemModel("blaze_burner", "block")) .register(); + public static final ItemEntry GOGGLES = REGISTRATE.item("goggles", GogglesItem::new) + .properties(p -> p.maxStackSize(1)) + .onRegister(CreateRegistrate.itemModel(() -> GogglesModel::new)) + .lang("Engineer's Goggles") + .register(); + public static final ItemEntry SUPER_GLUE = REGISTRATE.item("super_glue", SuperGlueItem::new) .register(); @@ -206,12 +209,6 @@ public class AllItems { .model(AssetLookup.itemModelWithPartials()) .register(); - public static final ItemEntry GOGGLES = REGISTRATE.item("goggles", GogglesItem::new) - .properties(p -> p.maxStackSize(1)) - .onRegister(CreateRegistrate.itemModel(() -> GogglesModel::new)) - .lang("Engineer's Goggles") - .register(); - public static final ItemEntry MINECART_CONTRAPTION = REGISTRATE.item("minecart_contraption", MinecartContraptionItem::rideable) .register(); diff --git a/src/main/java/com/simibubi/create/compat/jei/category/BlockCuttingCategory.java b/src/main/java/com/simibubi/create/compat/jei/category/BlockCuttingCategory.java index 2fd5373e6..93e27c9ab 100644 --- a/src/main/java/com/simibubi/create/compat/jei/category/BlockCuttingCategory.java +++ b/src/main/java/com/simibubi/create/compat/jei/category/BlockCuttingCategory.java @@ -33,7 +33,7 @@ public class BlockCuttingCategory extends CreateRecipeCategory getRecipeClass() { return CondensedBlockCuttingRecipe.class; } - + @Override public void setIngredients(CondensedBlockCuttingRecipe recipe, IIngredients ingredients) { ingredients.setInputIngredients(recipe.getIngredients()); @@ -118,6 +118,11 @@ public class BlockCuttingCategory extends CreateRecipeCategory getSerializer() { return AllRecipeTypes.MECHANICAL_CRAFTING.serializer; diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/Contraption.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/Contraption.java index 5ee4c3bb0..d80494f5e 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/Contraption.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/Contraption.java @@ -91,6 +91,7 @@ import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3d; import net.minecraft.util.palette.PaletteHashMap; +import net.minecraft.village.PointOfInterestType; import net.minecraft.world.IWorld; import net.minecraft.world.World; import net.minecraft.world.gen.feature.template.Template.BlockInfo; @@ -929,10 +930,14 @@ public abstract class Contraption { for (BlockInfo block : blocks.values()) { BlockPos add = block.pos.add(anchor) .add(offset); - if (!shouldUpdateAfterMovement(block)) - continue; - world.markAndNotifyBlock(add, null, block.state, Blocks.AIR.getDefaultState(), - BlockFlags.IS_MOVING | BlockFlags.DEFAULT); +// if (!shouldUpdateAfterMovement(block)) +// continue; + int flags = BlockFlags.IS_MOVING | BlockFlags.DEFAULT; + world.notifyBlockUpdate(add, block.state, Blocks.AIR.getDefaultState(), flags); + world.notifyNeighbors(add, block.state.getBlock()); + block.state.updateDiagonalNeighbors(world, add, flags & -2); +// world.markAndNotifyBlock(add, null, block.state, Blocks.AIR.getDefaultState(), +// BlockFlags.IS_MOVING | BlockFlags.DEFAULT); this method did strange logspamming with POI-related blocks } } @@ -1079,6 +1084,9 @@ public abstract class Contraption { } protected boolean shouldUpdateAfterMovement(BlockInfo info) { + if (PointOfInterestType.forState(info.state) + .isPresent()) + return false; return true; } diff --git a/src/main/java/com/simibubi/create/content/contraptions/processing/ProcessingRecipe.java b/src/main/java/com/simibubi/create/content/contraptions/processing/ProcessingRecipe.java index 5f928b1db..9fc92040c 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/processing/ProcessingRecipe.java +++ b/src/main/java/com/simibubi/create/content/contraptions/processing/ProcessingRecipe.java @@ -180,6 +180,11 @@ public abstract class ProcessingRecipe implements IRecipe< public ResourceLocation getId() { return id; } + + @Override + public boolean isDynamic() { + return true; + } @Override public IRecipeSerializer getSerializer() { diff --git a/src/main/java/com/simibubi/create/content/contraptions/relays/belt/transport/BeltFunnelInteractionHandler.java b/src/main/java/com/simibubi/create/content/contraptions/relays/belt/transport/BeltFunnelInteractionHandler.java index 3fa3d429c..b4da7da8f 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/relays/belt/transport/BeltFunnelInteractionHandler.java +++ b/src/main/java/com/simibubi/create/content/contraptions/relays/belt/transport/BeltFunnelInteractionHandler.java @@ -97,6 +97,7 @@ public class BeltFunnelInteractionHandler { remainder = ItemHandlerHelper.copyStackWithSize(currentItem.stack, notFilled); funnelTE.flap(true); + funnelTE.onTransfer(toInsert); currentItem.stack = remainder; beltInventory.belt.sendData(); if (blocking) 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 fe208b5ff..7dc616f67 100644 --- a/src/main/java/com/simibubi/create/foundation/ponder/SceneBuilder.java +++ b/src/main/java/com/simibubi/create/foundation/ponder/SceneBuilder.java @@ -4,6 +4,7 @@ import java.util.Optional; import java.util.UUID; import java.util.function.Consumer; import java.util.function.Function; +import java.util.function.Supplier; import java.util.function.UnaryOperator; import com.simibubi.create.content.contraptions.base.IRotate.SpeedLevel; @@ -19,6 +20,8 @@ import com.simibubi.create.foundation.ponder.elements.BeltItemElement; import com.simibubi.create.foundation.ponder.elements.EntityElement; import com.simibubi.create.foundation.ponder.elements.InputWindowElement; import com.simibubi.create.foundation.ponder.elements.ParrotElement; +import com.simibubi.create.foundation.ponder.elements.ParrotElement.ParrotPose; +import com.simibubi.create.foundation.ponder.elements.ParrotElement.SpinOnComponentPose; import com.simibubi.create.foundation.ponder.elements.TextWindowElement; import com.simibubi.create.foundation.ponder.elements.WorldSectionElement; import com.simibubi.create.foundation.ponder.instructions.AnimateParrotInstruction; @@ -294,44 +297,25 @@ public class SceneBuilder { public class SpecialInstructions { public ElementLink birbOnTurntable(BlockPos pos) { - ElementLink link = new ElementLink<>(ParrotElement.class); - ParrotElement parrot = ParrotElement.spinOnComponent(VecHelper.getCenterOf(pos), pos); - addInstruction(new CreateParrotInstruction(10, Direction.DOWN, parrot)); - addInstruction(scene -> scene.linkElement(parrot, link)); - return link; + return createBirb(VecHelper.getCenterOf(pos), () -> new SpinOnComponentPose(pos)); } public ElementLink birbOnSpinnyShaft(BlockPos pos) { + return createBirb(VecHelper.getCenterOf(pos) + .add(0, 0.5, 0), () -> new SpinOnComponentPose(pos)); + } + + public ElementLink createBirb(Vec3d location, Supplier pose) { ElementLink link = new ElementLink<>(ParrotElement.class); - ParrotElement parrot = ParrotElement.spinOnComponent(VecHelper.getCenterOf(pos) - .add(0, 0.5, 0), pos); + ParrotElement parrot = ParrotElement.create(location, pose); addInstruction(new CreateParrotInstruction(10, Direction.DOWN, parrot)); addInstruction(scene -> scene.linkElement(parrot, link)); return link; } - public ElementLink birbLookingAtPOI(Vec3d location) { - ElementLink link = new ElementLink<>(ParrotElement.class); - ParrotElement parrot = ParrotElement.lookAtPOI(location); - addInstruction(new CreateParrotInstruction(10, Direction.DOWN, parrot)); - addInstruction(scene -> scene.linkElement(parrot, link)); - return link; - } - - public ElementLink flappyBirb(Vec3d location) { - ElementLink link = new ElementLink<>(ParrotElement.class); - ParrotElement parrot = ParrotElement.flappy(location); - addInstruction(new CreateParrotInstruction(10, Direction.DOWN, parrot)); - addInstruction(scene -> scene.linkElement(parrot, link)); - return link; - } - - public ElementLink birbPartying(Vec3d location) { - ElementLink link = new ElementLink<>(ParrotElement.class); - ParrotElement parrot = ParrotElement.dance(location); - addInstruction(new CreateParrotInstruction(10, Direction.DOWN, parrot)); - addInstruction(scene -> scene.linkElement(parrot, link)); - return link; + public void changeBirbPose(ElementLink birb, Supplier pose) { + addInstruction(scene -> scene.resolve(birb) + .setPose(pose.get())); } public void movePointOfInterest(Vec3d location) { @@ -574,7 +558,7 @@ public class SceneBuilder { resolve.ifPresent(tis -> tis.locked = stalled); }); } - + public void changeBeltItemTo(ElementLink link, ItemStack newStack) { addInstruction(scene -> { BeltItemElement resolve = scene.resolve(link); diff --git a/src/main/java/com/simibubi/create/foundation/ponder/content/BeltScenes.java b/src/main/java/com/simibubi/create/foundation/ponder/content/BeltScenes.java index 09c5ff47b..547a8c348 100644 --- a/src/main/java/com/simibubi/create/foundation/ponder/content/BeltScenes.java +++ b/src/main/java/com/simibubi/create/foundation/ponder/content/BeltScenes.java @@ -17,6 +17,8 @@ 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.ParrotElement; +import com.simibubi.create.foundation.ponder.elements.ParrotElement.FaceCursorPose; +import com.simibubi.create.foundation.ponder.elements.ParrotElement.FacePointOfInterestPose; import com.simibubi.create.foundation.ponder.elements.WorldSectionElement; import com.simibubi.create.foundation.utility.NBTHelper; import com.simibubi.create.foundation.utility.Pointing; @@ -324,8 +326,8 @@ public class BeltScenes { scene.idle(20); - ElementLink parrot = scene.special.birbLookingAtPOI(util.vector.topOf(0, 1, 2) - .add(0, -3 / 16f, 0)); + ElementLink parrot = scene.special.createBirb(util.vector.topOf(0, 1, 2) + .add(0, -3 / 16f, 0), FacePointOfInterestPose::new); scene.special.moveParrot(parrot, util.vector.of(1.78, 0, 0), 40); scene.special.movePointOfInterest(util.grid.at(1, 1, 3)); @@ -371,7 +373,7 @@ public class BeltScenes { scene.effects.indicateSuccess(util.grid.at(3, 2, 2)); scene.idle(20); - scene.special.movePointOfInterest(util.grid.at(2, 1, 5)); + scene.special.changeBirbPose(parrot, FaceCursorPose::new); } public static void beltsCanBeEncased(SceneBuilder scene, SceneBuildingUtil util) { diff --git a/src/main/java/com/simibubi/create/foundation/ponder/content/DebugScenes.java b/src/main/java/com/simibubi/create/foundation/ponder/content/DebugScenes.java index da89236c3..1f37322eb 100644 --- a/src/main/java/com/simibubi/create/foundation/ponder/content/DebugScenes.java +++ b/src/main/java/com/simibubi/create/foundation/ponder/content/DebugScenes.java @@ -12,6 +12,8 @@ import com.simibubi.create.foundation.ponder.SceneBuildingUtil; import com.simibubi.create.foundation.ponder.Selection; import com.simibubi.create.foundation.ponder.elements.BeltItemElement; import com.simibubi.create.foundation.ponder.elements.InputWindowElement; +import com.simibubi.create.foundation.ponder.elements.ParrotElement.DancePose; +import com.simibubi.create.foundation.ponder.elements.ParrotElement.FacePointOfInterestPose; import com.simibubi.create.foundation.ponder.elements.WorldSectionElement; import com.simibubi.create.foundation.ponder.instructions.EmitParticlesInstruction.Emitter; import com.simibubi.create.foundation.utility.Pointing; @@ -108,7 +110,7 @@ public class DebugScenes { scene.showBasePlate(); scene.idle(10); Vec3d parrotPos = util.vector.topOf(1, 0, 1); - scene.special.birbLookingAtPOI(parrotPos); + scene.special.createBirb(parrotPos, FacePointOfInterestPose::new); scene.world.showSection(util.select.layersFrom(1), Direction.DOWN); scene.overlay.showText(1000) .text("Fluid rendering test.") @@ -290,11 +292,11 @@ public class DebugScenes { .pointAt(util.vector.topOf(pos)); scene.idle(10); - scene.special.birbPartying(util.vector.topOf(0, 1, 2)); + scene.special.createBirb(util.vector.topOf(0, 1, 2), DancePose::new); scene.idle(10); - scene.special.birbLookingAtPOI(util.vector.centerOf(3, 1, 3) - .add(0, 0.25f, 0)); + scene.special.createBirb(util.vector.centerOf(3, 1, 3) + .add(0, 0.25f, 0), FacePointOfInterestPose::new); scene.idle(20); BlockPos poi1 = util.grid.at(4, 1, 0); diff --git a/src/main/java/com/simibubi/create/foundation/ponder/content/FanScenes.java b/src/main/java/com/simibubi/create/foundation/ponder/content/FanScenes.java index 8d52c8113..edde435de 100644 --- a/src/main/java/com/simibubi/create/foundation/ponder/content/FanScenes.java +++ b/src/main/java/com/simibubi/create/foundation/ponder/content/FanScenes.java @@ -11,6 +11,7 @@ import com.simibubi.create.foundation.ponder.elements.BeltItemElement; import com.simibubi.create.foundation.ponder.elements.EntityElement; import com.simibubi.create.foundation.ponder.elements.InputWindowElement; import com.simibubi.create.foundation.ponder.elements.ParrotElement; +import com.simibubi.create.foundation.ponder.elements.ParrotElement.FlappyPose; import com.simibubi.create.foundation.ponder.elements.WorldSectionElement; import com.simibubi.create.foundation.ponder.instructions.EmitParticlesInstruction.Emitter; import com.simibubi.create.foundation.utility.Pointing; @@ -32,7 +33,6 @@ public class FanScenes { scene.title("fan_direction", "Air flow of Encased Fans"); scene.configureBasePlate(0, 1, 5); scene.world.showSection(util.select.layer(0), Direction.UP); -// scene.world.modifyKineticSpeed(util.select.everywhere(), f -> -f); scene.idle(5); scene.world.showSection(util.select.fromTo(3, 1, 0, 3, 1, 5) .add(util.select.position(3, 2, 4)), Direction.DOWN); @@ -45,7 +45,7 @@ public class FanScenes { scene.idle(40); scene.effects.rotationDirectionIndicator(fanPos.south()); - ElementLink flappyBirb = scene.special.flappyBirb(util.vector.topOf(1, 0, 3)); + ElementLink flappyBirb = scene.special.createBirb(util.vector.topOf(1, 0, 3), FlappyPose::new); scene.idle(2); scene.special.rotateParrot(flappyBirb, 0, 235, 0, 30); scene.special.moveParrot(flappyBirb, util.vector.of(0, 0, -2.5), 30); diff --git a/src/main/java/com/simibubi/create/foundation/ponder/elements/ParrotElement.java b/src/main/java/com/simibubi/create/foundation/ponder/elements/ParrotElement.java index abcbfd691..cd7043524 100644 --- a/src/main/java/com/simibubi/create/foundation/ponder/elements/ParrotElement.java +++ b/src/main/java/com/simibubi/create/foundation/ponder/elements/ParrotElement.java @@ -1,5 +1,7 @@ package com.simibubi.create.foundation.ponder.elements; +import java.util.function.Supplier; + import com.mojang.blaze3d.matrix.MatrixStack; import com.simibubi.create.Create; import com.simibubi.create.content.contraptions.base.KineticTileEntity; @@ -9,6 +11,7 @@ import com.simibubi.create.foundation.utility.AngleHelper; import com.simibubi.create.foundation.utility.AnimationTickHolder; import com.simibubi.create.foundation.utility.MatrixStacker; +import net.minecraft.client.MainWindow; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.IRenderTypeBuffer; import net.minecraft.client.renderer.entity.EntityRendererManager; @@ -24,42 +27,29 @@ public class ParrotElement extends AnimatedSceneElement { private Vec3d location; private ParrotEntity entity; private ParrotPose pose; + private Supplier initialPose; - public static ParrotElement lookAtPOI(Vec3d location) { - ParrotElement parrotElement = new ParrotElement(location); - parrotElement.pose = parrotElement.new FacePointOfInterestPose(); - return parrotElement; + public static ParrotElement create(Vec3d location, Supplier pose) { + return new ParrotElement(location, pose); } - public static ParrotElement spinOnComponent(Vec3d location, BlockPos componentPos) { - ParrotElement parrotElement = new ParrotElement(location); - parrotElement.pose = parrotElement.new SpinOnComponentPose(componentPos); - return parrotElement; - } - - public static ParrotElement dance(Vec3d location) { - ParrotElement parrotElement = new ParrotElement(location); - parrotElement.pose = parrotElement.new DancePose(); - return parrotElement; - } - - public static ParrotElement flappy(Vec3d location) { - ParrotElement parrotElement = new ParrotElement(location); - parrotElement.pose = parrotElement.new FlappyPose(); - return parrotElement; - } - - protected ParrotElement(Vec3d location) { + protected ParrotElement(Vec3d location, Supplier pose) { this.location = location; + initialPose = pose; + setPose(initialPose.get()); } @Override public void reset(PonderScene scene) { super.reset(scene); + setPose(initialPose.get()); entity.setPos(0, 0, 0); entity.prevPosX = 0; entity.prevPosY = 0; entity.prevPosZ = 0; + entity.lastTickPosX = 0; + entity.lastTickPosY = 0; + entity.lastTickPosZ = 0; } @Override @@ -74,13 +64,17 @@ public class ParrotElement extends AnimatedSceneElement { entity.oFlap = entity.flap; entity.onGround = true; - pose.tick(scene); - entity.prevPosX = entity.getX(); entity.prevPosY = entity.getY(); entity.prevPosZ = entity.getZ(); entity.prevRotationYaw = entity.rotationYaw; entity.prevRotationPitch = entity.rotationPitch; + + pose.tick(scene, entity, location); + + entity.lastTickPosX = entity.getX(); + entity.lastTickPosY = entity.getY(); + entity.lastTickPosZ = entity.getZ(); } public void setPositionOffset(Vec3d position, boolean immediate) { @@ -119,7 +113,7 @@ public class ParrotElement extends AnimatedSceneElement { .getRenderManager(); if (entity == null) - pose.create(world); + entity = pose.create(world); ms.push(); ms.translate(location.x, location.y, location.z); @@ -133,45 +127,46 @@ public class ParrotElement extends AnimatedSceneElement { ms.pop(); } - abstract class ParrotPose { + public void setPose(ParrotPose pose) { + this.pose = pose; + } - abstract void tick(PonderScene scene); + public static abstract class ParrotPose { - void create(PonderWorld world) { - entity = new ParrotEntity(EntityType.PARROT, world); + abstract void tick(PonderScene scene, ParrotEntity entity, Vec3d location); + + ParrotEntity create(PonderWorld world) { + ParrotEntity entity = new ParrotEntity(EntityType.PARROT, world); int nextInt = Create.random.nextInt(5); entity.setVariant(nextInt == 1 ? 0 : nextInt); // blue parrots are kinda hard to see + return entity; } } - class DancePose extends ParrotPose { + public static class DancePose extends ParrotPose { @Override - void create(PonderWorld world) { - super.create(world); + ParrotEntity create(PonderWorld world) { + ParrotEntity entity = super.create(world); entity.setPartying(BlockPos.ZERO, true); + return entity; } @Override - void tick(PonderScene scene) { + void tick(PonderScene scene, ParrotEntity entity, Vec3d location) { entity.prevRotationYaw = entity.rotationYaw; entity.rotationYaw -= 2; } } - class FlappyPose extends ParrotPose { + public static class FlappyPose extends ParrotPose { @Override - void create(PonderWorld world) { - super.create(world); - } - - @Override - void tick(PonderScene scene) { + void tick(PonderScene scene, ParrotEntity entity, Vec3d location) { double length = entity.getPositionVec() - .subtract(entity.prevPosX, entity.prevPosY, entity.prevPosZ) + .subtract(entity.lastTickPosX, entity.lastTickPosY, entity.lastTickPosZ) .length(); entity.onGround = false; double phase = Math.min(length * 15, 8); @@ -183,7 +178,7 @@ public class ParrotElement extends AnimatedSceneElement { } - class SpinOnComponentPose extends ParrotPose { + public static class SpinOnComponentPose extends ParrotPose { private BlockPos componentPos; @@ -192,7 +187,7 @@ public class ParrotElement extends AnimatedSceneElement { } @Override - void tick(PonderScene scene) { + void tick(PonderScene scene, ParrotEntity entity, Vec3d location) { TileEntity tileEntity = scene.getWorld() .getTileEntity(componentPos); if (!(tileEntity instanceof KineticTileEntity)) @@ -204,11 +199,11 @@ public class ParrotElement extends AnimatedSceneElement { } - class FacePointOfInterestPose extends ParrotPose { + public static abstract class FaceVecPose extends ParrotPose { @Override - void tick(PonderScene scene) { - Vec3d p_200602_2_ = scene.getPointOfInterest(); + void tick(PonderScene scene, ParrotEntity entity, Vec3d location) { + Vec3d p_200602_2_ = getFacedVec(scene); Vec3d vec3d = location.add(entity.getEyePosition(0)); double d0 = p_200602_2_.x - vec3d.x; double d1 = p_200602_2_.y - vec3d.y; @@ -220,6 +215,31 @@ public class ParrotElement extends AnimatedSceneElement { MathHelper.wrapDegrees((float) -(MathHelper.atan2(d2, d0) * (double) (180F / (float) Math.PI)) + 90); } + protected abstract Vec3d getFacedVec(PonderScene scene); + + } + + public static class FacePointOfInterestPose extends FaceVecPose { + + @Override + protected Vec3d getFacedVec(PonderScene scene) { + return scene.getPointOfInterest(); + } + + } + + public static class FaceCursorPose extends FaceVecPose { + + @Override + protected Vec3d getFacedVec(PonderScene scene) { + Minecraft minecraft = Minecraft.getInstance(); + MainWindow w = minecraft.getWindow(); + double mouseX = minecraft.mouseHelper.getMouseX() * w.getScaledWidth() / w.getWidth(); + double mouseY = minecraft.mouseHelper.getMouseY() * w.getScaledHeight() / w.getHeight(); + return scene.getTransform() + .screenToScene(mouseX, mouseY, 300); + } + } } diff --git a/src/main/resources/assets/create/models/block/analog_lever/item.json b/src/main/resources/assets/create/models/block/analog_lever/item.json index 01b9ee73e..855add131 100644 --- a/src/main/resources/assets/create/models/block/analog_lever/item.json +++ b/src/main/resources/assets/create/models/block/analog_lever/item.json @@ -67,7 +67,7 @@ }, "fixed": { "rotation": [-90, 0, 0], - "translation": [0, 0, -6], + "translation": [0, 0, -5.25], "scale": [0.75, 0.75, 0.75] } }, diff --git a/src/main/resources/assets/create/models/block/belt/start.json b/src/main/resources/assets/create/models/block/belt/start.json index ff4a6eed9..1402bc0ac 100644 --- a/src/main/resources/assets/create/models/block/belt/start.json +++ b/src/main/resources/assets/create/models/block/belt/start.json @@ -9,6 +9,7 @@ "name": "Top", "from": [3, 10, 2], "to": [13, 11, 16], + "rotation": {"angle": 0, "axis": "y", "origin": [0, 0, 0]}, "faces": { "east": {"uv": [3, 0, 4, 14], "rotation": 270, "texture": "#0"}, "west": {"uv": [12, 0, 13, 14], "rotation": 90, "texture": "#0"}, @@ -19,6 +20,7 @@ "name": "Top", "from": [1, 11, 1], "to": [15, 13, 16], + "rotation": {"angle": 0, "axis": "y", "origin": [0, 0, 0]}, "faces": { "north": {"uv": [1, 15, 15, 16], "texture": "#0"}, "east": {"uv": [0, 0, 2, 15], "rotation": 270, "texture": "#0"}, @@ -31,6 +33,7 @@ "name": "Side", "from": [1.1, 4, 0], "to": [14.9, 12, 2], + "rotation": {"angle": 0, "axis": "y", "origin": [0, 0, 0]}, "faces": { "north": {"uv": [1, 0, 15, 8], "texture": "#0"}, "east": {"uv": [0, 0, 2, 8], "texture": "#0"}, @@ -44,10 +47,11 @@ "name": "Side", "from": [3, 6, 2], "to": [13, 10, 3], + "rotation": {"angle": 0, "axis": "y", "origin": [0, 0, 0]}, "faces": { - "east": {"uv": [3, 6, 4, 10], "rotation": 180, "texture": "#0"}, + "east": {"uv": [3, 6, 4, 10], "texture": "#0"}, "south": {"uv": [3, 2, 13, 6], "texture": "#0"}, - "west": {"uv": [12, 6, 13, 10], "rotation": 180, "texture": "#0"} + "west": {"uv": [12, 6, 13, 10], "texture": "#0"} } } ] diff --git a/src/main/resources/assets/create/models/block/diodes/adjustable_pulse_repeater.json b/src/main/resources/assets/create/models/block/diodes/adjustable_pulse_repeater.json index 685e4b7b6..6481341d8 100644 --- a/src/main/resources/assets/create/models/block/diodes/adjustable_pulse_repeater.json +++ b/src/main/resources/assets/create/models/block/diodes/adjustable_pulse_repeater.json @@ -60,6 +60,11 @@ } ], "display": { + "gui": { + "rotation": [30, 45, 0], + "translation": [0, 2.5, 0], + "scale": [0.625, 0.625, 0.625] + }, "fixed": { "rotation": [ 270, 0, 0 ], "translation": [ 0, 0, -3], diff --git a/src/main/resources/assets/create/models/block/diodes/adjustable_repeater.json b/src/main/resources/assets/create/models/block/diodes/adjustable_repeater.json index 7cd8a0331..cf137e612 100644 --- a/src/main/resources/assets/create/models/block/diodes/adjustable_repeater.json +++ b/src/main/resources/assets/create/models/block/diodes/adjustable_repeater.json @@ -34,6 +34,11 @@ } ], "display": { + "gui": { + "rotation": [30, 45, 0], + "translation": [0, 2.5, 0], + "scale": [0.625, 0.625, 0.625] + }, "fixed": { "rotation": [ 270, 0, 0 ], "translation": [ 0, 0, -3], diff --git a/src/main/resources/assets/create/models/block/diodes/latch_off.json b/src/main/resources/assets/create/models/block/diodes/latch_off.json index b1fdfac10..4e8ce60be 100644 --- a/src/main/resources/assets/create/models/block/diodes/latch_off.json +++ b/src/main/resources/assets/create/models/block/diodes/latch_off.json @@ -90,11 +90,16 @@ } } ], - "groups": [0, 1, 2, 3, 4, - { - "name": "lever", - "origin": [8, 8, 8], - "children": [5, 6] - } - ] + "display": { + "gui": { + "rotation": [30, 45, 0], + "translation": [0, 2.5, 0], + "scale": [0.625, 0.625, 0.625] + }, + "fixed": { + "rotation": [ 270, 0, 0 ], + "translation": [ 0, 0, -3], + "scale":[ 0.5, 0.5, 0.5 ] + } + } } \ No newline at end of file diff --git a/src/main/resources/assets/create/models/block/diodes/latch_on.json b/src/main/resources/assets/create/models/block/diodes/latch_on.json index 8354678e8..6d4c4797f 100644 --- a/src/main/resources/assets/create/models/block/diodes/latch_on.json +++ b/src/main/resources/assets/create/models/block/diodes/latch_on.json @@ -92,11 +92,16 @@ } } ], - "groups": [0, 1, 2, 3, 4, - { - "name": "lever", - "origin": [8, 8, 8], - "children": [5, 6] - } - ] + "display": { + "gui": { + "rotation": [30, 45, 0], + "translation": [0, 2.5, 0], + "scale": [0.625, 0.625, 0.625] + }, + "fixed": { + "rotation": [ 270, 0, 0 ], + "translation": [ 0, 0, -3], + "scale":[ 0.5, 0.5, 0.5 ] + } + } } \ No newline at end of file diff --git a/src/main/resources/assets/create/models/block/diodes/pulse_repeater.json b/src/main/resources/assets/create/models/block/diodes/pulse_repeater.json index 8504219bf..315d2fed2 100644 --- a/src/main/resources/assets/create/models/block/diodes/pulse_repeater.json +++ b/src/main/resources/assets/create/models/block/diodes/pulse_repeater.json @@ -46,5 +46,17 @@ "up": { "texture": "#torch", "uv": [ 7, 6, 9, 8 ] } } } - ] + ], + "display": { + "gui": { + "rotation": [30, 45, 0], + "translation": [0, 2.5, 0], + "scale": [0.625, 0.625, 0.625] + }, + "fixed": { + "rotation": [ 270, 0, 0 ], + "translation": [ 0, 0, -3], + "scale":[ 0.5, 0.5, 0.5 ] + } + } } \ No newline at end of file diff --git a/src/main/resources/assets/create/models/block/redstone_link/transmitter.json b/src/main/resources/assets/create/models/block/redstone_link/transmitter.json index 133eae26f..235a9a0e5 100644 --- a/src/main/resources/assets/create/models/block/redstone_link/transmitter.json +++ b/src/main/resources/assets/create/models/block/redstone_link/transmitter.json @@ -51,7 +51,13 @@ "display": { "gui": { "rotation": [30, 45, 0], + "translation": [0, 2.5, 0], "scale": [0.625, 0.625, 0.625] - } - } + }, + "fixed": { + "rotation": [ 270, 0, 0 ], + "translation": [ 0, 0, -3], + "scale":[ 0.5, 0.5, 0.5 ] + } + } } \ No newline at end of file diff --git a/src/main/resources/assets/create/models/block/sail_frame.json b/src/main/resources/assets/create/models/block/sail_frame.json index da4b090fe..6240b3aee 100644 --- a/src/main/resources/assets/create/models/block/sail_frame.json +++ b/src/main/resources/assets/create/models/block/sail_frame.json @@ -131,7 +131,7 @@ "scale": [0.25, 0.25, 0.25] }, "gui": { - "rotation": [30, 225, 0], + "rotation": [30, 315, -90], "scale": [0.625, 0.625, 0.625] }, "fixed": { diff --git a/src/main/resources/assets/create/models/block/white_sail.json b/src/main/resources/assets/create/models/block/white_sail.json index 413810a92..dbeda7194 100644 --- a/src/main/resources/assets/create/models/block/white_sail.json +++ b/src/main/resources/assets/create/models/block/white_sail.json @@ -129,7 +129,7 @@ "scale": [0.25, 0.25, 0.25] }, "gui": { - "rotation": [30, 225, 0], + "rotation": [30, 315, -90], "scale": [0.625, 0.625, 0.625] }, "fixed": {