Jump to content

Recommended Posts

Posted

Hi. I'm new to modding (about 24 hours) but I have plenty of JAVA experience. I am trying to make several small mods just playing around with the API to get comfortable before I try anything big and one block I'm trying to add is a custom pressure plate.

I copied my pressure plate instantiation from block.Block.java and added a pressure plate class extends BlockPressurePlate to be able to call the constructor.

 

package obsidian;

import obsidian.CommonProxy;
import net.minecraft.block.Block;
import net.minecraft.block.BlockPressurePlate;
import net.minecraft.block.EnumMobType;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.EnumArmorMaterial;
import net.minecraft.item.EnumToolMaterial;
import net.minecraft.item.Item;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.FurnaceRecipes;
import net.minecraft.block.material.Material;
import net.minecraftforge.common.EnumHelper;
import net.minecraftforge.common.ForgeHooks;
import net.minecraftforge.common.MinecraftForge;
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.PostInit;
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.FMLPostInitializationEvent;
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.GameRegistry;
import cpw.mods.fml.common.registry.LanguageRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;

@Mod(modid = "Obsidian", name = "Obsidian", version = "0.0.0")
@NetworkMod(clientSideRequired = true, serverSideRequired = false)
public class Obsidian {
static EnumToolMaterial OBSIDIANTOOLS = EnumHelper.addToolMaterial("OBSIDIAN", 3, 3000, 6.0F, 2, 5);
public static Item shovelObsidian = new ObsidianShovel(1004, OBSIDIANTOOLS).setUnlocalizedName("shovelObsidian");
public static Item pickaxeObsidian = new ObsidianPickaxe(1005, OBSIDIANTOOLS).setUnlocalizedName("pickaxeObsidian");
public static Item axeObsidian = new ObsidianAxe(1006, OBSIDIANTOOLS).setUnlocalizedName("axeObsidian");
public static Item swordObsidian = new ObsidianSword(1007, OBSIDIANTOOLS).setUnlocalizedName("swordObsidian");
public static Item hoeObsidian = new ObsidianHoe(1008, OBSIDIANTOOLS).setUnlocalizedName("hoeObsidian");
static EnumArmorMaterial OBSIDIANARMOR = EnumHelper.addArmorMaterial("OBSIDIAN", 70, new int[] { 2, 7, 5, 2 }, 5);
public final static Item helmetObsidian = new ObsidianArmor(1000, OBSIDIANARMOR, 2, 0).setUnlocalizedName("helmetObsidian");
public final static Item chestplateObsidian = new ObsidianArmor(1001, OBSIDIANARMOR, 2, 1).setUnlocalizedName("chestplateObsidian");
public final static Item leggingsObsidian = new ObsidianArmor(1002, OBSIDIANARMOR, 2, 2).setUnlocalizedName("leggingsObsidian");
public final static Item bootsObsidian = new ObsidianArmor(1003, OBSIDIANARMOR, 2, 3).setUnlocalizedName("bootsObsidian");


//My custom pressure plate----------------------------------------------------------------------------------
public final static Block pressurePlateObsidian = new BlockObsidianPressurePlate(2000, "stone", Material.rock, EnumMobType.mobs);//.setUnlocalizedName("pressurePlateObsidian").setHardness(50.0F);
//public static final Block pressurePlateStone = (new BlockPressurePlate(70, "stone", Material.rock, EnumMobType.mobs)).setHardness(0.5F).setStepSound(soundStoneFootstep).setUnlocalizedName("pressurePlate");
@Instance("Obsidian")
    public static Obsidian instance;
    
    @SidedProxy(clientSide = "obsidian.client.ClientProxy", serverSide = "obsidian.CommonProxy")
    public static CommonProxy proxy;

    @PreInit
    public void preInit (FMLPreInitializationEvent event) {
        // Stub Method
    }
    
    @Init
    public void init(FMLInitializationEvent event) {
            //NetworkRegistry.instance().registerGuiHandler(this, new GuiHandler());
    }

    @Init
    public void load (FMLInitializationEvent event) {
    	
    	LanguageRegistry.addName(helmetObsidian, "Obsidian Helm");
    	LanguageRegistry.addName(chestplateObsidian, "Obsidian Chestplate");
    	LanguageRegistry.addName(leggingsObsidian, "Obsidian Pants");
    	LanguageRegistry.addName(bootsObsidian, "Obsidian Boots");
    	LanguageRegistry.addName(pickaxeObsidian, "Obsidian Pickaxe");
    	LanguageRegistry.addName(axeObsidian, "Obsidian Axe");
    	LanguageRegistry.addName(shovelObsidian, "Obsidian Shovel");
    	LanguageRegistry.addName(hoeObsidian, "Obsidian Hoe");
    	LanguageRegistry.addName(swordObsidian, "Obsidian Sword");
    	LanguageRegistry.addName(pressurePlateObsidian, "Obsidian Pressure Plate");
    	proxy.registerRenderers();
    	MinecraftForge.setToolClass(pickaxeObsidian, "pickaxe", 3);
    	MinecraftForge.setToolClass(shovelObsidian, "shovel", 3);
    	MinecraftForge.setToolClass(axeObsidian, "axe", 3);
    	ItemStack obsidianStack = new ItemStack(Block.obsidian);
    	ItemStack stickStack = new ItemStack(Item.stick);
    	GameRegistry.addRecipe(new ItemStack(helmetObsidian),    "xxx", "x x",        'x', obsidianStack);
    	GameRegistry.addRecipe(new ItemStack(chestplateObsidian),"x x", "xxx", "xxx", 'x', obsidianStack);
    	GameRegistry.addRecipe(new ItemStack(leggingsObsidian),  "xxx", "x x", "x x", 'x', obsidianStack);
    	GameRegistry.addRecipe(new ItemStack(bootsObsidian),     "x x", "x x",        'x', obsidianStack);
    	GameRegistry.addRecipe(new ItemStack(pickaxeObsidian),"xxx", " y ", " y ", 'x', obsidianStack, 'y', stickStack);
    	GameRegistry.addRecipe(new ItemStack(axeObsidian),    "xx ", "xy ", " y ", 'x', obsidianStack, 'y', stickStack);
    	GameRegistry.addRecipe(new ItemStack(axeObsidian),    " xx", " yx", " y ", 'x', obsidianStack, 'y', stickStack);
    	GameRegistry.addRecipe(new ItemStack(shovelObsidian),   "x",   "y",   "y", 'x', obsidianStack, 'y', stickStack);
    	GameRegistry.addRecipe(new ItemStack(hoeObsidian),    "xx ", " y ", " y ", 'x', obsidianStack, 'y', stickStack);
    	GameRegistry.addRecipe(new ItemStack(hoeObsidian),    " xx", " y ", " y ", 'x', obsidianStack, 'y', stickStack);
    	GameRegistry.addRecipe(new ItemStack(swordObsidian),    "x",   "x",   "y", 'x', obsidianStack, 'y', stickStack);
    	GameRegistry.addRecipe(new ItemStack(pressurePlateObsidian), "xx", 'x', new ItemStack(Block.cobblestone));
    }

    @PostInit
    public void postInit (FMLPostInitializationEvent event) {
        // Stub Method
    }
}

 

 

package obsidian;

import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.block.BlockPressurePlate;
import net.minecraft.block.EnumMobType;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IconRegister;

public class BlockObsidianPressurePlate extends BlockPressurePlate {
public BlockObsidianPressurePlate(int par1, String par2Str, Material par3Material, EnumMobType par4EnumMobType) {
	super(par1, par2Str, par3Material, par4EnumMobType);
}
//I have run the program with nothing below this comment and without @SideOnly or @Override
@SideOnly(Side.CLIENT)
    @Override
public void registerIcons(IconRegister par1IconRegister)
    {
        this.blockIcon = Block.obsidian.getBlockTextureFromSide(0);
    }
}

 

Forge seems to find the texture alright, but then it gives the error:

 

2013-05-03 10:55:29 [iNFO] [sTDERR] java.lang.NoSuchFieldException: GL_ARB_copy_image

2013-05-03 10:55:29 [iNFO] [sTDERR] at java.lang.Class.getField(Unknown Source)

2013-05-03 10:55:29 [iNFO] [sTDERR] at cpw.mods.fml.client.TextureFXManager.getHelper(TextureFXManager.java:122)

2013-05-03 10:55:29 [iNFO] [sTDERR] at net.minecraft.client.renderer.texture.TextureStitched.init(TextureStitched.java:74)

2013-05-03 10:55:29 [iNFO] [sTDERR] at net.minecraft.client.renderer.texture.TextureMap.refreshTextures(TextureMap.java:154)

2013-05-03 10:55:29 [iNFO] [sTDERR] at net.minecraft.client.renderer.RenderEngine.refreshTextureMaps(RenderEngine.java:520)

2013-05-03 10:55:29 [iNFO] [sTDERR] at net.minecraft.client.Minecraft.startGame(Minecraft.java:440)

2013-05-03 10:55:29 [iNFO] [sTDERR] at net.minecraft.client.MinecraftAppletImpl.startGame(MinecraftAppletImpl.java:44)

2013-05-03 10:55:29 [iNFO] [sTDERR] at net.minecraft.client.Minecraft.run(Minecraft.java:729)

2013-05-03 10:55:29 [iNFO] [sTDERR] at java.lang.Thread.run(Unknown Source)

 

While starting up minecraft. Then the game runs fine until the moment I place the second block of the recipe and the server starts shutting down before the game crashes and I have to stop the process through task manager.

 

My only thought is that it has to be something to do with my BlockObsidianPressurePlate class because that is the only difference between my code and the vanilla code. Any thoughts anyone?

 

___

 

It helps to register blocks. I had been playing with too many new items and forgot to register my block after making it. Thanks to diesieben07 for pointing out that there was no error message about my block.

Read my thoughts on my summer mod work and tell me what you think!

http://www.minecraftforge.net/forum/index.php/topic,8396.0.html

 

I absolutely love her when she smiles

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.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • So I started an MC server with some friends. It worked perfectly last night, but this morning I get the error that my PlayerData is invalid. I tried deleting my player data along with my cobblemon player pokemon storage data (for the cobblemon mod). I am still having the issue. https://pastes.io/log-38182 is my latest log, though I am not great at deciphering it. Any help would be appreciated. I have already tried using Packet Fixer aswell. I really would prefer to not have to delete the world.  
    • Looks like an issue with one of the create addons - remove these one by one
    • I have no idea - maybe it is directly an issue with mohist
    • I made a custom pack, but i can't even load it, it just crashes at launcher, giving me Error 1. I looked at the log, and it just doesn't seem to tell me what the issue actually is. Here's the report.   Edit- Trying to get report, but copy paste being weird [22:59:59] [main/ERROR]:Error replacing mixin module source java.lang.ClassNotFoundException: cpw.mods.cl.JarModuleFinder$JarModuleReference at java.base/jdk.internal.loader.Loader.loadClass(Loader.java:571) ~[?:?] at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:526) ~[?:?] at cpw.mods.securejarhandler/net.minecraftforge.securemodules.SecureModuleClassLoader.loadClass(SecureModuleClassLoader.java:429) ~[securemodules-2.2.21.jar!/:?] at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:526) ~[?:?] at java.base/java.lang.Class.forName0(Native Method) ~[?:?] at java.base/java.lang.Class.forName(Class.java:421) ~[?:?] at java.base/java.lang.Class.forName(Class.java:412) ~[?:?] at LAYER SERVICE/[email protected]+1.20.1/io.github.steelwoolmc.mixintransmog.InstrumentationHack.inject(InstrumentationHack.java:46) ~[?:?] at LAYER SERVICE/[email protected]+1.20.1/io.github.steelwoolmc.mixintransmog.MixinTransformationService.<init>(MixinTransformationService.java:59) ~[?:?] at java.base/jdk.internal.reflect.DirectConstructorHandleAccessor.newInstance(DirectConstructorHandleAccessor.java:62) [?:?] at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:502) [?:?] at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:486) [?:?] at java.base/java.util.ServiceLoader$ProviderImpl.newInstance(ServiceLoader.java:789) [?:?] at java.base/java.util.ServiceLoader$ProviderImpl.get(ServiceLoader.java:729) [?:?] at java.base/java.util.ServiceLoader$3.next(ServiceLoader.java:1403) [?:?] at SECURE-BOOTSTRAP/[email protected]/cpw.mods.modlauncher.TransformationServicesHandler.discoverServices(TransformationServicesHandler.java:156) [modlauncher-10.2.4.jar!/:?] at SECURE-BOOTSTRAP/[email protected]/cpw.mods.modlauncher.Launcher.run(Launcher.java:84) [modlauncher-10.2.4.jar!/:?] at SECURE-BOOTSTRAP/[email protected]/cpw.mods.modlauncher.Launcher.main(Launcher.java:75) [modlauncher-10.2.4.jar!/:?] at SECURE-BOOTSTRAP/[email protected]/cpw.mods.modlauncher.BootstrapEntry.main(BootstrapEntry.java:17) [modlauncher-10.2.4.jar!/:?] at [email protected]/net.minecraftforge.bootstrap.Bootstrap.moduleMain(Bootstrap.java:188) [bootstrap-2.1.8.jar!/:?] at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103) ~[?:?] at java.base/java.lang.reflect.Method.invoke(Method.java:580) ~[?:?] at net.minecraftforge.bootstrap.Bootstrap.bootstrapMain(Bootstrap.java:133) [bootstrap-2.1.8.jar:2.1.8] at net.minecraftforge.bootstrap.Bootstrap.start(Bootstrap.java:53) [bootstrap-2.1.8.jar:2.1.8] at net.minecraftforge.bootstrap.ForgeBootstrap.main(ForgeBootstrap.java:19) [bootstrap-2.1.8.jar:2.1.8] [22:59:59] [main/FATAL]:Encountered serious error loading transformation service, expect problems java.util.ServiceConfigurationError: cpw.mods.modlauncher.api.ITransformationService: Provider io.github.steelwoolmc.mixintransmog.MixinTransformationService could not be instantiated at java.base/java.util.ServiceLoader.fail(ServiceLoader.java:586) ~[?:?] at SECURE-BOOTSTRAP/[email protected]/cpw.mods.modlauncher.TransformationServicesHandler.discoverServices(TransformationServicesHandler.java:156) [modlauncher-10.2.4.jar!/:?] at SECURE-BOOTSTRAP/[email protected]/cpw.mods.modlauncher.Launcher.run(Launcher.java:84) [modlauncher-10.2.4.jar!/:?] at SECURE-BOOTSTRAP/[email protected]/cpw.mods.modlauncher.Launcher.main(Launcher.java:75) [modlauncher-10.2.4.jar!/:?] at SECURE-BOOTSTRAP/[email protected]/cpw.mods.modlauncher.BootstrapEntry.main(BootstrapEntry.java:17) [modlauncher-10.2.4.jar!/:?] at [email protected]/net.minecraftforge.bootstrap.Bootstrap.moduleMain(Bootstrap.java:188) [bootstrap-2.1.8.jar!/:?] at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103) ~[?:?] at java.base/java.lang.reflect.Method.invoke(Method.java:580) ~[?:?] at net.minecraftforge.bootstrap.Bootstrap.bootstrapMain(Bootstrap.java:133) [bootstrap-2.1.8.jar:2.1.8] at net.minecraftforge.bootstrap.Bootstrap.start(Bootstrap.java:53) [bootstrap-2.1.8.jar:2.1.8] at net.minecraftforge.bootstrap.ForgeBootstrap.main(ForgeBootstrap.java:19) [bootstrap-2.1.8.jar:2.1.8] Caused by: java.lang.RuntimeException: java.lang.ClassNotFoundException: cpw.mods.cl.JarModuleFinder$JarModuleReference at LAYER SERVICE/[email protected]+1.20.1/io.github.steelwoolmc.mixintransmog.MixinTransformationService.<init>(MixinTransformationService.java:62) ~[?:?] at java.base/jdk.internal.reflect.DirectConstructorHandleAccessor.newInstance(DirectConstructorHandleAccessor.java:62) ~[?:?] at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:502) ~[?:?] at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:486) ~[?:?] at java.base/java.util.ServiceLoader$ProviderImpl.newInstance(ServiceLoader.java:789) ~[?:?] ... 12 more Caused by: java.lang.ClassNotFoundException: cpw.mods.cl.JarModuleFinder$JarModuleReference at java.base/jdk.internal.loader.Loader.loadClass(Loader.java:571) ~[?:?] at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:526) ~[?:?] at cpw.mods.securejarhandler/net.minecraftforge.securemodules.SecureModuleClassLoader.loadClass(SecureModuleClassLoader.java:429) ~[securemodules-2.2.21.jar!/:?] at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:526) ~[?:?] at java.base/java.lang.Class.forName0(Native Method) ~[?:?] at java.base/java.lang.Class.forName(Class.java:421) ~[?:?] at java.base/java.lang.Class.forName(Class.java:412) ~[?:?] at LAYER SERVICE/[email protected]+1.20.1/io.github.steelwoolmc.mixintransmog.InstrumentationHack.inject(InstrumentationHack.java:46) ~[?:?] at LAYER SERVICE/[email protected]+1.20.1/io.github.steelwoolmc.mixintransmog.MixinTransformationService.<init>(MixinTransformationService.java:59) ~[?:?] at java.base/jdk.internal.reflect.DirectConstructorHandleAccessor.newInstance(DirectConstructorHandleAccessor.java:62) ~[?:?] at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:502) ~[?:?] at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:486) ~[?:?] at java.base/java.util.ServiceLoader$ProviderImpl.newInstance(ServiceLoader.java:789) ~[?:?] ... 12 more [22:59:59] [main/INFO]:SpongePowered MIXIN Subsystem Version=0.8.7 Source=jar:file:///C:/Users/mxz/curseforge/minecraft/Install/libraries/org/spongepowered/mixin/0.8.7/mixin-0.8.7.jar!/ Service=ModLauncher Env=CLIENT at java.base/java.util.ServiceLoader$ProviderImpl.newInstance(ServiceLoader.java:813) ~[?:?] at java.base/java.util.ServiceLoader$ProviderImpl.get(ServiceLoader.java:729) ~[?:?] at java.base/java.util.ServiceLoader$3.next(ServiceLoader.java:1403) ~[?:?]
    • here is a different world https://ibb.co/Q3VWj9gW and the server console https://ibb.co/dwQf0qrR
  • Topics

×
×
  • Create New...

Important Information

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