Skip to content

Commit

Permalink
Added feature infoViewGrowthSpeed
Browse files Browse the repository at this point in the history
  • Loading branch information
Fallen-Breath committed Feb 20, 2024
1 parent 037cad7 commit 431b6c7
Show file tree
Hide file tree
Showing 42 changed files with 1,693 additions and 390 deletions.
Binary file added docs/assets/infoViewGrowthSpeed-en_us.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/assets/infoViewGrowthSpeed-zh_cn.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
56 changes: 50 additions & 6 deletions docs/document-en_us.md
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ The target selecting strategy of infoViewBeacon
- Category: Features
- Type: option list (List)
- Default value: `Pointed`
- Available options: `Pointed`, `Beam`
- Available options: `Pointed`, `Beam`, `Range`


### infoViewBeamAngle
Expand Down Expand Up @@ -342,7 +342,7 @@ The target selecting strategy of infoViewCommandBlock
- Category: Features
- Type: option list (List)
- Default value: `Pointed`
- Available options: `Pointed`, `Beam`
- Available options: `Pointed`, `Beam`, `Range`


### infoViewCommandBlockTextScale
Expand Down Expand Up @@ -386,7 +386,51 @@ The target selecting strategy of infoViewComparator
- Category: Features
- Type: option list (List)
- Default value: `Beam`
- Available options: `Pointed`, `Beam`
- Available options: `Pointed`, `Beam`, `Range`


### infoViewGrowthSpeed

Display growth speed of crop blocks, weathering speed of copper blocks, and related information

Note: The chance displayed is the probability after a random tick selection

- Category: Features
- Type: hotkey togglable boolean (Tweak)
- Default value: *no hotkey*, `false`

![infoViewGrowthSpeed](assets/infoViewGrowthSpeed-en_us.png)


### infoViewGrowthSpeedRenderST (infoViewGrowthSpeedRenderStrategy)

The view rendering strategy of infoViewGrowthSpeed

- Category: Features
- Type: option list (List)
- Default value: `Always`
- Available options: `View hotkey held`, `Always`


### infoViewGrowthSpeedTargetST (infoViewGrowthSpeedTargetStrategy)

The target selecting strategy of infoViewGrowthSpeed

- Category: Features
- Type: option list (List)
- Default value: `Range`
- Available options: `Pointed`, `Beam`, `Range`


### infoViewGrowthSpeedTextScale

Scale of the displayed text rendered by infoViewGrowthSpeed

- Category: Features
- Type: double (Generic)
- Default value: `0.6`
- Minimum value: `0.1`
- Maximum value: `3.0`


### infoViewHopper
Expand Down Expand Up @@ -419,7 +463,7 @@ The target selecting strategy of infoViewHopper
- Category: Features
- Type: option list (List)
- Default value: `Beam`
- Available options: `Pointed`, `Beam`
- Available options: `Pointed`, `Beam`, `Range`


### infoViewRedstoneDustUpdateOrder
Expand Down Expand Up @@ -497,7 +541,7 @@ The target selecting strategy of infoViewRespawnBlockExplosion
- Category: Features
- Type: option list (List)
- Default value: `Beam`
- Available options: `Pointed`, `Beam`
- Available options: `Pointed`, `Beam`, `Range`


### infoViewRespawnBlockExplosionTextAlpha
Expand Down Expand Up @@ -567,7 +611,7 @@ The target selecting strategy of infoViewStructureBlock
- Category: Features
- Type: option list (List)
- Default value: `Pointed`
- Available options: `Pointed`, `Beam`
- Available options: `Pointed`, `Beam`, `Range`


### infoViewStructureBlockTextScale
Expand Down
56 changes: 50 additions & 6 deletions docs/document-zh_cn.md
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ TweakerMore提供的新功能
- 分类: 功能
- 类型: 选项列表 (列表)
- 默认值: `指向`
- 可用选项: `指向`, `光束`
- 可用选项: `指向`, `光束`, `范围`


### 信息展示设置-光束渲染策略角度 (infoViewBeamAngle)
Expand Down Expand Up @@ -342,7 +342,7 @@ TweakerMore提供的新功能
- 分类: 功能
- 类型: 选项列表 (列表)
- 默认值: `指向`
- 可用选项: `指向`, `光束`
- 可用选项: `指向`, `光束`, `范围`


### 信息展示-命令方块-文本缩放 (infoViewCommandBlockTextScale)
Expand Down Expand Up @@ -384,7 +384,51 @@ TweakerMore提供的新功能
- 分类: 功能
- 类型: 选项列表 (列表)
- 默认值: `光束`
- 可用选项: `指向`, `光束`
- 可用选项: `指向`, `光束`, `范围`


### 信息展示-生长速度 (infoViewGrowthSpeed)

展示作物类方块的生长速度、铜块的锈蚀速度,以及相关的信息

注:展示的概率是随机刻选择后的概率

- 分类: 功能
- 类型: 带热键布尔值 (工具)
- 默认值: *无快捷键*, `false`

![infoViewGrowthSpeed](assets/infoViewGrowthSpeed-zh_cn.png)


### 信息展示-生长速度-渲染策略 (infoViewGrowthSpeedRenderStrategy)

选项信息展示-生长速度的渲染策略

- 分类: 功能
- 类型: 选项列表 (列表)
- 默认值: `总是`
- 可用选项: `按住展示热键`, `总是`


### 信息展示-生长速度-目标策略 (infoViewGrowthSpeedTargetStrategy)

选项信息展示-生长速度的目标选择策略

- 分类: 功能
- 类型: 选项列表 (列表)
- 默认值: `范围`
- 可用选项: `指向`, `光束`, `范围`


### 信息展示-生长速度-文本缩放 (infoViewGrowthSpeedTextScale)

选项信息展示-生长速度渲染的文本的缩放比例

- 分类: 功能
- 类型: 实数 (通用)
- 默认值: `0.6`
- 最小值: `0.1`
- 最大值: `3.0`


### 信息展示-漏斗 (infoViewHopper)
Expand Down Expand Up @@ -415,7 +459,7 @@ TweakerMore提供的新功能
- 分类: 功能
- 类型: 选项列表 (列表)
- 默认值: `光束`
- 可用选项: `指向`, `光束`
- 可用选项: `指向`, `光束`, `范围`


### 信息展示-红石粉更新顺序 (infoViewRedstoneDustUpdateOrder)
Expand Down Expand Up @@ -493,7 +537,7 @@ TweakerMore提供的新功能
- 分类: 功能
- 类型: 选项列表 (列表)
- 默认值: `光束`
- 可用选项: `指向`, `光束`
- 可用选项: `指向`, `光束`, `范围`


### 信息展示-重生方块爆炸伤害-文本透明度 (infoViewRespawnBlockExplosionTextAlpha)
Expand Down Expand Up @@ -563,7 +607,7 @@ TweakerMore提供的新功能
- 分类: 功能
- 类型: 选项列表 (列表)
- 默认值: `指向`
- 可用选项: `指向`, `光束`
- 可用选项: `指向`, `光束`, `范围`


### 信息展示-结构方块-文本缩放 (infoViewStructureBlockTextScale)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,18 @@ public class TweakerMoreConfigs
@Config(type = Config.Type.GENERIC, category = Config.Category.FEATURES)
public static final TweakerMoreConfigDouble INFO_VIEW_COMMAND_BLOCK_TEXT_SCALE = newConfigDouble("infoViewCommandBlockTextScale", 1, 0.1, 3);

@Config(type = Config.Type.TWEAK, category = Config.Category.FEATURES)
public static final TweakerMoreConfigBooleanHotkeyed INFO_VIEW_GROWTH_SPEED = newConfigBooleanHotkeyed("infoViewGrowthSpeed");

@Config(type = Config.Type.LIST, category = Config.Category.FEATURES)
public static final TweakerMoreConfigOptionList INFO_VIEW_GROWTH_SPEED_RENDER_STRATEGY = newConfigOptionList("infoViewGrowthSpeedRenderStrategy", InfoViewRenderStrategy.ALWAYS);

@Config(type = Config.Type.LIST, category = Config.Category.FEATURES)
public static final TweakerMoreConfigOptionList INFO_VIEW_GROWTH_SPEED_TARGET_STRATEGY = newConfigOptionList("infoViewGrowthSpeedTargetStrategy", InfoViewTargetStrategy.RANGE);

@Config(type = Config.Type.GENERIC, category = Config.Category.FEATURES)
public static final TweakerMoreConfigDouble INFO_VIEW_GROWTH_SPEED_TEXT_SCALE = newConfigDouble("infoViewGrowthSpeedTextScale", 0.6, 0.1, 3);

@Config(type = Config.Type.TWEAK, category = Config.Category.FEATURES)
public static final TweakerMoreConfigBooleanHotkeyed INFO_VIEW_HOPPER = newConfigBooleanHotkeyed("infoViewHopper");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
public enum InfoViewTargetStrategy implements EnumOptionEntry
{
POINTED,
BEAM;
BEAM,
RANGE;

public static final InfoViewTargetStrategy DEFAULT = POINTED;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,51 +24,25 @@
import me.fallenbreath.tweakermore.config.TweakerMoreConfigs;
import me.fallenbreath.tweakermore.config.options.TweakerMoreConfigOptionList;
import me.fallenbreath.tweakermore.config.options.listentries.InfoViewRenderStrategy;
import me.fallenbreath.tweakermore.config.options.listentries.InfoViewTargetStrategy;
import me.fallenbreath.tweakermore.util.render.context.RenderContext;
import net.minecraft.block.BlockState;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import org.jetbrains.annotations.Nullable;

import java.util.function.Supplier;

public abstract class AbstractInfoViewer
public abstract class AbstractInfoViewer implements InfoViewer
{
private final IConfigBoolean switchConfig;
private final Supplier<InfoViewRenderStrategy> renderStrategySupplier;
private final Supplier<InfoViewTargetStrategy> targetStrategySupplier;
protected final IConfigBoolean switchConfig;
protected final Supplier<InfoViewRenderStrategy> renderStrategySupplier;

public AbstractInfoViewer(IConfigBoolean switchConfig, Supplier<InfoViewRenderStrategy> renderStrategySupplier, Supplier<InfoViewTargetStrategy> targetStrategySupplier)
public AbstractInfoViewer(IConfigBoolean switchConfig, Supplier<InfoViewRenderStrategy> renderStrategySupplier)
{
this.switchConfig = switchConfig;
this.renderStrategySupplier = renderStrategySupplier;
this.targetStrategySupplier = targetStrategySupplier;
}
public AbstractInfoViewer(IConfigBoolean switchConfig, TweakerMoreConfigOptionList renderStrategyOption, TweakerMoreConfigOptionList targetStrategyOption)
public AbstractInfoViewer(IConfigBoolean switchConfig, TweakerMoreConfigOptionList renderStrategyOption)
{
this(switchConfig, () -> (InfoViewRenderStrategy)renderStrategyOption.getOptionListValue(), () -> (InfoViewTargetStrategy)targetStrategyOption.getOptionListValue());
this(switchConfig, () -> (InfoViewRenderStrategy)renderStrategyOption.getOptionListValue());
}
public AbstractInfoViewer(IConfigBoolean switchConfig, TweakerMoreConfigOptionList renderStrategyOption, Supplier<InfoViewTargetStrategy> targetStrategySupplier)
{
this(switchConfig, () -> (InfoViewRenderStrategy)renderStrategyOption.getOptionListValue(), targetStrategySupplier);
}

/**
* If this viewer works for and should render for given context
*
* @param world The current world get from {@link fi.dy.masa.malilib.util.WorldUtils#getBestWorld}
* @param blockPos The block pos the player looking at
* @param blockState The block state the player looking at
* @param blockEntity The block entity the player looking at, nullable
*/
public abstract boolean shouldRenderFor(World world, BlockPos blockPos, BlockState blockState, @Nullable BlockEntity blockEntity);

public abstract boolean requireBlockEntitySyncing(World world, BlockPos blockPos, BlockState blockState, @Nullable BlockEntity blockEntity);

public abstract void render(RenderContext context, World world, BlockPos blockPos, BlockState blockState, BlockEntity blockEntity);

@Override
public boolean isRenderEnabled()
{
if (this.switchConfig.getBooleanValue())
Expand All @@ -83,28 +57,4 @@ public boolean isRenderEnabled()
}
return false;
}

public boolean isValidTarget(boolean crossHairPointed)
{
switch (this.targetStrategySupplier.get())
{
case POINTED:
return crossHairPointed;
case BEAM:
return true;
}
return false;
}

public void onInfoViewStart()
{
}

public void onInfoViewEnd()
{
}

public void onClientTick()
{
}
}
Loading

0 comments on commit 431b6c7

Please sign in to comment.