rename mod!
This commit is contained in:
parent
12d6874b95
commit
616502b16e
@ -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 {
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
@ -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);
|
||||
}
|
||||
}
|
@ -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<SlopeTestEntity> SLOPE_ENTITY = register("slope", SlopeTestEntity::new, SLOPE);
|
||||
public static final BlockEntityType<SlopeEntity> SLOPE_ENTITY = register("slope", SlopeEntity::new, SLOPE);
|
||||
|
||||
@Override
|
||||
public void onInitialize() {
|
@ -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);
|
||||
}
|
||||
}
|
@ -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
|
@ -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;
|
@ -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);
|
||||
}
|
||||
}
|
@ -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;
|
@ -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;
|
@ -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;
|
@ -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;
|
@ -1,4 +1,4 @@
|
||||
package io.github.cottonmc.slopetest.model;
|
||||
package io.github.cottonmc.templates.model;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
@ -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<Transformer> TRANSFORMERS = ThreadLocal.withInitial(Transformer::new);
|
||||
|
||||
public SlopeTestModel(BlockState blockState) {
|
||||
public SlopeModel(BlockState blockState) {
|
||||
super(baseMesh(blockState), TRANSFORMERS::get, MissingSprite.getMissingSprite(), ModelHelper.MODEL_TRANSFORM_BLOCK);
|
||||
}
|
||||
|
@ -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<ModelIdentifier, UnbakedModel> 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<BlockState, SimpleModel> model) {
|
||||
public void registerTemplateModels(Block block, BlockState itemState, Function<BlockState, SimpleModel> model) {
|
||||
for (BlockState state : block.getStateFactory().getStates()) {
|
||||
variants.put(BlockModels.getModelId(state), (SimpleUnbakedModel)() -> model.apply(state));
|
||||
}
|
@ -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;
|
@ -1,4 +1,4 @@
|
||||
package io.github.cottonmc.slopetest.util;
|
||||
package io.github.cottonmc.templates.util;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
@ -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;
|
Before Width: | Height: | Size: 164 KiB After Width: | Height: | Size: 164 KiB |
@ -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": "*"
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user