rename mod!

This commit is contained in:
Meredith Espinosa 2019-06-19 15:29:15 -07:00
parent 12d6874b95
commit 616502b16e
20 changed files with 72 additions and 82 deletions

View File

@ -28,12 +28,12 @@ if(rootProject.file('private.gradle').exists()) { //Publishing details
apply from: 'private.gradle' apply from: 'private.gradle'
} }
archivesBaseName = "slopetest" archivesBaseName = "templates"
group = "io.github.cottonmc" group = "io.github.cottonmc"
version = "1.1.0+1.14.2" version = "1.0.0+1.14.2"
minecraft { minecraft {
refmapName = 'mixins.slopetest.refmap.json' refmapName = 'mixins.templates.refmap.json'
} }
repositories { repositories {

View File

@ -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);
}
}

View File

@ -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);
}
}

View File

@ -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.templates.block.SlopeBlock;
import io.github.cottonmc.slopetest.block.entity.SlopeTestEntity; import io.github.cottonmc.templates.block.entity.SlopeEntity;
import io.github.cottonmc.slopetest.model.SlopeModelVariantProvider; import io.github.cottonmc.templates.model.TemplateModelVariantProvider;
import net.fabricmc.api.ModInitializer; import net.fabricmc.api.ModInitializer;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.entity.BlockEntity; import net.minecraft.block.entity.BlockEntity;
@ -12,14 +12,14 @@ import net.minecraft.util.Identifier;
import net.minecraft.util.registry.Registry; import net.minecraft.util.registry.Registry;
import java.util.function.Supplier; import java.util.function.Supplier;
public class SlopeTest implements ModInitializer { public class Templates implements ModInitializer {
public static final String MODID = "slopetest"; public static final String MODID = "templates";
//define/create here so that it always exists when called in a client initializer, regardless of load order //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") @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 @Override
public void onInitialize() { public void onInitialize() {

View File

@ -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);
}
}

View File

@ -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.fabricmc.fabric.api.block.FabricBlockSettings;
import net.minecraft.block.*; import net.minecraft.block.*;
import net.minecraft.block.entity.BlockEntity; import net.minecraft.block.entity.BlockEntity;
@ -17,7 +17,7 @@ import net.minecraft.world.BlockView;
import javax.annotation.Nullable; 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 DirectionProperty FACING = Properties.HORIZONTAL_FACING;
public static final VoxelShape BASE = VoxelShapes.cuboid(0f, 0f, 0f, 1f, 0.5f, 1f); 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 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 static final VoxelShape WEST = VoxelShapes.cuboid(0f, 0.5f, 0f, 0.5f, 1f, 1f);
public SlopeTestBlock() { public SlopeBlock() {
super(FabricBlockSettings.of(Material.WOOD).build()); super(FabricBlockSettings.of(Material.WOOD).build());
this.setDefaultState(this.getStateFactory().getDefaultState().with(FACING, Direction.NORTH).with(LIGHT, 0).with(REDSTONE, false)); 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 @Nullable
@Override @Override
public BlockEntity createBlockEntity(BlockView blockView) { public BlockEntity createBlockEntity(BlockView blockView) {
return new SlopeTestEntity(); return new SlopeEntity();
} }
@Nullable @Nullable

View File

@ -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.templates.Templates;
import io.github.cottonmc.slopetest.block.entity.TemplateBlockEntity; import io.github.cottonmc.templates.block.entity.TemplateBlockEntity;
import io.github.cottonmc.slopetest.util.StateContainer; import io.github.cottonmc.templates.util.StateContainer;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.BlockEntityProvider; import net.minecraft.block.BlockEntityProvider;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
@ -67,7 +67,7 @@ public abstract class TemplateBlock extends Block implements BlockEntityProvider
@Override @Override
public void onBlockRemoved(BlockState state, World world, BlockPos pos, BlockState newState, boolean bool) { 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); BlockEntity be = world.getBlockEntity(pos);
if (be instanceof TemplateBlockEntity) { if (be instanceof TemplateBlockEntity) {
TemplateBlockEntity template = (TemplateBlockEntity)be; TemplateBlockEntity template = (TemplateBlockEntity)be;

View File

@ -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);
}
}

View File

@ -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.block.entity.BlockEntityClientSerializable;
import net.fabricmc.fabric.api.rendering.data.v1.RenderAttachmentBlockEntity; import net.fabricmc.fabric.api.rendering.data.v1.RenderAttachmentBlockEntity;
import net.fabricmc.fabric.api.server.PlayerStream; import net.fabricmc.fabric.api.server.PlayerStream;

View File

@ -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.Renderer;
import net.fabricmc.fabric.api.renderer.v1.RendererAccess; import net.fabricmc.fabric.api.renderer.v1.RendererAccess;

View File

@ -1,4 +1,4 @@
package io.github.cottonmc.slopetest.model; package io.github.cottonmc.templates.model;
import java.util.Random; import java.util.Random;
import java.util.function.Supplier; import java.util.function.Supplier;

View File

@ -1,4 +1,4 @@
package io.github.cottonmc.slopetest.model; package io.github.cottonmc.templates.model;
import java.lang.ref.WeakReference; import java.lang.ref.WeakReference;
import java.util.Collections; import java.util.Collections;

View File

@ -1,4 +1,4 @@
package io.github.cottonmc.slopetest.model; package io.github.cottonmc.templates.model;
import java.util.Collection; import java.util.Collection;
import java.util.Collections; import java.util.Collections;

View File

@ -1,11 +1,11 @@
package io.github.cottonmc.slopetest.model; package io.github.cottonmc.templates.model;
import java.util.Random; import java.util.Random;
import java.util.function.Supplier; import java.util.function.Supplier;
import org.apache.commons.lang3.ObjectUtils; 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.client.render.ColorProviderRegistry;
import net.fabricmc.fabric.api.renderer.v1.material.MaterialFinder; import net.fabricmc.fabric.api.renderer.v1.material.MaterialFinder;
import net.fabricmc.fabric.api.renderer.v1.material.RenderMaterial; 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.util.math.Direction;
import net.minecraft.world.ExtendedBlockView; 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); 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); super(baseMesh(blockState), TRANSFORMERS::get, MissingSprite.getMissingSprite(), ModelHelper.MODEL_TRANSFORM_BLOCK);
} }

View File

@ -1,4 +1,4 @@
package io.github.cottonmc.slopetest.model; package io.github.cottonmc.templates.model;
import java.util.HashMap; import java.util.HashMap;
import java.util.function.Function; 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.client.util.ModelIdentifier;
import net.minecraft.util.registry.Registry; import net.minecraft.util.registry.Registry;
public class SlopeModelVariantProvider implements ModelVariantProvider { public class TemplateModelVariantProvider implements ModelVariantProvider {
private final HashMap<ModelIdentifier, UnbakedModel> variants = new HashMap<>(); private final HashMap<ModelIdentifier, UnbakedModel> variants = new HashMap<>();
public SlopeModelVariantProvider() { } public TemplateModelVariantProvider() { }
@Override @Override
public UnbakedModel loadModelVariant(ModelIdentifier modelId, ModelProviderContext context) throws ModelProviderException { public UnbakedModel loadModelVariant(ModelIdentifier modelId, ModelProviderContext context) throws ModelProviderException {
return variants.get(modelId); 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()) { for (BlockState state : block.getStateFactory().getStates()) {
variants.put(BlockModels.getModelId(state), (SimpleUnbakedModel)() -> model.apply(state)); variants.put(BlockModels.getModelId(state), (SimpleUnbakedModel)() -> model.apply(state));
} }

View File

@ -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.Block;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;

View File

@ -1,4 +1,4 @@
package io.github.cottonmc.slopetest.util; package io.github.cottonmc.templates.util;
import java.util.List; import java.util.List;
import java.util.Random; import java.util.Random;

View File

@ -1,4 +1,4 @@
package io.github.cottonmc.slopetest.util; package io.github.cottonmc.templates.util;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;

View File

Before

Width:  |  Height:  |  Size: 164 KiB

After

Width:  |  Height:  |  Size: 164 KiB

View File

@ -1,25 +1,26 @@
{ {
"schemaVersion": 1, "schemaVersion": 1,
"id": "slopetest", "id": "templates",
"version": "$version", "version": "$version",
"name": "Slope Test", "name": "Templates",
"icon": "assets/libcd/icon.png", "icon": "assets/templates/icon.png",
"description": "Various tweaks to make data packs even more useful!", "description": "An API for templated blocks",
"licence": "MIT", "licence": "MIT",
"contact": { "contact": {
"sources": "https://github.com/CottonMC/LibCD" "sources": "https://github.com/CottonMC/Templates"
}, },
"environment": "*", "environment": "*",
"entrypoints": { "entrypoints": {
"main": [ "main": [
"io.github.cottonmc.slopetest.SlopeTest" "io.github.cottonmc.templates.Templates"
], ],
"client": [ "client": [
"io.github.cottonmc.slopetest.SlopeTestClient" "io.github.cottonmc.templates.TemplatesClient"
] ]
}, },
"requires": { "requires": {
"fabricloader": ">=0.4.0" "fabricloader": ">=0.4.0",
"fabric-renderer-indigo": "*"
} }
} }