-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
28 changed files
with
283 additions
and
122 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,51 +1,89 @@ | ||
# Crafted License | ||
|
||
Version 1.0, 18 September 2024 | ||
Copyright (c) To_Craft Development, https://tocraft.dev | ||
|
||
This document explains the conditions, terms, and permissions of the licensed project applying to the licensee. | ||
|
||
## 1. Definitions | ||
|
||
This section defines the used definitions in this license. | ||
|
||
### a) project | ||
"Projects" are references in terms of the result of planned tasks to accomplish a goal. Projects are also publicly available with or without their source. | ||
|
||
"Projects" are references in terms of the result of planned tasks to accomplish a goal. Projects are also publicly | ||
available with or without their source. | ||
|
||
### b) library | ||
This license defines a "library" as an interface that does not provide any end-user features. In specific, a library cannot be used without writing additional code directly or indirectly interacting with the licensed files. | ||
|
||
This license defines a "library" as an interface that does not provide any end-user features. In specific, a library | ||
cannot be used without writing additional code directly or indirectly interacting with the licensed files. | ||
|
||
### c) application | ||
"Applications" represent a licensed project that, in contrast to libraries, actively provides end-user features and does not have to be used in other projects with or without additional code in order to fulfill their purpose. | ||
|
||
"Applications" represent a licensed project that, in contrast to libraries, actively provides end-user features and does | ||
not have to be used in other projects with or without additional code in order to fulfill their purpose. | ||
|
||
### d) accessibility | ||
"Accessibility" is used to describe that the end-user must be able to find the accessible object when downloading, viewing, or using the work of the licensee without more than 3 mouse clicks, in the case of a digital project, or by directly being linked to it in the project description. In any way, the licensee must ensure the end-user does not have to pay any amount of money or leak any personal information to reach the project source. | ||
In most cases, this is guaranteed by linking the accessible object in the project meta, the project description, and the project source. | ||
|
||
"Accessibility" is used to describe that the end-user must be able to find the accessible object when downloading, | ||
viewing, or using the work of the licensee without more than 3 mouse clicks, in the case of a digital project, or by | ||
directly being linked to it in the project description. In any way, the licensee must ensure the end-user does not have | ||
to pay any amount of money or leak any personal information to reach the project source. | ||
In most cases, this is guaranteed by linking the accessible object in the project meta, the project description, and the | ||
project source. | ||
|
||
## 2. Warranty and Liability | ||
With this license, the author of the licensed project clarifies they will not provide any kind of warranty or liability for the licensed project. Any misuse is the liability of the actor and not the author of this project. By declaring this, the author also agrees the licensed project is not intended for any kind of illegal or unethical usage. | ||
|
||
With this license, the author of the licensed project clarifies they will not provide any kind of warranty or liability | ||
for the licensed project. Any misuse is the liability of the actor and not the author of this project. By declaring | ||
this, the author also agrees the licensed project is not intended for any kind of illegal or unethical usage. | ||
|
||
## 3. Validity | ||
This license only applies to the states of the project containing this license. Any version not containing the same Crafted License is subject to the corresponding license. However, this license must not be provided for each file or part of the project. A non-misleading file name in the directory of the project or including this license in the project description automatically licenses every file and/or part of the project with this license if this file or part isn't already licensed with another license or other version of Crafted License. | ||
|
||
This license only applies to the states of the project containing this license. Any version not containing the same | ||
Crafted License is subject to the corresponding license. However, this license must not be provided for each file or | ||
part of the project. A non-misleading file name in the directory of the project or including this license in the project | ||
description automatically licenses every file and/or part of the project with this license if this file or part isn't | ||
already licensed with another license or other version of Crafted License. | ||
|
||
## 4. Private Use | ||
If the licensee does not publish their work using the licensed project or any modification of it, nor shares it with more than 15 personally known people without any commercial interest, the licensee is free to use the licensed project in their work without applying the restrictions as defined in Section 5. | ||
|
||
If the licensee does not publish their work using the licensed project or any modification of it, nor shares it with | ||
more than 15 personally known people without any commercial interest, the licensee is free to use the licensed project | ||
in their work without applying the restrictions as defined in Section 5. | ||
|
||
## 5. Public Use | ||
|
||
Public use is any kind of use that cannot be counted as private use as defined in Section 4. | ||
Public commercial use is not allowed without the approval of the author of the licensed project. Commercial use hereby means usage explicitly for earning any form of money. Sponsors or advertisements do not count as commercial use if the end-user is still able to use the work of the licensee without having to evade or attend to sponsoring or advertising. | ||
Public commercial use is not allowed without the approval of the author of the licensed project. Commercial use hereby | ||
means usage explicitly for earning any form of money. Sponsors or advertisements do not count as commercial use if the | ||
end-user is still able to use the work of the licensee without having to evade or attend to sponsoring or advertising. | ||
The licensee must provide their source files, or in the case of coded projects, their source code. | ||
This source files must be accessibly linked. | ||
|
||
### a) Forking, Modifying, and Distributing | ||
|
||
Every condition as specified in Section 5 applies. | ||
Any work not only using the licensed project but forking and/or modifying it must contain the exact same license as the original project and must accessibly link the original project and its license. | ||
Any work not only using the licensed project but forking and/or modifying it must contain the exact same license as the | ||
original project and must accessibly link the original project and its license. | ||
|
||
### b) Using Libraries | ||
|
||
Every condition as specified in Section 5 applies. | ||
If the licensed project is a library, the licensee does not have to link the library's license to their work as long as they only use it without publishing any parts of the licensed project in any form except the releases of the licensee's work. To ensure this condition in the case of Gradle projects, it's recommended to use Maven Artifacts instead of uploading any jar library of the licensed project. | ||
If the licensed project is a library, the licensee does not have to link the library's license to their work as long as | ||
they only use it without publishing any parts of the licensed project in any form except the releases of the licensee's | ||
work. To ensure this condition in the case of Gradle projects, it's recommended to use Maven Artifacts instead of | ||
uploading any jar library of the licensed project. | ||
|
||
### c) Other usage | ||
|
||
Every condition as specified in Section 5 applies. | ||
When using a licensed application or other licensed project that cannot be described as a library, the licensee must accessibly link an official source to the source licensed project and its license, if the license is not already explicitly linked in the official source. | ||
When using a licensed application or other licensed project that cannot be described as a library, the licensee must | ||
accessibly link an official source to the source licensed project and its license, if the license is not already | ||
explicitly linked in the official source. | ||
|
||
## 6. Additions | ||
The author reserves themselves the right to explicitly lower conditions for a licensee but does not have to name any reason not to do so. However, they cannot limit the permissions guaranteed in this license. | ||
|
||
The author reserves themselves the right to explicitly lower conditions for a licensee but does not have to name any | ||
reason not to do so. However, they cannot limit the permissions guaranteed in this license. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
common/src/main/java/dev/tocraft/crafted/ctgen/CTerrainGeneration.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
common/src/main/java/dev/tocraft/crafted/ctgen/blockplacer/BasicPlacer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package dev.tocraft.crafted.ctgen.blockplacer; | ||
|
||
import com.mojang.serialization.Codec; | ||
import com.mojang.serialization.codecs.RecordCodecBuilder; | ||
import dev.tocraft.crafted.ctgen.CTerrainGeneration; | ||
import dev.tocraft.crafted.ctgen.zone.Codecs; | ||
import net.minecraft.resources.ResourceLocation; | ||
import net.minecraft.world.level.block.Block; | ||
import net.minecraft.world.level.levelgen.synth.SimplexNoise; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
public class BasicPlacer extends BlockPlacer { | ||
@NotNull | ||
private final Block value; | ||
|
||
public BasicPlacer(@NotNull Block value) { | ||
this.value = value; | ||
} | ||
|
||
public Block get(SimplexNoise noise, double x, double y, double z, String layer) { | ||
return value; | ||
} | ||
|
||
@Override | ||
public Block get(SimplexNoise noise, double x, double z, String layer) { | ||
return value; | ||
} | ||
|
||
public @NotNull Block getValue() { | ||
return value; | ||
} | ||
|
||
public static final Codec<BasicPlacer> CODEC = RecordCodecBuilder.create(instance -> instance.group( | ||
Codecs.BLOCK.fieldOf("value").forGetter(o -> o.value) | ||
).apply(instance, instance.stable(BasicPlacer::new))); | ||
|
||
public static final ResourceLocation ID = CTerrainGeneration.id("basic"); | ||
|
||
@Override | ||
public Codec<BasicPlacer> codec() { | ||
return CODEC; | ||
} | ||
} |
33 changes: 25 additions & 8 deletions
33
common/src/main/java/dev/tocraft/crafted/ctgen/blockplacer/BlockPlacer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,41 @@ | ||
package dev.tocraft.crafted.ctgen.blockplacer; | ||
|
||
import com.mojang.datafixers.util.Either; | ||
import com.mojang.serialization.Codec; | ||
import dev.tocraft.crafted.ctgen.CTerrainGeneration; | ||
import dev.tocraft.crafted.ctgen.impl.services.ServerPlatform; | ||
import dev.tocraft.crafted.ctgen.util.CTRegistries; | ||
import dev.tocraft.crafted.ctgen.zone.Codecs; | ||
import net.minecraft.core.Registry; | ||
import net.minecraft.resources.ResourceKey; | ||
import net.minecraft.world.level.block.Block; | ||
import net.minecraft.world.level.levelgen.synth.SimplexNoise; | ||
|
||
import java.util.Optional; | ||
import java.util.function.Function; | ||
|
||
public abstract class BlockPlacer { | ||
public static final ResourceKey<Registry<Codec<? extends BlockPlacer>>> BLOCK_PLAYER_REGISTRY_KEY = ResourceKey.createRegistryKey(CTerrainGeneration.id("block_placer")); | ||
public static final Registry<Codec<? extends BlockPlacer>> BLOCK_PLACER_REGISTRY = ServerPlatform.INSTANCE.simpleRegistry(BLOCK_PLAYER_REGISTRY_KEY); | ||
public static final Codec<BlockPlacer> DIRECT_CODEC = CTRegistries.BLOCK_PLACER.byNameCodec().dispatchStable(BlockPlacer::codec, Function.identity()); | ||
public static final Codec<BlockPlacer> CODEC = Codec.either(Codecs.BLOCK, DIRECT_CODEC).xmap(either -> { | ||
Optional<Block> left = either.left(); | ||
if (left.isPresent()) { | ||
return new BasicPlacer(left.get()); | ||
} else { | ||
return either.right().orElseThrow(); | ||
} | ||
}, placer -> { | ||
if (placer instanceof BasicPlacer basic) { | ||
return Either.left(basic.getValue()); | ||
} else { | ||
return Either.right(placer); | ||
} | ||
}); | ||
|
||
public static final Codec<BlockPlacer> CODEC = BLOCK_PLACER_REGISTRY.byNameCodec().dispatchStable(BlockPlacer::codec, Function.identity()); | ||
public static void register() { | ||
Registry.register(CTRegistries.BLOCK_PLACER, BasicPlacer.ID, BasicPlacer.CODEC); | ||
Registry.register(CTRegistries.BLOCK_PLACER, NoisePlacer.ID, NoisePlacer.CODEC); | ||
} | ||
|
||
public abstract Block get(SimplexNoise noise, double x, double y, double z); | ||
public abstract Block get(SimplexNoise noise, double x, double y, double z, String layer); | ||
|
||
public abstract Block get(SimplexNoise noise, double x, double z); | ||
public abstract Block get(SimplexNoise noise, double x, double z, String layer); | ||
|
||
protected abstract Codec<? extends BlockPlacer> codec(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 0 additions & 1 deletion
1
common/src/main/java/dev/tocraft/crafted/ctgen/impl/services/ServerPlatform.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
common/src/main/java/dev/tocraft/crafted/ctgen/layer/BlockLayer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package dev.tocraft.crafted.ctgen.layer; | ||
|
||
import com.mojang.serialization.Codec; | ||
import dev.tocraft.crafted.ctgen.util.CTRegistries; | ||
import net.minecraft.world.level.levelgen.synth.SimplexNoise; | ||
|
||
import java.util.function.Function; | ||
|
||
public abstract class BlockLayer { | ||
public static final Codec<BlockLayer> CODEC = CTRegistries.BLOCK_LAYER.byNameCodec().dispatchStable(BlockLayer::codec, Function.identity()); | ||
|
||
protected final String name; | ||
|
||
public BlockLayer(String name) { | ||
this.name = name; | ||
} | ||
|
||
public abstract boolean is(SimplexNoise noise, double x, double y, double z); | ||
|
||
public String getName() { | ||
return this.name; | ||
} | ||
|
||
; | ||
|
||
protected abstract Codec<? extends BlockLayer> codec(); | ||
} |
Oops, something went wrong.