Reformated
This commit is contained in:
parent
079b51e3f6
commit
852e5a6abc
385 changed files with 6924 additions and 5656 deletions
|
@ -23,21 +23,21 @@ public class BaseChestBlockModel {
|
|||
"partC",
|
||||
CubeListBuilder.create().texOffs(0, 19).addBox(1.0f, 0.0f, 1.0f, 14.0f, 9.0f, 14.0f, deformation_partC),
|
||||
PartPose.ZERO
|
||||
);
|
||||
);
|
||||
|
||||
CubeDeformation deformation_partA = new CubeDeformation(0.0f);
|
||||
modelPartData.addOrReplaceChild(
|
||||
"partA",
|
||||
CubeListBuilder.create().texOffs(0, 0).addBox(1.0f, 0.0f, 0.0f, 14.0f, 5.0f, 14.0f, deformation_partA),
|
||||
PartPose.offset(0.0f, 9.0f, 1.0f)
|
||||
);
|
||||
);
|
||||
|
||||
CubeDeformation deformation_partB = new CubeDeformation(0.0f);
|
||||
modelPartData.addOrReplaceChild(
|
||||
"partB",
|
||||
CubeListBuilder.create().texOffs(0, 0).addBox(7.0f, -1.0f, 15.0f, 2.0f, 4.0f, 1.0f, deformation_partB),
|
||||
PartPose.offset(0.0f, 8.0f, 0.0f)
|
||||
);
|
||||
);
|
||||
|
||||
CubeDeformation deformation_partRightC = new CubeDeformation(0.0f);
|
||||
modelPartData.addOrReplaceChild(
|
||||
|
@ -46,7 +46,7 @@ public class BaseChestBlockModel {
|
|||
.texOffs(0, 19)
|
||||
.addBox(1.0f, 0.0f, 1.0f, 15.0f, 9.0f, 14.0f, deformation_partRightC),
|
||||
PartPose.ZERO
|
||||
);
|
||||
);
|
||||
|
||||
CubeDeformation deformation_partRightA = new CubeDeformation(0.0f);
|
||||
modelPartData.addOrReplaceChild(
|
||||
|
@ -55,7 +55,7 @@ public class BaseChestBlockModel {
|
|||
.texOffs(0, 0)
|
||||
.addBox(1.0f, 0.0f, 0.0f, 15.0f, 5.0f, 14.0f, deformation_partRightA),
|
||||
PartPose.offset(0.0f, 9.0f, 1.0f)
|
||||
);
|
||||
);
|
||||
|
||||
CubeDeformation deformation_partRightB = new CubeDeformation(0.0f);
|
||||
PartDefinition partRightB = modelPartData.addOrReplaceChild(
|
||||
|
@ -64,7 +64,7 @@ public class BaseChestBlockModel {
|
|||
.texOffs(0, 0)
|
||||
.addBox(15.0f, -1.0f, 15.0f, 1.0f, 4.0f, 1.0f, deformation_partRightB),
|
||||
PartPose.offset(0.0f, 8.0f, 0.0f)
|
||||
);
|
||||
);
|
||||
|
||||
CubeDeformation deformation_partLeftC = new CubeDeformation(0.0f);
|
||||
modelPartData.addOrReplaceChild(
|
||||
|
@ -73,7 +73,7 @@ public class BaseChestBlockModel {
|
|||
.texOffs(0, 19)
|
||||
.addBox(0.0f, 0.0f, 1.0f, 15.0f, 9.0f, 14.0f, deformation_partLeftC),
|
||||
PartPose.ZERO
|
||||
);
|
||||
);
|
||||
|
||||
CubeDeformation deformation_partLeftA = new CubeDeformation(0.0f);
|
||||
modelPartData.addOrReplaceChild(
|
||||
|
@ -82,7 +82,7 @@ public class BaseChestBlockModel {
|
|||
.texOffs(0, 0)
|
||||
.addBox(0.0f, 0.0f, 0.0f, 15.0f, 5.0f, 14.0f, deformation_partLeftA),
|
||||
PartPose.offset(0.0f, 9.0f, 1.0f)
|
||||
);
|
||||
);
|
||||
|
||||
CubeDeformation deformation_partLeftB = new CubeDeformation(0.0f);
|
||||
modelPartData.addOrReplaceChild(
|
||||
|
@ -91,7 +91,7 @@ public class BaseChestBlockModel {
|
|||
.texOffs(0, 0)
|
||||
.addBox(0.0f, -1.0f, 15.0f, 1.0f, 4.0f, 1.0f, deformation_partLeftB),
|
||||
PartPose.offset(0.0f, 8.0f, 0.0f)
|
||||
);
|
||||
);
|
||||
|
||||
return LayerDefinition.create(modelData, 64, 64);
|
||||
}
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
package org.betterx.bclib.client.models;
|
||||
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
|
||||
import org.betterx.bclib.BCLib;
|
||||
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
|
||||
public class BasePatterns {
|
||||
//Block Models
|
||||
public final static ResourceLocation BLOCK_EMPTY = BCLib.makeID("patterns/block/empty.json");
|
||||
|
|
|
@ -1,5 +1,11 @@
|
|||
package org.betterx.bclib.client.models;
|
||||
|
||||
import org.betterx.bclib.api.v2.ModIntegrationAPI;
|
||||
import org.betterx.bclib.client.render.EmissiveTextureInfo;
|
||||
import org.betterx.bclib.interfaces.BlockModelProvider;
|
||||
import org.betterx.bclib.interfaces.ItemModelProvider;
|
||||
|
||||
import com.mojang.datafixers.util.Pair;
|
||||
import net.minecraft.client.renderer.block.BlockModelShaper;
|
||||
import net.minecraft.client.renderer.block.model.BlockModel;
|
||||
import net.minecraft.client.renderer.block.model.multipart.MultiPart;
|
||||
|
@ -15,11 +21,6 @@ import net.minecraft.world.level.block.state.BlockState;
|
|||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.google.common.collect.Sets;
|
||||
import com.mojang.datafixers.util.Pair;
|
||||
import org.betterx.bclib.api.v2.ModIntegrationAPI;
|
||||
import org.betterx.bclib.client.render.EmissiveTextureInfo;
|
||||
import org.betterx.bclib.interfaces.BlockModelProvider;
|
||||
import org.betterx.bclib.interfaces.ItemModelProvider;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
|
@ -34,16 +35,20 @@ public class CustomModelBakery {
|
|||
}
|
||||
|
||||
public UnbakedModel getItemModel(ResourceLocation location) {
|
||||
ResourceLocation storageID = new ResourceLocation(location.getNamespace(),
|
||||
"models/item/" + location.getPath() + ".json");
|
||||
ResourceLocation storageID = new ResourceLocation(
|
||||
location.getNamespace(),
|
||||
"models/item/" + location.getPath() + ".json"
|
||||
);
|
||||
return models.get(location);
|
||||
}
|
||||
|
||||
public void loadCustomModels(ResourceManager resourceManager) {
|
||||
Registry.BLOCK.stream().parallel().filter(block -> block instanceof BlockModelProvider).forEach(block -> {
|
||||
ResourceLocation blockID = Registry.BLOCK.getKey(block);
|
||||
ResourceLocation storageID = new ResourceLocation(blockID.getNamespace(),
|
||||
"blockstates/" + blockID.getPath() + ".json");
|
||||
ResourceLocation storageID = new ResourceLocation(
|
||||
blockID.getNamespace(),
|
||||
"blockstates/" + blockID.getPath() + ".json"
|
||||
);
|
||||
if (resourceManager.getResource(storageID).isEmpty()) {
|
||||
addBlockModel(blockID, block);
|
||||
}
|
||||
|
@ -55,8 +60,10 @@ public class CustomModelBakery {
|
|||
|
||||
Registry.ITEM.stream().parallel().filter(item -> item instanceof ItemModelProvider).forEach(item -> {
|
||||
ResourceLocation registryID = Registry.ITEM.getKey(item);
|
||||
ResourceLocation storageID = new ResourceLocation(registryID.getNamespace(),
|
||||
"models/item/" + registryID.getPath() + ".json");
|
||||
ResourceLocation storageID = new ResourceLocation(
|
||||
registryID.getNamespace(),
|
||||
"models/item/" + registryID.getPath() + ".json"
|
||||
);
|
||||
if (resourceManager.getResource(storageID).isEmpty()) {
|
||||
addItemModel(registryID, (ItemModelProvider) item);
|
||||
}
|
||||
|
@ -88,9 +95,11 @@ public class CustomModelBakery {
|
|||
}
|
||||
|
||||
private void addItemModel(ResourceLocation itemID, ItemModelProvider provider) {
|
||||
ModelResourceLocation modelLocation = new ModelResourceLocation(itemID.getNamespace(),
|
||||
itemID.getPath(),
|
||||
"inventory");
|
||||
ModelResourceLocation modelLocation = new ModelResourceLocation(
|
||||
itemID.getNamespace(),
|
||||
itemID.getPath(),
|
||||
"inventory"
|
||||
);
|
||||
if (models.containsKey(modelLocation)) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package org.betterx.bclib.client.models;
|
||||
|
||||
import com.mojang.math.Transformation;
|
||||
import net.minecraft.client.renderer.block.model.BlockModel;
|
||||
import net.minecraft.client.renderer.block.model.MultiVariant;
|
||||
import net.minecraft.client.renderer.block.model.Variant;
|
||||
|
@ -17,7 +18,6 @@ import net.fabricmc.api.EnvType;
|
|||
import net.fabricmc.api.Environment;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.mojang.math.Transformation;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
@ -47,9 +47,11 @@ public class ModelsHelper {
|
|||
return fromPattern(pattern);
|
||||
}
|
||||
|
||||
public static MultiVariant createMultiVariant(ResourceLocation resourceLocation,
|
||||
Transformation transform,
|
||||
boolean uvLock) {
|
||||
public static MultiVariant createMultiVariant(
|
||||
ResourceLocation resourceLocation,
|
||||
Transformation transform,
|
||||
boolean uvLock
|
||||
) {
|
||||
Variant variant = new Variant(resourceLocation, transform, uvLock, 1);
|
||||
return new MultiVariant(Lists.newArrayList(variant));
|
||||
}
|
||||
|
@ -58,10 +60,12 @@ public class ModelsHelper {
|
|||
return createMultiVariant(resourceLocation, Transformation.identity(), false);
|
||||
}
|
||||
|
||||
public static MultiVariant createFacingModel(ResourceLocation resourceLocation,
|
||||
Direction facing,
|
||||
boolean uvLock,
|
||||
boolean inverted) {
|
||||
public static MultiVariant createFacingModel(
|
||||
ResourceLocation resourceLocation,
|
||||
Direction facing,
|
||||
boolean uvLock,
|
||||
boolean inverted
|
||||
) {
|
||||
if (inverted) {
|
||||
facing = facing.getOpposite();
|
||||
}
|
||||
|
@ -90,7 +94,7 @@ public class ModelsHelper {
|
|||
new Variant(resourceLocation, BlockModelRotation.X0_Y90.getRotation(), false, 1),
|
||||
new Variant(resourceLocation, BlockModelRotation.X0_Y180.getRotation(), false, 1),
|
||||
new Variant(resourceLocation, BlockModelRotation.X0_Y270.getRotation(), false, 1)
|
||||
));
|
||||
));
|
||||
}
|
||||
|
||||
public static class MultiPartBuilder {
|
||||
|
|
|
@ -1,5 +1,11 @@
|
|||
package org.betterx.bclib.client.models;
|
||||
|
||||
import org.betterx.bclib.BCLib;
|
||||
import org.betterx.bclib.util.BlocksHelper;
|
||||
import org.betterx.bclib.util.MHelper;
|
||||
|
||||
import com.mojang.datafixers.util.Pair;
|
||||
import com.mojang.math.Vector3f;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.block.model.BakedQuad;
|
||||
import net.minecraft.client.renderer.block.model.ItemOverrides;
|
||||
|
@ -18,11 +24,6 @@ import net.fabricmc.api.Environment;
|
|||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.mojang.datafixers.util.Pair;
|
||||
import com.mojang.math.Vector3f;
|
||||
import org.betterx.bclib.BCLib;
|
||||
import org.betterx.bclib.util.BlocksHelper;
|
||||
import org.betterx.bclib.util.MHelper;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
|
@ -50,12 +51,14 @@ public class OBJBlockModel implements UnbakedModel, BakedModel {
|
|||
protected boolean useShading;
|
||||
protected byte particleIndex;
|
||||
|
||||
public OBJBlockModel(ResourceLocation location,
|
||||
Vector3f offset,
|
||||
boolean useCulling,
|
||||
boolean useShading,
|
||||
byte particleIndex,
|
||||
ResourceLocation... textureIDs) {
|
||||
public OBJBlockModel(
|
||||
ResourceLocation location,
|
||||
Vector3f offset,
|
||||
boolean useCulling,
|
||||
boolean useShading,
|
||||
byte particleIndex,
|
||||
ResourceLocation... textureIDs
|
||||
) {
|
||||
for (Direction dir : BlocksHelper.DIRECTIONS) {
|
||||
quadsUnbakedMap.put(dir, Lists.newArrayList());
|
||||
quadsBakedMap.put(dir, Lists.newArrayList());
|
||||
|
@ -83,17 +86,21 @@ public class OBJBlockModel implements UnbakedModel, BakedModel {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Collection<Material> getMaterials(Function<ResourceLocation, UnbakedModel> function,
|
||||
Set<Pair<String, String>> set) {
|
||||
public Collection<Material> getMaterials(
|
||||
Function<ResourceLocation, UnbakedModel> function,
|
||||
Set<Pair<String, String>> set
|
||||
) {
|
||||
return materials;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public BakedModel bake(ModelBakery modelBakery,
|
||||
Function<Material, TextureAtlasSprite> textureGetter,
|
||||
ModelState modelState,
|
||||
ResourceLocation resourceLocation) {
|
||||
public BakedModel bake(
|
||||
ModelBakery modelBakery,
|
||||
Function<Material, TextureAtlasSprite> textureGetter,
|
||||
ModelState modelState,
|
||||
ResourceLocation resourceLocation
|
||||
) {
|
||||
for (int i = 0; i < sprites.length; i++) {
|
||||
sprites[i] = textureGetter.apply(materials.get(i));
|
||||
}
|
||||
|
@ -111,9 +118,11 @@ public class OBJBlockModel implements UnbakedModel, BakedModel {
|
|||
// Baked Model //
|
||||
|
||||
@Override
|
||||
public List<BakedQuad> getQuads(@Nullable BlockState blockState,
|
||||
@Nullable Direction direction,
|
||||
RandomSource random) {
|
||||
public List<BakedQuad> getQuads(
|
||||
@Nullable BlockState blockState,
|
||||
@Nullable Direction direction,
|
||||
RandomSource random
|
||||
) {
|
||||
return direction == null ? quadsBaked : quadsBakedMap.get(direction);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
package org.betterx.bclib.client.models;
|
||||
|
||||
import com.mojang.math.Vector3f;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.mojang.math.Vector3f;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
package org.betterx.bclib.client.models;
|
||||
|
||||
import com.mojang.math.Matrix4f;
|
||||
import com.mojang.math.Vector3f;
|
||||
import com.mojang.math.Vector4f;
|
||||
import net.minecraft.client.renderer.block.model.BakedQuad;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.client.resources.model.ModelState;
|
||||
|
@ -8,10 +11,6 @@ import net.minecraft.core.Direction;
|
|||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
|
||||
import com.mojang.math.Matrix4f;
|
||||
import com.mojang.math.Vector3f;
|
||||
import com.mojang.math.Vector4f;
|
||||
|
||||
@Environment(EnvType.CLIENT)
|
||||
public class UnbakedQuad {
|
||||
private static final Vector4f POS = new Vector4f();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue