fix: add missing BlockType constructor (#2306)

- Deprecate public BlockType constructors
 - People really should not be initialising their own block types. This can and most likely will cause issues.
 - Fixes #2290
This commit is contained in:
Jordan 2023-06-19 15:36:47 +02:00 committed by GitHub
parent a8c8a0fbd6
commit 01be53ed65
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -78,13 +78,35 @@ public class BlockType implements Keyed, Pattern {
this.id = i == -1 ? id : id.substring(0, i); this.id = i == -1 ? id : id.substring(0, i);
this.settings = new BlockTypesCache.Settings(this, id, internalId, states); this.settings = new BlockTypesCache.Settings(this, id, internalId, states);
} }
//FAWE end
//FAWE start
/**
* @deprecated You should not be initialising your own BlockTypes, use {@link BlockTypes#get(String)} instead. If there is
* a specific requirement to actually create new block types, please contact the FAWE devs to discuss. Use
* {@link BlockTypes#get(String)} instead.
*/
@Deprecated(since = "TODO")
//FAWE end
public BlockType(String id) {
this(id, null);
}
//FAWE start
/**
* @deprecated You should not be initialising your own BlockTypes, use {@link BlockTypes#get(String)} instead. If there is
* a specific requirement to actually create new block types, please contact the FAWE devs to discuss. Use
* {@link BlockTypes#get(String)} instead.
*/
@Deprecated(since = "TODO")
//FAWE end
public BlockType(String id, Function<BlockState, BlockState> values) { public BlockType(String id, Function<BlockState, BlockState> values) {
// If it has no namespace, assume minecraft. // If it has no namespace, assume minecraft.
if (!id.contains(":")) { if (!id.contains(":")) {
id = "minecraft:" + id; id = "minecraft:" + id;
} }
this.id = id; this.id = id;
//FAWE start
//TODO fix the line below //TODO fix the line below
this.settings = new BlockTypesCache.Settings(this, id, 0, null); this.settings = new BlockTypesCache.Settings(this, id, 0, null);
} }