Changed models loading (Done)

This commit is contained in:
Aleksey 2021-05-24 15:04:16 +03:00
parent 831faeb306
commit 5da634fc73
63 changed files with 490 additions and 729 deletions

View file

@ -36,20 +36,7 @@ public abstract class EndButtonBlock extends ButtonBlock implements BlockModelPr
}
@Override
public Optional<String> getModelString(String block) {
ResourceLocation blockId = Registry.BLOCK.getKey(this);
ResourceLocation parentId = Registry.BLOCK.getKey(parent);
if (block.contains("item")) {
return Patterns.createJson(Patterns.ITEM_BUTTON, parentId.getPath(), blockId.getPath());
}
if (block.contains("pressed")) {
return Patterns.createJson(Patterns.BLOCK_BUTTON_PRESSED, parentId.getPath(), blockId.getPath());
}
return Patterns.createJson(Patterns.BLOCK_BUTTON, parentId.getPath(), blockId.getPath());
}
@Override
public BlockModel getModel(ResourceLocation blockId) {
public BlockModel getItemModel(ResourceLocation blockId) {
ResourceLocation parentId = Registry.BLOCK.getKey(parent);
Optional<String> pattern = Patterns.createJson(Patterns.ITEM_BUTTON, parentId.getPath(), blockId.getPath());
return ModelsHelper.fromPattern(pattern);
@ -66,11 +53,11 @@ public abstract class EndButtonBlock extends ButtonBlock implements BlockModelPr
}
@Override
public UnbakedModel getModelVariant(ResourceLocation resourceLocation, BlockState blockState, Map<ResourceLocation, UnbakedModel> modelCache) {
public UnbakedModel getModelVariant(ResourceLocation stateId, BlockState blockState, Map<ResourceLocation, UnbakedModel> modelCache) {
String powered = blockState.getValue(POWERED) ? "_powered" : "";
ResourceLocation modelId = new ResourceLocation(resourceLocation.getNamespace(),
"block/" + resourceLocation.getPath() + powered);
registerBlockModel(resourceLocation, modelId, blockState, modelCache);
ResourceLocation modelId = new ResourceLocation(stateId.getNamespace(),
"block/" + stateId.getPath() + powered);
registerBlockModel(stateId, modelId, blockState, modelCache);
AttachFace face = blockState.getValue(FACE);
boolean isCeiling = face == AttachFace.CEILING;
int x = 0, y = 0;