-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a DecoratorTypes accessor similar to PlacerTypes; Terrestria can …
…use this. - Add a DecoratorTypes accessor similar to PlacerTypes
- Loading branch information
1 parent
9a0df86
commit 67395f1
Showing
4 changed files
with
41 additions
and
1 deletion.
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
23 changes: 23 additions & 0 deletions
23
...tree-api-v1/src/main/java/com/terraformersmc/terraform/tree/decorator/DecoratorTypes.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,23 @@ | ||
package com.terraformersmc.terraform.tree.decorator; | ||
|
||
import com.mojang.serialization.MapCodec; | ||
import com.terraformersmc.terraform.tree.mixin.InvokerTreeDecoratorType; | ||
import net.minecraft.util.Identifier; | ||
import net.minecraft.world.gen.treedecorator.TreeDecorator; | ||
import net.minecraft.world.gen.treedecorator.TreeDecoratorType; | ||
|
||
public final class DecoratorTypes { | ||
private DecoratorTypes() { | ||
return; | ||
} | ||
|
||
// Deprecated annotation is just a warning for non-internal references | ||
@SuppressWarnings("deprecation") | ||
public static <D extends TreeDecorator> TreeDecoratorType<D> registerTreeDecorator(String id, MapCodec<D> codec) { | ||
return InvokerTreeDecoratorType.callRegister(id, codec); | ||
} | ||
|
||
public static <D extends TreeDecorator> TreeDecoratorType<D> registerTreeDecorator(Identifier id, MapCodec<D> codec) { | ||
return registerTreeDecorator(id.toString(), codec); | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
...pi-v1/src/main/java/com/terraformersmc/terraform/tree/mixin/InvokerTreeDecoratorType.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,16 @@ | ||
package com.terraformersmc.terraform.tree.mixin; | ||
|
||
import com.mojang.serialization.MapCodec; | ||
import net.minecraft.world.gen.treedecorator.TreeDecorator; | ||
import net.minecraft.world.gen.treedecorator.TreeDecoratorType; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.gen.Invoker; | ||
|
||
@Mixin(TreeDecoratorType.class) | ||
public interface InvokerTreeDecoratorType { | ||
@Invoker | ||
@Deprecated | ||
static <D extends TreeDecorator> TreeDecoratorType<D> callRegister(String id, MapCodec<D> codec) { | ||
throw new UnsupportedOperationException(); | ||
} | ||
} |
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