mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2025-07-04 00:45:57 +00:00
create TerraScriptSamplerFunctionAddon
This commit is contained in:
parent
44595a861a
commit
42e357892f
@ -0,0 +1,26 @@
|
|||||||
|
package com.dfsek.terra.addons.terrascript.sampler;
|
||||||
|
|
||||||
|
import com.dfsek.terra.addons.terrascript.parser.lang.ImplementationArguments;
|
||||||
|
import com.dfsek.terra.addons.terrascript.parser.lang.functions.Function;
|
||||||
|
import com.dfsek.terra.addons.terrascript.parser.lang.variables.Variable;
|
||||||
|
import com.dfsek.terra.addons.terrascript.tokenizer.Position;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
|
||||||
|
public class SamplerFunction implements Function<Void> {
|
||||||
|
@Override
|
||||||
|
public Void apply(ImplementationArguments implementationArguments, Map<String, Variable<?>> variableMap) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Position getPosition() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ReturnType returnType() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,30 @@
|
|||||||
|
package com.dfsek.terra.addons.terrascript.sampler;
|
||||||
|
|
||||||
|
import com.dfsek.terra.addons.terrascript.parser.lang.Returnable;
|
||||||
|
import com.dfsek.terra.addons.terrascript.parser.lang.Returnable.ReturnType;
|
||||||
|
import com.dfsek.terra.addons.terrascript.parser.lang.functions.FunctionBuilder;
|
||||||
|
import com.dfsek.terra.addons.terrascript.tokenizer.Position;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
|
public class SamplerFunctionBuilder implements FunctionBuilder<SamplerFunction> {
|
||||||
|
@Override
|
||||||
|
public SamplerFunction build(List<Returnable<?>> argumentList, Position position) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int argNumber() {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ReturnType getArgument(int position) {
|
||||||
|
return switch(position) {
|
||||||
|
case 0 -> ReturnType.STRING;
|
||||||
|
case 1, 2, 3 -> ReturnType.NUMBER;
|
||||||
|
default -> null;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,32 @@
|
|||||||
|
package com.dfsek.terra.addons.terrascript.sampler;
|
||||||
|
|
||||||
|
import com.dfsek.terra.addons.manifest.api.AddonInitializer;
|
||||||
|
import com.dfsek.terra.addons.terrascript.parser.lang.functions.FunctionBuilder;
|
||||||
|
import com.dfsek.terra.api.Platform;
|
||||||
|
import com.dfsek.terra.api.addon.BaseAddon;
|
||||||
|
import com.dfsek.terra.api.event.events.config.pack.ConfigPackPreLoadEvent;
|
||||||
|
import com.dfsek.terra.api.event.functional.FunctionalEventHandler;
|
||||||
|
import com.dfsek.terra.api.inject.annotations.Inject;
|
||||||
|
|
||||||
|
|
||||||
|
public class TerraScriptSamplerFunctionAddon implements AddonInitializer {
|
||||||
|
@Inject
|
||||||
|
private Platform platform;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private BaseAddon addon;
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void initialize() {
|
||||||
|
platform.getEventManager()
|
||||||
|
.getHandler(FunctionalEventHandler.class)
|
||||||
|
.register(addon, ConfigPackPreLoadEvent.class)
|
||||||
|
.priority(51)
|
||||||
|
.then(event -> event
|
||||||
|
.getPack()
|
||||||
|
.getOrCreateRegistry(FunctionBuilder.class)
|
||||||
|
.register(addon.key("sampler"), new SamplerFunctionBuilder(event.getPack().getContext().get())))
|
||||||
|
.failThrough();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,15 @@
|
|||||||
|
schema-version: 1
|
||||||
|
contributors:
|
||||||
|
- Terra contributors
|
||||||
|
id: terrascript-function-sampler
|
||||||
|
version: @VERSION@
|
||||||
|
entrypoints:
|
||||||
|
- "com.dfsek.terra.addons.terrascript.sampler.TerraScriptSamplerFunctionAddon"
|
||||||
|
website:
|
||||||
|
issues: https://github.com/PolyhedralDev/Terra/issues
|
||||||
|
source: https://github.com/PolyhedralDev/Terra
|
||||||
|
docs: https://github.com/PolyhedralDev/Terra/wiki
|
||||||
|
license: MIT
|
||||||
|
depends:
|
||||||
|
structure-terrascript-loader: "0.1.+"
|
||||||
|
config-noise-functions: "0.1.+"
|
Loading…
x
Reference in New Issue
Block a user