Jump to content

NetworkMod - Gui


WaterMinecraft

Recommended Posts

So I've been having this issue with my Furnace. When I try to open it, it says "A gui can not be opened because it is not a NetworkMod." or something close to that. (:

 

GuiHandler

 

 

 

package teamoverhaul.netheroverhaul.gui;

 

import net.minecraft.client.gui.GuiButton;

import net.minecraft.entity.player.EntityPlayer;

import net.minecraft.tileentity.TileEntity;

import net.minecraft.world.World;

import cpw.mods.fml.common.network.IGuiHandler;

 

public class GuiHandler implements IGuiHandler {

 

@Override

        public Object getServerGuiElement(int id, EntityPlayer player, World world, int x, int y, int z) {

                TileEntity tileEntity = world.getBlockTileEntity(x, y, z);

             

                if(player != null)

                {

                switch(id)

                {

                case 0:

                return new ContainerNetherFurnace(player.inventory, (TileEntityNetherFurnace) tileEntity);

               

                }

               

                }

               

                return null;

               

        }

 

 

@Override

        public Object getClientGuiElement(int id, EntityPlayer player, World world, int x, int y, int z) {

                TileEntity tileEntity = world.getBlockTileEntity(x, y, z);

               

                if(player != null)

                {

                switch(id)

                {

                case 0:

                return new GuiNetherFurnace(player.inventory, (TileEntityNetherFurnace) tileEntity);

        }

                }

                return null;

 

        }

}

 

 

 

 

mod_Nether

 

 

 

package teamoverhaul.netheroverhaul;

 

import net.minecraft.block.Block;

import net.minecraft.block.BlockFurnace;

import net.minecraft.creativetab.CreativeTabs;

import net.minecraft.entity.EntityList;

import net.minecraft.item.EnumArmorMaterial;

import net.minecraft.item.EnumToolMaterial;

import net.minecraft.item.Item;

import net.minecraft.item.ItemStack;

import net.minecraft.stats.Achievement;

import net.minecraft.world.biome.BiomeGenBase;

import net.minecraftforge.common.AchievementPage;

import net.minecraftforge.common.DimensionManager;

import net.minecraftforge.common.EnumHelper;

import teamoverhaul.netheroverhaul.block.BlockBloodRock;

import teamoverhaul.netheroverhaul.block.BlockGlowShroom1;

import teamoverhaul.netheroverhaul.block.BlockGlowShroom2;

import teamoverhaul.netheroverhaul.block.BlockGlowshroomStem;

import teamoverhaul.netheroverhaul.block.BlockGlowshroomTop1;

import teamoverhaul.netheroverhaul.block.BlockGlowshroomTop2;

import teamoverhaul.netheroverhaul.block.BlockGraphite;

import teamoverhaul.netheroverhaul.block.BlockHellCobble;

import teamoverhaul.netheroverhaul.block.BlockHellLeaves;

import teamoverhaul.netheroverhaul.block.BlockHellLog;

import teamoverhaul.netheroverhaul.block.BlockHellPlanks;

import teamoverhaul.netheroverhaul.block.BlockHellSapling;

import teamoverhaul.netheroverhaul.block.BlockHellTorch;

import teamoverhaul.netheroverhaul.block.BlockHellsoil;

import teamoverhaul.netheroverhaul.block.BlockHellstone;

import teamoverhaul.netheroverhaul.block.BlockNetherrack;

import teamoverhaul.netheroverhaul.block.BlockRope;

import teamoverhaul.netheroverhaul.block.BlockSoot;

import teamoverhaul.netheroverhaul.block.BlockSootSmoldering;

import teamoverhaul.netheroverhaul.block.OreBrimstone;

import teamoverhaul.netheroverhaul.block.OreDarkQuartz;

import teamoverhaul.netheroverhaul.block.OreGarnet;

import teamoverhaul.netheroverhaul.block.OreGraphite;

import teamoverhaul.netheroverhaul.block.OreNetherrack;

import teamoverhaul.netheroverhaul.block.OreQuartz;

import teamoverhaul.netheroverhaul.common.CommonProxy;

import teamoverhaul.netheroverhaul.common.FuelHandler;

import teamoverhaul.netheroverhaul.common.TickHandler;

import teamoverhaul.netheroverhaul.creativetab.CreativeTabBlockNether;

import teamoverhaul.netheroverhaul.creativetab.CreativeTabCombatNether;

import teamoverhaul.netheroverhaul.creativetab.CreativeTabDecorNether;

import teamoverhaul.netheroverhaul.creativetab.CreativeTabResourceNether;

import teamoverhaul.netheroverhaul.creativetab.CreativeTabToolNether;

import teamoverhaul.netheroverhaul.entity.EntityDweller;

import teamoverhaul.netheroverhaul.entity.EntityGhoul;

import teamoverhaul.netheroverhaul.entity.EntityShade;

import teamoverhaul.netheroverhaul.gui.GuiHandler;

import teamoverhaul.netheroverhaul.gui.NetherFurnace;

import teamoverhaul.netheroverhaul.gui.TileEntityNetherFurnace;

import teamoverhaul.netheroverhaul.item.ItemBrimstone;

import teamoverhaul.netheroverhaul.item.ItemDarkQuartz;

import teamoverhaul.netheroverhaul.item.ItemGarnet;

import teamoverhaul.netheroverhaul.item.ItemGraphite;

import teamoverhaul.netheroverhaul.item.ItemHellStick;

import teamoverhaul.netheroverhaul.item.ItemNetherrack;

import teamoverhaul.netheroverhaul.tool.AxeBrimstone;

import teamoverhaul.netheroverhaul.tool.AxeGarnet;

import teamoverhaul.netheroverhaul.tool.AxeGraphite;

import teamoverhaul.netheroverhaul.tool.AxeHellstone;

import teamoverhaul.netheroverhaul.tool.AxeHellwood;

import teamoverhaul.netheroverhaul.tool.PickaxeBrimstone;

import teamoverhaul.netheroverhaul.tool.PickaxeGarnet;

import teamoverhaul.netheroverhaul.tool.PickaxeGraphite;

import teamoverhaul.netheroverhaul.tool.PickaxeHellstone;

import teamoverhaul.netheroverhaul.tool.PickaxeHellwood;

import teamoverhaul.netheroverhaul.tool.ShovelBrimstone;

import teamoverhaul.netheroverhaul.tool.ShovelGarnet;

import teamoverhaul.netheroverhaul.tool.ShovelGraphite;

import teamoverhaul.netheroverhaul.tool.ShovelHellstone;

import teamoverhaul.netheroverhaul.tool.ShovelHellwood;

import teamoverhaul.netheroverhaul.tool.SwordBrimstone;

import teamoverhaul.netheroverhaul.tool.SwordGarnet;

import teamoverhaul.netheroverhaul.tool.SwordGraphite;

import teamoverhaul.netheroverhaul.tool.SwordHellstone;

import teamoverhaul.netheroverhaul.tool.SwordHellwood;

import teamoverhaul.netheroverhaul.tool.SwordWithering;

import teamoverhaul.netheroverhaul.wearable.BrimstoneBoots;

import teamoverhaul.netheroverhaul.wearable.BrimstoneChest;

import teamoverhaul.netheroverhaul.wearable.BrimstoneHelmet;

import teamoverhaul.netheroverhaul.wearable.BrimstoneLegs;

import teamoverhaul.netheroverhaul.wearable.GarnetBoots;

import teamoverhaul.netheroverhaul.wearable.GarnetChest;

import teamoverhaul.netheroverhaul.wearable.GarnetHelmet;

import teamoverhaul.netheroverhaul.wearable.GarnetLegs;

import teamoverhaul.netheroverhaul.wearable.GraphiteBoots;

import teamoverhaul.netheroverhaul.wearable.GraphiteChest;

import teamoverhaul.netheroverhaul.wearable.GraphiteHelmet;

import teamoverhaul.netheroverhaul.wearable.GraphiteLegs;

import teamoverhaul.netheroverhaul.world.BiomeGenNether;

import teamoverhaul.netheroverhaul.world.WorldGeneratorNether;

import teamoverhaul.netheroverhaul.world.WorldProviderNether;

import cpw.mods.fml.common.Mod;

import cpw.mods.fml.common.Mod.Init;

import cpw.mods.fml.common.Mod.Instance;

import cpw.mods.fml.common.Mod.PreInit;

import cpw.mods.fml.common.SidedProxy;

import cpw.mods.fml.common.event.FMLInitializationEvent;

import cpw.mods.fml.common.event.FMLPreInitializationEvent;

import cpw.mods.fml.common.network.NetworkMod;

import cpw.mods.fml.common.network.NetworkRegistry;

import cpw.mods.fml.common.registry.EntityRegistry;

import cpw.mods.fml.common.registry.GameRegistry;

import cpw.mods.fml.common.registry.LanguageRegistry;

import cpw.mods.fml.common.registry.TickRegistry;

import cpw.mods.fml.relauncher.Side;

 

//The old stuff was WAY too unorganized, so here's a much better layout, complete with comments from ME (allshallobey)!

 

//Gives Forge Nether Overhaul's ID, name, and version.

@Mod(modid = mod_Nether.modid, name = "The Nether Overhaul", version="ALPHA 1.0")

@NetworkMod(clientSideRequired = true, serverSideRequired = false)

 

public class mod_Nether {

 

public static final String modid = "teamOverhaul_netherOverhaul";

 

@Instance("The Nether Overhaul")

public static mod_Nether instance;

 

@SidedProxy(clientSide="teamoverhaul.netheroverhaul.client.ClientProxy", serverSide="teamoverhaul.netheroverhaul.common.CommonProxy")

public static CommonProxy proxy;

 

//BIOME

public static BiomeGenBase nether;

 

//CREATIVE TABS

public static final CreativeTabs tabBlockNether = new CreativeTabBlockNether(CreativeTabs.getNextID(), "tabBlockNether");

public static final CreativeTabs tabDecorNether = new CreativeTabDecorNether(CreativeTabs.getNextID(), "tabDecorNether");

public static final CreativeTabs tabResourceNether = new CreativeTabResourceNether(CreativeTabs.getNextID(), "tabResourceNether");

public static final CreativeTabs tabCombatNether = new CreativeTabCombatNether(CreativeTabs.getNextID(), "tabCombatNether");

public static final CreativeTabs tabToolNether = new CreativeTabToolNether(CreativeTabs.getNextID(), "tabToolNether");

 

//BLOCKS

//Building blocks

public static Block hellStone;

public static Block hellCobble;

public static Block hellSoil;

public static Block soot;

public static Block sootSmoldering;

public static Block hellSapling;

public static Block hellLog;

public static Block hellLeaves;

public static Block hellPlanks;

public static Block blockNetherrack;

public static Block blockGraphite;

public static Block bigGlowshroom1;

public static Block bigGlowshroom2;

public static Block bigGlowshroomStem;

public static Block netherFurnaceIdle;

public static Block netherFurnaceBurning;

public static Block bloodRock;

public static Block rope;

 

//Ore

public static Block oreNetherrack;

public static Block oreQuartz;

public static Block oreDarkQuartz;

public static Block oreBrimstone;

public static Block oreGarnet;

public static Block oreGraphite;

 

//Decorative blocks

public static Block hellTorch;

public static Block glowShroom1;

public static Block glowShroom2;

 

//ITEMS

//Materials: addToolMaterial(name, harvest level, max uses, efficiency, damage, enchantability)

public static EnumToolMaterial matHellwood = EnumHelper.addToolMaterial("Hellwood", 0, 59, 2.0F, 0, 15);

public static EnumToolMaterial matHellstone = EnumHelper.addToolMaterial("Hellstone", 1, 131, 4.0F, 1, 5);

public static EnumToolMaterial matBrimstone = EnumHelper.addToolMaterial("Brimstone", 2, 250, 6.0F, 2, 14);

public static EnumToolMaterial matGarnet = EnumHelper.addToolMaterial("Garnet", 3, 1561, 8.0F, 3, 10);

public static EnumToolMaterial matGraphite = EnumHelper.addToolMaterial("Graphite", 4, 1721, 14.0F, 5, 25);

 

//Armor materials: addArmorMaterial(name, durability, reductionAmounts, enchantability)

public static EnumArmorMaterial armorBrimstone = EnumHelper.addArmorMaterial("Brimstone", 15, new int[]{2, 5, 4, 2}, 9);

public static EnumArmorMaterial armorGarnet = EnumHelper.addArmorMaterial("Garnet", 33, new int[]{3, 7, 5, 3}, 10);

public static EnumArmorMaterial armorGraphite = EnumHelper.addArmorMaterial("Graphite", 33, new int[]{3, 8, 6, 3}, 11);

 

//Resources

public static Item hellStick;

public static Item netherRack;

public static Item brimStone;

public static Item garnet;

public static Item graphite;

public static Item darkQuartz;

 

//Armor

public static Item helmetBrimstone;

public static Item chestBrimstone;

public static Item legsBrimstone;

public static Item bootsBrimstone;

public static Item helmetGarnet;

public static Item chestGarnet;

public static Item legsGarnet;

public static Item bootsGarnet;

public static Item helmetGraphite;

public static Item chestGraphite;

public static Item legsGraphite;

public static Item bootsGraphite;

 

//Swords

public static Item swordHellwood;

public static Item swordHellstone;

public static Item swordBrimstone;

public static Item swordGarnet;

public static Item swordGraphite;

public static Item swordWithering;

 

//Pickaxes

public static Item pickHellwood;

public static Item pickHellstone;

public static Item pickBrimstone;

public static Item pickGarnet;

public static Item pickGraphite;

 

//Axes

public static Item axeHellwood;

public static Item axeHellstone;

public static Item axeBrimstone;

public static Item axeGarnet;

public static Item axeGraphite;

 

//Shovels

public static Item shovelHellwood;

public static Item shovelHellstone;

public static Item shovelBrimstone;

public static Item shovelGarnet;

public static Item shovelGraphite;

 

//Misc

public static Item discSong1;

public static Item discSong2;

public static Item discSong3;

 

//Achievements

public static AchievementPage NetherPage;

public static Achievement getToTheNether;

public static Achievement gettingCloseToTheNether;

 

//Pre-initialization, anything that happens BEFORE the game starts!

@PreInit

public void PreInit(FMLPreInitializationEvent event) {

 

proxy.renderCapes();

 

//World Generator

GameRegistry.registerWorldGenerator(new WorldGeneratorNether());

 

//DEFINE BLOCKS

//Move vanilla blocks

Block.portal.setCreativeTab(this.tabBlockNether);

Block.glowStone.setCreativeTab(this.tabBlockNether);

Block.slowSand.setCreativeTab(this.tabBlockNether);

Block.netherBrick.setCreativeTab(this.tabBlockNether);

Block.stairsNetherBrick.setCreativeTab(this.tabBlockNether);

Block.netherFence.setCreativeTab(this.tabDecorNether);

Block.netherStalk.setCreativeTab(this.tabDecorNether);

Block.blockNetherQuartz.setCreativeTab(this.tabBlockNether);

Block.stairsNetherQuartz.setCreativeTab(this.tabBlockNether);

Block.oreNetherQuartz.setCreativeTab(null);

Block.netherrack.setCreativeTab(null);

 

//Define building blocks

hellStone = new BlockHellstone(200).setHardness(2.0F).setResistance(10.0F).setUnlocalizedName("hellStone").setCreativeTab(this.tabBlockNether);

hellCobble = new BlockHellCobble(201).setHardness(2.0F).setResistance(10.0F).setUnlocalizedName("hellCobble").setCreativeTab(this.tabBlockNether);

hellSoil = new BlockHellsoil(202).setHardness(0.5F).setResistance(10.0F).setUnlocalizedName("hellSoil").setCreativeTab(this.tabBlockNether);

soot = new BlockSoot(204).setHardness(0.6F).setUnlocalizedName("soot").setCreativeTab(this.tabDecorNether);

sootSmoldering = new BlockSootSmoldering(205).setHardness(0.6F).setUnlocalizedName("sootSmoldering").setCreativeTab(this.tabDecorNether).setLightValue(0.5F);

hellSapling = (new BlockHellSapling(206)).setHardness(0.0F).setStepSound(Block.soundGrassFootstep).setUnlocalizedName("sapling").setCreativeTab(this.tabDecorNether);

hellLog = new BlockHellLog(207).setHardness(2.5F).setUnlocalizedName("hellLog").setLightValue(1.0F).setCreativeTab(this.tabBlockNether);

hellLeaves = new BlockHellLeaves(208).setHardness(0.2F).setUnlocalizedName("hellLeaves").setLightValue(1.0F).setCreativeTab(this.tabDecorNether);

hellPlanks = new BlockHellPlanks(209).setHardness(2.5F).setUnlocalizedName("hellPlanks").setCreativeTab(this.tabBlockNether);

blockGraphite = new BlockGraphite(210).setHardness(3.5F).setUnlocalizedName("blockGraphite").setCreativeTab(this.tabBlockNether);

blockNetherrack = new BlockNetherrack(212).setHardness(0.4F).setUnlocalizedName("blockNetherrack").setCreativeTab(this.tabBlockNether);

    blockGraphite = new BlockGraphite(213).setHardness(50.5F).setResistance(2000.0F).setUnlocalizedName("blockGraphite").setCreativeTab(this.tabBlockNether);

    bigGlowshroom1 = new BlockGlowshroomTop1(214).setHardness(0.9F).setUnlocalizedName("bigGlowshroom1").setLightValue(1.0F).setCreativeTab(this.tabBlockNether);

    bigGlowshroom2 = new BlockGlowshroomTop2(215).setHardness(0.9F).setUnlocalizedName("bigGlowshroom2").setLightValue(1.0F).setCreativeTab(this.tabBlockNether);

    bigGlowshroomStem = new BlockGlowshroomStem(216).setHardness(0.9F).setUnlocalizedName("bigGlowshroomStem").setLightValue(1.0F).setCreativeTab(null);   

    bloodRock = new BlockBloodRock(227).setHardness(-1.0F).setUnlocalizedName("bloodRock").setCreativeTab(this.tabBlockNether);

 

    //Define ore

    oreNetherrack = new OreNetherrack(217).setHardness(3.5F).setResistance(10.0F).setUnlocalizedName("oreNetherrack").setCreativeTab(this.tabBlockNether);

    oreQuartz = new OreQuartz(218).setHardness(3.5F).setResistance(10.0F).setUnlocalizedName("oreQuartz").setCreativeTab(this.tabBlockNether);

    oreDarkQuartz = new OreDarkQuartz(219).setHardness(3.5F).setResistance(10.0F).setUnlocalizedName("oreDarkQuartz").setCreativeTab(this.tabBlockNether);

    oreBrimstone = new OreBrimstone(220).setHardness(3.5F).setResistance(10.0F).setUnlocalizedName("oreBrimstone").setCreativeTab(this.tabBlockNether);

    oreGarnet = new OreGarnet(221).setHardness(3.5F).setResistance(10.0F).setUnlocalizedName("oreGarnet").setCreativeTab(this.tabBlockNether);

    oreGraphite = new OreGraphite(222).setHardness(3.5F).setResistance(10.0F).setUnlocalizedName("oreGraphite").setCreativeTab(this.tabBlockNether);

   

    //Define decorative blocks

    hellTorch = new BlockHellTorch(224).setUnlocalizedName("hellTorch").setCreativeTab(this.tabDecorNether).setLightValue(1.0F);

    glowShroom1 = new BlockGlowShroom1(225, null).setUnlocalizedName("glowShroom1").setCreativeTab(this.tabDecorNether).setLightValue(1.0F);

    glowShroom2 = new BlockGlowShroom2(226, null).setUnlocalizedName("glowShroom2").setCreativeTab(this.tabDecorNether).setLightValue(1.0F);

    netherFurnaceIdle = new NetherFurnace(1000, false).setHardness(2.0F).setResistance(10.0F).setCreativeTab(this.tabDecorNether);

    netherFurnaceBurning = new NetherFurnace(1001, true).setHardness(2.0F).setResistance(10.0F).setCreativeTab(this.tabDecorNether);

    rope = new BlockRope(1002).setHardness(2.0F).setUnlocalizedName("rope").setCreativeTab(this.tabDecorNether);

   

    //DEFINE ITEMS

    //Move/fix vanilla Resources

    Item.lightStoneDust.setCreativeTab(this.tabResourceNether);

    Item.blazeRod.setFull3D().setCreativeTab(this.tabResourceNether);

    Item.netherrackBrick.setCreativeTab(this.tabResourceNether);

    Item.ghastTear.setCreativeTab(this.tabResourceNether);

    Item.magmaCream.setCreativeTab(this.tabResourceNether);

    Item.goldNugget.setCreativeTab(this.tabResourceNether);

    Item.netherQuartz.setCreativeTab(this.tabResourceNether);

    Item.netherStar.setCreativeTab(this.tabResourceNether);

    Item.blazePowder.setCreativeTab(this.tabResourceNether);

 

//Define Resources

    hellStick = new ItemHellStick(1500).setFull3D().setUnlocalizedName("hellStick").setCreativeTab(this.tabResourceNether);

    netherRack = new ItemNetherrack(1501).setUnlocalizedName("netherRack").setCreativeTab(this.tabResourceNether);

    brimStone = new ItemBrimstone(1502).setUnlocalizedName("brimStone").setCreativeTab(this.tabResourceNether);

    garnet = new ItemGarnet(1503).setUnlocalizedName("garnet").setCreativeTab(this.tabResourceNether);

    darkQuartz = new ItemDarkQuartz(1504).setUnlocalizedName("darkQuartz").setCreativeTab(this.tabResourceNether);

    graphite = new ItemGraphite(1505).setUnlocalizedName("graphite").setCreativeTab(this.tabResourceNether);

 

//Define Armor

    helmetBrimstone = new BrimstoneHelmet(1506, armorBrimstone, proxy.addArmor("brimstone"), 0).setUnlocalizedName("helmetBrimstone").setCreativeTab(this.tabCombatNether);

    chestBrimstone = new BrimstoneChest(1507, armorBrimstone, proxy.addArmor("brimstone"), 1).setUnlocalizedName("chestBrimstone").setCreativeTab(this.tabCombatNether);

    legsBrimstone = new BrimstoneLegs(1508, armorBrimstone, proxy.addArmor("brimstone"), 2).setUnlocalizedName("legsBrimstone").setCreativeTab(this.tabCombatNether);

    bootsBrimstone = new BrimstoneBoots(1509, armorBrimstone, proxy.addArmor("brimstone"), 3).setUnlocalizedName("bootsBrimstone").setCreativeTab(this.tabCombatNether);

    helmetGarnet = new GarnetHelmet(1510, armorGarnet, proxy.addArmor("garnet"), 0).setUnlocalizedName("helmetGarnet").setCreativeTab(this.tabCombatNether);

    chestGarnet = new GarnetChest(1511, armorGarnet, proxy.addArmor("garnet"), 1).setUnlocalizedName("chestGarnet").setCreativeTab(this.tabCombatNether);

    legsGarnet = new GarnetLegs(1512, armorGarnet, proxy.addArmor("garnet"), 2).setUnlocalizedName("legsGarnet").setCreativeTab(this.tabCombatNether);

    bootsGarnet = new GarnetBoots(1513, armorGarnet, proxy.addArmor("garnet"), 3).setUnlocalizedName("bootsGarnet").setCreativeTab(this.tabCombatNether);

    helmetGraphite = new GraphiteHelmet(1514, armorGraphite, proxy.addArmor("graphite"), 0).setUnlocalizedName("helmetGraphite").setCreativeTab(this.tabCombatNether);

    chestGraphite = new GraphiteChest(1515, armorGraphite, proxy.addArmor("graphite"), 1).setUnlocalizedName("chestGraphite").setCreativeTab(this.tabCombatNether);

    legsGraphite = new GraphiteLegs(15156, armorGraphite, proxy.addArmor("graphite"), 2).setUnlocalizedName("legsGraphite").setCreativeTab(this.tabCombatNether);

    bootsGraphite = new GraphiteBoots(1517, armorGraphite, proxy.addArmor("graphite"), 3).setUnlocalizedName("bootsGraphite").setCreativeTab(this.tabCombatNether);

   

    //Define Swords

    swordHellwood = new SwordHellwood(1530, this.matHellwood).setUnlocalizedName("swordHellwood").setCreativeTab(this.tabCombatNether);

    swordHellstone = new SwordHellstone(1531, this.matHellstone).setUnlocalizedName("swordHellstone").setCreativeTab(this.tabCombatNether);

    swordBrimstone = new SwordBrimstone(1532, this.matBrimstone).setUnlocalizedName("swordBrimstone").setCreativeTab(this.tabCombatNether);

    swordGarnet = new SwordGarnet(1533, this.matGarnet).setUnlocalizedName("swordGarnet").setCreativeTab(this.tabCombatNether);

    swordGraphite = new SwordGraphite(1535, this.matGraphite).setUnlocalizedName("swordGraphite").setCreativeTab(this.tabCombatNether);

    swordWithering = new SwordWithering(1536, this.matGraphite).setUnlocalizedName("swordWithering").setCreativeTab(this.tabCombatNether);

 

    //Define Pickaxes

    pickHellwood = new PickaxeHellwood(1537, this.matHellwood).setUnlocalizedName("pickHellwood").setCreativeTab(this.tabToolNether);

    pickHellstone = new PickaxeHellstone(1538, this.matHellstone).setUnlocalizedName("pickHellstone").setCreativeTab(this.tabToolNether);

    pickBrimstone = new PickaxeBrimstone(1539, this.matBrimstone).setUnlocalizedName("pickBrimstone").setCreativeTab(this.tabToolNether);

    pickGarnet = new PickaxeGarnet(1540, this.matGarnet).setUnlocalizedName("pickGarnet").setCreativeTab(this.tabToolNether);

    pickGraphite = new PickaxeGraphite(1542, this.matGraphite).setUnlocalizedName("pickGraphite").setCreativeTab(this.tabToolNether);

   

    //Define Axes

    axeHellwood = new AxeHellwood (1560, this.matHellwood).setUnlocalizedName("axeHellwood").setCreativeTab(this.tabToolNether);

    axeHellstone = new AxeHellstone (1561, this.matHellstone).setUnlocalizedName("axeHellstone").setCreativeTab(this.tabToolNether);

    axeBrimstone = new AxeBrimstone (1562, this.matBrimstone).setUnlocalizedName("axeBrimstone").setCreativeTab(this.tabToolNether);

    axeGarnet = new AxeGarnet (1563, this.matGarnet).setUnlocalizedName("axeGarnet").setCreativeTab(this.tabToolNether);

    axeGraphite = new AxeGraphite (1565, this.matGraphite).setUnlocalizedName("axeGraphite").setCreativeTab(this.tabToolNether);

   

    //Define Shovels

        shovelHellwood = new ShovelHellwood (1571, this.matHellwood).setUnlocalizedName("shovelHellwood").setCreativeTab(this.tabToolNether);

    shovelHellstone = new ShovelHellstone (1572, this.matHellstone).setUnlocalizedName("shovelHellstone").setCreativeTab(this.tabToolNether);

    shovelBrimstone = new ShovelBrimstone (1573, this.matBrimstone).setUnlocalizedName("shovelBrimstone").setCreativeTab(this.tabToolNether);

    shovelGarnet = new ShovelGarnet (1574, this.matGarnet).setUnlocalizedName("shovelGarnet").setCreativeTab(this.tabToolNether);

    shovelGraphite = new ShovelGraphite (1575, this.matGraphite).setUnlocalizedName("shovelGraphite").setCreativeTab(this.tabToolNether);

   

    //Achievements!   

    getToTheNether = (new Achievement(27, "goToTheNether", 0, 0, Item.flintAndSteel, null)).registerAchievement();

        gettingCloseToTheNether = (new Achievement(28, "gettingCloseToTheNether", 2, 0, Block.obsidian, getToTheNether)).registerAchievement();

 

       

        //Achievement Naming

 

      this.addAchievementName("goToTheNether", "Quest For The Nether");

      this.addAchievementName("gettingCloseToTheNether", "Closer To The Nether");

     

      this.addAchievementDesc("goToTheNether", "Step 1 Complete");

      this.addAchievementDesc("gettingCloseToTheNether", "Step 2 Complete");

     

      NetherPage = new AchievementPage("Nether Achievements", getToTheNether, gettingCloseToTheNether);

       

        AchievementPage.registerAchievementPage(NetherPage);

     

        //CraftingManager/SmeltingManager

      GameRegistry.registerCraftingHandler(new CraftingHandler());

     

      //PickupHandler

      GameRegistry.registerPickupHandler(new PickupHandler());

       

   

    //BIOMES

nether = (new BiomeGenNether(8)).setColor(16711680).setBiomeName("Nether").setDisableRain().setTemperatureRainfall(2.0F, 0.0F);

 

    //MONSTER REGISTRY

    //Register Shade

    EntityRegistry.registerModEntity(EntityShade.class, "Shade", 1, this, 80, 3, true);

    EntityList.addMapping(EntityShade.class, "Shade", 1, 219032, 219031);

   

    //Register Ghoul

    EntityRegistry.registerModEntity(EntityGhoul.class, "Ghoul", 2, this, 80, 3, true);

    EntityList.addMapping(EntityGhoul.class, "Ghoul", 2, 843942, 4254343);

   

    //Register Dweller

    EntityRegistry.registerModEntity(EntityDweller.class, "Dweller", 3, this, 80, 3, true);

    EntityList.addMapping(EntityDweller.class, "Dweller", 3, 345345, 987552);

   

    //DIMENSION REGISTRY

    DimensionManager.unregisterProviderType(-1);

    DimensionManager.registerProviderType(-1, WorldProviderNether.class, true);

   

    //GEN REGISTRY

 

    //BLOCK REGISTRY

    //Register building blocks

    GameRegistry.registerBlock(hellStone, "hellStone");

    GameRegistry.registerBlock(hellCobble, "hellCobble");

    GameRegistry.registerBlock(hellSoil, "hellSoil");

    GameRegistry.registerBlock(soot, "soot");

    GameRegistry.registerBlock(sootSmoldering, "sootSmoldering");

    GameRegistry.registerBlock(hellSapling, "hellSapling");

    GameRegistry.registerBlock(hellLog, "hellLog");

    GameRegistry.registerBlock(hellLeaves, "hellLeaves");

GameRegistry.registerBlock(hellPlanks, "hellPlanks");

GameRegistry.registerBlock(blockGraphite, "blockGraphite");

GameRegistry.registerBlock(blockNetherrack, "blockNetherrack");

GameRegistry.registerBlock(bigGlowshroom1, "bigGlowshroom1");

GameRegistry.registerBlock(bigGlowshroom2, "bigGlowshroom2");

GameRegistry.registerBlock(bloodRock, "bloodRock");

 

//Register ores

GameRegistry.registerBlock(oreNetherrack, "oreNetherrack");

GameRegistry.registerBlock(oreQuartz, "oreQuartz");

GameRegistry.registerBlock(oreDarkQuartz, "oreDarkQuartz");

GameRegistry.registerBlock(oreBrimstone, "oreBrimstone");

GameRegistry.registerBlock(oreGarnet, "oreGarnet");

GameRegistry.registerBlock(oreGraphite, "oreGraphite");

 

//Register decorative blocks

GameRegistry.registerBlock(hellTorch, "hellTorch");

GameRegistry.registerBlock(glowShroom1, "glowShroom1");

GameRegistry.registerBlock(glowShroom2, "glowShroom2");

GameRegistry.registerBlock(bigGlowshroomStem, "bigGlowshroomStem");

GameRegistry.registerBlock(netherFurnaceIdle, "netherFurnaceIdle");

GameRegistry.registerBlock(rope, "rope");

 

//ITEM REGISTRY

//Register resources

GameRegistry.registerItem(hellStick, "hellStick");

GameRegistry.registerItem(netherRack, "netherRack");

GameRegistry.registerItem(brimStone, "brimStone");

GameRegistry.registerItem(garnet, "garnet");

GameRegistry.registerItem(darkQuartz, "darkQuartz");

GameRegistry.registerItem(graphite, "graphite");

 

//Register armor

GameRegistry.registerItem(helmetBrimstone, "helmetBrimstone");

GameRegistry.registerItem(chestBrimstone, "chestBrimstone");

GameRegistry.registerItem(legsBrimstone, "legsBrimstone");

GameRegistry.registerItem(bootsBrimstone, "bootsBrimstone");

GameRegistry.registerItem(helmetGarnet, "helmetGarnet");

GameRegistry.registerItem(chestGarnet, "chestGarnet");

GameRegistry.registerItem(legsGarnet, "legsGarnet");

GameRegistry.registerItem(bootsGarnet, "bootsGarnet");

GameRegistry.registerItem(helmetGraphite, "helmetGraphite");

GameRegistry.registerItem(chestGraphite, "chestGraphite");

GameRegistry.registerItem(legsGraphite, "legsGraphite");

GameRegistry.registerItem(bootsGraphite, "bootsGraphite");

 

//Register swords

GameRegistry.registerItem(swordHellwood, "swordHellwood");

GameRegistry.registerItem(swordHellstone, "swordHellstone");

GameRegistry.registerItem(swordBrimstone, "swordBrimstone");

GameRegistry.registerItem(swordGarnet, "swordGarnet");

GameRegistry.registerItem(swordGraphite, "swordGraphite");

GameRegistry.registerItem(swordWithering, "swordWithering");

 

//Register pickaxes

GameRegistry.registerItem(pickHellwood, "pickHellwood");

GameRegistry.registerItem(pickHellstone, "pickHellstone");

GameRegistry.registerItem(pickBrimstone, "pickBrimstone");

GameRegistry.registerItem(pickGarnet, "pickGarnet");

GameRegistry.registerItem(pickGraphite, "pickGraphite");

 

//Register axes

GameRegistry.registerItem(axeHellwood, "axeHellwood");

GameRegistry.registerItem(axeHellstone, "axeHellstone");

GameRegistry.registerItem(axeBrimstone, "axeBrimstone");

GameRegistry.registerItem(axeGarnet, "axeGarnet");

GameRegistry.registerItem(axeGraphite, "axeGraphite");

 

//Register shovels

GameRegistry.registerItem(shovelHellwood, "shovelHellwood");

GameRegistry.registerItem(shovelHellstone, "shovelHellstone");

GameRegistry.registerItem(shovelBrimstone, "shovelBrimstone");

GameRegistry.registerItem(shovelGarnet, "shovelGarnet");

GameRegistry.registerItem(shovelGraphite, "shovelGraphite");

 

 

GameRegistry.addSmelting(this.oreGraphite.blockID, new ItemStack(this.graphite), 0.5F);

 

}

 

//ACHIEVEMENT STUFF

private void addAchievementName(String ach, String name)

{

LanguageRegistry.instance().addStringLocalization("achievement." + ach, "en_US", name);

}

 

private void addAchievementDesc(String ach, String desc)

{

LanguageRegistry.instance().addStringLocalization("achievement." + ach + ".desc", "en_US", desc);

}

 

//Initialization, anything that happens WHILE the game is starting!

@Init

public void Init(FMLInitializationEvent event) {

 

    proxy.init();

TickRegistry.registerTickHandler(new TickHandler(), Side.SERVER);

GameRegistry.registerFuelHandler(new FuelHandler());

 

GameRegistry.registerTileEntity(teamoverhaul.netheroverhaul.gui.TileEntityNetherFurnace.class, "0");

 

//MONSTER NAMES

LanguageRegistry.instance().addStringLocalization("entity.Ghoul.name", "Ghoul");

LanguageRegistry.instance().addStringLocalization("entity.Shade.name", "Shade");

LanguageRegistry.instance().addStringLocalization("entity.Dweller.name", "Dweller");

 

//BLOCK NAMES

//Extend vanilla blocks via metadata

LanguageRegistry.addName(new ItemStack(Block.workbench, 1, 1), "Crafting Table");

 

//Add names to building blocks

LanguageRegistry.addName(hellStone, "Hellstone");

LanguageRegistry.addName(hellCobble, "Hell Cobblestone");

LanguageRegistry.addName(hellSoil, "Hellsoil");

LanguageRegistry.addName(soot, "Soot");

LanguageRegistry.addName(sootSmoldering, "Smoldering Soot");

LanguageRegistry.addName(hellLog, "Blazewood");

LanguageRegistry.addName(hellLeaves, "Blazewood Leaves");

LanguageRegistry.addName(hellPlanks, "Blazewood Planks");

LanguageRegistry.addName(blockNetherrack, "Netherrack Block");

LanguageRegistry.addName(blockGraphite, "Graphite Block");

LanguageRegistry.addName(bloodRock, "Blood Rock");

 

//Add names to ores

LanguageRegistry.addName(oreNetherrack, "Netherrack Ore");

LanguageRegistry.addName(oreQuartz, "Quartz Ore");

LanguageRegistry.addName(oreDarkQuartz, "Blackquartz Ore");

LanguageRegistry.addName(oreBrimstone, "Brimstone Ore");

LanguageRegistry.addName(oreGarnet, "Garnet Ore");

LanguageRegistry.addName(oreGraphite, "Graphite Ore");

 

//Add names to decorative blocks

LanguageRegistry.addName(hellTorch, "Torch");

LanguageRegistry.addName(glowShroom1, "Glowshroom");

LanguageRegistry.addName(glowShroom2, "Glowshroom");

LanguageRegistry.addName(bigGlowshroom1, "Big Glowshroom Cap");

LanguageRegistry.addName(bigGlowshroom2, "Big Glowshroom Cap");

LanguageRegistry.addName(bigGlowshroomStem, "Big Glowshroom Stem");

LanguageRegistry.addName(netherFurnaceIdle, "Nether Furnace");

LanguageRegistry.addName(rope, "Rope");

 

//NAME ITEMS

//Add names to resources

LanguageRegistry.addName(hellStick, "Stick");

LanguageRegistry.addName(netherRack, "Netherrack");

LanguageRegistry.addName(brimStone, "Brimstone");

LanguageRegistry.addName(garnet, "Garnet");

LanguageRegistry.addName(darkQuartz, "Blackquartz");

LanguageRegistry.addName(graphite, "Graphite");

 

//Add names to armor

LanguageRegistry.addName(helmetBrimstone, "Brimstone Helmet");

LanguageRegistry.addName(chestBrimstone, "Brimstone Chestplate");

LanguageRegistry.addName(legsBrimstone, "Brimstone Leggings");

LanguageRegistry.addName(bootsBrimstone, "Brimstone Boots");

LanguageRegistry.addName(helmetGarnet, "Garnet Helmet");

LanguageRegistry.addName(chestGarnet, "Garnet Chestplate");

LanguageRegistry.addName(legsGarnet, "Garnet Leggings");

LanguageRegistry.addName(bootsGarnet, "Garnet Boots");

LanguageRegistry.addName(helmetGraphite, "Graphite Helmet");

LanguageRegistry.addName(chestGraphite, "Graphite Chestplate");

LanguageRegistry.addName(legsGraphite, "Graphite Leggings");

LanguageRegistry.addName(bootsGraphite, "Graphite Boots");

 

//Add names to swords

LanguageRegistry.addName(swordHellwood, "Wooden Sword");

LanguageRegistry.addName(swordHellstone, "Hellstone Sword");

LanguageRegistry.addName(swordBrimstone, "Brimstone Sword");

LanguageRegistry.addName(swordGarnet, "Garnet Sword");

LanguageRegistry.addName(swordGraphite, "Graphite Sword");

LanguageRegistry.addName(swordWithering, "Withering Sword");

 

//Add names to pickaxes

LanguageRegistry.addName(pickHellwood, "Wooden Pickaxe");

LanguageRegistry.addName(pickHellstone, "Hellstone Pickaxe");

LanguageRegistry.addName(pickBrimstone, "Brimstone Pickaxe");

LanguageRegistry.addName(pickGarnet, "Garnet Pickaxe");

LanguageRegistry.addName(pickGraphite, "Graphite Pickaxe");

 

//Add names to axes

LanguageRegistry.addName(axeHellwood, "Wooden Axe");

LanguageRegistry.addName(axeHellstone, "Hellstone Axe");

LanguageRegistry.addName(axeBrimstone, "Brimstone Axe");

LanguageRegistry.addName(axeGarnet, "Garnet Axe");

LanguageRegistry.addName(axeGraphite, "Graphite Axe");

 

//Add names to shovel

LanguageRegistry.addName(shovelHellwood, "Wooden Shovel");

LanguageRegistry.addName(shovelHellstone, "Hellstone Shovel");

LanguageRegistry.addName(shovelBrimstone, "Brimstone Shovel");

LanguageRegistry.addName(shovelGarnet, "Garnet Shovel");

LanguageRegistry.addName(shovelGraphite, "Graphite Shovel");

 

 

        NetworkRegistry.instance().registerGuiHandler(this, new GuiHandler());

       

}

}

 

 

 

 

Link to comment
Share on other sites

not that it's likely to be anything to do with your problem Water' , but taking all the registrations for everything into separate classes would make the code a lot more easy to read/debug also...

 

e.g. pulling all the block registrations and fields into their own class from those preinit/inits, and calling a static method on a class to initialise them all... i do this for blocks, items, entities... each with their own "init this lot" class... that way my FMLInit/PreInitializationEvent methods just say the equivalent of: "BlockHelper.init()" in the preinit  and "BlockHelper.register()" in my init [ plus similar for items and entities n stuff ]

 

as a rule, i consider any method longer than about a standard screen page to need refactoring... [ unless there's a really good reason i can't break the method down, or if it makes no sense to do so ]

 

doing it this way will make your life a helluva lot easier if you ever need to change anything, since it'll be all nice an encapsulated in its own class... plus it makes abstracting the main mod from the blocks/items etc a lot simpler...

 

... and it'll save the eyes of those trying to read the code from bleeding as much ;)

 

 

back to your issue... i don't think you've pasted the code where the error happens, surely that's on an openGui line, no?

 

 

[ as an aside also, is there a specific reason why you have two separate blocks for the furnace when it's lit or not lit? - rather than just use metadata to switch the texture/mode? sorry - i'm not trying to pick holes in the code, i'm just curious :) ]

 

Link to comment
Share on other sites

Should be better this way:

@Mod(modid = mod_id, name = "The Nether Overhaul", version="ALPHA 1.0")
@NetworkMod(clientSideRequired = true, serverSideRequired = false)

public class mod_Nether {
   
   public static final String mod_id = "teamoverhaul_netheroverhaul";
   
   @Instance(mod_id)
   public static mod_Nether instance;

 

Link to comment
Share on other sites

not that it's likely to be anything to do with your problem Water' , but taking all the registrations for everything into separate classes would make the code a lot more easy to read/debug also...

 

e.g. pulling all the block registrations and fields into their own class from those preinit/inits, and calling a static method on a class to initialise them all... i do this for blocks, items, entities... each with their own "init this lot" class... that way my FMLInit/PreInitializationEvent methods just say the equivalent of: "BlockHelper.init()" in the preinit  and "BlockHelper.register()" in my init [ plus similar for items and entities n stuff ]

 

as a rule, i consider any method longer than about a standard screen page to need refactoring... [ unless there's a really good reason i can't break the method down, or if it makes no sense to do so ]

 

doing it this way will make your life a helluva lot easier if you ever need to change anything, since it'll be all nice an encapsulated in its own class... plus it makes abstracting the main mod from the blocks/items etc a lot simpler...

 

... and it'll save the eyes of those trying to read the code from bleeding as much ;)

 

 

back to your issue... i don't think you've pasted the code where the error happens, surely that's on an openGui line, no?

 

 

[ as an aside also, is there a specific reason why you have two separate blocks for the furnace when it's lit or not lit? - rather than just use metadata to switch the texture/mode? sorry - i'm not trying to pick holes in the code, i'm just curious :) ]

 

 

Haha That's a good point! (: I'm actually working with a team and the other head modder did that... I like your idea better though! (: haha The reason why I did the furnaces that way is because I learned them that way and haven't gotten to meta-data yet in my coding! (: I'll be sure to check it out though! I just took from the MC code and changed what I needed and stuff.

 

 

 

 

public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9)

    {

        if (world.isRemote)

        {

            return true;

        }

        else

        {

            TileEntityNetherFurnace tileentitynetherfurnace = (TileEntityNetherFurnace)world.getBlockTileEntity(x, y, z);

 

            if (tileentitynetherfurnace != null)

            {

            player.openGui(mod_Nether.instance, 0, world, x, y, z);

            }

 

            return true;

        }

    }

 

 

 

 

That's from my Nether Furnace class. I believe that's what you're talking about. (:

 

Also, I just did what you mentioned and it took out a lot of space! (: Thanks

Link to comment
Share on other sites

bump

 

did you do what gotolink suggested?  i.e. fix the instance name?

 

you were using @Instance("The Nether Overhaul")  rather than the modid...

 

That would do it... :P

I am Mew. The Legendary Psychic. I behave oddly and am always playing practical jokes.

 

I have also found that I really love making extremely long and extremely but sometimes not so descriptive variables. Sort of like what I just did there xD

Link to comment
Share on other sites

bump

 

did you do what gotolink suggested?  i.e. fix the instance name?

 

you were using @Instance("The Nether Overhaul")  rather than the modid...

 

I totally missed that post! (: I thought something looked fishy with that! Thank you all so much! (:

 

EDIT: I had to change the instance name to just modid without the "". (: I'm not sure if that will be a problem in the future... But it's fixed! Woo!

Link to comment
Share on other sites

Tip: read this www.minecraftforge.net/wiki/Basic_Modding

;)

 

Tip2: Keep your mod ID in some separate class file, so you can do Reference.modID whenever you need the modID, if it ever changes you only need to change one line ;)

 

tip3: The modid should NEVER NEVER include uppercase letters!

      Keep it all lowerCase or else you will get problems at a later stage ;)

If you guys dont get it.. then well ya.. try harder...

Link to comment
Share on other sites

so you can do Reference.modID whenever you need the modID, if it ever changes you only need to change one line

 

well .. i mean you should just keep it static, not necessarelly in a separate file

 

public class Reference{
    public static String modid = "theforgerevolution";
}

 

i mean this class is kindof useless

 

 

 

@op: keep in mind that your mod id and your mod NAME are 2 different things, players rarelly get to see the modid

 

ex:

my mod name: "The Forge Revolution"

my mod id: "forgerev" (i think, or something similar)

how to debug 101:http://www.minecraftforge.net/wiki/Debug_101

-hydroflame, author of the forge revolution-

Link to comment
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.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
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

    • The future of Bitcoin recovery is a topic of great interest and excitement, particularly with the emergence of innovative companies like Dexdert Net Pro Recovery leading the charge. As the cryptocurrency market continues to evolve and face new challenges, the need for effective solutions to help users recover lost or stolen Bitcoin has become increasingly critical. Dexdert Net Pro, a specialized firm dedicated to this very purpose, has positioned itself at the forefront of this emerging field. Through their proprietary techniques and deep expertise in blockchain technology, Dexdert Net Pro has developed a comprehensive approach to tracking down and retrieving misplaced or compromised Bitcoin, providing a lifeline to individuals and businesses who have fallen victim to the inherent risks of the digital currency landscape. Their team of seasoned investigators and cryptography experts employ a meticulous, multi-pronged strategy, leveraging advanced data analysis, forensic techniques, and collaborative partnerships with law enforcement to painstakingly trace the movement of lost or stolen coins, often recovering funds that would otherwise be considered irrecoverable. This pioneering work not only restores financial assets but also helps to bolster confidence and trust in the long-term viability of Bitcoin, cementing Dexdert Net Pro role as a crucial player in shaping the future of cryptocurrency recovery and security. As the digital finance ecosystem continues to evolve, the importance of innovative solutions like those offered by Dexdert Net Pro will only grow, ensuring that users can navigate the complexities of Bitcoin with greater peace of mind and protection. Call Dexdert Net Pro now     
    • I'm developing a dimension, but it's kinda resource intensive so some times during player teleporting it lags behind making the player phase down into the void, so im trying to implement some kind of pregeneration to force the game loading a small set of chunks in the are the player will teleport to. Some of the things i've tried like using ServerLevel and ServerChunkCache methods like getChunk() dont actually trigger chunk generation if the chunk isn't already on persistent storage (already generated) or placing tickets, but that doesn't work either. Ideally i should be able to check when the task has ended too. I've peeked around some pregen engines, but they're too complex for my current understanding of the system of which I have just a basic understanding (how ServerLevel ,ServerChunkCache  and ChunkMap work) of. Any tips or other classes I should be looking into to understand how to do this correctly?
    • https://mclo.gs/4UC49Ao
    • Way back in the Forge 1.17 days, work started for adding JPMS (Java Platform Module Support) to ModLauncher and ForgeModLoader. This has been used internally by Forge and some libraries for a while now, but mods (those with mods.toml specifically) have not been able to take advantage of it. As of Forge 1.21.1 and 1.21.3, this is now possible!   What is JPMS and what does it mean for modders? JPMS is the Java Platform Module System, introduced in Java 9. It allows you to define modules, which are collections of packages and resources that can be exported or hidden from other modules. This allows for much more fine-tuned control over visibility, cleaner syntax for service declarations and support for sealed types across packages. For example, you might have a mod with a module called `com.example.mod` that exports `com.example.mod.api` and `com.example.mod.impl` to other mods, but hides `com.example.mod.internal` from them. This would allow you to have a clean API for other mods to use, while keeping your internal implementation details hidden from IDE hints, helping prevent accidental usage of internals that might break without prior notice. This is particularly useful if you'd like to use public records with module-private constructors or partially module-private record components, as you can create a sealed interface that only your record implements, having the interface be exported and the record hidden. It's also nice for declaring and using services, as you'll get compile-time errors from the Java compiler for typos and the like, rather than deferring to runtime errors. In more advanced cases, you can also have public methods that are only accessible to specific other modules -- handy if you want internal interactions between multiple of your own mods.   How do I bypass it? We understand there may be drama in implementing a system that prevents mods from accessing each other's internals when necessary (like when a mod is abandoned or you need to fix a compat issue) -- after all, we are already modding a game that doesn't have explicit support for Java mods yet. We have already thought of this and are offering APIs from day one to selectively bypass module restrictions. Let me be clear: Forge mods are not required to use JPMS. If you don't want to use it, you don't have to. The default behaviour is to have fully open, fully exported automatic modules. In Java, you can use the `Add-Opens` and `Add-Exports` manifest attributes to selectively bypass module restrictions of other mods at launch time, and we've added explicit support for these when loading your Forge mods. At compile-time, you can use existing solutions such as the extra-java-module-info Gradle plugin to deal with non-modular dependencies and add extra opens and exports to other modules. Here's an example on how to make the internal package `com.example.examplemod.internal` open to your mod in your build.gradle: tasks.named('jar', Jar) { manifest { attributes([ 'Add-Opens' : 'com.example.examplemod/com.example.examplemod.internal' 'Specification-Title' : mod_id, 'Specification-Vendor' : mod_authors // (...) ]) } } With the above in your mod's jar manifest, you can now reflectively access the classes inside that internal package. Multiple entries are separated with a space, as per Java's official spec. You can also use Add-Exports to directly call without reflection, however you'd need to use the Gradle plugin mentioned earlier to be able to compile. The syntax for Add-Exports is the same as Add-Opens, and instructions for the compile-time step with the Gradle plugin are detailed later in this post. Remember to prefer the opens and exports keywords inside module-info.java for sources you control. The Add-Opens/Add-Exports attributes are only intended for forcing open other mods.   What else is new with module support? Previously, the runtime module name was always forced to the first mod ID in your `mods.toml` file and all packages were forced fully open and exported. Module names are now distinguished from mod IDs, meaning the module name in your module-info.java can be different from the mod ID in your `mods.toml`. This allows you to have a more descriptive module name that doesn't have to be the same as your mod ID, however we strongly recommend including your mod ID as part of your module name to aid troubleshooting. The `Automatic-Module-Name` manifest attribute is now also honoured, allowing you to specify a module name for your mod without needing to create a `module-info.java` file. This is particularly useful for mods that don't care about JPMS features but want to have a more descriptive module name and easier integration with other mods that do use JPMS.   How do I use it? The first step is to create a `module-info.java` file in your mod's source directory. This file should be in the same package as your main mod class, and should look something like this: open module com.example.examplemod { requires net.minecraftforge.eventbus; requires net.minecraftforge.fmlcore; requires net.minecraftforge.forge; requires net.minecraftforge.javafmlmod; requires net.minecraftforge.mergetool.api; requires org.slf4j; requires logging; } For now, we're leaving the whole module open to reflection, which is a good starting point. When we know we want to close something off, we can remove the open modifier from the module and open or export individual packages instead. Remember that you need to be open to Forge (module name net.minecraftforge.forge), otherwise it can't call your mod's constructor. Next is fixing modules in Gradle. While Forge and Java support modules properly, Gradle does not put automatic modules on the module path by default, meaning that the logging module (from com.mojang:logging) is not found. To fix this, add the Gradle plugin and add a compile-time module definition for that Mojang library: plugins { // (...) id 'org.gradlex.extra-java-module-info' version "1.9" } // (...) extraJavaModuleInfo { failOnMissingModuleInfo = false automaticModule("com.mojang:logging", "logging") } The automatic module override specified in your build.gradle should match the runtime one to avoid errors. You can do the same for any library or mod dependency that is missing either a module-info or explicit Automatic-Module-Name, however be aware that you may need to update your mod once said library adds one. That's all you need to get started with module support in your mods. You can learn more about modules and how to use them at dev.java.
    • Faire la mise à jour grâce à ce lien m'a aider personnellement, merci à @Paint_Ninja. https://www.amd.com/en/support 
  • Topics

  • Who's Online (See full list)

×
×
  • Create New...

Important Information

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