-
-
Notifications
You must be signed in to change notification settings - Fork 247
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: 秋雨落 <[email protected]>
- Loading branch information
Showing
11 changed files
with
74 additions
and
37 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
37 changes: 37 additions & 0 deletions
37
...java/io/izzel/arclight/common/mixin/core/world/level/block/CropBlockMixin_NoNeoForge.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,37 @@ | ||
package io.izzel.arclight.common.mixin.core.world.level.block; | ||
|
||
import io.izzel.arclight.api.ArclightPlatform; | ||
import io.izzel.arclight.common.bridge.core.world.WorldBridge; | ||
import io.izzel.arclight.common.mod.mixins.annotation.OnlyInPlatform; | ||
import net.minecraft.core.BlockPos; | ||
import net.minecraft.world.level.BlockGetter; | ||
import net.minecraft.world.level.block.Block; | ||
import net.minecraft.world.level.block.Blocks; | ||
import net.minecraft.world.level.block.CropBlock; | ||
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; | ||
|
||
@OnlyInPlatform(value = {ArclightPlatform.FABRIC, ArclightPlatform.FORGE, ArclightPlatform.VANILLA}) | ||
@Mixin(CropBlock.class) | ||
public abstract class CropBlockMixin_NoNeoForge extends BlockMixin { | ||
@Inject(method = "getGrowthSpeed", cancellable = true, at = @At("RETURN")) | ||
private static void arclight$spigotModifier(Block block, BlockGetter blockGetter, BlockPos pos, CallbackInfoReturnable<Float> cir) { | ||
if (blockGetter instanceof WorldBridge bridge) { | ||
int modifier; | ||
if (block == Blocks.BEETROOTS) { | ||
modifier = bridge.bridge$spigotConfig().beetrootModifier; | ||
} else if (block == Blocks.CARROTS) { | ||
modifier = bridge.bridge$spigotConfig().carrotModifier; | ||
} else if (block == Blocks.POTATOES) { | ||
modifier = bridge.bridge$spigotConfig().potatoModifier; | ||
} else { | ||
modifier = bridge.bridge$spigotConfig().wheatModifier; | ||
} | ||
var f = cir.getReturnValueF(); | ||
f /= (100F / modifier); | ||
cir.setReturnValue(f); | ||
} | ||
} | ||
} |
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
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
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