Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Forge Capabilities Question


Recommended Posts

Hello!

 

I'm modding Minecraft for the first time and I was using forge as my API.

But, I'm not sure the thing I want to do is possible in forge. So could someone answer a simple question so I know if forge is the right API for me?

 

With forge, can I remove certain elements of terrain generation, like villages and mineshafts?

Is that possible?

 

Thanks,

-MathewAlden

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Recently Browsing

    No registered users viewing this page.

  • Posts

    • Why do you use DeferredRegister for ruby_ingot but not for the custom pickaxe? When using registry events manually you must use @ObjectHolder to assign the items to fields, do not assign them manually. You never register ItemInit.class to the event bus, as such your event handler registerItems never gets called.
    • @diesieben07 sorry about that! i thought that if you spoiler a code its still has the body  
    • So... you made your own mod? Or what do you mean?
    • Hello. I need help with my Code. When i start my Client my custom pickaxe "ruby_pickaxe" doenst register. Here is my code: dmod: package me.DracoFAAD.dmod; import me.DracoFAAD.dmod.Tools.ItemList; import net.minecraft.block.Blocks; import net.minecraft.item.PickaxeItem; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.eventbus.api.IEventBus; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.InterModComms; import net.minecraftforge.fml.RegistryObject; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent; import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent; import net.minecraftforge.fml.event.lifecycle.InterModEnqueueEvent; import net.minecraftforge.fml.event.lifecycle.InterModProcessEvent; import net.minecraftforge.fml.event.server.FMLServerStartingEvent; import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import java.util.stream.Collectors; // The value here should match an entry in the META-INF/mods.toml file @Mod(dmod.MOD_ID) public class dmod { public static final String MOD_ID = "dmod"; // Directly reference a log4j logger. private static final Logger LOGGER = LogManager.getLogger(); public dmod() { IEventBus bus = FMLJavaModLoadingContext.get().getModEventBus(); // Register the setup method for modloading bus.addListener(this::setup); // Register the enqueueIMC method for modloading bus.addListener(this::enqueueIMC); // Register the processIMC method for modloading bus.addListener(this::processIMC); // Register the doClientStuff method for modloading bus.addListener(this::doClientStuff); ItemInit.ITEMS.register(bus); // Register ourselves for server and other game events we are interested in MinecraftForge.EVENT_BUS.register(this); } private void setup(final FMLCommonSetupEvent event) { // some preinit code LOGGER.info("HELLO FROM PREINIT"); LOGGER.info("DIRT BLOCK >> {}", Blocks.DIRT.getRegistryName()); } private void doClientStuff(final FMLClientSetupEvent event) { // do something that can only be done on the client LOGGER.info("Got game settings {}", event.getMinecraftSupplier().get()); } private void enqueueIMC(final InterModEnqueueEvent event) { // some example code to dispatch IMC to another mod InterModComms.sendTo("examplemod", "helloworld", () -> { LOGGER.info("Hello world from the MDK"); return "Hello world";}); } private void processIMC(final InterModProcessEvent event) { // some example code to receive and process InterModComms from other mods LOGGER.info("Got IMC {}", event.getIMCStream(). map(m->m.getMessageSupplier().get()). collect(Collectors.toList())); } // You can use SubscribeEvent and let the Event Bus discover methods to call @SubscribeEvent public void onServerStarting(FMLServerStartingEvent event) { // do something when the server starts LOGGER.info("HELLO from server starting"); } } ToolMaterialList:   package me.DracoFAAD.dmod.Tools; import net.minecraft.item.IItemTier; import net.minecraft.item.Item; import net.minecraft.item.crafting.Ingredient; public enum ToolMaterialList implements IItemTier { tutorial(10.0f, 9.0f, 800, 3, 25, ItemList.ruby_pickaxe); private float attackDamage, efficiency; private int durability, harvestLevel, enchantability; private Item repairMaterial; private ToolMaterialList(float attackDamage, float efficiency, int durability, int harvestLevel, int enchantability, Item repairMaterial) { this.attackDamage = attackDamage; this.efficiency = efficiency; this.durability = durability; this.harvestLevel = harvestLevel; this.enchantability = enchantability; this.repairMaterial = repairMaterial; } @Override public float getAttackDamage() { return this.attackDamage; } @Override public float getEfficiency() { return this.efficiency; } @Override public int getEnchantability() { return this.enchantability; } @Override public int getHarvestLevel() { return this.harvestLevel; } @Override public int getMaxUses() { return this.durability; } @Override public Ingredient getRepairMaterial() { return Ingredient.fromItems(this.repairMaterial); } } ItemList: package me.DracoFAAD.dmod.Tools; import net.minecraft.item.Item; public class ItemList { public static Item ruby_pickaxe; } ItemCustomPickaxe: package me.DracoFAAD.dmod.Tools; import net.minecraft.item.IItemTier; import net.minecraft.item.Item; import net.minecraft.item.ItemGroup; import net.minecraft.item.PickaxeItem; public class ItemCustomPickaxe extends PickaxeItem { public ItemCustomPickaxe(IItemTier tier, int attackDamageIn, float attackSpeedIn, Properties builder) { super(tier, attackDamageIn, attackSpeedIn, builder); } } ItemInit:   package me.DracoFAAD.dmod; import me.DracoFAAD.dmod.Tools.ItemCustomPickaxe; import me.DracoFAAD.dmod.Tools.ItemList; import me.DracoFAAD.dmod.Tools.ToolMaterialList; import net.minecraft.item.Item; import net.minecraft.item.ItemGroup; import net.minecraftforge.event.RegistryEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.RegistryObject; import net.minecraftforge.registries.DeferredRegister; import net.minecraftforge.registries.ForgeRegistries; import java.lang.ref.Reference; public class ItemInit{ public static final DeferredRegister<Item> ITEMS = DeferredRegister.create(ForgeRegistries.ITEMS, dmod.MOD_ID); public static final RegistryObject<Item> RUBY_INGOT = ITEMS.register("ruby_ingot", () -> new Item(new Item.Properties().group(ItemGroup.MISC))); @SubscribeEvent public static void registerItems(final RegistryEvent.Register<Item> event) { ItemList.ruby_pickaxe = new ItemCustomPickaxe(ToolMaterialList.tutorial, -2, 6.0f, new Item.Properties().group(ItemGroup.TOOLS)).setRegistryName("ruby_pickaxe"); } }  
  • Topics

  • Who's Online (See full list)

×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.