Captain Distracto

- Removed processing recipes from recipe book
- Reorganized items in creative tab
- Tweaked a few model transforms
- Fixed belt uvs
- ponder birbs can now face the cursor
- fix interpolation on ponder birbs
- Fixed log spam when assembling certain blocks (Points of interest) in a contraption
- Fixed content observers not triggering for in-line belt funnels
This commit is contained in:
simibubi 2021-03-09 01:49:49 +01:00
parent 33d718d653
commit 62c3ae4040
21 changed files with 261 additions and 190 deletions

View file

@ -68,6 +68,74 @@ public class AllItems {
REGISTRATE.startSection(MATERIALS); REGISTRATE.startSection(MATERIALS);
} }
public static final ItemEntry<Item> 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<HiddenIngredientItem> BLAZE_CAKE_BASE =
REGISTRATE.item("blaze_cake_base", HiddenIngredientItem::new)
.tag(AllItemTags.UPRIGHT_ON_BELT.tag)
.register();
public static final ItemEntry<CombustibleItem> BLAZE_CAKE = REGISTRATE.item("blaze_cake", CombustibleItem::new)
.tag(AllItemTags.UPRIGHT_ON_BELT.tag)
.register();
public static final ItemEntry<Item> 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<Item> 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<Item> 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<Item> 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<BuildersTeaItem> 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<Item> 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<ChromaticCompoundItem> 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<ShadowSteelItem> SHADOW_STEEL = REGISTRATE.item("shadow_steel", ShadowSteelItem::new)
.properties(p -> p.rarity(Rarity.UNCOMMON))
.register();
public static final ItemEntry<RefinedRadianceItem> REFINED_RADIANCE =
REGISTRATE.item("refined_radiance", RefinedRadianceItem::new)
.properties(p -> p.rarity(Rarity.UNCOMMON))
.register();
public static final ItemEntry<Item> COPPER_NUGGET = public static final ItemEntry<Item> COPPER_NUGGET =
taggedIngredient("copper_nugget", forgeItemTag("nuggets/copper"), NUGGETS.tag), taggedIngredient("copper_nugget", forgeItemTag("nuggets/copper"), NUGGETS.tag),
ZINC_NUGGET = taggedIngredient("zinc_nugget", forgeItemTag("nuggets/zinc"), 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_QUICKSILVER = compatCrushedOre("quicksilver"), CRUSHED_BAUXITE = compatCrushedOre("aluminum"),
CRUSHED_URANIUM = compatCrushedOre("uranium"), CRUSHED_NICKEL = compatCrushedOre("nickel"); CRUSHED_URANIUM = compatCrushedOre("uranium"), CRUSHED_NICKEL = compatCrushedOre("nickel");
public static final ItemEntry<Item> 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<HiddenIngredientItem> BLAZE_CAKE_BASE =
REGISTRATE.item("blaze_cake_base", HiddenIngredientItem::new)
.tag(AllItemTags.UPRIGHT_ON_BELT.tag)
.register();
public static final ItemEntry<CombustibleItem> BLAZE_CAKE = REGISTRATE.item("blaze_cake", CombustibleItem::new)
.tag(AllItemTags.UPRIGHT_ON_BELT.tag)
.register();
public static final ItemEntry<Item> 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<Item> 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<Item> 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<Item> 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<BuildersTeaItem> 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<ChromaticCompoundItem> 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<ShadowSteelItem> SHADOW_STEEL = REGISTRATE.item("shadow_steel", ShadowSteelItem::new)
.properties(p -> p.rarity(Rarity.UNCOMMON))
.register();
public static final ItemEntry<RefinedRadianceItem> REFINED_RADIANCE =
REGISTRATE.item("refined_radiance", RefinedRadianceItem::new)
.properties(p -> p.rarity(Rarity.UNCOMMON))
.register();
public static final ItemEntry<Item>
ELECTRON_TUBE = ingredient("electron_tube"), INTEGRATED_CIRCUIT = ingredient("integrated_circuit");
// Kinetics // Kinetics
static { static {
@ -184,6 +181,12 @@ public class AllItems {
.model(AssetLookup.<BlazeBurnerBlockItem>customItemModel("blaze_burner", "block")) .model(AssetLookup.<BlazeBurnerBlockItem>customItemModel("blaze_burner", "block"))
.register(); .register();
public static final ItemEntry<GogglesItem> 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<SuperGlueItem> SUPER_GLUE = REGISTRATE.item("super_glue", SuperGlueItem::new) public static final ItemEntry<SuperGlueItem> SUPER_GLUE = REGISTRATE.item("super_glue", SuperGlueItem::new)
.register(); .register();
@ -206,12 +209,6 @@ public class AllItems {
.model(AssetLookup.itemModelWithPartials()) .model(AssetLookup.itemModelWithPartials())
.register(); .register();
public static final ItemEntry<GogglesItem> 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<MinecartContraptionItem> MINECART_CONTRAPTION = public static final ItemEntry<MinecartContraptionItem> MINECART_CONTRAPTION =
REGISTRATE.item("minecart_contraption", MinecartContraptionItem::rideable) REGISTRATE.item("minecart_contraption", MinecartContraptionItem::rideable)
.register(); .register();

View file

@ -33,7 +33,7 @@ public class BlockCuttingCategory extends CreateRecipeCategory<CondensedBlockCut
public Class<? extends CondensedBlockCuttingRecipe> getRecipeClass() { public Class<? extends CondensedBlockCuttingRecipe> getRecipeClass() {
return CondensedBlockCuttingRecipe.class; return CondensedBlockCuttingRecipe.class;
} }
@Override @Override
public void setIngredients(CondensedBlockCuttingRecipe recipe, IIngredients ingredients) { public void setIngredients(CondensedBlockCuttingRecipe recipe, IIngredients ingredients) {
ingredients.setInputIngredients(recipe.getIngredients()); ingredients.setInputIngredients(recipe.getIngredients());
@ -118,6 +118,11 @@ public class BlockCuttingCategory extends CreateRecipeCategory<CondensedBlockCut
} }
return condensed; return condensed;
} }
@Override
public boolean isDynamic() {
return true;
}
} }

View file

@ -36,6 +36,11 @@ public class MechanicalCraftingRecipe extends ShapedRecipe {
return AllRecipeTypes.MECHANICAL_CRAFTING.type; return AllRecipeTypes.MECHANICAL_CRAFTING.type;
} }
@Override
public boolean isDynamic() {
return true;
}
@Override @Override
public IRecipeSerializer<?> getSerializer() { public IRecipeSerializer<?> getSerializer() {
return AllRecipeTypes.MECHANICAL_CRAFTING.serializer; return AllRecipeTypes.MECHANICAL_CRAFTING.serializer;

View file

@ -91,6 +91,7 @@ import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d; import net.minecraft.util.math.Vec3d;
import net.minecraft.util.palette.PaletteHashMap; import net.minecraft.util.palette.PaletteHashMap;
import net.minecraft.village.PointOfInterestType;
import net.minecraft.world.IWorld; import net.minecraft.world.IWorld;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraft.world.gen.feature.template.Template.BlockInfo; import net.minecraft.world.gen.feature.template.Template.BlockInfo;
@ -929,10 +930,14 @@ public abstract class Contraption {
for (BlockInfo block : blocks.values()) { for (BlockInfo block : blocks.values()) {
BlockPos add = block.pos.add(anchor) BlockPos add = block.pos.add(anchor)
.add(offset); .add(offset);
if (!shouldUpdateAfterMovement(block)) // if (!shouldUpdateAfterMovement(block))
continue; // continue;
world.markAndNotifyBlock(add, null, block.state, Blocks.AIR.getDefaultState(), int flags = BlockFlags.IS_MOVING | BlockFlags.DEFAULT;
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) { protected boolean shouldUpdateAfterMovement(BlockInfo info) {
if (PointOfInterestType.forState(info.state)
.isPresent())
return false;
return true; return true;
} }

View file

@ -180,6 +180,11 @@ public abstract class ProcessingRecipe<T extends IInventory> implements IRecipe<
public ResourceLocation getId() { public ResourceLocation getId() {
return id; return id;
} }
@Override
public boolean isDynamic() {
return true;
}
@Override @Override
public IRecipeSerializer<?> getSerializer() { public IRecipeSerializer<?> getSerializer() {

View file

@ -97,6 +97,7 @@ public class BeltFunnelInteractionHandler {
remainder = ItemHandlerHelper.copyStackWithSize(currentItem.stack, notFilled); remainder = ItemHandlerHelper.copyStackWithSize(currentItem.stack, notFilled);
funnelTE.flap(true); funnelTE.flap(true);
funnelTE.onTransfer(toInsert);
currentItem.stack = remainder; currentItem.stack = remainder;
beltInventory.belt.sendData(); beltInventory.belt.sendData();
if (blocking) if (blocking)

View file

@ -4,6 +4,7 @@ import java.util.Optional;
import java.util.UUID; import java.util.UUID;
import java.util.function.Consumer; import java.util.function.Consumer;
import java.util.function.Function; import java.util.function.Function;
import java.util.function.Supplier;
import java.util.function.UnaryOperator; import java.util.function.UnaryOperator;
import com.simibubi.create.content.contraptions.base.IRotate.SpeedLevel; 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.EntityElement;
import com.simibubi.create.foundation.ponder.elements.InputWindowElement; import com.simibubi.create.foundation.ponder.elements.InputWindowElement;
import com.simibubi.create.foundation.ponder.elements.ParrotElement; 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.TextWindowElement;
import com.simibubi.create.foundation.ponder.elements.WorldSectionElement; import com.simibubi.create.foundation.ponder.elements.WorldSectionElement;
import com.simibubi.create.foundation.ponder.instructions.AnimateParrotInstruction; import com.simibubi.create.foundation.ponder.instructions.AnimateParrotInstruction;
@ -294,44 +297,25 @@ public class SceneBuilder {
public class SpecialInstructions { public class SpecialInstructions {
public ElementLink<ParrotElement> birbOnTurntable(BlockPos pos) { public ElementLink<ParrotElement> birbOnTurntable(BlockPos pos) {
ElementLink<ParrotElement> link = new ElementLink<>(ParrotElement.class); return createBirb(VecHelper.getCenterOf(pos), () -> new SpinOnComponentPose(pos));
ParrotElement parrot = ParrotElement.spinOnComponent(VecHelper.getCenterOf(pos), pos);
addInstruction(new CreateParrotInstruction(10, Direction.DOWN, parrot));
addInstruction(scene -> scene.linkElement(parrot, link));
return link;
} }
public ElementLink<ParrotElement> birbOnSpinnyShaft(BlockPos pos) { public ElementLink<ParrotElement> birbOnSpinnyShaft(BlockPos pos) {
return createBirb(VecHelper.getCenterOf(pos)
.add(0, 0.5, 0), () -> new SpinOnComponentPose(pos));
}
public ElementLink<ParrotElement> createBirb(Vec3d location, Supplier<? extends ParrotPose> pose) {
ElementLink<ParrotElement> link = new ElementLink<>(ParrotElement.class); ElementLink<ParrotElement> link = new ElementLink<>(ParrotElement.class);
ParrotElement parrot = ParrotElement.spinOnComponent(VecHelper.getCenterOf(pos) ParrotElement parrot = ParrotElement.create(location, pose);
.add(0, 0.5, 0), pos);
addInstruction(new CreateParrotInstruction(10, Direction.DOWN, parrot)); addInstruction(new CreateParrotInstruction(10, Direction.DOWN, parrot));
addInstruction(scene -> scene.linkElement(parrot, link)); addInstruction(scene -> scene.linkElement(parrot, link));
return link; return link;
} }
public ElementLink<ParrotElement> birbLookingAtPOI(Vec3d location) { public void changeBirbPose(ElementLink<ParrotElement> birb, Supplier<? extends ParrotPose> pose) {
ElementLink<ParrotElement> link = new ElementLink<>(ParrotElement.class); addInstruction(scene -> scene.resolve(birb)
ParrotElement parrot = ParrotElement.lookAtPOI(location); .setPose(pose.get()));
addInstruction(new CreateParrotInstruction(10, Direction.DOWN, parrot));
addInstruction(scene -> scene.linkElement(parrot, link));
return link;
}
public ElementLink<ParrotElement> flappyBirb(Vec3d location) {
ElementLink<ParrotElement> 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<ParrotElement> birbPartying(Vec3d location) {
ElementLink<ParrotElement> 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 movePointOfInterest(Vec3d location) { public void movePointOfInterest(Vec3d location) {
@ -574,7 +558,7 @@ public class SceneBuilder {
resolve.ifPresent(tis -> tis.locked = stalled); resolve.ifPresent(tis -> tis.locked = stalled);
}); });
} }
public void changeBeltItemTo(ElementLink<BeltItemElement> link, ItemStack newStack) { public void changeBeltItemTo(ElementLink<BeltItemElement> link, ItemStack newStack) {
addInstruction(scene -> { addInstruction(scene -> {
BeltItemElement resolve = scene.resolve(link); BeltItemElement resolve = scene.resolve(link);

View file

@ -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.EntityElement;
import com.simibubi.create.foundation.ponder.elements.InputWindowElement; import com.simibubi.create.foundation.ponder.elements.InputWindowElement;
import com.simibubi.create.foundation.ponder.elements.ParrotElement; 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.ponder.elements.WorldSectionElement;
import com.simibubi.create.foundation.utility.NBTHelper; import com.simibubi.create.foundation.utility.NBTHelper;
import com.simibubi.create.foundation.utility.Pointing; import com.simibubi.create.foundation.utility.Pointing;
@ -324,8 +326,8 @@ public class BeltScenes {
scene.idle(20); scene.idle(20);
ElementLink<ParrotElement> parrot = scene.special.birbLookingAtPOI(util.vector.topOf(0, 1, 2) ElementLink<ParrotElement> parrot = scene.special.createBirb(util.vector.topOf(0, 1, 2)
.add(0, -3 / 16f, 0)); .add(0, -3 / 16f, 0), FacePointOfInterestPose::new);
scene.special.moveParrot(parrot, util.vector.of(1.78, 0, 0), 40); scene.special.moveParrot(parrot, util.vector.of(1.78, 0, 0), 40);
scene.special.movePointOfInterest(util.grid.at(1, 1, 3)); 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.effects.indicateSuccess(util.grid.at(3, 2, 2));
scene.idle(20); 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) { public static void beltsCanBeEncased(SceneBuilder scene, SceneBuildingUtil util) {

View file

@ -12,6 +12,8 @@ import com.simibubi.create.foundation.ponder.SceneBuildingUtil;
import com.simibubi.create.foundation.ponder.Selection; import com.simibubi.create.foundation.ponder.Selection;
import com.simibubi.create.foundation.ponder.elements.BeltItemElement; import com.simibubi.create.foundation.ponder.elements.BeltItemElement;
import com.simibubi.create.foundation.ponder.elements.InputWindowElement; 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.elements.WorldSectionElement;
import com.simibubi.create.foundation.ponder.instructions.EmitParticlesInstruction.Emitter; import com.simibubi.create.foundation.ponder.instructions.EmitParticlesInstruction.Emitter;
import com.simibubi.create.foundation.utility.Pointing; import com.simibubi.create.foundation.utility.Pointing;
@ -108,7 +110,7 @@ public class DebugScenes {
scene.showBasePlate(); scene.showBasePlate();
scene.idle(10); scene.idle(10);
Vec3d parrotPos = util.vector.topOf(1, 0, 1); 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.world.showSection(util.select.layersFrom(1), Direction.DOWN);
scene.overlay.showText(1000) scene.overlay.showText(1000)
.text("Fluid rendering test.") .text("Fluid rendering test.")
@ -290,11 +292,11 @@ public class DebugScenes {
.pointAt(util.vector.topOf(pos)); .pointAt(util.vector.topOf(pos));
scene.idle(10); 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.idle(10);
scene.special.birbLookingAtPOI(util.vector.centerOf(3, 1, 3) scene.special.createBirb(util.vector.centerOf(3, 1, 3)
.add(0, 0.25f, 0)); .add(0, 0.25f, 0), FacePointOfInterestPose::new);
scene.idle(20); scene.idle(20);
BlockPos poi1 = util.grid.at(4, 1, 0); BlockPos poi1 = util.grid.at(4, 1, 0);

View file

@ -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.EntityElement;
import com.simibubi.create.foundation.ponder.elements.InputWindowElement; import com.simibubi.create.foundation.ponder.elements.InputWindowElement;
import com.simibubi.create.foundation.ponder.elements.ParrotElement; 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.elements.WorldSectionElement;
import com.simibubi.create.foundation.ponder.instructions.EmitParticlesInstruction.Emitter; import com.simibubi.create.foundation.ponder.instructions.EmitParticlesInstruction.Emitter;
import com.simibubi.create.foundation.utility.Pointing; import com.simibubi.create.foundation.utility.Pointing;
@ -32,7 +33,6 @@ public class FanScenes {
scene.title("fan_direction", "Air flow of Encased Fans"); scene.title("fan_direction", "Air flow of Encased Fans");
scene.configureBasePlate(0, 1, 5); scene.configureBasePlate(0, 1, 5);
scene.world.showSection(util.select.layer(0), Direction.UP); scene.world.showSection(util.select.layer(0), Direction.UP);
// scene.world.modifyKineticSpeed(util.select.everywhere(), f -> -f);
scene.idle(5); scene.idle(5);
scene.world.showSection(util.select.fromTo(3, 1, 0, 3, 1, 5) scene.world.showSection(util.select.fromTo(3, 1, 0, 3, 1, 5)
.add(util.select.position(3, 2, 4)), Direction.DOWN); .add(util.select.position(3, 2, 4)), Direction.DOWN);
@ -45,7 +45,7 @@ public class FanScenes {
scene.idle(40); scene.idle(40);
scene.effects.rotationDirectionIndicator(fanPos.south()); scene.effects.rotationDirectionIndicator(fanPos.south());
ElementLink<ParrotElement> flappyBirb = scene.special.flappyBirb(util.vector.topOf(1, 0, 3)); ElementLink<ParrotElement> flappyBirb = scene.special.createBirb(util.vector.topOf(1, 0, 3), FlappyPose::new);
scene.idle(2); scene.idle(2);
scene.special.rotateParrot(flappyBirb, 0, 235, 0, 30); scene.special.rotateParrot(flappyBirb, 0, 235, 0, 30);
scene.special.moveParrot(flappyBirb, util.vector.of(0, 0, -2.5), 30); scene.special.moveParrot(flappyBirb, util.vector.of(0, 0, -2.5), 30);

View file

@ -1,5 +1,7 @@
package com.simibubi.create.foundation.ponder.elements; package com.simibubi.create.foundation.ponder.elements;
import java.util.function.Supplier;
import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.matrix.MatrixStack;
import com.simibubi.create.Create; import com.simibubi.create.Create;
import com.simibubi.create.content.contraptions.base.KineticTileEntity; 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.AnimationTickHolder;
import com.simibubi.create.foundation.utility.MatrixStacker; import com.simibubi.create.foundation.utility.MatrixStacker;
import net.minecraft.client.MainWindow;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.IRenderTypeBuffer; import net.minecraft.client.renderer.IRenderTypeBuffer;
import net.minecraft.client.renderer.entity.EntityRendererManager; import net.minecraft.client.renderer.entity.EntityRendererManager;
@ -24,42 +27,29 @@ public class ParrotElement extends AnimatedSceneElement {
private Vec3d location; private Vec3d location;
private ParrotEntity entity; private ParrotEntity entity;
private ParrotPose pose; private ParrotPose pose;
private Supplier<? extends ParrotPose> initialPose;
public static ParrotElement lookAtPOI(Vec3d location) { public static ParrotElement create(Vec3d location, Supplier<? extends ParrotPose> pose) {
ParrotElement parrotElement = new ParrotElement(location); return new ParrotElement(location, pose);
parrotElement.pose = parrotElement.new FacePointOfInterestPose();
return parrotElement;
} }
public static ParrotElement spinOnComponent(Vec3d location, BlockPos componentPos) { protected ParrotElement(Vec3d location, Supplier<? extends ParrotPose> pose) {
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) {
this.location = location; this.location = location;
initialPose = pose;
setPose(initialPose.get());
} }
@Override @Override
public void reset(PonderScene scene) { public void reset(PonderScene scene) {
super.reset(scene); super.reset(scene);
setPose(initialPose.get());
entity.setPos(0, 0, 0); entity.setPos(0, 0, 0);
entity.prevPosX = 0; entity.prevPosX = 0;
entity.prevPosY = 0; entity.prevPosY = 0;
entity.prevPosZ = 0; entity.prevPosZ = 0;
entity.lastTickPosX = 0;
entity.lastTickPosY = 0;
entity.lastTickPosZ = 0;
} }
@Override @Override
@ -74,13 +64,17 @@ public class ParrotElement extends AnimatedSceneElement {
entity.oFlap = entity.flap; entity.oFlap = entity.flap;
entity.onGround = true; entity.onGround = true;
pose.tick(scene);
entity.prevPosX = entity.getX(); entity.prevPosX = entity.getX();
entity.prevPosY = entity.getY(); entity.prevPosY = entity.getY();
entity.prevPosZ = entity.getZ(); entity.prevPosZ = entity.getZ();
entity.prevRotationYaw = entity.rotationYaw; entity.prevRotationYaw = entity.rotationYaw;
entity.prevRotationPitch = entity.rotationPitch; 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) { public void setPositionOffset(Vec3d position, boolean immediate) {
@ -119,7 +113,7 @@ public class ParrotElement extends AnimatedSceneElement {
.getRenderManager(); .getRenderManager();
if (entity == null) if (entity == null)
pose.create(world); entity = pose.create(world);
ms.push(); ms.push();
ms.translate(location.x, location.y, location.z); ms.translate(location.x, location.y, location.z);
@ -133,45 +127,46 @@ public class ParrotElement extends AnimatedSceneElement {
ms.pop(); 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) { abstract void tick(PonderScene scene, ParrotEntity entity, Vec3d location);
entity = new ParrotEntity(EntityType.PARROT, world);
ParrotEntity create(PonderWorld world) {
ParrotEntity entity = new ParrotEntity(EntityType.PARROT, world);
int nextInt = Create.random.nextInt(5); int nextInt = Create.random.nextInt(5);
entity.setVariant(nextInt == 1 ? 0 : nextInt); // blue parrots are kinda hard to see 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 @Override
void create(PonderWorld world) { ParrotEntity create(PonderWorld world) {
super.create(world); ParrotEntity entity = super.create(world);
entity.setPartying(BlockPos.ZERO, true); entity.setPartying(BlockPos.ZERO, true);
return entity;
} }
@Override @Override
void tick(PonderScene scene) { void tick(PonderScene scene, ParrotEntity entity, Vec3d location) {
entity.prevRotationYaw = entity.rotationYaw; entity.prevRotationYaw = entity.rotationYaw;
entity.rotationYaw -= 2; entity.rotationYaw -= 2;
} }
} }
class FlappyPose extends ParrotPose { public static class FlappyPose extends ParrotPose {
@Override @Override
void create(PonderWorld world) { void tick(PonderScene scene, ParrotEntity entity, Vec3d location) {
super.create(world);
}
@Override
void tick(PonderScene scene) {
double length = entity.getPositionVec() double length = entity.getPositionVec()
.subtract(entity.prevPosX, entity.prevPosY, entity.prevPosZ) .subtract(entity.lastTickPosX, entity.lastTickPosY, entity.lastTickPosZ)
.length(); .length();
entity.onGround = false; entity.onGround = false;
double phase = Math.min(length * 15, 8); 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; private BlockPos componentPos;
@ -192,7 +187,7 @@ public class ParrotElement extends AnimatedSceneElement {
} }
@Override @Override
void tick(PonderScene scene) { void tick(PonderScene scene, ParrotEntity entity, Vec3d location) {
TileEntity tileEntity = scene.getWorld() TileEntity tileEntity = scene.getWorld()
.getTileEntity(componentPos); .getTileEntity(componentPos);
if (!(tileEntity instanceof KineticTileEntity)) 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 @Override
void tick(PonderScene scene) { void tick(PonderScene scene, ParrotEntity entity, Vec3d location) {
Vec3d p_200602_2_ = scene.getPointOfInterest(); Vec3d p_200602_2_ = getFacedVec(scene);
Vec3d vec3d = location.add(entity.getEyePosition(0)); Vec3d vec3d = location.add(entity.getEyePosition(0));
double d0 = p_200602_2_.x - vec3d.x; double d0 = p_200602_2_.x - vec3d.x;
double d1 = p_200602_2_.y - vec3d.y; 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); 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);
}
} }
} }

View file

@ -67,7 +67,7 @@
}, },
"fixed": { "fixed": {
"rotation": [-90, 0, 0], "rotation": [-90, 0, 0],
"translation": [0, 0, -6], "translation": [0, 0, -5.25],
"scale": [0.75, 0.75, 0.75] "scale": [0.75, 0.75, 0.75]
} }
}, },

View file

@ -9,6 +9,7 @@
"name": "Top", "name": "Top",
"from": [3, 10, 2], "from": [3, 10, 2],
"to": [13, 11, 16], "to": [13, 11, 16],
"rotation": {"angle": 0, "axis": "y", "origin": [0, 0, 0]},
"faces": { "faces": {
"east": {"uv": [3, 0, 4, 14], "rotation": 270, "texture": "#0"}, "east": {"uv": [3, 0, 4, 14], "rotation": 270, "texture": "#0"},
"west": {"uv": [12, 0, 13, 14], "rotation": 90, "texture": "#0"}, "west": {"uv": [12, 0, 13, 14], "rotation": 90, "texture": "#0"},
@ -19,6 +20,7 @@
"name": "Top", "name": "Top",
"from": [1, 11, 1], "from": [1, 11, 1],
"to": [15, 13, 16], "to": [15, 13, 16],
"rotation": {"angle": 0, "axis": "y", "origin": [0, 0, 0]},
"faces": { "faces": {
"north": {"uv": [1, 15, 15, 16], "texture": "#0"}, "north": {"uv": [1, 15, 15, 16], "texture": "#0"},
"east": {"uv": [0, 0, 2, 15], "rotation": 270, "texture": "#0"}, "east": {"uv": [0, 0, 2, 15], "rotation": 270, "texture": "#0"},
@ -31,6 +33,7 @@
"name": "Side", "name": "Side",
"from": [1.1, 4, 0], "from": [1.1, 4, 0],
"to": [14.9, 12, 2], "to": [14.9, 12, 2],
"rotation": {"angle": 0, "axis": "y", "origin": [0, 0, 0]},
"faces": { "faces": {
"north": {"uv": [1, 0, 15, 8], "texture": "#0"}, "north": {"uv": [1, 0, 15, 8], "texture": "#0"},
"east": {"uv": [0, 0, 2, 8], "texture": "#0"}, "east": {"uv": [0, 0, 2, 8], "texture": "#0"},
@ -44,10 +47,11 @@
"name": "Side", "name": "Side",
"from": [3, 6, 2], "from": [3, 6, 2],
"to": [13, 10, 3], "to": [13, 10, 3],
"rotation": {"angle": 0, "axis": "y", "origin": [0, 0, 0]},
"faces": { "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"}, "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"}
} }
} }
] ]

View file

@ -60,6 +60,11 @@
} }
], ],
"display": { "display": {
"gui": {
"rotation": [30, 45, 0],
"translation": [0, 2.5, 0],
"scale": [0.625, 0.625, 0.625]
},
"fixed": { "fixed": {
"rotation": [ 270, 0, 0 ], "rotation": [ 270, 0, 0 ],
"translation": [ 0, 0, -3], "translation": [ 0, 0, -3],

View file

@ -34,6 +34,11 @@
} }
], ],
"display": { "display": {
"gui": {
"rotation": [30, 45, 0],
"translation": [0, 2.5, 0],
"scale": [0.625, 0.625, 0.625]
},
"fixed": { "fixed": {
"rotation": [ 270, 0, 0 ], "rotation": [ 270, 0, 0 ],
"translation": [ 0, 0, -3], "translation": [ 0, 0, -3],

View file

@ -90,11 +90,16 @@
} }
} }
], ],
"groups": [0, 1, 2, 3, 4, "display": {
{ "gui": {
"name": "lever", "rotation": [30, 45, 0],
"origin": [8, 8, 8], "translation": [0, 2.5, 0],
"children": [5, 6] "scale": [0.625, 0.625, 0.625]
} },
] "fixed": {
"rotation": [ 270, 0, 0 ],
"translation": [ 0, 0, -3],
"scale":[ 0.5, 0.5, 0.5 ]
}
}
} }

View file

@ -92,11 +92,16 @@
} }
} }
], ],
"groups": [0, 1, 2, 3, 4, "display": {
{ "gui": {
"name": "lever", "rotation": [30, 45, 0],
"origin": [8, 8, 8], "translation": [0, 2.5, 0],
"children": [5, 6] "scale": [0.625, 0.625, 0.625]
} },
] "fixed": {
"rotation": [ 270, 0, 0 ],
"translation": [ 0, 0, -3],
"scale":[ 0.5, 0.5, 0.5 ]
}
}
} }

View file

@ -46,5 +46,17 @@
"up": { "texture": "#torch", "uv": [ 7, 6, 9, 8 ] } "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 ]
}
}
} }

View file

@ -51,7 +51,13 @@
"display": { "display": {
"gui": { "gui": {
"rotation": [30, 45, 0], "rotation": [30, 45, 0],
"translation": [0, 2.5, 0],
"scale": [0.625, 0.625, 0.625] "scale": [0.625, 0.625, 0.625]
} },
} "fixed": {
"rotation": [ 270, 0, 0 ],
"translation": [ 0, 0, -3],
"scale":[ 0.5, 0.5, 0.5 ]
}
}
} }

View file

@ -131,7 +131,7 @@
"scale": [0.25, 0.25, 0.25] "scale": [0.25, 0.25, 0.25]
}, },
"gui": { "gui": {
"rotation": [30, 225, 0], "rotation": [30, 315, -90],
"scale": [0.625, 0.625, 0.625] "scale": [0.625, 0.625, 0.625]
}, },
"fixed": { "fixed": {

View file

@ -129,7 +129,7 @@
"scale": [0.25, 0.25, 0.25] "scale": [0.25, 0.25, 0.25]
}, },
"gui": { "gui": {
"rotation": [30, 225, 0], "rotation": [30, 315, -90],
"scale": [0.625, 0.625, 0.625] "scale": [0.625, 0.625, 0.625]
}, },
"fixed": { "fixed": {