Skip to content

Commit

Permalink
Fixed server not loading mod
Browse files Browse the repository at this point in the history
  • Loading branch information
AlurienFlame committed Aug 25, 2021
1 parent 76149f0 commit b6aaac2
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 24 deletions.
24 changes: 0 additions & 24 deletions src/main/java/net/balancedrecall/BalancedRecall.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,8 @@

import net.fabricmc.api.ModInitializer;
import net.fabricmc.fabric.api.item.v1.FabricItemSettings;
import net.fabricmc.fabric.api.object.builder.v1.client.model.FabricModelPredicateProviderRegistry;
import net.minecraft.client.world.ClientWorld;
import net.minecraft.entity.LivingEntity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemGroup;
import net.minecraft.item.ItemStack;
import net.minecraft.recipe.RecipeSerializer;
import net.minecraft.stat.StatFormatter;
import net.minecraft.stat.Stats;
Expand Down Expand Up @@ -36,26 +32,6 @@ public void onInitialize() {
Registry.register(Registry.ITEM, new Identifier(MODID, "dimensional_mirror"), DIMENSIONAL_MIRROR);
Registry.register(Registry.ITEM, new Identifier(MODID, "sleeping_mat"), SLEEPING_MAT);

// Model Predicates
FabricModelPredicateProviderRegistry.register(MAGIC_MIRROR, new Identifier("recalling"), (ItemStack itemStack, ClientWorld clientWorld, LivingEntity livingEntity, int seed) -> {
if (livingEntity == null || livingEntity.getActiveItem() != itemStack) {
return 0.0F;
}
return (itemStack.getMaxUseTime() - livingEntity.getItemUseTimeLeft()) / 20.0F;
});
FabricModelPredicateProviderRegistry.register(DIMENSIONAL_MIRROR, new Identifier("recalling"), (ItemStack itemStack, ClientWorld clientWorld, LivingEntity livingEntity, int seed) -> {
if (livingEntity == null || livingEntity.getActiveItem() != itemStack) {
return 0.0F;
}
return (itemStack.getMaxUseTime() - livingEntity.getItemUseTimeLeft()) / 20.0F;
});
FabricModelPredicateProviderRegistry.register(MAGIC_MIRROR, new Identifier("broken"), (ItemStack itemStack, ClientWorld clientWorld, LivingEntity livingEntity, int seed) -> {
return (itemStack.getDamage() >= itemStack.getMaxDamage() - 1) ? 1F : 0F;
});
FabricModelPredicateProviderRegistry.register(DIMENSIONAL_MIRROR, new Identifier("broken"), (ItemStack itemStack, ClientWorld clientWorld, LivingEntity livingEntity, int seed) -> {
return (itemStack.getDamage() >= itemStack.getMaxDamage() - 1) ? 1F : 0F;
});

// Recipe
Registry.register(Registry.RECIPE_SERIALIZER, new Identifier(MODID, "mirror_repairing"), MIRROR_REPAIRING_SERIALIZER);

Expand Down
35 changes: 35 additions & 0 deletions src/main/java/net/balancedrecall/BalancedRecallClient.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package net.balancedrecall;

import net.fabricmc.api.ClientModInitializer;
import net.fabricmc.fabric.api.object.builder.v1.client.model.FabricModelPredicateProviderRegistry;
import net.minecraft.client.world.ClientWorld;
import net.minecraft.entity.LivingEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.util.Identifier;

public class BalancedRecallClient implements ClientModInitializer{

@Override
public void onInitializeClient() {
// Model Predicates
FabricModelPredicateProviderRegistry.register(BalancedRecall.MAGIC_MIRROR, new Identifier("recalling"), (ItemStack itemStack, ClientWorld clientWorld, LivingEntity livingEntity, int seed) -> {
if (livingEntity == null || livingEntity.getActiveItem() != itemStack) {
return 0.0F;
}
return (itemStack.getMaxUseTime() - livingEntity.getItemUseTimeLeft()) / 20.0F;
});
FabricModelPredicateProviderRegistry.register(BalancedRecall.DIMENSIONAL_MIRROR, new Identifier("recalling"), (ItemStack itemStack, ClientWorld clientWorld, LivingEntity livingEntity, int seed) -> {
if (livingEntity == null || livingEntity.getActiveItem() != itemStack) {
return 0.0F;
}
return (itemStack.getMaxUseTime() - livingEntity.getItemUseTimeLeft()) / 20.0F;
});
FabricModelPredicateProviderRegistry.register(BalancedRecall.MAGIC_MIRROR, new Identifier("broken"), (ItemStack itemStack, ClientWorld clientWorld, LivingEntity livingEntity, int seed) -> {
return (itemStack.getDamage() >= itemStack.getMaxDamage() - 1) ? 1F : 0F;
});
FabricModelPredicateProviderRegistry.register(BalancedRecall.DIMENSIONAL_MIRROR, new Identifier("broken"), (ItemStack itemStack, ClientWorld clientWorld, LivingEntity livingEntity, int seed) -> {
return (itemStack.getDamage() >= itemStack.getMaxDamage() - 1) ? 1F : 0F;
});
}

}
3 changes: 3 additions & 0 deletions src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
"entrypoints": {
"main": [
"net.balancedrecall.BalancedRecall"
],
"client": [
"net.balancedrecall.BalancedRecallClient"
]
},
"mixins": [
Expand Down

0 comments on commit b6aaac2

Please sign in to comment.