Skip to content

Commit

Permalink
add mc tweak disableHoneyBlockEffect (#74)
Browse files Browse the repository at this point in the history
* add mc tweak disableHoneyBlockEffect

* change to improve implementation (ModifyExpressionValue)

* fixed coding style, and import

* added disableHoneyBlockEffect name, description in lang file

* changed indent

* Added zh_cn docs and finishing doc stuffs for mc tweak `disableHoneyBlockEffect`

---------

Co-authored-by: Fallen_Breath <[email protected]>
  • Loading branch information
topi-banana and Fallen-Breath authored Sep 3, 2024
1 parent 7a3d22b commit a7a159e
Show file tree
Hide file tree
Showing 10 changed files with 223 additions and 0 deletions.
12 changes: 12 additions & 0 deletions docs/document-en_us.md
Original file line number Diff line number Diff line change
Expand Up @@ -1340,6 +1340,18 @@ See also: option f3BEntityFacingVectorLength
- Default value: *no hotkey*, `false`


### disableHoneyBlockEffect

Disable honey block effects such as "slowdown", "cannot jump"

- Category: MC Tweaks
- Type: hotkey togglable boolean (Disable)
- Default value: *no hotkey*, `false`
- Mod restrictions:
- Required mods:
- Minecraft (`minecraft`) `>=1.15`


### disableHorizonShadingRendering

Prevent the horizon from turning dark when you are nearby the world's bottom y
Expand Down
12 changes: 12 additions & 0 deletions docs/document-zh_cn.md
Original file line number Diff line number Diff line change
Expand Up @@ -1336,6 +1336,18 @@ schematicBlockPlacement的严格模式
- 默认值: *无快捷键*, `false`


### 禁用蜂蜜块效果 (disableHoneyBlockEffect)

禁用蜂蜜块对玩家造成的各类效果,如移动减速、跳跃阻止等

- 分类: MC修改
- 类型: 带热键布尔值 (禁用)
- 默认值: *无快捷键*, `false`
- 模组约束:
- 依赖模组:
- Minecraft (`minecraft`) `>=1.15`


### 禁用地平线渲染变暗 (disableHorizonShadingRendering)

阻止地平线在玩家接近世界最低y值时变暗的渲染效果
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -458,6 +458,9 @@ public class TweakerMoreConfigs
@Config(type = Config.Type.TWEAK, category = Config.Category.MC_TWEAKS)
public static final TweakerMoreConfigBooleanHotkeyed DISABLE_F3_B_ENTITY_FACING_VECTOR = newConfigBooleanHotkeyed("disableF3BEntityFacingVector");

@Config(type = Config.Type.DISABLE, restriction = @Restriction(require = @Condition(value = ModIds.minecraft, versionPredicates = ">=1.15")), category = Config.Category.MC_TWEAKS)
public static final TweakerMoreConfigBooleanHotkeyed DISABLE_HONEY_BLOCK_EFFECT = newConfigBooleanHotkeyed("disableHoneyBlockEffect");

@Config(type = Config.Type.DISABLE, category = Config.Category.MC_TWEAKS)
public static final TweakerMoreConfigBooleanHotkeyed DISABLE_HORIZON_SHADING_RENDERING = newConfigBooleanHotkeyed("disableHorizonShadingRendering");

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
/*
* This file is part of the TweakerMore project, licensed under the
* GNU Lesser General Public License v3.0
*
* Copyright (C) 2023 Fallen_Breath and contributors
*
* TweakerMore is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* TweakerMore is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with TweakerMore. If not, see <https://www.gnu.org/licenses/>.
*/

package me.fallenbreath.tweakermore.mixins.tweaks.mc_tweaks.disableHoneyBlockEffect;

import me.fallenbreath.conditionalmixin.api.annotation.Condition;
import me.fallenbreath.conditionalmixin.api.annotation.Restriction;
import me.fallenbreath.tweakermore.config.TweakerMoreConfigs;
import me.fallenbreath.tweakermore.util.ModIds;
import net.minecraft.block.Block;
import net.minecraft.block.Blocks;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;

@Restriction(require = @Condition(value = ModIds.minecraft, versionPredicates = ">=1.15"))
@Mixin(Block.class)
public abstract class BlockMixin
{
@Inject(method = "getJumpVelocityMultiplier", at = @At("HEAD"), cancellable = true)
private void getJumpVelocityMultiplier(CallbackInfoReturnable<Float> cir)
{
if (TweakerMoreConfigs.DISABLE_HONEY_BLOCK_EFFECT.getBooleanValue())
{
Block self = (Block) (Object) this;
if (self == Blocks.HONEY_BLOCK)
{
cir.setReturnValue(1.0F);
}
}
}
@Inject(method = "getVelocityMultiplier", at = @At("HEAD"), cancellable = true)
private void getVelocityMultiplier(CallbackInfoReturnable<Float> cir)
{
if (TweakerMoreConfigs.DISABLE_HONEY_BLOCK_EFFECT.getBooleanValue())
{
Block self = (Block) (Object) this;
if (self == Blocks.HONEY_BLOCK)
{
cir.setReturnValue(1.0F);
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
/*
* This file is part of the TweakerMore project, licensed under the
* GNU Lesser General Public License v3.0
*
* Copyright (C) 2023 Fallen_Breath and contributors
*
* TweakerMore is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* TweakerMore is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with TweakerMore. If not, see <https://www.gnu.org/licenses/>.
*/

package me.fallenbreath.tweakermore.mixins.tweaks.mc_tweaks.disableHoneyBlockEffect;

import com.llamalad7.mixinextras.injector.ModifyExpressionValue;
import com.llamalad7.mixinextras.sugar.Local;
import me.fallenbreath.conditionalmixin.api.annotation.Condition;
import me.fallenbreath.conditionalmixin.api.annotation.Restriction;
import me.fallenbreath.tweakermore.config.TweakerMoreConfigs;
import me.fallenbreath.tweakermore.util.ModIds;
import net.minecraft.block.HoneyBlock;
import net.minecraft.client.MinecraftClient;
import net.minecraft.entity.Entity;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;

@Restriction(require = @Condition(value = ModIds.minecraft, versionPredicates = ">=1.15"))
@Mixin(HoneyBlock.class)
public abstract class HoneyBlockMixin
{
@ModifyExpressionValue(
method = "onEntityCollision",
at = @At(value = "INVOKE", target = "Lnet/minecraft/block/HoneyBlock;isSliding(Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/entity/Entity;)Z")
)
private boolean isSliding(boolean original, @Local(argsOnly = true) Entity entity)
{
if (original
&& TweakerMoreConfigs.DISABLE_HONEY_BLOCK_EFFECT.getBooleanValue()
&& entity == MinecraftClient.getInstance().player)
{
return false;
}
else
{
return original;
}
}
}
5 changes: 5 additions & 0 deletions src/main/resources/assets/tweakermore/lang/en_us.yml
Original file line number Diff line number Diff line change
Expand Up @@ -507,6 +507,11 @@ tweakermore:
Disable the rendered entity facing vector line when F3 + B is on
See also: option @option#f3BEntityFacingVectorLength@
pretty_name: Disable F3+B Entity Facing Vector
disableHoneyBlockEffect:
.: disableHoneyBlockEffect
comment: |-
Disable honey block effects such as "slowdown", "cannot jump"
pretty_name: Disable Honey Block Effect
disableHorizonShadingRendering:
.: disableHorizonShadingRendering
comment: |-
Expand Down
5 changes: 5 additions & 0 deletions src/main/resources/assets/tweakermore/lang/zh_cn.yml
Original file line number Diff line number Diff line change
Expand Up @@ -507,6 +507,11 @@ tweakermore:
在启用F3+B实体碰撞箱显示后,禁用渲染代表实体朝向的线段
另见:选项 @option#f3BEntityFacingVectorLength@
pretty_name: 禁用F3+B实体朝向线段渲染
disableHoneyBlockEffect:
.: 禁用蜂蜜块效果
comment: |-
禁用蜂蜜块对玩家造成的各类效果,如移动减速、跳跃阻止等
pretty_name: 禁用蜂蜜块效果
disableHorizonShadingRendering:
.: 禁用地平线渲染变暗
comment: |-
Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/tweakermore.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@
"tweaks.mc_tweaks.disableEntityRenderInterpolation.LivingEntityMixin",
"tweaks.mc_tweaks.disableEntityRenderInterpolation.WorldRendererMixin",
"tweaks.mc_tweaks.disableF3BEntityFacingVector.EntityRenderDispatcherMixin",
"tweaks.mc_tweaks.disableHoneyBlockEffect.BlockMixin",
"tweaks.mc_tweaks.disableHoneyBlockEffect.HoneyBlockMixin",
"tweaks.mc_tweaks.disableHorizonShadingRendering.BackgroundRendererMixin",
"tweaks.mc_tweaks.disableLightUpdates.ClientChunkManagerMixin",
"tweaks.mc_tweaks.disableLightUpdates.LightingProviderMixin",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*
* This file is part of the TweakerMore project, licensed under the
* GNU Lesser General Public License v3.0
*
* Copyright (C) 2023 Fallen_Breath and contributors
*
* TweakerMore is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* TweakerMore is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with TweakerMore. If not, see <https://www.gnu.org/licenses/>.
*/

package me.fallenbreath.tweakermore.mixins.tweaks.mc_tweaks.disableHoneyBlockEffect;

import me.fallenbreath.conditionalmixin.api.annotation.Condition;
import me.fallenbreath.conditionalmixin.api.annotation.Restriction;
import me.fallenbreath.tweakermore.util.ModIds;
import me.fallenbreath.tweakermore.util.mixin.DummyClass;
import org.spongepowered.asm.mixin.Mixin;

@Restriction(require = @Condition(value = ModIds.minecraft, versionPredicates = ">=1.15"))
@Mixin(DummyClass.class)
public abstract class BlockMixin
{
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*
* This file is part of the TweakerMore project, licensed under the
* GNU Lesser General Public License v3.0
*
* Copyright (C) 2023 Fallen_Breath and contributors
*
* TweakerMore is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* TweakerMore is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with TweakerMore. If not, see <https://www.gnu.org/licenses/>.
*/

package me.fallenbreath.tweakermore.mixins.tweaks.mc_tweaks.disableHoneyBlockEffect;

import me.fallenbreath.conditionalmixin.api.annotation.Condition;
import me.fallenbreath.conditionalmixin.api.annotation.Restriction;
import me.fallenbreath.tweakermore.util.ModIds;
import me.fallenbreath.tweakermore.util.mixin.DummyClass;
import org.spongepowered.asm.mixin.Mixin;

@Restriction(require = @Condition(value = ModIds.minecraft, versionPredicates = ">=1.15"))
@Mixin(DummyClass.class)
public abstract class HoneyBlockMixin
{
}

0 comments on commit a7a159e

Please sign in to comment.