Please anyone I need code help for 1.7.3

Started by Zergmazter on

Topic category: Help with modding (Java Edition)

Last seen on 02:07, 12. Mar 2020
Joined Nov 2014
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Please anyone I need code help for 1.7.3
Sat, 02/03/2018 - 04:46 (edited)

I'm exhausted...I've been at it for weeks with little to no help but I've now face planted. This code is for an event handler is for mcreator 1.7.3 for mc 1.7.10:

package mod.mcreator;

import net.minecraftforge.event.terraingen.PopulateChunkEvent;
import net.minecraftforge.event.terraingen.DecorateBiomeEvent;
import net.minecraftforge.event.world.BlockEvent.HarvestDropsEvent;
import net.minecraftforge.event.world.BlockEvent;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.client.event.RenderGameOverlayEvent;

import net.minecraft.world.World;
import net.minecraft.server.MinecraftServer;
import net.minecraft.item.ItemStack;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.client.Minecraft;
import net.minecraft.init.Blocks;

import java.util.Random;

import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.eventhandler.EventPriority;
import cpw.mods.fml.common.event.FMLServerStartingEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.FMLCommonHandler;

//import static net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.*;

//import static net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.*;

public class mcreator_myVanillaEdits {

    public static class MyBlockEventClass {    
          @SubscribeEvent
          public void onBlockBreak(BlockEvent.HarvestDropsEvent event)
          {
               if(event.state.getBlock() == Blocks.sand)
                    {
               
                    }
          }
    }

    public mcreator_myVanillaEdits() {
    }

    public Object instance;

    public void load() {
        MinecraftForge.EVENT_BUS.register(new MyBlockEventClass());
    }

    public void generateNether(World world, Random random, int chunkX, int chunkZ) {
    }

    public void generateSurface(World world, Random random, int chunkX, int chunkZ) {
    }

    public int addFuel(ItemStack fuel) {
        return 0;
    }

    public void serverLoad(FMLServerStartingEvent event) {
    }

    public void preInit(FMLPreInitializationEvent event) {
    }

    public void registerRenderers() {
    }
}

 

It's unfinished I know, but I wanted to fix the many errors first. Fixed them all mainly by importing stuff after doing research. This is all I could learn in 2 weeks. This one error won't let me reap the results of my efforts. I've spent 2-4 hours a day for 2 weeks looking at the forge documentation and I'm very disappointed. I have no clue how people can come up with their lines of code. It would take me a few more months to go through all the documentation to see if I can finish this event handler, and I'm not guaranteed success. There is as much information as in the holy bible and I feel lost as if I was trying to find the recipe for some holy water :^(

 

My problem is I wanna make sand drop a stick, but graddle gives me this error:

 

C:\Pylo\MCreator173\forge\build\sources\java\mod\mcreator\mcreator_myVanillaEdits.java:35: error: cannot find symbol
               if(event.state.getBlock() == Blocks.sand)
                       ^
  symbol:   variable state
  location: variable event of type HarvestDropsEvent
1 error

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':compileJava'.
> Compilation failed; see the compiler error output for details.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

 

I can't finish my Handler without fixing this error. It's almost as if I'm using code for a different mc version or maybe I'm missing an Import.

Edited by Zergmazter on Sat, 02/03/2018 - 04:46
Last seen on 22:13, 3. Apr 2024
Joined Aug 2013
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Yes , you are using a code…
Sat, 02/03/2018 - 08:46

Yes , you are using a code for different version. The field with name state of type BlockState exists from version 1.8 - when actually BlockState were introduced;

Last seen on 02:07, 12. Mar 2020
Joined Nov 2014
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Nuparu00…
Wed, 02/07/2018 - 03:13

Nuparu00

Thank you very much for the reply.

I wanted to learn how to code for minecraft but wow... I'm baffled... I can do what I want with other mods, but then it'd be a modpack. I wanted to make my own mod and not a modpack :(

Thank you for your time. I've spent way too much time on this stuff (3 weeks) and stopped working on my mcreator mods. I'm just gonna go and finish my mods. There are other mods out there that can do what I wanted to introduce with my mods, so I guess people will have to just make a modpack.

Here is a link to the 2 mods I'm working on soon to be released in this forum, then to forge:

https://www.minecraftforum.net/forums/mapping-and-modding-java-edition/…

https://www.minecraftforum.net/forums/mapping-and-modding-java-edition/…