generated from Fallen-Breath/fabric-mod-template
-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add mc tweak disableHoneyBlockEffect (#74)
* 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
1 parent
7a3d22b
commit a7a159e
Showing
10 changed files
with
223 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 62 additions & 0 deletions
62
.../fallenbreath/tweakermore/mixins/tweaks/mc_tweaks/disableHoneyBlockEffect/BlockMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} | ||
} | ||
} |
56 changes: 56 additions & 0 deletions
56
...enbreath/tweakermore/mixins/tweaks/mc_tweaks/disableHoneyBlockEffect/HoneyBlockMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
.../fallenbreath/tweakermore/mixins/tweaks/mc_tweaks/disableHoneyBlockEffect/BlockMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
{ | ||
} |
33 changes: 33 additions & 0 deletions
33
...enbreath/tweakermore/mixins/tweaks/mc_tweaks/disableHoneyBlockEffect/HoneyBlockMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
{ | ||
} |