Jump to content

fieldbox

Members
  • Posts

    32
  • Joined

  • Last visited

Posts posted by fieldbox

  1. I'm trying to make a Lightning Rod item to learn how to use the onItemUse method in modding. It's supposed to summon a lightning bolt when right clicked. However, when I right click with the item, it just plays the sound of a lightning bolt being summoned and doesn't spawn an actual bolt. What have I done wrong? Here's the code inside my onItemUse method.

    @Override
    public ActionResultType onItemUse(ItemUseContext context) {
    	LightningBoltEntity bolt = new LightningBoltEntity(context.getWorld(), context.getPos().getX(), context.getPos().getY(), context.getPos().getZ(), true);
    	context.getWorld().addEntity(bolt);
    	return ActionResultType.PASS;
    }

     

  2. Sorry if Forgelin isn't supported here, there was nowhere else to ask. If you post Java, IDEA automatically converts it into Kotlin, so it doesn't matter if you don't know Kotlin. Anyway, I set up a ClientProxy and ServerProxy that implement an IProxy interface I made. I added a public static val (like a constant in Java) of type IProxy? with an @SidedProxy annotation with the exact package names of both proxies. Both the proxies are public. When I run, I get an error saying this:

     

    java.lang.IllegalAccessException: Class net.minecraftforge.fml.common.ProxyInjector can not access a member of class com.fieldbox.upgrademod.ClientProxy with modifiers "private"

     

    I don't understand. The object ClientProxy is public, so it shouldn't be throwing this error, right?

     

    Proxy code in mod file (Kotlin)

    @JvmStatic
    @SidedProxy(clientSide = "com.fieldbox.upgrademod.ClientProxy", serverSide = "com.fieldbox.upgrademod.ServerProxy")
    public val proxy : IProxy? = null

     

    Proxy code in mod file (Java, but a bit rusty)

    @SidedProxyclientSide = "com.fieldbox.upgrademod.ClientProxy", serverSide = "com.fieldbox.upgrademod.ServerProxy"public static final IProxy 
  3. I changed things around in the "repositories" part of the gradle file (looks like my other repositories part was blocking out the official one with the forge stuff). Now there's a new issue:

     Could not find net.minecraftforge.gradle:ForgeGradle:2.3-SNAPSHOT.
         Searched in the following locations:
             https://jcenter.bintray.com/net/minecraftforge/gradle/ForgeGradle/2.3-SNAPSHOT/maven-metadata.xml
             https://jcenter.bintray.com/net/minecraftforge/gradle/ForgeGradle/2.3-SNAPSHOT/ForgeGradle-2.3-SNAPSHOT.pom
             https://jcenter.bintray.com/net/minecraftforge/gradle/ForgeGradle/2.3-SNAPSHOT/ForgeGradle-2.3-SNAPSHOT.jar
             http://maven.shadowfacts.net/net/minecraftforge/gradle/ForgeGradle/2.3-SNAPSHOT/maven-metadata.xml
             http://maven.shadowfacts.net/net/minecraftforge/gradle/ForgeGradle/2.3-SNAPSHOT/ForgeGradle-2.3-SNAPSHOT.pom
             http://maven.shadowfacts.net/net/minecraftforge/gradle/ForgeGradle/2.3-SNAPSHOT/ForgeGradle-2.3-SNAPSHOT.jar
         Required by:
             :mod:unspecified

    That error appears in the Gradle window for IDEA as well as setupDecompWorkspace.

  4. I'm using Forgelin and created an object, annotated it with Mod, which didn't work. I then tried to import net.minecraftforge.fml.common.Mod, but that throws an 'unresolved reference' error. I'm in IDEA and, if it helps, Forge and Minecraft are not in my External Libraries. Sorry if Forgelin isn't directly supported, I didn't know where else to ask. Oh yeah, and genIntellijRuns throws a NullPointerException! 

  5. image.thumb.png.21fa1c5089a314dcf92b2f511448f252.png

    When I run .\gradlew setupDecompWorkspace in PowerShell, this error appears. I am using the latest 64-bit JDK. If this changes anything, I have added the Forgelin stuff into build.gradle:

     

    repositories {
    	jcenter()
    	maven {
    		url "http://maven.shadowfacts.net/"
    	}
    }
    
    dependencies {
    	compile group: "net.shadowfacts", name: "Forgelin", version: "LATEST_VERSION"
    }

     

    EDIT: Whoops, I think I posted in the wrong section. I only saw "Support and Bug Reports", didn't see Modding Support.

  6. 7 minutes ago, Cadiboo said:

    Can you use /setblock to place it?

    If so, Are you registering an ItemBlock for your block?

    I tried registering Item.getItemFromBlock(Blocks.testBlock) as an item but it's still not working...

     

     

  7. @Mod(modid = MyMod.MODID, name = MyMod.NAME, version = MyMod.VERSION)
    public class MyMod {
        public static final String MODID = "testmod";
        public static final String NAME = "test mod";
        public static final String VERSION = "1.0";
        @SidedProxy(clientSide = "com.harry.proxy.ClientProxy", serverSide = "com.harry.proxy.CommonProxy")
        public static CommonProxy proxy;
        @SidedProxy(clientSide = "com.harry.proxy.ClientProxy", serverSide = "com.harry.proxy.CommonProxy")
        public static ClientProxy proxy2;
        @Mod.Instance
        public static MyMod mod;
        public static final Logger LOGGER = LogManager.getLogger(MODID);
    
        @EventHandler
        public void preInit(FMLPreInitializationEvent event)
        {
            proxy.preInit(event);
        }
    
        @EventHandler
        public void init(FMLInitializationEvent event)
        {
            proxy.init(event);
        }
        @EventHandler
        @SideOnly(Side.CLIENT)
        public void clientInit(FMLInitializationEvent event) {
            proxy2.init(event);
        }
        @EventHandler
        public void postInit(FMLPostInitializationEvent event)
        {
            proxy.postInit(event);
        }
    }
    

    (i haven't got around to fixing that CommonProxy thing)

    public class TestBlock extends BlockBase {
        public TestBlock(String name, Material mat, CreativeTabs tab, float hardness, float resistance) {
            super(name, mat, tab, hardness, resistance);
        }
    }
    

    And the BlockBase class:

    public class BlockBase extends Block {
        public BlockBase(String name, Material mat, CreativeTabs tab, float hardness, float resistance, String tool, int harvest) {
            this(name, mat, tab, hardness, resistance);
            setHarvestLevel(tool, harvest);
        }
        public BlockBase(String name, Material mat, CreativeTabs tab, float hardness, float resistance, float light) {
            this(name, mat, tab, hardness, resistance);
            setLightLevel(light);
        }
        public BlockBase(String name, Material mat, CreativeTabs tab, float hardness, float resistance) {
            super(mat);
            setUnlocalizedName(name);
            setRegistryName(name);
            setHardness(hardness);
            setResistance(resistance);
            setCreativeTab(tab);
        }
    }
    
×
×
  • Create New...

Important Information

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