forked from FrozenBlock/WilderWild
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b6cb323
commit 827cd18
Showing
7 changed files
with
105 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
30 changes: 30 additions & 0 deletions
30
src/main/java/net/frozenblock/wilderwild/mixin/client/crab/MultiPlayerGameModeMixin.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,30 @@ | ||
package net.frozenblock.wilderwild.mixin.client.crab; | ||
|
||
import com.llamalad7.mixinextras.injector.ModifyReturnValue; | ||
import net.fabricmc.api.EnvType; | ||
import net.fabricmc.api.Environment; | ||
import net.frozenblock.wilderwild.registry.RegisterMobEffects; | ||
import net.minecraft.client.Minecraft; | ||
import net.minecraft.client.multiplayer.MultiPlayerGameMode; | ||
import org.spongepowered.asm.mixin.Final; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.Shadow; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
|
||
@Environment(EnvType.CLIENT) | ||
@Mixin(MultiPlayerGameMode.class) | ||
public class MultiPlayerGameModeMixin { | ||
|
||
@Shadow @Final | ||
private Minecraft minecraft; | ||
|
||
@ModifyReturnValue(method = "getPickRange", at = @At("RETURN")) | ||
public float wilderWild$getPickRange(float original) { | ||
if (this.minecraft.player != null && this.minecraft.player.hasEffect(RegisterMobEffects.REACH)) { | ||
int amplifier = this.minecraft.player.getEffect(RegisterMobEffects.REACH).getAmplifier() + 1; | ||
return original + (amplifier * 0.75F); | ||
} | ||
return original; | ||
} | ||
|
||
} |
27 changes: 27 additions & 0 deletions
27
src/main/java/net/frozenblock/wilderwild/mixin/entity/crab/ServerPlayerGameModeMixin.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,27 @@ | ||
package net.frozenblock.wilderwild.mixin.entity.crab; | ||
|
||
import com.llamalad7.mixinextras.injector.ModifyExpressionValue; | ||
import net.frozenblock.wilderwild.registry.RegisterMobEffects; | ||
import net.minecraft.server.level.ServerPlayer; | ||
import net.minecraft.server.level.ServerPlayerGameMode; | ||
import org.spongepowered.asm.mixin.Final; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.Shadow; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
|
||
@Mixin(ServerPlayerGameMode.class) | ||
public class ServerPlayerGameModeMixin { | ||
|
||
@Shadow @Final | ||
protected ServerPlayer player; | ||
|
||
@ModifyExpressionValue(method = "handleBlockBreakAction", at = @At(value = "FIELD", target = "Lnet/minecraft/server/network/ServerGamePacketListenerImpl;MAX_INTERACTION_DISTANCE:D")) | ||
public double wilderWild$handleBlockBreakAction(double original) { | ||
if (this.player != null && this.player.hasEffect(RegisterMobEffects.REACH)) { | ||
int amplifier = this.player.getEffect(RegisterMobEffects.REACH).getAmplifier() + 1; | ||
return original + (amplifier * 0.75); | ||
} | ||
return original; | ||
} | ||
|
||
} |
43 changes: 43 additions & 0 deletions
43
src/main/java/net/frozenblock/wilderwild/registry/RegisterMobEffects.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,43 @@ | ||
/* | ||
* Copyright 2023 FrozenBlock | ||
* This file is part of Wilder Wild. | ||
* | ||
* This program 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. | ||
* | ||
* This program 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 this program; if not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
package net.frozenblock.wilderwild.registry; | ||
|
||
import net.frozenblock.wilderwild.misc.WilderSharedConstants; | ||
import net.minecraft.core.Registry; | ||
import net.minecraft.core.registries.BuiltInRegistries; | ||
import net.minecraft.world.effect.MobEffect; | ||
import net.minecraft.world.effect.MobEffectCategory; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
public final class RegisterMobEffects { | ||
|
||
public static final MobEffect REACH = register("reach_boost", new MobEffect(MobEffectCategory.BENEFICIAL, 16646020)); | ||
|
||
private RegisterMobEffects() { | ||
throw new UnsupportedOperationException("RegisterMobEffects contains only static declarations."); | ||
} | ||
|
||
public static void init() { | ||
WilderSharedConstants.logWild("Registering MobEffects for", WilderSharedConstants.UNSTABLE_LOGGING); | ||
} | ||
|
||
private static @NotNull MobEffect register(String id, MobEffect entry) { | ||
return Registry.register(BuiltInRegistries.MOB_EFFECT, WilderSharedConstants.id(id), entry); | ||
} | ||
} |
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
Binary file added
BIN
+280 Bytes
src/main/resources/assets/wilderwild/textures/mob_effect/reach_boost.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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