generated from FabricMC/fabric-example-mod
-
Notifications
You must be signed in to change notification settings - Fork 4
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
a00dd03
commit 20b5fd6
Showing
14 changed files
with
116 additions
and
127 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
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
25 changes: 0 additions & 25 deletions
25
...rc/main/java/uk/debb/vanilla_disable/mixin/command/enchantment/item/MixinEnchantment.java
This file was deleted.
Oops, something went wrong.
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
31 changes: 31 additions & 0 deletions
31
common/src/main/java/uk/debb/vanilla_disable/mixin/command/item/food/MixinCakeBlock.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,31 @@ | ||
/* | ||
* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. | ||
*/ | ||
|
||
package uk.debb.vanilla_disable.mixin.command.item.food; | ||
|
||
import net.minecraft.world.level.block.CakeBlock; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.ModifyArgs; | ||
import org.spongepowered.asm.mixin.injection.invoke.arg.Args; | ||
import uk.debb.vanilla_disable.data.command.CommandDataHandler; | ||
|
||
@Mixin(CakeBlock.class) | ||
public abstract class MixinCakeBlock { | ||
@ModifyArgs( | ||
method = "eat", | ||
at = @At( | ||
value = "INVOKE", | ||
target = "Lnet/minecraft/world/food/FoodData;eat(IF)V" | ||
) | ||
) | ||
private static void vanillaDisable$eat(Args args) { | ||
int nutrition = CommandDataHandler.getCachedInt("items", "minecraft:cake", "nutrition"); | ||
float saturation = (float) CommandDataHandler.getCachedDouble("items", "minecraft:cake", "saturation"); | ||
args.set(0, nutrition); | ||
args.set(1, saturation); | ||
} | ||
} |
44 changes: 44 additions & 0 deletions
44
common/src/main/java/uk/debb/vanilla_disable/mixin/command/item/food/MixinPlayer.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,44 @@ | ||
/* | ||
* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. | ||
*/ | ||
|
||
package uk.debb.vanilla_disable.mixin.command.item.food; | ||
|
||
import com.llamalad7.mixinextras.injector.v2.WrapWithCondition; | ||
import net.minecraft.world.entity.player.Player; | ||
import net.minecraft.world.food.FoodData; | ||
import net.minecraft.world.food.FoodProperties; | ||
import net.minecraft.world.item.ItemStack; | ||
import net.minecraft.world.level.Level; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.Shadow; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Inject; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; | ||
import uk.debb.vanilla_disable.data.command.CommandDataHandler; | ||
|
||
@Mixin(Player.class) | ||
public abstract class MixinPlayer { | ||
@Shadow public abstract FoodData getFoodData(); | ||
|
||
@Inject(method = "eat", at = @At("HEAD")) | ||
private void vanillaDisable$eat(Level level, ItemStack itemStack, FoodProperties foodProperties, CallbackInfoReturnable<ItemStack> cir) { | ||
String name = CommandDataHandler.getKeyFromItemRegistry(itemStack.getItem()); | ||
int nutrition = CommandDataHandler.getCachedInt("items", name, "nutrition"); | ||
float saturation = (float) CommandDataHandler.getCachedDouble("items", name, "saturation"); | ||
this.getFoodData().eat(nutrition, saturation); | ||
} | ||
|
||
@WrapWithCondition( | ||
method = "eat", | ||
at = @At( | ||
value = "INVOKE", | ||
target = "Lnet/minecraft/world/food/FoodData;eat(Lnet/minecraft/world/food/FoodProperties;)V" | ||
) | ||
) | ||
private boolean vanillaDisable$eat1(FoodData instance, FoodProperties foodProperties) { | ||
return false; | ||
} | ||
} |
34 changes: 0 additions & 34 deletions
34
common/src/main/java/uk/debb/vanilla_disable/mixin/command/item/other/MixinFoodData.java
This file was deleted.
Oops, something went wrong.
24 changes: 0 additions & 24 deletions
24
common/src/main/java/uk/debb/vanilla_disable/mixin/worldgen/feature/MixinServerLevel.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.