diff --git a/build.gradle b/build.gradle index 84fae0e..544a0fe 100755 --- a/build.gradle +++ b/build.gradle @@ -28,12 +28,12 @@ if(rootProject.file('private.gradle').exists()) { //Publishing details apply from: 'private.gradle' } -archivesBaseName = "slopetest" +archivesBaseName = "templates" group = "io.github.cottonmc" -version = "1.1.0+1.14.2" +version = "1.0.0+1.14.2" minecraft { - refmapName = 'mixins.slopetest.refmap.json' + refmapName = 'mixins.templates.refmap.json' } repositories { diff --git a/src/main/java/io/github/cottonmc/slopetest/SlopeTestClient.java b/src/main/java/io/github/cottonmc/slopetest/SlopeTestClient.java deleted file mode 100644 index 3983a07..0000000 --- a/src/main/java/io/github/cottonmc/slopetest/SlopeTestClient.java +++ /dev/null @@ -1,15 +0,0 @@ -package io.github.cottonmc.slopetest; - -import io.github.cottonmc.slopetest.block.SlopeTestBlock; -import io.github.cottonmc.slopetest.model.SlopeTestModel; -import net.fabricmc.api.ClientModInitializer; -import net.fabricmc.fabric.api.client.model.ModelLoadingRegistry; -import net.minecraft.util.math.Direction; - -public class SlopeTestClient implements ClientModInitializer { - @Override - public void onInitializeClient() { - ModelLoadingRegistry.INSTANCE.registerVariantProvider(rm -> SlopeTest.provider); - SlopeTest.provider.registerTemplateBlock(SlopeTest.SLOPE, SlopeTest.SLOPE.getDefaultState().with(SlopeTestBlock.FACING, Direction.SOUTH), SlopeTestModel::new); - } -} diff --git a/src/main/java/io/github/cottonmc/slopetest/block/entity/SlopeTestEntity.java b/src/main/java/io/github/cottonmc/slopetest/block/entity/SlopeTestEntity.java deleted file mode 100644 index 7568a35..0000000 --- a/src/main/java/io/github/cottonmc/slopetest/block/entity/SlopeTestEntity.java +++ /dev/null @@ -1,20 +0,0 @@ -package io.github.cottonmc.slopetest.block.entity; - -import io.github.cottonmc.slopetest.SlopeTest; -import io.github.cottonmc.slopetest.util.BlockStateUtil; -import net.fabricmc.fabric.api.block.entity.BlockEntityClientSerializable; -import net.fabricmc.fabric.api.rendering.data.v1.RenderAttachmentBlockEntity; -import net.fabricmc.fabric.api.server.PlayerStream; -import net.minecraft.block.BlockState; -import net.minecraft.block.Blocks; -import net.minecraft.block.entity.BlockEntity; -import net.minecraft.client.world.ClientWorld; -import net.minecraft.nbt.CompoundTag; -import net.minecraft.server.network.ServerPlayerEntity; -import net.minecraft.util.math.Direction; - -public class SlopeTestEntity extends TemplateBlockEntity { - public SlopeTestEntity() { - super(SlopeTest.SLOPE_ENTITY, SlopeTest.SLOPE); - } -} diff --git a/src/main/java/io/github/cottonmc/slopetest/SlopeTest.java b/src/main/java/io/github/cottonmc/templates/Templates.java similarity index 65% rename from src/main/java/io/github/cottonmc/slopetest/SlopeTest.java rename to src/main/java/io/github/cottonmc/templates/Templates.java index 424ca85..e3343cb 100644 --- a/src/main/java/io/github/cottonmc/slopetest/SlopeTest.java +++ b/src/main/java/io/github/cottonmc/templates/Templates.java @@ -1,8 +1,8 @@ -package io.github.cottonmc.slopetest; +package io.github.cottonmc.templates; -import io.github.cottonmc.slopetest.block.SlopeTestBlock; -import io.github.cottonmc.slopetest.block.entity.SlopeTestEntity; -import io.github.cottonmc.slopetest.model.SlopeModelVariantProvider; +import io.github.cottonmc.templates.block.SlopeBlock; +import io.github.cottonmc.templates.block.entity.SlopeEntity; +import io.github.cottonmc.templates.model.TemplateModelVariantProvider; import net.fabricmc.api.ModInitializer; import net.minecraft.block.Block; import net.minecraft.block.entity.BlockEntity; @@ -12,14 +12,14 @@ import net.minecraft.util.Identifier; import net.minecraft.util.registry.Registry; import java.util.function.Supplier; -public class SlopeTest implements ModInitializer { - public static final String MODID = "slopetest"; +public class Templates implements ModInitializer { + public static final String MODID = "templates"; //define/create here so that it always exists when called in a client initializer, regardless of load order - public static SlopeModelVariantProvider provider = new SlopeModelVariantProvider(); + public static TemplateModelVariantProvider provider = new TemplateModelVariantProvider(); - public static final Block SLOPE = register("slope", new SlopeTestBlock(), ItemGroup.DECORATIONS); + public static final Block SLOPE = register("slope", new SlopeBlock(), ItemGroup.DECORATIONS); @SuppressWarnings("unchecked") - public static final BlockEntityType SLOPE_ENTITY = register("slope", SlopeTestEntity::new, SLOPE); + public static final BlockEntityType SLOPE_ENTITY = register("slope", SlopeEntity::new, SLOPE); @Override public void onInitialize() { diff --git a/src/main/java/io/github/cottonmc/templates/TemplatesClient.java b/src/main/java/io/github/cottonmc/templates/TemplatesClient.java new file mode 100644 index 0000000..5d5edeb --- /dev/null +++ b/src/main/java/io/github/cottonmc/templates/TemplatesClient.java @@ -0,0 +1,15 @@ +package io.github.cottonmc.templates; + +import io.github.cottonmc.templates.block.SlopeBlock; +import io.github.cottonmc.templates.model.SlopeModel; +import net.fabricmc.api.ClientModInitializer; +import net.fabricmc.fabric.api.client.model.ModelLoadingRegistry; +import net.minecraft.util.math.Direction; + +public class TemplatesClient implements ClientModInitializer { + @Override + public void onInitializeClient() { + ModelLoadingRegistry.INSTANCE.registerVariantProvider(rm -> Templates.provider); + Templates.provider.registerTemplateModels(Templates.SLOPE, Templates.SLOPE.getDefaultState().with(SlopeBlock.FACING, Direction.SOUTH), SlopeModel::new); + } +} diff --git a/src/main/java/io/github/cottonmc/slopetest/block/SlopeTestBlock.java b/src/main/java/io/github/cottonmc/templates/block/SlopeBlock.java similarity index 91% rename from src/main/java/io/github/cottonmc/slopetest/block/SlopeTestBlock.java rename to src/main/java/io/github/cottonmc/templates/block/SlopeBlock.java index ba8d5cc..07b411e 100644 --- a/src/main/java/io/github/cottonmc/slopetest/block/SlopeTestBlock.java +++ b/src/main/java/io/github/cottonmc/templates/block/SlopeBlock.java @@ -1,6 +1,6 @@ -package io.github.cottonmc.slopetest.block; +package io.github.cottonmc.templates.block; -import io.github.cottonmc.slopetest.block.entity.SlopeTestEntity; +import io.github.cottonmc.templates.block.entity.SlopeEntity; import net.fabricmc.fabric.api.block.FabricBlockSettings; import net.minecraft.block.*; import net.minecraft.block.entity.BlockEntity; @@ -17,7 +17,7 @@ import net.minecraft.world.BlockView; import javax.annotation.Nullable; -public class SlopeTestBlock extends TemplateBlock { +public class SlopeBlock extends TemplateBlock { public static final DirectionProperty FACING = Properties.HORIZONTAL_FACING; public static final VoxelShape BASE = VoxelShapes.cuboid(0f, 0f, 0f, 1f, 0.5f, 1f); @@ -26,7 +26,7 @@ public class SlopeTestBlock extends TemplateBlock { public static final VoxelShape EAST = VoxelShapes.cuboid(0.5f, 0.5f, 0f, 1f, 1f, 1f); public static final VoxelShape WEST = VoxelShapes.cuboid(0f, 0.5f, 0f, 0.5f, 1f, 1f); - public SlopeTestBlock() { + public SlopeBlock() { super(FabricBlockSettings.of(Material.WOOD).build()); this.setDefaultState(this.getStateFactory().getDefaultState().with(FACING, Direction.NORTH).with(LIGHT, 0).with(REDSTONE, false)); } @@ -39,7 +39,7 @@ public class SlopeTestBlock extends TemplateBlock { @Nullable @Override public BlockEntity createBlockEntity(BlockView blockView) { - return new SlopeTestEntity(); + return new SlopeEntity(); } @Nullable diff --git a/src/main/java/io/github/cottonmc/slopetest/block/TemplateBlock.java b/src/main/java/io/github/cottonmc/templates/block/TemplateBlock.java similarity index 95% rename from src/main/java/io/github/cottonmc/slopetest/block/TemplateBlock.java rename to src/main/java/io/github/cottonmc/templates/block/TemplateBlock.java index 47222d0..f7b8913 100644 --- a/src/main/java/io/github/cottonmc/slopetest/block/TemplateBlock.java +++ b/src/main/java/io/github/cottonmc/templates/block/TemplateBlock.java @@ -1,8 +1,8 @@ -package io.github.cottonmc.slopetest.block; +package io.github.cottonmc.templates.block; -import io.github.cottonmc.slopetest.SlopeTest; -import io.github.cottonmc.slopetest.block.entity.TemplateBlockEntity; -import io.github.cottonmc.slopetest.util.StateContainer; +import io.github.cottonmc.templates.Templates; +import io.github.cottonmc.templates.block.entity.TemplateBlockEntity; +import io.github.cottonmc.templates.util.StateContainer; import net.minecraft.block.Block; import net.minecraft.block.BlockEntityProvider; import net.minecraft.block.BlockState; @@ -67,7 +67,7 @@ public abstract class TemplateBlock extends Block implements BlockEntityProvider @Override public void onBlockRemoved(BlockState state, World world, BlockPos pos, BlockState newState, boolean bool) { - if (newState.getBlock() == SlopeTest.SLOPE) return; + if (newState.getBlock() == Templates.SLOPE) return; BlockEntity be = world.getBlockEntity(pos); if (be instanceof TemplateBlockEntity) { TemplateBlockEntity template = (TemplateBlockEntity)be; diff --git a/src/main/java/io/github/cottonmc/templates/block/entity/SlopeEntity.java b/src/main/java/io/github/cottonmc/templates/block/entity/SlopeEntity.java new file mode 100644 index 0000000..6f2380f --- /dev/null +++ b/src/main/java/io/github/cottonmc/templates/block/entity/SlopeEntity.java @@ -0,0 +1,9 @@ +package io.github.cottonmc.templates.block.entity; + +import io.github.cottonmc.templates.Templates; + +public class SlopeEntity extends TemplateBlockEntity { + public SlopeEntity() { + super(Templates.SLOPE_ENTITY, Templates.SLOPE); + } +} diff --git a/src/main/java/io/github/cottonmc/slopetest/block/entity/TemplateBlockEntity.java b/src/main/java/io/github/cottonmc/templates/block/entity/TemplateBlockEntity.java similarity index 96% rename from src/main/java/io/github/cottonmc/slopetest/block/entity/TemplateBlockEntity.java rename to src/main/java/io/github/cottonmc/templates/block/entity/TemplateBlockEntity.java index f35a9f0..2e235b7 100644 --- a/src/main/java/io/github/cottonmc/slopetest/block/entity/TemplateBlockEntity.java +++ b/src/main/java/io/github/cottonmc/templates/block/entity/TemplateBlockEntity.java @@ -1,6 +1,6 @@ -package io.github.cottonmc.slopetest.block.entity; +package io.github.cottonmc.templates.block.entity; -import io.github.cottonmc.slopetest.util.BlockStateUtil; +import io.github.cottonmc.templates.util.BlockStateUtil; import net.fabricmc.fabric.api.block.entity.BlockEntityClientSerializable; import net.fabricmc.fabric.api.rendering.data.v1.RenderAttachmentBlockEntity; import net.fabricmc.fabric.api.server.PlayerStream; diff --git a/src/main/java/io/github/cottonmc/slopetest/model/AbstractModel.java b/src/main/java/io/github/cottonmc/templates/model/AbstractModel.java similarity index 96% rename from src/main/java/io/github/cottonmc/slopetest/model/AbstractModel.java rename to src/main/java/io/github/cottonmc/templates/model/AbstractModel.java index 19fc38c..69e8001 100644 --- a/src/main/java/io/github/cottonmc/slopetest/model/AbstractModel.java +++ b/src/main/java/io/github/cottonmc/templates/model/AbstractModel.java @@ -1,4 +1,4 @@ -package io.github.cottonmc.slopetest.model; +package io.github.cottonmc.templates.model; import net.fabricmc.fabric.api.renderer.v1.Renderer; import net.fabricmc.fabric.api.renderer.v1.RendererAccess; diff --git a/src/main/java/io/github/cottonmc/slopetest/model/MeshTransformer.java b/src/main/java/io/github/cottonmc/templates/model/MeshTransformer.java similarity index 92% rename from src/main/java/io/github/cottonmc/slopetest/model/MeshTransformer.java rename to src/main/java/io/github/cottonmc/templates/model/MeshTransformer.java index da71907..71650dd 100644 --- a/src/main/java/io/github/cottonmc/slopetest/model/MeshTransformer.java +++ b/src/main/java/io/github/cottonmc/templates/model/MeshTransformer.java @@ -1,4 +1,4 @@ -package io.github.cottonmc.slopetest.model; +package io.github.cottonmc.templates.model; import java.util.Random; import java.util.function.Supplier; diff --git a/src/main/java/io/github/cottonmc/slopetest/model/SimpleModel.java b/src/main/java/io/github/cottonmc/templates/model/SimpleModel.java similarity index 98% rename from src/main/java/io/github/cottonmc/slopetest/model/SimpleModel.java rename to src/main/java/io/github/cottonmc/templates/model/SimpleModel.java index a1df376..7b35ad0 100644 --- a/src/main/java/io/github/cottonmc/slopetest/model/SimpleModel.java +++ b/src/main/java/io/github/cottonmc/templates/model/SimpleModel.java @@ -1,4 +1,4 @@ -package io.github.cottonmc.slopetest.model; +package io.github.cottonmc.templates.model; import java.lang.ref.WeakReference; import java.util.Collections; diff --git a/src/main/java/io/github/cottonmc/slopetest/model/SimpleUnbakedModel.java b/src/main/java/io/github/cottonmc/templates/model/SimpleUnbakedModel.java similarity index 95% rename from src/main/java/io/github/cottonmc/slopetest/model/SimpleUnbakedModel.java rename to src/main/java/io/github/cottonmc/templates/model/SimpleUnbakedModel.java index f4313a2..72eda85 100644 --- a/src/main/java/io/github/cottonmc/slopetest/model/SimpleUnbakedModel.java +++ b/src/main/java/io/github/cottonmc/templates/model/SimpleUnbakedModel.java @@ -1,4 +1,4 @@ -package io.github.cottonmc.slopetest.model; +package io.github.cottonmc.templates.model; import java.util.Collection; import java.util.Collections; diff --git a/src/main/java/io/github/cottonmc/slopetest/model/SlopeTestModel.java b/src/main/java/io/github/cottonmc/templates/model/SlopeModel.java similarity index 98% rename from src/main/java/io/github/cottonmc/slopetest/model/SlopeTestModel.java rename to src/main/java/io/github/cottonmc/templates/model/SlopeModel.java index 25c182c..3b50355 100644 --- a/src/main/java/io/github/cottonmc/slopetest/model/SlopeTestModel.java +++ b/src/main/java/io/github/cottonmc/templates/model/SlopeModel.java @@ -1,11 +1,11 @@ -package io.github.cottonmc.slopetest.model; +package io.github.cottonmc.templates.model; import java.util.Random; import java.util.function.Supplier; import org.apache.commons.lang3.ObjectUtils; -import io.github.cottonmc.slopetest.util.SpriteSet; +import io.github.cottonmc.templates.util.SpriteSet; import net.fabricmc.fabric.api.client.render.ColorProviderRegistry; import net.fabricmc.fabric.api.renderer.v1.material.MaterialFinder; import net.fabricmc.fabric.api.renderer.v1.material.RenderMaterial; @@ -30,11 +30,11 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Direction; import net.minecraft.world.ExtendedBlockView; -public class SlopeTestModel extends SimpleModel { +public class SlopeModel extends SimpleModel { private static final ThreadLocal TRANSFORMERS = ThreadLocal.withInitial(Transformer::new); - public SlopeTestModel(BlockState blockState) { + public SlopeModel(BlockState blockState) { super(baseMesh(blockState), TRANSFORMERS::get, MissingSprite.getMissingSprite(), ModelHelper.MODEL_TRANSFORM_BLOCK); } diff --git a/src/main/java/io/github/cottonmc/slopetest/model/SlopeModelVariantProvider.java b/src/main/java/io/github/cottonmc/templates/model/TemplateModelVariantProvider.java similarity index 80% rename from src/main/java/io/github/cottonmc/slopetest/model/SlopeModelVariantProvider.java rename to src/main/java/io/github/cottonmc/templates/model/TemplateModelVariantProvider.java index d14c2a0..c6934b1 100644 --- a/src/main/java/io/github/cottonmc/slopetest/model/SlopeModelVariantProvider.java +++ b/src/main/java/io/github/cottonmc/templates/model/TemplateModelVariantProvider.java @@ -1,4 +1,4 @@ -package io.github.cottonmc.slopetest.model; +package io.github.cottonmc.templates.model; import java.util.HashMap; import java.util.function.Function; @@ -12,18 +12,18 @@ import net.minecraft.client.render.model.UnbakedModel; import net.minecraft.client.util.ModelIdentifier; import net.minecraft.util.registry.Registry; -public class SlopeModelVariantProvider implements ModelVariantProvider { +public class TemplateModelVariantProvider implements ModelVariantProvider { private final HashMap variants = new HashMap<>(); - public SlopeModelVariantProvider() { } + public TemplateModelVariantProvider() { } @Override public UnbakedModel loadModelVariant(ModelIdentifier modelId, ModelProviderContext context) throws ModelProviderException { return variants.get(modelId); } - public void registerTemplateBlock(Block block, BlockState itemState, Function model) { + public void registerTemplateModels(Block block, BlockState itemState, Function model) { for (BlockState state : block.getStateFactory().getStates()) { variants.put(BlockModels.getModelId(state), (SimpleUnbakedModel)() -> model.apply(state)); } diff --git a/src/main/java/io/github/cottonmc/slopetest/util/BlockStateUtil.java b/src/main/java/io/github/cottonmc/templates/util/BlockStateUtil.java similarity index 97% rename from src/main/java/io/github/cottonmc/slopetest/util/BlockStateUtil.java rename to src/main/java/io/github/cottonmc/templates/util/BlockStateUtil.java index 36b079d..7d0d47e 100644 --- a/src/main/java/io/github/cottonmc/slopetest/util/BlockStateUtil.java +++ b/src/main/java/io/github/cottonmc/templates/util/BlockStateUtil.java @@ -1,4 +1,4 @@ -package io.github.cottonmc.slopetest.util; +package io.github.cottonmc.templates.util; import net.minecraft.block.Block; import net.minecraft.block.BlockState; diff --git a/src/main/java/io/github/cottonmc/slopetest/util/SpriteSet.java b/src/main/java/io/github/cottonmc/templates/util/SpriteSet.java similarity index 97% rename from src/main/java/io/github/cottonmc/slopetest/util/SpriteSet.java rename to src/main/java/io/github/cottonmc/templates/util/SpriteSet.java index 3971cc2..47fdb65 100644 --- a/src/main/java/io/github/cottonmc/slopetest/util/SpriteSet.java +++ b/src/main/java/io/github/cottonmc/templates/util/SpriteSet.java @@ -1,4 +1,4 @@ -package io.github.cottonmc.slopetest.util; +package io.github.cottonmc.templates.util; import java.util.List; import java.util.Random; diff --git a/src/main/java/io/github/cottonmc/slopetest/util/StateContainer.java b/src/main/java/io/github/cottonmc/templates/util/StateContainer.java similarity index 83% rename from src/main/java/io/github/cottonmc/slopetest/util/StateContainer.java rename to src/main/java/io/github/cottonmc/templates/util/StateContainer.java index dabb4be..56237bf 100644 --- a/src/main/java/io/github/cottonmc/slopetest/util/StateContainer.java +++ b/src/main/java/io/github/cottonmc/templates/util/StateContainer.java @@ -1,4 +1,4 @@ -package io.github.cottonmc.slopetest.util; +package io.github.cottonmc.templates.util; import net.minecraft.block.BlockState; import net.minecraft.util.math.BlockPos; diff --git a/src/main/resources/assets/libcd/icon.png b/src/main/resources/assets/templates/icon.png similarity index 100% rename from src/main/resources/assets/libcd/icon.png rename to src/main/resources/assets/templates/icon.png diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 6459ac8..ad518d1 100755 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -1,25 +1,26 @@ { "schemaVersion": 1, - "id": "slopetest", + "id": "templates", "version": "$version", - "name": "Slope Test", - "icon": "assets/libcd/icon.png", - "description": "Various tweaks to make data packs even more useful!", + "name": "Templates", + "icon": "assets/templates/icon.png", + "description": "An API for templated blocks", "licence": "MIT", "contact": { - "sources": "https://github.com/CottonMC/LibCD" + "sources": "https://github.com/CottonMC/Templates" }, "environment": "*", "entrypoints": { "main": [ - "io.github.cottonmc.slopetest.SlopeTest" + "io.github.cottonmc.templates.Templates" ], "client": [ - "io.github.cottonmc.slopetest.SlopeTestClient" + "io.github.cottonmc.templates.TemplatesClient" ] }, "requires": { - "fabricloader": ">=0.4.0" + "fabricloader": ">=0.4.0", + "fabric-renderer-indigo": "*" } }