Why does my minecraft location_check predicate not run? - json

I have followed several tutorials to the letter, and got the "player is_sprinting:true" predicate to work. So I know my fresh new datapack is working.
There are no examples of location predicates anywhere. Videos, wiki, nothing.
I go to a generator and generate the whole predicate, export the whole file, put it in the proper folder, and when I type the path in my tick.mcfunction, Visual Studio Code properly links to it (finally after having to create a new project AND restart my computer to not have the new project auto-fill paths to my old project... for some reason).
It does not detect when a player is within 100 of 0 0 0. It does nothing. Here's what I've tried:
{
"condition": "minecraft:entity_properties",
"entity": "this",
"predicate": {
"type": "minecraft:player",
"location": {
"position": {
"x": 0,
"y": 0,
"z": 0
}
},
"distance": {
"absolute": {
"min": 0,
"max": 100
}
}
}
}
And...
{
"condition": "minecraft:entity_properties",
"entity": "this",
"predicate": {
"type": "minecraft:player",
"distance": {
"absolute": {
"min": 0,
"max": 100
}
}
}
}
And...
{
"condition": "minecraft:location_check",
"predicate": {
"position": {
"x": {
"min": -100,
"max": 100
},
"y": {
"min": -100,
"max": 100
},
"z": {
"min": -100,
"max": 100
}
}
}
}
All combined with:
execute as #a if predicate test:homezone run say hi
Or:
execute as #a[predicate=test:homezone] run say hi
And my player is standing in a new map, at 0, 0, 0 with no other functions running. What's my problem?

when using a predicate as a target selector argument, you need to have the namespaced ID. other than that i'm not really sure. if that dosen't help, try asking on the official minecraft commands discord server, they are good with that stuff. https://discord.gg/QAFXFtZ
for example:
#e[predicate=foo:bar]
not just
#e[predicate=bar]

locations are weird, I test in superflat void
What you have in your third predicate with the location_check is almost what I have in mine.
{
"condition": "minecraft:location_check",
"offsetX": -20,
"offsetY": 0,
"offsetZ": -20,
"predicate": {
"position": {
"x": {
"min": 0,
"max": 2
},
"y": 4,
"z": {
"min": 0,
"max": 2
}
}
}
}
This is what I have running in a command block
execute as #p[predicate=test:area] unless predicate test:sneaking run function test:null
This detects player at 20 4 20 to 21 4 21 unless sneaking.

Related

JSON schema: number greater than (not greater than and equal)

I've the following JSON config:
{
"zoomLevel": {
"min": 5,
"max": 7
}
}
The ajv validation should check if the max value is larger than the min value and can't be equal. I've found In the docs for the ajv package only the larger than or equal check and I've no idea how should I check for only the larger one. So if I use this schema:
"zoomLevel": {
"type": "object",
"properties": {
"min": {
"type": "number",
"minimum": 0
},
"max": {
"type": "number",
"minimum": {
"$data": "1/min"
},
"maximum": 18
}
}
}
it checks only if the max is larger than or equal to min. I need something like this:
"minimum": {
"$data": "1/min + 1"
},
The keyword you're looking for is exclusiveMinimum instead of minimum.
Also, note that $data is non-standard JSON Schema. This is something that ajv have decided to provide and will not be compatible with other validators.

Error loading files from Multiatlas in Phaser3

Trying to use the multiatlas feature in Phaser and TexturePacker.
Getting this error:
VM32201:1 GET http://localhost:8080/bg-sd.json 404 (Not Found)
Texture.js:250 Texture.frame missing: 1/1.png
The JSON file actually resides at http://localhost:8080/dist/img/bg-sd.json and I can browse to it. I can also browse to http://localhost:8080/dist/img/bg-1-sd.png.
I'm loading the atlas like:
scene.load.multiatlas({
key: 'bg-sd',
atlasURL: 'dist/img/bg-sd.json',
baseURL: 'dist/img'
});
The 1/1.png frame is also in the file:
{
"textures": [
{
"image": "bg-1-sd.png",
"format": "RGBA8888",
"size": {
"w": 1924,
"h": 2039
},
"scale": 0.5,
"frames": [
{
"filename": "1/1.png",
"rotated": false,
"trimmed": false,
"sourceSize": {
"w": 960,
"h": 540
},
"spriteSourceSize": {
"x": 0,
"y": 0,
"w": 960,
"h": 540
},
"frame": {
"x": 1,
"y": 1,
"w": 960,
"h": 540
}
},
I've tried various combinations of the path and baseURL settings but it will not load the file from dist/img.
I think providing both a baseURL and an atlasURL might be conflicting. The baseURL is attached in front of the atlasURL value so you're probably loading something like dist/img/dist/img/bg-sd.json.
Have you tried without the configuration object, like:
this.load.multiatlas('bd-sd', './dist/img/bg-sd.json');

Issue while creating a job for AWS Elemental media convert

I am having some issue while creating a job for AWS Elemental media convert.
I have followed the following sequence.
1.) Create a new job
2.) Add input and configurations
3.) Add File output group and configure destination settings
4.) Under Output change Container to No Container
5.) Under Output remove Audio
6.) Under Output -> Video change Codec to JPEG to Frame Capture
7.) Configure frame rate (rate which captures will be produced (more notes and examples below))
8.) Configure max capture settings
I got the following error:
Job_contains_the_following_error:
/outputGroups: Should not match the schema
Here is my job JSON:
{
"Settings": {
"AdAvailOffset": 0,
"Inputs": [
{
"FilterEnable": "AUTO",
"PsiControl": "USE_PSI",
"FilterStrength": 0,
"DeblockFilter": "DISABLED",
"DenoiseFilter": "DISABLED",
"TimecodeSource": "EMBEDDED",
"VideoSelector": {
"ColorSpace": "FOLLOW",
"Rotate": "DEGREE_0"
},
"AudioSelectors": {
"Audio Selector 1": {
"Offset": 0,
"DefaultSelection": "DEFAULT",
"ProgramSelection": 1
}
},
"FileInput": "s3://field-live-user-data/udariyan.mp4"
}
],
"OutputGroups": [
{
"Name": "File Group",
"OutputGroupSettings": {
"Type": "FILE_GROUP_SETTINGS",
"FileGroupSettings": {
"Destination": "s3://field-live-user-data/"
}
},
"Outputs": [
{
"VideoDescription": {
"ScalingBehavior": "DEFAULT",
"TimecodeInsertion": "DISABLED",
"AntiAlias": "ENABLED",
"Sharpness": 50,
"CodecSettings": {
"Codec": "FRAME_CAPTURE",
"FrameCaptureSettings": {
"FramerateNumerator": 30,
"FramerateDenominator": 100,
"MaxCaptures": 2,
"Quality": 80
}
},
"DropFrameTimecode": "ENABLED",
"ColorMetadata": "INSERT",
"Width": 1280,
"Height": 720
},
"ContainerSettings": {
"Container": "RAW"
},
"Extension": "jpg"
}
],
"CustomName": "customGroup"
}
]
},
"Queue": "arn:aws:mediaconvert:us-east-1:469030323850:queues/Default",
"Role": "arn:aws:iam::469030323850:role/myMediaConverter"
}
Currently, you can't have a job template with frame capture only:
AWS Dev forums on this topic

Mongo $and query returning no results

How do I approach writing a query to return all the records matching both match.id and player.name for the following collection?
{
"match": {
"id": 1,
"event": {
"timestamp": "2015-06-03 15:02:22",
"event": "round_stats",
"round": 1,
"player": {
"name": "Jim",
"userId": 45,
"uniqueId": "BOT",
"team": 2
},
"shots": 0,
"hits": 0,
"kills": 0,
"headshots": 0,
"tks": 0,
"damage": 0,
"assists": 0,
"assists_tk": 0,
"deaths": 0,
"head": 0,
"chest": 0,
"stomach": 0,
"leftArm": 0,
"rightArm": 0,
"leftLeg": 0,
"rightLeg": 0,
"generic": 0
}
}
}
I've attempted it with both the following query statements, but had no luck -- they both return no results:
db.warmod_events.find( { $and: [ { "match.id": 1}, { "player.name": 'Jim' } ] } )
db.warmod_events.find( { $and: [ { "match.id": 1}, { "event": { "player.name": "Jim" } } ] } )
I'm pretty new to Mongo and any guidance and explanation would help a bunch -- truthfully I've chosen to use Mongo for this project as the data I am working with is already presented in this form (the JSON) and, due to that, it seemed like a good opportunity to use and learn Mongo.
I am referring to the documentation on the Mongo site currently.
Thanks all
Try the following query:
db.warmod_events.find({ "match.id": 1, "match.event.player.name": 'Jim' })
which will match documents where the match id is the same as the embedded document player name.

Json.NET (Newtonsoft.Json) - Two 'properties' with same name?

I'm coding in C# for the .NET Framework 3.5.
I am trying to parse some Json to a JObject.
The Json is as follows:
{
"TBox": {
"Name": "SmallBox",
"Length": 1,
"Width": 1,
"Height": 2 },
"TBox": {
"Name": "MedBox",
"Length": 5,
"Width": 10,
"Height": 10 },
"TBox": {
"Name": "LargeBox",
"Length": 20,
"Width": 20,
"Height": 10 }
}
When I try to parse this Json to a JObject, the JObject only knows about LargeBox. The information for SmallBox and MedBox is lost. Obviously this is because it is interpreting "TBox" as a property, and that property is being overwritten.
I am receiving this Json from a service that's coded in Delphi. I'm trying to create a C# proxy for that service. On the Delphi-side of things, the "TBox" is understood as the type of the object being returned. The inner properties ("Name", "Length", "Width", "Height") are then understood as regular properties.
I can serialize and deserialize a custom 'TBox' object that has Name, Length, Width, and Height properties. That's fine.
What I want to do is step through all the TBox sections in such a way as to extract the following three Json strings.
First:
{
"Name": "SmallBox",
"Length": 1,
"Width": 1,
"Height": 2 }
Second:
{
"Name": "MedBox"
"Length": 5,
"Width": 10,
"Height": 10 }
Third:
{
"Name": "LargeBox"
"Length": 20,
"Width": 20,
"Height": 10 }
Once I have these strings, I can serialize and deserialize to my heart's content.
I'm finding Newtonsoft.Json to be very good. I really don't want to go messing about with other frameworks if I can avoid it.
Any help would be greatly appreciated.
I have very limited input as to changes that can be made to the server.
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
JsonTextReader jsonReader = new JsonTextReader(reader);
jsonReader.Read();
while(jsonReader.Read())
{
if(jsonReader.TokenType == JsonToken.StartObject)
{
JObject tbox = JObject.Load(jsonReader);
}
}
However, note that the RFC says, "The names within an object SHOULD be unique" so if you can, recommend the format be changed.
EDIT: Here's an alternate design that doesn't have duplicate keys:
[
{
"TBox": {
"Width": 1,
"Length": 1,
"Name": "SmallBox",
"Height": 2
}
},
{
"TBox": {
"Width": 10,
"Length": 5,
"Name": "MedBox",
"Height": 10
}
},
{
"TBox": {
"Width": 20,
"Length": 20,
"Name": "LargeBox",
"Height": 10
}
}
]
If I'm not mistaken, the correct answer to this is that your input is not actually JSON. So no, getting a JSON parser to parse it probably isn't going to work.
Maybe you don't have any control over the source of the input, so I'd use a Regex or something to pre-filter the string. Turn it into something like:
{"TBoxes":
[
{
"Name": "SmallBox",
"Length": 1,
"Width": 1,
"Height": 2
},
{
"Name": "MedBox",
"Length": 5,
"Width": 10,
"Height": 10
},
{
"Name": "LargeBox",
"Length": 20,
"Width": 20,
"Height": 10
}
]
}
And treat it like the array that it is.