2026-09-08 19:44:45 +03:00
|
|
|
package online.astradev.cauldron;
|
|
|
|
|
|
|
|
|
|
import com.mojang.math.Transformation;
|
|
|
|
|
|
|
|
|
|
import net.minecraft.core.BlockPos;
|
|
|
|
|
import net.minecraft.server.level.ServerLevel;
|
|
|
|
|
import net.minecraft.world.entity.Display;
|
|
|
|
|
import net.minecraft.world.entity.EntityTypes;
|
|
|
|
|
import net.minecraft.world.item.*;
|
|
|
|
|
import net.minecraft.world.level.storage.ValueOutput;
|
2026-09-13 21:55:44 +03:00
|
|
|
|
2026-09-08 19:44:45 +03:00
|
|
|
import org.joml.Quaternionf;
|
|
|
|
|
import org.joml.Vector3f;
|
|
|
|
|
|
|
|
|
|
final class SoupDisplay extends Display.ItemDisplay {
|
|
|
|
|
static final String TAG = "astracauldron:cauldron_visual";
|
2026-09-13 21:55:44 +03:00
|
|
|
|
2026-09-08 19:44:45 +03:00
|
|
|
SoupDisplay(ServerLevel level, BlockPos pos, ItemStack stack) {
|
|
|
|
|
super(EntityTypes.ITEM_DISPLAY, level);
|
|
|
|
|
setPos(pos.getX() + .5, pos.getY() + .5, pos.getZ() + .5);
|
|
|
|
|
getSlot(0).set(stack.copy());
|
|
|
|
|
setItemTransform(ItemDisplayContext.FIXED);
|
|
|
|
|
setNoGravity(true);
|
|
|
|
|
setInvulnerable(true);
|
|
|
|
|
setSilent(true);
|
|
|
|
|
addTag(TAG);
|
|
|
|
|
setTransformationInterpolationDuration(2);
|
|
|
|
|
}
|
2026-09-13 21:55:44 +03:00
|
|
|
|
2026-09-08 19:44:45 +03:00
|
|
|
void ingredient(int slot, int water, int ticks, int elapsed, int duration) {
|
|
|
|
|
var frame = CauldronAnimation.frame(slot, water, ticks, elapsed, duration);
|
|
|
|
|
setTransformationInterpolationDelay(0);
|
2026-09-13 21:55:44 +03:00
|
|
|
setTransformation(
|
|
|
|
|
new Transformation(
|
|
|
|
|
new Vector3f(
|
|
|
|
|
(float) frame.x() - .5f,
|
|
|
|
|
(float) frame.y() - .5f,
|
|
|
|
|
(float) frame.z() - .5f),
|
|
|
|
|
new Quaternionf(),
|
|
|
|
|
new Vector3f(.3f),
|
|
|
|
|
new Quaternionf().rotationY(ticks * .035f + slot)));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public boolean shouldBeSaved() {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public boolean saveAsPassenger(ValueOutput output) {
|
|
|
|
|
return false;
|
2026-09-08 19:44:45 +03:00
|
|
|
}
|
|
|
|
|
}
|