Probably overzealous formatting commit
This commit is contained in:
parent
735e79ea78
commit
5b369ab95e
@ -6,9 +6,12 @@ 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;
|
||||||
import net.minecraft.block.entity.BlockEntityType;
|
import net.minecraft.block.entity.BlockEntityType;
|
||||||
import net.minecraft.item.*;
|
import net.minecraft.item.BlockItem;
|
||||||
|
import net.minecraft.item.Item;
|
||||||
|
import net.minecraft.item.ItemGroup;
|
||||||
import net.minecraft.util.Identifier;
|
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 Templates implements ModInitializer {
|
public class Templates implements ModInitializer {
|
||||||
|
@ -9,6 +9,7 @@ import net.minecraft.util.math.Direction;
|
|||||||
|
|
||||||
public class TemplatesClient implements ClientModInitializer {
|
public class TemplatesClient implements ClientModInitializer {
|
||||||
public static TemplateModelVariantProvider provider = new TemplateModelVariantProvider();
|
public static TemplateModelVariantProvider provider = new TemplateModelVariantProvider();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onInitializeClient() {
|
public void onInitializeClient() {
|
||||||
ModelLoadingRegistry.INSTANCE.registerVariantProvider(rm -> provider);
|
ModelLoadingRegistry.INSTANCE.registerVariantProvider(rm -> provider);
|
||||||
|
@ -2,10 +2,12 @@ package io.github.cottonmc.templates.block;
|
|||||||
|
|
||||||
import io.github.cottonmc.templates.block.entity.SlopeEntity;
|
import io.github.cottonmc.templates.block.entity.SlopeEntity;
|
||||||
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||||||
import net.minecraft.block.*;
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.block.BlockState;
|
||||||
|
import net.minecraft.block.Material;
|
||||||
import net.minecraft.block.entity.BlockEntity;
|
import net.minecraft.block.entity.BlockEntity;
|
||||||
import net.minecraft.entity.EntityContext;
|
import net.minecraft.entity.EntityContext;
|
||||||
import net.minecraft.item.*;
|
import net.minecraft.item.ItemPlacementContext;
|
||||||
import net.minecraft.state.StateManager;
|
import net.minecraft.state.StateManager;
|
||||||
import net.minecraft.state.property.DirectionProperty;
|
import net.minecraft.state.property.DirectionProperty;
|
||||||
import net.minecraft.state.property.Properties;
|
import net.minecraft.state.property.Properties;
|
||||||
|
@ -10,7 +10,11 @@ import net.minecraft.block.Blocks;
|
|||||||
import net.minecraft.block.entity.BlockEntity;
|
import net.minecraft.block.entity.BlockEntity;
|
||||||
import net.minecraft.entity.ItemEntity;
|
import net.minecraft.entity.ItemEntity;
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.item.*;
|
import net.minecraft.item.BlockItem;
|
||||||
|
import net.minecraft.item.ItemPlacementContext;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.item.ItemUsageContext;
|
||||||
|
import net.minecraft.item.Items;
|
||||||
import net.minecraft.state.property.BooleanProperty;
|
import net.minecraft.state.property.BooleanProperty;
|
||||||
import net.minecraft.state.property.IntProperty;
|
import net.minecraft.state.property.IntProperty;
|
||||||
import net.minecraft.util.Hand;
|
import net.minecraft.util.Hand;
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
package io.github.cottonmc.templates.model;
|
package io.github.cottonmc.templates.model;
|
||||||
|
|
||||||
import java.util.Random;
|
|
||||||
import java.util.function.Supplier;
|
|
||||||
|
|
||||||
import net.fabricmc.fabric.api.renderer.v1.render.RenderContext.QuadTransform;
|
import net.fabricmc.fabric.api.renderer.v1.render.RenderContext.QuadTransform;
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.world.BlockRenderView;
|
import net.minecraft.world.BlockRenderView;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
public interface MeshTransformer extends QuadTransform {
|
public interface MeshTransformer extends QuadTransform {
|
||||||
MeshTransformer prepare(BlockRenderView blockView, BlockState state, BlockPos pos, Supplier<Random> randomSupplier);
|
MeshTransformer prepare(BlockRenderView blockView, BlockState state, BlockPos pos, Supplier<Random> randomSupplier);
|
||||||
|
|
||||||
|
@ -1,13 +1,6 @@
|
|||||||
package io.github.cottonmc.templates.model;
|
package io.github.cottonmc.templates.model;
|
||||||
|
|
||||||
import java.lang.ref.WeakReference;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Random;
|
|
||||||
import java.util.function.Supplier;
|
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
|
|
||||||
import net.fabricmc.fabric.api.renderer.v1.mesh.Mesh;
|
import net.fabricmc.fabric.api.renderer.v1.mesh.Mesh;
|
||||||
import net.fabricmc.fabric.api.renderer.v1.model.ModelHelper;
|
import net.fabricmc.fabric.api.renderer.v1.model.ModelHelper;
|
||||||
import net.fabricmc.fabric.api.renderer.v1.render.RenderContext;
|
import net.fabricmc.fabric.api.renderer.v1.render.RenderContext;
|
||||||
@ -24,6 +17,12 @@ import net.minecraft.util.math.Direction;
|
|||||||
import net.minecraft.world.BlockRenderView;
|
import net.minecraft.world.BlockRenderView;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
import java.lang.ref.WeakReference;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Random;
|
||||||
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Simple baked model supporting the Fabric Render API features.<p>
|
* Simple baked model supporting the Fabric Render API features.<p>
|
||||||
*/
|
*/
|
||||||
|
@ -1,10 +1,5 @@
|
|||||||
package io.github.cottonmc.templates.model;
|
package io.github.cottonmc.templates.model;
|
||||||
|
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.Set;
|
|
||||||
import java.util.function.Function;
|
|
||||||
|
|
||||||
import net.minecraft.client.render.model.BakedModel;
|
import net.minecraft.client.render.model.BakedModel;
|
||||||
import net.minecraft.client.render.model.ModelBakeSettings;
|
import net.minecraft.client.render.model.ModelBakeSettings;
|
||||||
import net.minecraft.client.render.model.ModelLoader;
|
import net.minecraft.client.render.model.ModelLoader;
|
||||||
@ -12,6 +7,11 @@ import net.minecraft.client.render.model.UnbakedModel;
|
|||||||
import net.minecraft.client.texture.Sprite;
|
import net.minecraft.client.texture.Sprite;
|
||||||
import net.minecraft.util.Identifier;
|
import net.minecraft.util.Identifier;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.function.Function;
|
||||||
|
|
||||||
@FunctionalInterface
|
@FunctionalInterface
|
||||||
public interface SimpleUnbakedModel extends UnbakedModel {
|
public interface SimpleUnbakedModel extends UnbakedModel {
|
||||||
BakedModel bake();
|
BakedModel bake();
|
||||||
|
@ -1,12 +1,5 @@
|
|||||||
package io.github.cottonmc.templates.model;
|
package io.github.cottonmc.templates.model;
|
||||||
|
|
||||||
import java.util.Random;
|
|
||||||
import java.util.function.Supplier;
|
|
||||||
|
|
||||||
import net.minecraft.client.render.RenderLayer;
|
|
||||||
import net.minecraft.world.BlockRenderView;
|
|
||||||
import org.apache.commons.lang3.ObjectUtils;
|
|
||||||
|
|
||||||
import io.github.cottonmc.templates.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;
|
||||||
@ -22,6 +15,7 @@ import net.minecraft.block.BlockState;
|
|||||||
import net.minecraft.block.Blocks;
|
import net.minecraft.block.Blocks;
|
||||||
import net.minecraft.client.MinecraftClient;
|
import net.minecraft.client.MinecraftClient;
|
||||||
import net.minecraft.client.color.block.BlockColorProvider;
|
import net.minecraft.client.color.block.BlockColorProvider;
|
||||||
|
import net.minecraft.client.render.RenderLayer;
|
||||||
import net.minecraft.client.render.model.BakedModel;
|
import net.minecraft.client.render.model.BakedModel;
|
||||||
import net.minecraft.client.texture.MissingSprite;
|
import net.minecraft.client.texture.MissingSprite;
|
||||||
import net.minecraft.client.texture.Sprite;
|
import net.minecraft.client.texture.Sprite;
|
||||||
@ -29,6 +23,11 @@ import net.minecraft.item.ItemStack;
|
|||||||
import net.minecraft.state.property.Properties;
|
import net.minecraft.state.property.Properties;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.util.math.Direction;
|
import net.minecraft.util.math.Direction;
|
||||||
|
import net.minecraft.world.BlockRenderView;
|
||||||
|
import org.apache.commons.lang3.ObjectUtils;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
public class SlopeModel extends SimpleModel {
|
public class SlopeModel extends SimpleModel {
|
||||||
|
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
package io.github.cottonmc.templates.model;
|
package io.github.cottonmc.templates.model;
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.function.Function;
|
|
||||||
import net.fabricmc.fabric.api.client.model.ModelProviderContext;
|
import net.fabricmc.fabric.api.client.model.ModelProviderContext;
|
||||||
import net.fabricmc.fabric.api.client.model.ModelProviderException;
|
import net.fabricmc.fabric.api.client.model.ModelProviderException;
|
||||||
import net.fabricmc.fabric.api.client.model.ModelVariantProvider;
|
import net.fabricmc.fabric.api.client.model.ModelVariantProvider;
|
||||||
@ -12,6 +10,9 @@ 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;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.function.Function;
|
||||||
|
|
||||||
public class TemplateModelVariantProvider implements ModelVariantProvider {
|
public class TemplateModelVariantProvider implements ModelVariantProvider {
|
||||||
|
|
||||||
private final HashMap<ModelIdentifier, UnbakedModel> variants = new HashMap<>();
|
private final HashMap<ModelIdentifier, UnbakedModel> variants = new HashMap<>();
|
||||||
|
@ -1,19 +1,18 @@
|
|||||||
package io.github.cottonmc.templates.util;
|
package io.github.cottonmc.templates.util;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
import net.minecraft.client.texture.MissingSprite;
|
|
||||||
|
|
||||||
import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap;
|
import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap;
|
||||||
import net.fabricmc.fabric.api.renderer.v1.model.ModelHelper;
|
import net.fabricmc.fabric.api.renderer.v1.model.ModelHelper;
|
||||||
import net.minecraft.client.MinecraftClient;
|
import net.minecraft.client.MinecraftClient;
|
||||||
import net.minecraft.client.render.model.BakedModel;
|
import net.minecraft.client.render.model.BakedModel;
|
||||||
import net.minecraft.client.render.model.BakedQuad;
|
import net.minecraft.client.render.model.BakedQuad;
|
||||||
|
import net.minecraft.client.texture.MissingSprite;
|
||||||
import net.minecraft.client.texture.Sprite;
|
import net.minecraft.client.texture.Sprite;
|
||||||
import net.minecraft.util.Identifier;
|
import net.minecraft.util.Identifier;
|
||||||
import net.minecraft.util.math.Direction;
|
import net.minecraft.util.math.Direction;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
public class SpriteSet {
|
public class SpriteSet {
|
||||||
private Object2ObjectOpenHashMap<Direction, BakedQuad> quads = new Object2ObjectOpenHashMap<>();
|
private Object2ObjectOpenHashMap<Direction, BakedQuad> quads = new Object2ObjectOpenHashMap<>();
|
||||||
private boolean isDefault = true;
|
private boolean isDefault = true;
|
||||||
|
@ -6,5 +6,6 @@ import net.minecraft.world.World;
|
|||||||
|
|
||||||
public interface StateContainer {
|
public interface StateContainer {
|
||||||
BlockState getContainedState(World world, BlockPos pos);
|
BlockState getContainedState(World world, BlockPos pos);
|
||||||
|
|
||||||
void setContainedState(World world, BlockPos pos, BlockState state);
|
void setContainedState(World world, BlockPos pos, BlockState state);
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
"schemaVersion": 1,
|
"schemaVersion": 1,
|
||||||
"id": "templates",
|
"id": "templates",
|
||||||
"version": "$version",
|
"version": "$version",
|
||||||
|
|
||||||
"name": "Templates",
|
"name": "Templates",
|
||||||
"icon": "assets/templates/icon.png",
|
"icon": "assets/templates/icon.png",
|
||||||
"description": "An API for templated blocks",
|
"description": "An API for templated blocks",
|
||||||
|
Loading…
Reference in New Issue
Block a user