rename palette-block-shortcut to shortcut-block-palette

This commit is contained in:
dfsek committed 2026-01-02 22:26:33 -07:00
1 parent 6a6a3928cd
commit aa3fe18339
5 files changed

No files matched your search

@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2020-2025 Polyhedral Development
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
@@ -0,0 +1,5 @@
version = version("1.0.0")
dependencies {
compileOnlyApi(project(":common:addons:addon-loader-manifest"))
}
@@ -0,0 +1,30 @@
package com.dfsek.terra.addons.palette.shortcut.block;
import com.dfsek.terra.addons.manifest.api.AddonInitializer;
import com.dfsek.terra.api.Platform;
import com.dfsek.terra.api.addon.BaseAddon;
import com.dfsek.terra.api.block.state.BlockState;
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;
import com.dfsek.terra.api.world.chunk.generation.util.Palette;
public class PaletteBlockShortcutAddon implements AddonInitializer {
@Inject
private BaseAddon addon;
@Inject
private Platform platform;
@Override
public void initialize() {
platform.getEventManager()
.getHandler(FunctionalEventHandler.class)
.register(addon, ConfigPackPreLoadEvent.class)
.then(event -> event.getPack()
.registerShortcut(Palette.class, "BLOCK",
(configLoader, input, tracker) -> new SingletonPalette(
configLoader.loadType(BlockState.class, input, tracker))))
.failThrough();
}
}
@@ -0,0 +1,18 @@
package com.dfsek.terra.addons.palette.shortcut.block;
import com.dfsek.terra.api.block.state.BlockState;
import com.dfsek.terra.api.world.chunk.generation.util.Palette;
public class SingletonPalette implements Palette {
private final BlockState blockState;
public SingletonPalette(BlockState blockState) {
this.blockState = blockState;
}
@Override
public BlockState get(int layer, double x, double y, double z, long seed) {
return blockState;
}
}
@@ -0,0 +1,12 @@
schema-version: 1
contributors:
- Terra contributors
id: palette-block-shortcut
version: @VERSION@
entrypoints:
- "com.dfsek.terra.addons.palette.shortcut.block.PaletteBlockShortcutAddon"
website:
issues: https://github.com/PolyhedralDev/Terra/issues
source: https://github.com/PolyhedralDev/Terra
docs: https://terra.polydev.org
license: MIT License