Path model fix
This commit is contained in:
parent
2986556c97
commit
5da667261c
3 changed files with 9 additions and 2 deletions
|
@ -8,7 +8,7 @@ yarn_mappings=6
|
||||||
loader_version=0.11.3
|
loader_version=0.11.3
|
||||||
|
|
||||||
# Mod Properties
|
# Mod Properties
|
||||||
mod_version = 0.1.8
|
mod_version = 0.1.9
|
||||||
maven_group = ru.bclib
|
maven_group = ru.bclib
|
||||||
archives_base_name = bclib
|
archives_base_name = bclib
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,7 @@ import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
|
import net.minecraft.core.Registry;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
import com.google.common.collect.Maps;
|
import com.google.common.collect.Maps;
|
||||||
|
@ -32,8 +33,11 @@ import ru.bclib.client.models.PatternsHelper;
|
||||||
public class BasePathBlock extends BaseBlockNotFull {
|
public class BasePathBlock extends BaseBlockNotFull {
|
||||||
private static final VoxelShape SHAPE = Block.box(0, 0, 0, 16, 15, 16);
|
private static final VoxelShape SHAPE = Block.box(0, 0, 0, 16, 15, 16);
|
||||||
|
|
||||||
|
private final Block base;
|
||||||
|
|
||||||
public BasePathBlock(Block source) {
|
public BasePathBlock(Block source) {
|
||||||
super(FabricBlockSettings.copyOf(source).isValidSpawn((state, world, pos, type) -> { return false; }));
|
super(FabricBlockSettings.copyOf(source).isValidSpawn((state, world, pos, type) -> { return false; }));
|
||||||
|
this.base = source;
|
||||||
if (source instanceof BaseTerrainBlock) {
|
if (source instanceof BaseTerrainBlock) {
|
||||||
BaseTerrainBlock terrain = (BaseTerrainBlock) source;
|
BaseTerrainBlock terrain = (BaseTerrainBlock) source;
|
||||||
terrain.setPathBlock(this);
|
terrain.setPathBlock(this);
|
||||||
|
@ -67,10 +71,13 @@ public class BasePathBlock extends BaseBlockNotFull {
|
||||||
@Override
|
@Override
|
||||||
public @Nullable BlockModel getBlockModel(ResourceLocation resourceLocation, BlockState blockState) {
|
public @Nullable BlockModel getBlockModel(ResourceLocation resourceLocation, BlockState blockState) {
|
||||||
String name = resourceLocation.getPath();
|
String name = resourceLocation.getPath();
|
||||||
|
ResourceLocation baseId = Registry.BLOCK.getKey(base);
|
||||||
|
String bottom = baseId.getNamespace() + ":block/" + baseId.getPath();
|
||||||
Map<String, String> textures = Maps.newHashMap();
|
Map<String, String> textures = Maps.newHashMap();
|
||||||
textures.put("%modid%", resourceLocation.getNamespace());
|
textures.put("%modid%", resourceLocation.getNamespace());
|
||||||
textures.put("%top%", name + "_top");
|
textures.put("%top%", name + "_top");
|
||||||
textures.put("%side%", name.replace("_path", "") + "_side");
|
textures.put("%side%", name.replace("_path", "") + "_side");
|
||||||
|
textures.put("%bottom%", bottom);
|
||||||
Optional<String> pattern = PatternsHelper.createJson(BasePatterns.BLOCK_PATH, textures);
|
Optional<String> pattern = PatternsHelper.createJson(BasePatterns.BLOCK_PATH, textures);
|
||||||
return ModelsHelper.fromPattern(pattern);
|
return ModelsHelper.fromPattern(pattern);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,6 @@
|
||||||
"textures": {
|
"textures": {
|
||||||
"top": "%modid%:block/%top%",
|
"top": "%modid%:block/%top%",
|
||||||
"side": "%modid%:block/%side%",
|
"side": "%modid%:block/%side%",
|
||||||
"bottom": "%modid%:block/%bottom%"
|
"bottom": "%bottom%"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue