Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

DracoFAAD

Members
  • Joined

  • Last visited

Everything posted by DracoFAAD

  1. How to use dimensions from json in code? Any help would be appreciated. For Example: Teleport Player to the Dimension
  2. Could you help me with the DefferedRegister? Edit: I found my self, but thank you!
  3. @diesieben07 sorry about that! i thought that if you spoiler a code its still has the body
  4. 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"); } }

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.