Skip to content

Commit

Permalink
migrate to mojmaps
Browse files Browse the repository at this point in the history
  • Loading branch information
ArduFish committed Nov 17, 2024
1 parent 85e6db2 commit ba00a7d
Show file tree
Hide file tree
Showing 6 changed files with 309 additions and 75 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ loom {
dependencies {
// To change the versions see the gradle.properties file
minecraft "com.mojang:minecraft:${project.minecraft_version}"
mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
mappings loom.officialMojangMappings()
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
// Fabric API. This is technically optional, but you probably want it anyway.
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
Expand Down
191 changes: 191 additions & 0 deletions remappedSrc/ro/fishmc/FishMC.java
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)
);
});
}
}
28 changes: 28 additions & 0 deletions remappedSrc/ro/fishmc/ModItems.java
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() {
}
}
15 changes: 15 additions & 0 deletions remappedSrc/ro/fishmc/mixin/ExampleMixin.java
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
}
}
Loading

0 comments on commit ba00a7d

Please sign in to comment.