-
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
Showing
6 changed files
with
309 additions
and
75 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,191 @@ | ||
package ro.fishmc; | ||
|
||
import net.fabric_extras.ranged_weapon.api.CustomBow; | ||
import net.fabric_extras.ranged_weapon.api.RangedConfig; | ||
import net.fabricmc.api.ModInitializer; | ||
|
||
import net.fabricmc.fabric.api.registry.FabricBrewingRecipeRegistryBuilder; | ||
import net.minecraft.core.Holder; | ||
import net.minecraft.core.Registry; | ||
import net.minecraft.core.registries.BuiltInRegistries; | ||
import net.minecraft.resources.ResourceLocation; | ||
import net.minecraft.world.effect.MobEffectInstance; | ||
import net.minecraft.world.effect.MobEffects; | ||
import net.minecraft.world.item.Item; | ||
import net.minecraft.world.item.Items; | ||
import net.minecraft.world.item.alchemy.Potion; | ||
import net.minecraft.world.item.alchemy.Potions; | ||
import net.minecraft.world.item.crafting.Ingredient; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
public class FishMC implements ModInitializer { | ||
// This logger is used to write text to the console and the log file. | ||
// It is considered best practice to use your mod id as the logger's name. | ||
// That way, it's clear which mod wrote info, warnings, and errors. | ||
public static final String MOD_ID = "fishmc"; | ||
public static final Logger LOGGER = LoggerFactory.getLogger("fishmc"); | ||
public static final Potion DECAY = | ||
Registry.register( | ||
BuiltInRegistries.POTION, | ||
ResourceLocation.fromNamespaceAndPath("fishmc", "decay"), | ||
new Potion( | ||
new MobEffectInstance( | ||
MobEffects.WITHER, | ||
3600, | ||
1))); | ||
public static final Potion BLINDNESS = | ||
Registry.register( | ||
BuiltInRegistries.POTION, | ||
ResourceLocation.fromNamespaceAndPath("fishmc", "blindness"), | ||
new Potion( | ||
new MobEffectInstance( | ||
MobEffects.BLINDNESS, | ||
3600, | ||
0))); | ||
public static final Potion GLOWING = | ||
Registry.register( | ||
BuiltInRegistries.POTION, | ||
ResourceLocation.fromNamespaceAndPath("fishmc", "glowing"), | ||
new Potion( | ||
new MobEffectInstance( | ||
MobEffects.GLOWING, | ||
800, | ||
0))); | ||
public static final Potion LEVITATION = | ||
Registry.register( | ||
BuiltInRegistries.POTION, | ||
ResourceLocation.fromNamespaceAndPath("fishmc", "levitation"), | ||
new Potion( | ||
new MobEffectInstance( | ||
MobEffects.LEVITATION, | ||
3600, | ||
0))); | ||
public static final Potion STUNNED = | ||
Registry.register( | ||
BuiltInRegistries.POTION, | ||
ResourceLocation.fromNamespaceAndPath("fishmc", "stunned"),new Potion(new MobEffectInstance[]{new MobEffectInstance(MobEffects.MOVEMENT_SLOWDOWN, 400, 200), new MobEffectInstance(MobEffects.WEAKNESS, 400, 200), new MobEffectInstance(MobEffects.DIG_SLOWDOWN, 400, 200)})); | ||
public static final Potion SHULKERCRAFT = | ||
Registry.register( | ||
BuiltInRegistries.POTION, | ||
ResourceLocation.fromNamespaceAndPath("fishmc", "shulkercraft"),new Potion(new MobEffectInstance[]{new MobEffectInstance(MobEffects.MOVEMENT_SLOWDOWN, 200, 200), new MobEffectInstance(MobEffects.DAMAGE_RESISTANCE, 200, 2)})); | ||
public static final Potion CRAFTABLE_DECAY = | ||
Registry.register( | ||
BuiltInRegistries.POTION, | ||
ResourceLocation.fromNamespaceAndPath("fishmc", "craftable_decay"), | ||
new Potion( | ||
new MobEffectInstance( | ||
MobEffects.WITHER, | ||
400, | ||
1))); | ||
public static final Potion CRAFTABLE_BLINDNESS = | ||
Registry.register( | ||
BuiltInRegistries.POTION, | ||
ResourceLocation.fromNamespaceAndPath("fishmc", "craftable_blindness"), | ||
new Potion( | ||
new MobEffectInstance( | ||
MobEffects.BLINDNESS, | ||
400, | ||
0))); | ||
public static final Potion CRAFTABLE_GLOWING = | ||
Registry.register( | ||
BuiltInRegistries.POTION, | ||
ResourceLocation.fromNamespaceAndPath("fishmc", "craftable_glowing"), | ||
new Potion( | ||
new MobEffectInstance( | ||
MobEffects.GLOWING, | ||
400, | ||
0))); | ||
public static final Potion CRAFTABLE_LEVITATION = | ||
Registry.register( | ||
BuiltInRegistries.POTION, | ||
ResourceLocation.fromNamespaceAndPath("fishmc", "craftable_levitation"), | ||
new Potion( | ||
new MobEffectInstance( | ||
MobEffects.LEVITATION, | ||
400, | ||
0))); | ||
public static final Potion CRAFTABLE_STUNNED = | ||
Registry.register( | ||
BuiltInRegistries.POTION, | ||
ResourceLocation.fromNamespaceAndPath("fishmc", "craftable_stunned"),new Potion(new MobEffectInstance[]{new MobEffectInstance(MobEffects.MOVEMENT_SLOWDOWN, 400, 200), new MobEffectInstance(MobEffects.WEAKNESS, 400, 200), new MobEffectInstance(MobEffects.DIG_SLOWDOWN, 400, 200)})); | ||
@Override | ||
public void onInitialize() { | ||
// This code runs as soon as Minecraft is in a mod-load-ready state. | ||
// However, some things (like resources) may still be uninitialized. | ||
// Proceed with mild caution. | ||
LOGGER.info("Welcome to FishMC!"); | ||
var bow = new CustomBow( | ||
new Item.Properties().durability(150), | ||
new RangedConfig(3, -0.7F, 5), | ||
() -> Ingredient.of(Items.OAK_WOOD) | ||
); | ||
Registry.register( | ||
BuiltInRegistries.ITEM, | ||
ResourceLocation.fromNamespaceAndPath(FishMC.MOD_ID, "shortbow"), | ||
bow | ||
); | ||
ModItems.initialize(); | ||
//Registry.registerPotionRecipe(Potions.WATER, Items.POTATO, DECAY); | ||
FabricBrewingRecipeRegistryBuilder.BUILD.register(builder -> { | ||
builder.addMix( | ||
// Input potion. | ||
Potions.AWKWARD, | ||
// Ingredient | ||
Items.WITHER_ROSE, | ||
// Output potion. | ||
Holder.direct(CRAFTABLE_DECAY) | ||
); | ||
}); | ||
FabricBrewingRecipeRegistryBuilder.BUILD.register(builder -> { | ||
builder.addMix( | ||
// Input potion. | ||
Potions.AWKWARD, | ||
// Ingredient | ||
Items.FERMENTED_SPIDER_EYE, | ||
// Output potion. | ||
Holder.direct(CRAFTABLE_BLINDNESS) | ||
); | ||
}); | ||
FabricBrewingRecipeRegistryBuilder.BUILD.register(builder -> { | ||
builder.addMix( | ||
// Input potion. | ||
Potions.AWKWARD, | ||
// Ingredient | ||
Items.GLOW_BERRIES, | ||
// Output potion. | ||
Holder.direct(CRAFTABLE_GLOWING) | ||
); | ||
}); | ||
FabricBrewingRecipeRegistryBuilder.BUILD.register(builder -> { | ||
builder.addMix( | ||
// Input potion. | ||
Potions.AWKWARD, | ||
// Ingredient | ||
Items.SHULKER_SHELL, | ||
// Output potion. | ||
Holder.direct(CRAFTABLE_LEVITATION) | ||
); | ||
}); | ||
FabricBrewingRecipeRegistryBuilder.BUILD.register(builder -> { | ||
builder.addMix( | ||
// Input potion. | ||
Potions.AWKWARD, | ||
// Ingredient | ||
Items.OMINOUS_BOTTLE, | ||
// Output potion. | ||
Holder.direct(CRAFTABLE_STUNNED) | ||
); | ||
}); | ||
FabricBrewingRecipeRegistryBuilder.BUILD.register(builder -> { | ||
builder.addMix( | ||
// Input potion. | ||
Potions.AWKWARD, | ||
// Ingredient | ||
Items.SHULKER_BOX, | ||
// Output potion. | ||
Holder.direct(SHULKERCRAFT) | ||
); | ||
}); | ||
} | ||
} |
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,28 @@ | ||
package ro.fishmc; | ||
|
||
import eu.raspberrymods.fishlib.ObsidianTool; | ||
import net.minecraft.core.Registry; | ||
import net.minecraft.core.registries.BuiltInRegistries; | ||
import net.minecraft.resources.ResourceLocation; | ||
import net.minecraft.world.item.Item; | ||
import net.minecraft.world.item.SwordItem; | ||
|
||
public class ModItems { | ||
public static Item register(Item item, String id) { | ||
// Create the identifier for the item. | ||
ResourceLocation itemID = ResourceLocation.fromNamespaceAndPath(FishMC.MOD_ID, id); | ||
|
||
// Register the item. | ||
Item registeredItem = Registry.register(BuiltInRegistries.ITEM, itemID, item); | ||
|
||
// Return the registered item! | ||
return registeredItem; | ||
} | ||
|
||
public static final Item OBSIDIAN_CLAYMORE = register(new SwordItem(ObsidianTool.INSTANCE, new Item.Properties().stacksTo(1).fireResistant().attributes( | ||
SwordItem.createAttributes( | ||
ObsidianTool.INSTANCE, | ||
12, -0.5f))), "obsidian_claymore"); | ||
public static void initialize() { | ||
} | ||
} |
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,15 @@ | ||
package ro.fishmc.mixin; | ||
|
||
import net.minecraft.server.MinecraftServer; | ||
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.CallbackInfo; | ||
|
||
@Mixin(MinecraftServer.class) | ||
public class ExampleMixin { | ||
@Inject(at = @At("HEAD"), method = "loadWorld") | ||
private void init(CallbackInfo info) { | ||
// This code is injected into the start of MinecraftServer.loadWorld()V | ||
} | ||
} |
Oops, something went wrong.