Merge remote-tracking branch 'origin/1.18.2' into 1.18.2

This commit is contained in:
Frank 2022-06-08 10:22:50 +02:00
commit f9ce865a46
2 changed files with 21 additions and 15 deletions

View file

@ -1,7 +1,5 @@
package ru.bclib.blocks;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.client.renderer.block.model.BlockModel;
import net.minecraft.client.resources.model.BlockModelRotation;
import net.minecraft.client.resources.model.UnbakedModel;
@ -11,7 +9,10 @@ import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.ButtonBlock;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.properties.AttachFace;
import org.jetbrains.annotations.Nullable;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import ru.bclib.client.models.BasePatterns;
import ru.bclib.client.models.ModelsHelper;
import ru.bclib.client.models.PatternsHelper;
@ -20,15 +21,16 @@ import ru.bclib.interfaces.LootProvider;
import java.util.Map;
import java.util.Optional;
import org.jetbrains.annotations.Nullable;
public abstract class BaseButtonBlock extends ButtonBlock implements BlockModelProvider, LootProvider {
private final Block parent;
protected BaseButtonBlock(Block parent, Properties properties, boolean sensitive) {
super(sensitive, properties);
super(sensitive, properties.noCollission());
this.parent = parent;
}
@Override
@Environment(EnvType.CLIENT)
public BlockModel getItemModel(ResourceLocation blockId) {
@ -36,21 +38,25 @@ public abstract class BaseButtonBlock extends ButtonBlock implements BlockModelP
Optional<String> pattern = PatternsHelper.createJson(BasePatterns.ITEM_BUTTON, parentId);
return ModelsHelper.fromPattern(pattern);
}
@Override
@Environment(EnvType.CLIENT)
public @Nullable BlockModel getBlockModel(ResourceLocation resourceLocation, BlockState blockState) {
ResourceLocation parentId = Registry.BLOCK.getKey(parent);
Optional<String> pattern = blockState.getValue(POWERED) ? PatternsHelper.createJson(
BasePatterns.BLOCK_BUTTON_PRESSED,
parentId
) : PatternsHelper.createJson(BasePatterns.BLOCK_BUTTON, parentId);
Optional<String> pattern = blockState.getValue(POWERED)
? PatternsHelper.createJson(
BasePatterns.BLOCK_BUTTON_PRESSED,
parentId
)
: PatternsHelper.createJson(BasePatterns.BLOCK_BUTTON, parentId);
return ModelsHelper.fromPattern(pattern);
}
@Override
@Environment(EnvType.CLIENT)
public UnbakedModel getModelVariant(ResourceLocation stateId, 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(stateId.getNamespace(), "block/" + stateId.getPath() + powered);
registerBlockModel(stateId, modelId, blockState, modelCache);

View file

@ -38,7 +38,7 @@
"title.bclib.syncfiles.modlist": "Mod Information",
"message.bclib.syncfiles.modlist": "The following shows the state of your installed installed Mods.\n\nAll Mods that do not exist locally, or have a different version on the Server will be synchronized.",
"title.bclib.modmissmatch": "Mod Version Conflict",
"message.bclib.modmissmatch": "Some Mods on this client do not match the version of Mods on the Server.\n\nMismatching Mods can result in odd game behavior or crashes. Please make sue that you use the same mods as the server.",
"message.bclib.modmissmatch": "Some Mods on this client do not match the version of Mods on the Server.\n\nMismatching Mods can result in odd game behavior or crashes. Please make sure that you use the same mods as the server.",
"message.bclib.datafixer.progress.waitbackup": "Waiting for Backup to finish. This may take a while!",
"message.bclib.datafixer.progress.reading": "Reading Data",
@ -57,4 +57,4 @@
"title.config.bclib.client.rendering.netherThickFog": "Nether Thick Fog",
"tooltip.bclib.place_on": "Survives on: %s"
}
}