public class AdditionalStoneWorldGeneration implements IWorldGenerator
{
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider)
{
switch (world.provider.dimensionId)
{
case 0:
generateSurface(world, random, chunkX * 16, chunkZ * 16);
case -1:
generateNether(world, random, chunkX * 16, chunkZ * 16);
case 1:
generateEnd(world, random, chunkX * 16, chunkZ * 16);
}
}
private void generateSurface(World world, Random random, int x, int z)
{
addOreSpawn(ModBlocks.BonumStone, world, random, x, z, 16, 16, 20 + random.nextInt(5), 9, 0, 255);
}
private void generateNether(World world, Random random, int x, int z)
{
}
private void generateEnd(World world, Random random, int x, int z)
{
}
private void addOreSpawn(Block block, World world, Random random, int blockXPos, int blockZPos, int maxX, int maxZ, int maxVeinSize, int chanceToSpawn, int minY, int maxY)
{
for (int i = 0; i < chanceToSpawn; i++)
{
int posX = blockXPos + random.nextInt(maxX);
int posY = minY + random.nextInt(maxY - minY);
int posZ = blockZPos + random.nextInt(maxZ);
new WorldGenMinable(block, maxVeinSize).generate(world, random, posX, posY, posZ);
}
}
}
Main Class:
package SageRaziel.AdditionalStone;
import cpw.mods.fml.common.IWorldGenerator;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler; // used in 1.6.2
//import cpw.mods.fml.common.Mod.PreInit; // used in 1.5.2
//import cpw.mods.fml.common.Mod.Init; // used in 1.5.2
//import cpw.mods.fml.common.Mod.PostInit; // used in 1.5.2
import cpw.mods.fml.common.Mod.Instance;
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.registry.GameRegistry;
import SageRaziel.AdditionalStone.Generation.AdditionalStoneWorldGeneration;
import SageRaziel.AdditionalStone.help.Reference;
//import cpw.mods.fml.common.network.NetworkMod; // not used in 1.7
import SageRaziel.AdditionalStone.init.ModBlocks;
@Mod(modid = Reference.MODID, name = Reference.NAME, version = Reference.VERSION)
//@NetworkMod(clientSideRequired=true) // not used in 1.7
public class AdditionalStone {
// The instance of your mod that Forge uses.
@Instance(value = "AdditionalStone")
public static AdditionalStone instance;
// Says where the client and server 'proxy' code is loaded.
@SidedProxy(clientSide="SageRaziel.AdditionalStone.client.ClientProxy", serverSide="SageRaziel.AdditionalStone.CommonProxy")
public static CommonProxy proxy;
@EventHandler // used in 1.6.2
//@PreInit // used in 1.5.2
public void preInit(FMLPreInitializationEvent event) {
ModBlocks.init();
// Stub Method
GameRegistry.registerWorldGenerator(this.eventWorldGen, 0);
}
AdditionalStoneWorldGeneration eventWorldGen = new AdditionalStoneWorldGeneration();
@EventHandler // used in 1.6.2
//@Init // used in 1.5.2
public void load(FMLInitializationEvent event) {
proxy.registerRenderers();
}
@EventHandler // used in 1.6.2
//@PostInit // used in 1.5.2
public void postInit(FMLPostInitializationEvent event) {
// Stub Method
}
}
Latest Crash Report:
[00:26:16] [main/INFO]: Setting user: Player627
[00:26:17] [Client thread/INFO]: LWJGL Version: 2.9.1
[00:26:21] [Client thread/INFO]: Reloading ResourceManager: Default, FMLFileResourcePack:Forge Mod Loader, FMLFileResourcePack:Minecraft Forge, FMLFileResourcePack:Additional Stone
[00:26:22] [Sound Library Loader/INFO]: Sound engine started
[00:26:22] [Client thread/INFO]: Created: 512x256 textures/blocks-atlas
[00:26:22] [Client thread/INFO]: Created: 256x256 textures/items-atlas
[00:26:22] [Client thread/INFO]: Reloading ResourceManager: Default, FMLFileResourcePack:Forge Mod Loader, FMLFileResourcePack:Minecraft Forge, FMLFileResourcePack:Additional Stone
[00:26:23] [Client thread/INFO]: Created: 512x256 textures/blocks-atlas
[00:26:23] [Client thread/INFO]: Created: 256x256 textures/items-atlas
[00:26:24] [Sound Library Loader/INFO]: Sound engine started
[00:26:27] [Client thread/INFO]: Deleting level New World
[00:26:27] [Client thread/INFO]: Attempt 1...
[00:26:31] [Server thread/INFO]: Starting integrated minecraft server version 1.7.10
[00:26:31] [Server thread/INFO]: Generating keypair
[00:26:31] [Server thread/INFO]: Converting map!
[00:26:31] [Server thread/INFO]: Scanning folders...
[00:26:31] [Server thread/INFO]: Total conversion count is 0
[00:26:32] [Server thread/INFO]: Preparing start region for level 0
[00:26:32] [Server thread/ERROR]: Encountered an unexpected exception
java.lang.NullPointerException
at net.minecraft.world.chunk.storage.ExtendedBlockStorage.func_150818_a(ExtendedBlockStorage.java:86) ~[ExtendedBlockStorage.class:?]
at net.minecraft.world.chunk.Chunk.func_150807_a(Chunk.java:653) ~[Chunk.class:?]
at net.minecraft.world.World.setBlock(World.java:519) ~[World.class:?]
at net.minecraft.world.gen.feature.WorldGenMinable.generate(WorldGenMinable.java:79) ~[WorldGenMinable.class:?]
at SageRaziel.AdditionalStone.Generation.AdditionalStoneWorldGeneration.addOreSpawn(AdditionalStoneWorldGeneration.java:47) ~[AdditionalStoneWorldGeneration.class:?]
at SageRaziel.AdditionalStone.Generation.AdditionalStoneWorldGeneration.generateSurface(AdditionalStoneWorldGeneration.java:28) ~[AdditionalStoneWorldGeneration.class:?]
at SageRaziel.AdditionalStone.Generation.AdditionalStoneWorldGeneration.generate(AdditionalStoneWorldGeneration.java:19) ~[AdditionalStoneWorldGeneration.class:?]
at cpw.mods.fml.common.registry.GameRegistry.generateWorld(GameRegistry.java:106) ~[GameRegistry.class:?]
at net.minecraft.world.gen.ChunkProviderServer.populate(ChunkProviderServer.java:314) ~[ChunkProviderServer.class:?]
at net.minecraft.world.chunk.Chunk.populateChunk(Chunk.java:1157) ~[Chunk.class:?]
at net.minecraft.world.gen.ChunkProviderServer.originalLoadChunk(ChunkProviderServer.java:208) ~[ChunkProviderServer.class:?]
at net.minecraft.world.gen.ChunkProviderServer.loadChunk(ChunkProviderServer.java:149) ~[ChunkProviderServer.class:?]
at net.minecraft.world.gen.ChunkProviderServer.loadChunk(ChunkProviderServer.java:119) ~[ChunkProviderServer.class:?]
at net.minecraft.server.MinecraftServer.initialWorldChunkLoad(MinecraftServer.java:305) ~[MinecraftServer.class:?]
at net.minecraft.server.integrated.IntegratedServer.loadAllWorlds(IntegratedServer.java:79) ~[IntegratedServer.class:?]
at net.minecraft.server.integrated.IntegratedServer.startServer(IntegratedServer.java:96) ~[IntegratedServer.class:?]
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:445) [MinecraftServer.class:?]
at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:752) [MinecraftServer$2.class:?]
[00:26:32] [Server thread/ERROR]: This crash report has been saved to: C:\Users\Raziel\Desktop\forge-1.7.10-10.13.2.1291-src\eclipse\.\crash-reports\crash-2015-03-09_00.26.32-server.txt
Latest FML Client Crash Report:
Ask if you need this...It's too long to post here, as it exceeds 12,000 characters.
Latest FML Junk Early Startup Log:
[00:26:14] [main/INFO] [GradleStart]: Extra: []
[00:26:14] [main/INFO] [GradleStart]: Running with arguments: [--userProperties, {}, --assetsDir, C:/Users/Raziel/.gradle/caches/minecraft/assets, --assetIndex, 1.7.10, --accessToken, {REDACTED}, --version, 1.7.10, --tweakClass, cpw.mods.fml.common.launcher.FMLTweaker, --tweakClass, net.minecraftforge.gradle.GradleStartCommon$GradleStartTweaker]
[00:26:14] [main/INFO] [LaunchWrapper]: Loading tweak class name cpw.mods.fml.common.launcher.FMLTweaker
[00:26:14] [main/INFO] [LaunchWrapper]: Using primary tweak class name cpw.mods.fml.common.launcher.FMLTweaker
[00:26:14] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.gradle.GradleStartCommon$GradleStartTweaker
[00:26:14] [main/INFO] [LaunchWrapper]: Calling tweak class cpw.mods.fml.common.launcher.FMLTweaker
Additionl Information:
Running the latest recommended build of Forge for MineCraft 1.7.10. I'm using, obviously, MineCraft 1.7.10. I have no mods installed. There are no errors appearing in Eclipse on any of my files. All of my blocks work just fine, and can be accessed via the creative tab. The game will launch to the MineCraft menue. I select "Single Player" and I attempt to generate a new world in Creative Mode. This is when the game crashes.
If you need any more information, please let me know. I've provided as much as I can think of.
public class AdditionalStoneWorldGeneration implements IWorldGenerator
{
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider)
{
switch (world.provider.dimensionId)
{
case 0:
generateSurface(world, random, chunkX * 16, chunkZ * 16);
case -1:
generateNether(world, random, chunkX * 16, chunkZ * 16);
case 1:
generateEnd(world, random, chunkX * 16, chunkZ * 16);
}
}
private void generateSurface(World world, Random random, int x, int z)
{
addOreSpawn(ModBlocks.BonumStone, world, random, x, z, 16, 16, 20 + random.nextInt(5), 9, 0, 255);
}
private void generateNether(World world, Random random, int x, int z)
{
}
private void generateEnd(World world, Random random, int x, int z)
{
}
private void addOreSpawn(Block block, World world, Random random, int blockXPos, int blockZPos, int maxX, int maxZ, int maxVeinSize, int chanceToSpawn, int minY, int maxY)
{
for (int i = 0; i < chanceToSpawn; i++)
{
int posX = blockXPos + random.nextInt(maxX);
int posY = minY + random.nextInt(maxY - minY);
int posZ = blockZPos + random.nextInt(maxZ);
new WorldGenMinable(block, maxVeinSize).generate(world, random, posX, posY, posZ);
}
}
}
Main Class:
package SageRaziel.AdditionalStone;
import cpw.mods.fml.common.IWorldGenerator;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler; // used in 1.6.2
//import cpw.mods.fml.common.Mod.PreInit; // used in 1.5.2
//import cpw.mods.fml.common.Mod.Init; // used in 1.5.2
//import cpw.mods.fml.common.Mod.PostInit; // used in 1.5.2
import cpw.mods.fml.common.Mod.Instance;
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.registry.GameRegistry;
import SageRaziel.AdditionalStone.Generation.AdditionalStoneWorldGeneration;
import SageRaziel.AdditionalStone.help.Reference;
//import cpw.mods.fml.common.network.NetworkMod; // not used in 1.7
import SageRaziel.AdditionalStone.init.ModBlocks;
@Mod(modid = Reference.MODID, name = Reference.NAME, version = Reference.VERSION)
//@NetworkMod(clientSideRequired=true) // not used in 1.7
public class AdditionalStone {
// The instance of your mod that Forge uses.
@Instance(value = "AdditionalStone")
public static AdditionalStone instance;
// Says where the client and server 'proxy' code is loaded.
@SidedProxy(clientSide="SageRaziel.AdditionalStone.client.ClientProxy", serverSide="SageRaziel.AdditionalStone.CommonProxy")
public static CommonProxy proxy;
@EventHandler // used in 1.6.2
//@PreInit // used in 1.5.2
public void preInit(FMLPreInitializationEvent event) {
ModBlocks.init();
// Stub Method
GameRegistry.registerWorldGenerator(this.eventWorldGen, 0);
}
AdditionalStoneWorldGeneration eventWorldGen = new AdditionalStoneWorldGeneration();
@EventHandler // used in 1.6.2
//@Init // used in 1.5.2
public void load(FMLInitializationEvent event) {
proxy.registerRenderers();
}
@EventHandler // used in 1.6.2
//@PostInit // used in 1.5.2
public void postInit(FMLPostInitializationEvent event) {
// Stub Method
}
}
Latest Crash Report:
[00:26:16] [main/INFO]: Setting user: Player627
[00:26:17] [Client thread/INFO]: LWJGL Version: 2.9.1
[00:26:21] [Client thread/INFO]: Reloading ResourceManager: Default, FMLFileResourcePack:Forge Mod Loader, FMLFileResourcePack:Minecraft Forge, FMLFileResourcePack:Additional Stone
[00:26:22] [Sound Library Loader/INFO]: Sound engine started
[00:26:22] [Client thread/INFO]: Created: 512x256 textures/blocks-atlas
[00:26:22] [Client thread/INFO]: Created: 256x256 textures/items-atlas
[00:26:22] [Client thread/INFO]: Reloading ResourceManager: Default, FMLFileResourcePack:Forge Mod Loader, FMLFileResourcePack:Minecraft Forge, FMLFileResourcePack:Additional Stone
[00:26:23] [Client thread/INFO]: Created: 512x256 textures/blocks-atlas
[00:26:23] [Client thread/INFO]: Created: 256x256 textures/items-atlas
[00:26:24] [Sound Library Loader/INFO]: Sound engine started
[00:26:27] [Client thread/INFO]: Deleting level New World
[00:26:27] [Client thread/INFO]: Attempt 1...
[00:26:31] [Server thread/INFO]: Starting integrated minecraft server version 1.7.10
[00:26:31] [Server thread/INFO]: Generating keypair
[00:26:31] [Server thread/INFO]: Converting map!
[00:26:31] [Server thread/INFO]: Scanning folders...
[00:26:31] [Server thread/INFO]: Total conversion count is 0
[00:26:32] [Server thread/INFO]: Preparing start region for level 0
[00:26:32] [Server thread/ERROR]: Encountered an unexpected exception
java.lang.NullPointerException
at net.minecraft.world.chunk.storage.ExtendedBlockStorage.func_150818_a(ExtendedBlockStorage.java:86) ~[ExtendedBlockStorage.class:?]
at net.minecraft.world.chunk.Chunk.func_150807_a(Chunk.java:653) ~[Chunk.class:?]
at net.minecraft.world.World.setBlock(World.java:519) ~[World.class:?]
at net.minecraft.world.gen.feature.WorldGenMinable.generate(WorldGenMinable.java:79) ~[WorldGenMinable.class:?]
at SageRaziel.AdditionalStone.Generation.AdditionalStoneWorldGeneration.addOreSpawn(AdditionalStoneWorldGeneration.java:47) ~[AdditionalStoneWorldGeneration.class:?]
at SageRaziel.AdditionalStone.Generation.AdditionalStoneWorldGeneration.generateSurface(AdditionalStoneWorldGeneration.java:28) ~[AdditionalStoneWorldGeneration.class:?]
at SageRaziel.AdditionalStone.Generation.AdditionalStoneWorldGeneration.generate(AdditionalStoneWorldGeneration.java:19) ~[AdditionalStoneWorldGeneration.class:?]
at cpw.mods.fml.common.registry.GameRegistry.generateWorld(GameRegistry.java:106) ~[GameRegistry.class:?]
at net.minecraft.world.gen.ChunkProviderServer.populate(ChunkProviderServer.java:314) ~[ChunkProviderServer.class:?]
at net.minecraft.world.chunk.Chunk.populateChunk(Chunk.java:1157) ~[Chunk.class:?]
at net.minecraft.world.gen.ChunkProviderServer.originalLoadChunk(ChunkProviderServer.java:208) ~[ChunkProviderServer.class:?]
at net.minecraft.world.gen.ChunkProviderServer.loadChunk(ChunkProviderServer.java:149) ~[ChunkProviderServer.class:?]
at net.minecraft.world.gen.ChunkProviderServer.loadChunk(ChunkProviderServer.java:119) ~[ChunkProviderServer.class:?]
at net.minecraft.server.MinecraftServer.initialWorldChunkLoad(MinecraftServer.java:305) ~[MinecraftServer.class:?]
at net.minecraft.server.integrated.IntegratedServer.loadAllWorlds(IntegratedServer.java:79) ~[IntegratedServer.class:?]
at net.minecraft.server.integrated.IntegratedServer.startServer(IntegratedServer.java:96) ~[IntegratedServer.class:?]
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:445) [MinecraftServer.class:?]
at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:752) [MinecraftServer$2.class:?]
[00:26:32] [Server thread/ERROR]: This crash report has been saved to: C:\Users\Raziel\Desktop\forge-1.7.10-10.13.2.1291-src\eclipse\.\crash-reports\crash-2015-03-09_00.26.32-server.txt
Latest FML Client Crash Report:
Ask if you need this...It's too long to post here, as it exceeds 12,000 characters.
Latest FML Junk Early Startup Log:
[00:26:14] [main/INFO] [GradleStart]: Extra: []
[00:26:14] [main/INFO] [GradleStart]: Running with arguments: [--userProperties, {}, --assetsDir, C:/Users/Raziel/.gradle/caches/minecraft/assets, --assetIndex, 1.7.10, --accessToken, {REDACTED}, --version, 1.7.10, --tweakClass, cpw.mods.fml.common.launcher.FMLTweaker, --tweakClass, net.minecraftforge.gradle.GradleStartCommon$GradleStartTweaker]
[00:26:14] [main/INFO] [LaunchWrapper]: Loading tweak class name cpw.mods.fml.common.launcher.FMLTweaker
[00:26:14] [main/INFO] [LaunchWrapper]: Using primary tweak class name cpw.mods.fml.common.launcher.FMLTweaker
[00:26:14] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.gradle.GradleStartCommon$GradleStartTweaker
[00:26:14] [main/INFO] [LaunchWrapper]: Calling tweak class cpw.mods.fml.common.launcher.FMLTweaker
Additionl Information:
Running the latest recommended build of Forge for MineCraft 1.7.10. I'm using, obviously, MineCraft 1.7.10. I have no mods installed. There are no errors appearing in Eclipse on any of my files. All of my blocks work just fine, and can be accessed via the creative tab. The game will launch to the MineCraft menue. I select "Single Player" and I attempt to generate a new world in Creative Mode. This is when the game crashes.
If you need any more information, please let me know. I've provided as much as I can think of.
Thanks again,
~Sage Raziel
Check here: SageRaziel.AdditionalStone.Generation.AdditionalStoneWorldGeneration.addOreSpawn(AdditionalStoneWorldGeneration.java:47) ~[AdditionalStoneWorldGeneration.class:?]. That is what is causing your error. I can't tell what line is causing the crash exactly because I can't see the line numbers.
So when added/modified everything I want, how do I go about making the jar file for my new mod?
Edit the build.gradle file to point towards your mod, change the name of the file name, then type gradlew build (or ./gradlew build in Terminal) in Command Prompt.
Check here: SageRaziel.AdditionalStone.Generation.AdditionalStoneWorldGeneration.addOreSpawn(AdditionalStoneWorldGeneration.java:47) ~[AdditionalStoneWorldGeneration.class:?]. That is what is causing your error. I can't tell what line is causing the crash exactly because I can't see the line numbers.
private void generateSurface(World world, Random random, int x, int z)
{
addOreSpawn(ModBlocks.BonumStone, world, random, x, z, 16, 16, 20 + random.nextInt(5), 9, 0, 255);
}
private void generateNether(World world, Random random, int x, int z)
{
}
private void generateEnd(World world, Random random, int x, int z)
{
}
private void addOreSpawn(Block block, World world, Random random, int blockXPos, int blockZPos, int maxX, int maxZ, int maxVeinSize, int chanceToSpawn, int minY, int maxY)
{
for (int i = 0; i < chanceToSpawn; i++)
{
int posX = blockXPos + random.nextInt(maxX);
int posY = minY + random.nextInt(maxY - minY);
int posZ = blockZPos + random.nextInt(maxZ);
new WorldGenMinable(block, maxVeinSize).generate(world, random, posX, posY, posZ);
}
}
}
That's the portion of code. I'm still not sure what has gone wrong. Eclipse isn't marking anything as an error.
This isn't really related to the tutorials, but if anyone has some advice I'd appreciate it.
I'm trying to make a mod that does custom whitelisting, when a player tries to login it should read from a database to see if they have the necessary perk.
From a bit of looking around it seems like I need this:
public class ConnectionHandler {
@SubscribeEvent
public void onEvent(ServerConnectionFromClientEvent event) {
}
}
But I'm not really sure where to go from here. To check with the database, I need the uuid of whomever is trying to connect, but I'm not seeing a way to get that. Any suggestions?
private void generateSurface(World world, Random random, int x, int z)
{
addOreSpawn(ModBlocks.BonumStone, world, random, x, z, 16, 16, 20 + random.nextInt(5), 9, 0, 255);
}
private void generateNether(World world, Random random, int x, int z)
{
}
private void generateEnd(World world, Random random, int x, int z)
{
}
private void addOreSpawn(Block block, World world, Random random, int blockXPos, int blockZPos, int maxX, int maxZ, int maxVeinSize, int chanceToSpawn, int minY, int maxY)
{
for (int i = 0; i < chanceToSpawn; i++)
{
int posX = blockXPos + random.nextInt(maxX);
int posY = minY + random.nextInt(maxY - minY);
int posZ = blockZPos + random.nextInt(maxZ);
new WorldGenMinable(block, maxVeinSize).generate(world, random, posX, posY, posZ);
}
}
}
That's the portion of code. I'm still not sure what has gone wrong. Eclipse isn't marking anything as an error.
There's an "addOreSpawn" on line 28 and an "addOreSpawn on line 40.
Lines 26-29
private void generateSurface(World world, Random random, int x, int z)
{ addOreSpawn(ModBlocks.BonumStone, world, random, x, z, 16, 16, 20 + random.nextInt(5), 9, 0, 255);
}
Lines 40-49
private void addOreSpawn(Block block, World world, Random random, int blockXPos, int blockZPos, int maxX, int maxZ, int maxVeinSize, int chanceToSpawn, int minY, int maxY)
{
for (int i = 0; i < chanceToSpawn; i++)
{
int posX = blockXPos + random.nextInt(maxX);
int posY = minY + random.nextInt(maxY - minY);
int posZ = blockZPos + random.nextInt(maxZ);
new WorldGenMinable(block, maxVeinSize).generate(world, random, posX, posY, posZ);
}
}
I'm sorry if I'm not getting you the information you need. I'm trying :). I'm completely new to modding and Java, so I'm working hard to figure this out as I go. I've also been reading up on Java as I go through these tutorials.
Entities "won" the poll by 10 votes, and with that, a new tutorial regarding Entity Registry has been released :).
Also, if you haven't gotten an answer to a question, let me know. I haven't been around much, and probably have missed some people.
You probably already know that my case is still open, since I quoted it for you, but nonetheless, as you asked, here's letting you know. Awesome job on the new tutorial by the way!
Hi there! I hope I'm in the right place, I have an interesting question. So now I can create new elements (items, blocks, tools etc.) with this useful tutorials, but I would like to modify parameters of the default natural blocks. For example how to change function getItemDropped() of Blocks.stone? I can't edit the base blocks in Eclipse, 'cause they are unchangeable, but I want it to dropped MyMinecraftMod.blockBrokenStone (called Broken Stone Block) or something, anyway notBlocks.cobblestone. Would it be possible?
Hi there! I hope I'm in the right place, I have an interesting question. So now I can create new elements (items, blocks, tools etc.) with this useful tutorials, but I would like to modify parameters of the default natural blocks. For example how to change function getItemDropped() of Blocks.stone? I can't edit the base blocks in Eclipse, 'cause they are unchangeable, but I want it to dropped MyMinecraftMod.blockBrokenStone (called Broken Stone Block) or something, anyway notBlocks.cobblestone. Would it be possible?
Yes. You would have to subscribe to the HarvestDrops event. For more information on events, check here.
[quote=sageraziel;/members/sageraziel;/forums/mapping-and-modding/mapping-and-modding-tutorials/2282788-1-7-thexfactor117s-forge-modding-tutorials-14?comment=573]
You probably already know that my case is still open, since I quoted it for you, but nonetheless, as you asked, here's letting you know. Awesome job on the new tutorial by the way! I'm going to look into this more. In the meantime, compare code between some of my code: main class and generation class.
[quote=Baconfish;/members/Baconfish;/forums/mapping-and-modding/mapping-and-modding-tutorials/2282788-1-7-thexfactor117s-forge-modding-tutorials-14?comment=575]
Still have some questions unanswered.
(This is the same person as EX_plode, just accidentally posted with a different account) How do I create a new mod, separate from the one being currently developed?
How would I open another already-existing mod to change bits or look at how it works?
How do I use the API of another mod in mine?
How do I make a config file for my mod, so that the user can change settings?
1. For creating a second workspace, I would just setup a whole new workspace (start the process over again), however, there are ways to have multiple mods in one workspace - I just haven't done it that way since I have only one project to work on.
2. To start off, I would say you can't. If the mod is closed-source, you can't really do anything besides play the mod. If the mod is open-source, you can look at the code all you want, and some licenses even let you change it and compile it to fit your needs (although, these are more rare). In the end, most mods you see will allow you to look at their code because it is open source, however, some more popular mods are closed source (not saying all of them are). Just check the licenses before doing anything.
3. You would need to get the libraries of the API loaded into your workspace. There are a few good tutorials on how to do that out there already.
4. Look into my configuration code here. There is really no tutorials out there for these, so I may make one after I finish up the entities. You'll just have to look through some code to figure out how to do it.
If you have any more questions, let me know
So, quoting three people didn't really work. I'll just notify everyone who I was supposed to quote @Skac83 @Baconfish @sageraziel
Hey, I finally understand most of this tutorial, however near the end of #5 I am getting errors that I don't know how to fix. the setBlockName and setBlockTextureName are coming up as errors, as well as IIconRegister and itemIcon. it's saying there's nothing to import, and I don't know what to do from here. Help?
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
Age: 23
Skype: I'll PM you.
I do not have TeamSpeak
Do You Care About(Squeakers)?
World Generation Class:
package SageRaziel.AdditionalStone.Generation;
import java.util.Random;
import SageRaziel.AdditionalStone.init.ModBlocks;
import net.minecraft.block.Block;
import net.minecraft.world.World;
import net.minecraft.world.chunk.IChunkProvider;
import net.minecraft.world.gen.feature.WorldGenMinable;
import cpw.mods.fml.common.IWorldGenerator;
public class AdditionalStoneWorldGeneration implements IWorldGenerator
{
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider)
{
switch (world.provider.dimensionId)
{
case 0:
generateSurface(world, random, chunkX * 16, chunkZ * 16);
case -1:
generateNether(world, random, chunkX * 16, chunkZ * 16);
case 1:
generateEnd(world, random, chunkX * 16, chunkZ * 16);
}
}
private void generateSurface(World world, Random random, int x, int z)
{
addOreSpawn(ModBlocks.BonumStone, world, random, x, z, 16, 16, 20 + random.nextInt(5), 9, 0, 255);
}
private void generateNether(World world, Random random, int x, int z)
{
}
private void generateEnd(World world, Random random, int x, int z)
{
}
private void addOreSpawn(Block block, World world, Random random, int blockXPos, int blockZPos, int maxX, int maxZ, int maxVeinSize, int chanceToSpawn, int minY, int maxY)
{
for (int i = 0; i < chanceToSpawn; i++)
{
int posX = blockXPos + random.nextInt(maxX);
int posY = minY + random.nextInt(maxY - minY);
int posZ = blockZPos + random.nextInt(maxZ);
new WorldGenMinable(block, maxVeinSize).generate(world, random, posX, posY, posZ);
}
}
}
Main Class:
package SageRaziel.AdditionalStone;
import cpw.mods.fml.common.IWorldGenerator;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler; // used in 1.6.2
//import cpw.mods.fml.common.Mod.PreInit; // used in 1.5.2
//import cpw.mods.fml.common.Mod.Init; // used in 1.5.2
//import cpw.mods.fml.common.Mod.PostInit; // used in 1.5.2
import cpw.mods.fml.common.Mod.Instance;
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.registry.GameRegistry;
import SageRaziel.AdditionalStone.Generation.AdditionalStoneWorldGeneration;
import SageRaziel.AdditionalStone.help.Reference;
//import cpw.mods.fml.common.network.NetworkMod; // not used in 1.7
import SageRaziel.AdditionalStone.init.ModBlocks;
@Mod(modid = Reference.MODID, name = Reference.NAME, version = Reference.VERSION)
//@NetworkMod(clientSideRequired=true) // not used in 1.7
public class AdditionalStone {
// The instance of your mod that Forge uses.
@Instance(value = "AdditionalStone")
public static AdditionalStone instance;
// Says where the client and server 'proxy' code is loaded.
@SidedProxy(clientSide="SageRaziel.AdditionalStone.client.ClientProxy", serverSide="SageRaziel.AdditionalStone.CommonProxy")
public static CommonProxy proxy;
@EventHandler // used in 1.6.2
//@PreInit // used in 1.5.2
public void preInit(FMLPreInitializationEvent event) {
ModBlocks.init();
// Stub Method
GameRegistry.registerWorldGenerator(this.eventWorldGen, 0);
}
AdditionalStoneWorldGeneration eventWorldGen = new AdditionalStoneWorldGeneration();
@EventHandler // used in 1.6.2
//@Init // used in 1.5.2
public void load(FMLInitializationEvent event) {
proxy.registerRenderers();
}
@EventHandler // used in 1.6.2
//@PostInit // used in 1.5.2
public void postInit(FMLPostInitializationEvent event) {
// Stub Method
}
}
Latest Crash Report:
[00:26:16] [main/INFO]: Setting user: Player627
[00:26:17] [Client thread/INFO]: LWJGL Version: 2.9.1
[00:26:21] [Client thread/INFO]: Reloading ResourceManager: Default, FMLFileResourcePack:Forge Mod Loader, FMLFileResourcePack:Minecraft Forge, FMLFileResourcePack:Additional Stone
[00:26:22] [Sound Library Loader/INFO]: Sound engine started
[00:26:22] [Client thread/INFO]: Created: 512x256 textures/blocks-atlas
[00:26:22] [Client thread/INFO]: Created: 256x256 textures/items-atlas
[00:26:22] [Client thread/INFO]: Reloading ResourceManager: Default, FMLFileResourcePack:Forge Mod Loader, FMLFileResourcePack:Minecraft Forge, FMLFileResourcePack:Additional Stone
[00:26:23] [Client thread/INFO]: Created: 512x256 textures/blocks-atlas
[00:26:23] [Client thread/INFO]: Created: 256x256 textures/items-atlas
[00:26:24] [Sound Library Loader/INFO]: Sound engine started
[00:26:27] [Client thread/INFO]: Deleting level New World
[00:26:27] [Client thread/INFO]: Attempt 1...
[00:26:31] [Server thread/INFO]: Starting integrated minecraft server version 1.7.10
[00:26:31] [Server thread/INFO]: Generating keypair
[00:26:31] [Server thread/INFO]: Converting map!
[00:26:31] [Server thread/INFO]: Scanning folders...
[00:26:31] [Server thread/INFO]: Total conversion count is 0
[00:26:32] [Server thread/INFO]: Preparing start region for level 0
[00:26:32] [Server thread/ERROR]: Encountered an unexpected exception
java.lang.NullPointerException
at net.minecraft.world.chunk.storage.ExtendedBlockStorage.func_150818_a(ExtendedBlockStorage.java:86) ~[ExtendedBlockStorage.class:?]
at net.minecraft.world.chunk.Chunk.func_150807_a(Chunk.java:653) ~[Chunk.class:?]
at net.minecraft.world.World.setBlock(World.java:519) ~[World.class:?]
at net.minecraft.world.gen.feature.WorldGenMinable.generate(WorldGenMinable.java:79) ~[WorldGenMinable.class:?]
at SageRaziel.AdditionalStone.Generation.AdditionalStoneWorldGeneration.addOreSpawn(AdditionalStoneWorldGeneration.java:47) ~[AdditionalStoneWorldGeneration.class:?]
at SageRaziel.AdditionalStone.Generation.AdditionalStoneWorldGeneration.generateSurface(AdditionalStoneWorldGeneration.java:28) ~[AdditionalStoneWorldGeneration.class:?]
at SageRaziel.AdditionalStone.Generation.AdditionalStoneWorldGeneration.generate(AdditionalStoneWorldGeneration.java:19) ~[AdditionalStoneWorldGeneration.class:?]
at cpw.mods.fml.common.registry.GameRegistry.generateWorld(GameRegistry.java:106) ~[GameRegistry.class:?]
at net.minecraft.world.gen.ChunkProviderServer.populate(ChunkProviderServer.java:314) ~[ChunkProviderServer.class:?]
at net.minecraft.world.chunk.Chunk.populateChunk(Chunk.java:1157) ~[Chunk.class:?]
at net.minecraft.world.gen.ChunkProviderServer.originalLoadChunk(ChunkProviderServer.java:208) ~[ChunkProviderServer.class:?]
at net.minecraft.world.gen.ChunkProviderServer.loadChunk(ChunkProviderServer.java:149) ~[ChunkProviderServer.class:?]
at net.minecraft.world.gen.ChunkProviderServer.loadChunk(ChunkProviderServer.java:119) ~[ChunkProviderServer.class:?]
at net.minecraft.server.MinecraftServer.initialWorldChunkLoad(MinecraftServer.java:305) ~[MinecraftServer.class:?]
at net.minecraft.server.integrated.IntegratedServer.loadAllWorlds(IntegratedServer.java:79) ~[IntegratedServer.class:?]
at net.minecraft.server.integrated.IntegratedServer.startServer(IntegratedServer.java:96) ~[IntegratedServer.class:?]
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:445) [MinecraftServer.class:?]
at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:752) [MinecraftServer$2.class:?]
[00:26:32] [Server thread/ERROR]: This crash report has been saved to: C:\Users\Raziel\Desktop\forge-1.7.10-10.13.2.1291-src\eclipse\.\crash-reports\crash-2015-03-09_00.26.32-server.txt
Latest FML Client Crash Report:
Latest FML Junk Early Startup Log:
[00:26:14] [main/INFO] [GradleStart]: Extra: []
[00:26:14] [main/INFO] [GradleStart]: Running with arguments: [--userProperties, {}, --assetsDir, C:/Users/Raziel/.gradle/caches/minecraft/assets, --assetIndex, 1.7.10, --accessToken, {REDACTED}, --version, 1.7.10, --tweakClass, cpw.mods.fml.common.launcher.FMLTweaker, --tweakClass, net.minecraftforge.gradle.GradleStartCommon$GradleStartTweaker]
[00:26:14] [main/INFO] [LaunchWrapper]: Loading tweak class name cpw.mods.fml.common.launcher.FMLTweaker
[00:26:14] [main/INFO] [LaunchWrapper]: Using primary tweak class name cpw.mods.fml.common.launcher.FMLTweaker
[00:26:14] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.gradle.GradleStartCommon$GradleStartTweaker
[00:26:14] [main/INFO] [LaunchWrapper]: Calling tweak class cpw.mods.fml.common.launcher.FMLTweaker
Additionl Information:
Running the latest recommended build of Forge for MineCraft 1.7.10. I'm using, obviously, MineCraft 1.7.10. I have no mods installed. There are no errors appearing in Eclipse on any of my files. All of my blocks work just fine, and can be accessed via the creative tab. The game will launch to the MineCraft menue. I select "Single Player" and I attempt to generate a new world in Creative Mode. This is when the game crashes.
If you need any more information, please let me know. I've provided as much as I can think of.
Thanks again,
~Sage Raziel
Check here: SageRaziel.AdditionalStone.Generation.AdditionalStoneWorldGeneration.addOreSpawn(AdditionalStoneWorldGeneration.java:47) ~[AdditionalStoneWorldGeneration.class:?]. That is what is causing your error. I can't tell what line is causing the crash exactly because I can't see the line numbers.
Edit the build.gradle file to point towards your mod, change the name of the file name, then type gradlew build (or ./gradlew build in Terminal) in Command Prompt.
-
View User Profile
-
View Posts
-
Send Message
Curse PremiumTab file:
package com.alexl29.chromiumcovered.tabs;
import com.alexl29.chromiumcovered.init.ModItems;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
public class ChromiumCoveredTab extends CreativeTabs {
String name;
public ChromiumCoveredTab(int par1, String par25tr)
{
super(par1, par25tr);
this.name = par25tr;
}
@SideOnly(Side.CLIENT)
public Item getTabIconItem()
{
if (this.name == "tabChromiumCovered")
{
return ModItems.omega;
}
return null;
}
}
ModTabs file:
package com.alexl29.chromiumcovered.tabs;
import net.minecraft.creativetab.CreativeTabs;
public class ModTabs {
public static CreativeTabs tabChromiumCovered = new ChromiumCoveredTab(CreativeTabs.getNextID(), "tabChromiumCovered");
}
I NEED HELP!
I already told you that Omega is an example of an item. Change it.
private void generateSurface(World world, Random random, int x, int z)
{
addOreSpawn(ModBlocks.BonumStone, world, random, x, z, 16, 16, 20 + random.nextInt(5), 9, 0, 255);
}
private void generateNether(World world, Random random, int x, int z)
{
}
private void generateEnd(World world, Random random, int x, int z)
{
}
private void addOreSpawn(Block block, World world, Random random, int blockXPos, int blockZPos, int maxX, int maxZ, int maxVeinSize, int chanceToSpawn, int minY, int maxY)
{
for (int i = 0; i < chanceToSpawn; i++)
{
int posX = blockXPos + random.nextInt(maxX);
int posY = minY + random.nextInt(maxY - minY);
int posZ = blockZPos + random.nextInt(maxZ);
new WorldGenMinable(block, maxVeinSize).generate(world, random, posX, posY, posZ);
}
}
}
I'm trying to make a mod that does custom whitelisting, when a player tries to login it should read from a database to see if they have the necessary perk.
From a bit of looking around it seems like I need this:
public class ConnectionHandler {
@SubscribeEvent
public void onEvent(ServerConnectionFromClientEvent event) {
}
}
But I'm not really sure where to go from here. To check with the database, I need the uuid of whomever is trying to connect, but I'm not seeing a way to get that. Any suggestions?
Can you tell me the exact line.
Of course. We can even make an entity shoot it.
There's an "addOreSpawn" on line 28 and an "addOreSpawn on line 40.
Lines 26-29
private void generateSurface(World world, Random random, int x, int z)
{
addOreSpawn(ModBlocks.BonumStone, world, random, x, z, 16, 16, 20 + random.nextInt(5), 9, 0, 255);
}
private void addOreSpawn(Block block, World world, Random random, int blockXPos, int blockZPos, int maxX, int maxZ, int maxVeinSize, int chanceToSpawn, int minY, int maxY)
{
for (int i = 0; i < chanceToSpawn; i++)
{
int posX = blockXPos + random.nextInt(maxX);
int posY = minY + random.nextInt(maxY - minY);
int posZ = blockZPos + random.nextInt(maxZ);
new WorldGenMinable(block, maxVeinSize).generate(world, random, posX, posY, posZ);
}
}
I hope we can fix this issue.
~Sage Raziel
Also, if you haven't gotten an answer to a question, let me know. I haven't been around much, and probably have missed some people.
You probably already know that my case is still open, since I quoted it for you, but nonetheless, as you asked, here's letting you know. Awesome job on the new tutorial by the way!
-
View User Profile
-
View Posts
-
Send Message
Curse Premium[14:45:54] [Client thread/DEBUG] [FML/]: Examining directory ChromiumCovered-1.0.0 for potential mods
[14:45:54] [Client thread/DEBUG] [FML/]: Found an mcmod.info file in directory ChromiumCovered-1.0.0
[14:45:54] [Client thread/TRACE] [FML/]: Recursing into package assets
[14:45:54] [Client thread/TRACE] [FML/]: Recursing into package assets.alexl29_chromiumcovered
[14:45:54] [Client thread/TRACE] [FML/]: Recursing into package assets.alexl29_chromiumcovered.blocks
[14:45:54] [Client thread/TRACE] [FML/]: Recursing into package assets.alexl29_chromiumcovered.items
[14:45:54] [Client thread/TRACE] [FML/]: Recursing into package assets.alexl29_chromiumcovered.lang
[14:45:54] [Client thread/TRACE] [FML/]: Recursing into package assets.alexl29_chromiumcovered.textures
[14:45:54] [Client thread/TRACE] [FML/]: Recursing into package assets.alexl29_chromiumcovered.textures.blocks
[14:45:54] [Client thread/TRACE] [FML/]: Recursing into package assets.alexl29_chromiumcovered.textures.items
[14:45:54] [Client thread/TRACE] [FML/]: Recursing into package com
[14:45:54] [Client thread/TRACE] [FML/]: Recursing into package com.alexl29
[14:45:54] [Client thread/TRACE] [FML/]: Recursing into package com.alexl29.chromiumcovered
[14:45:54] [Client thread/TRACE] [FML/]: Recursing into package com.alexl29.chromiumcovered.blocks
[14:45:54] [Client thread/TRACE] [FML/]: Recursing into package com.alexl29.chromiumcovered.crafting
[14:45:54] [Client thread/TRACE] [FML/]: Recursing into package com.alexl29.chromiumcovered.generation
[14:45:54] [Client thread/TRACE] [FML/]: Recursing into package com.alexl29.chromiumcovered.help
[14:45:54] [Client thread/TRACE] [FML/]: Recursing into package com.alexl29.chromiumcovered.init
[14:45:54] [Client thread/TRACE] [FML/]: Recursing into package com.alexl29.chromiumcovered.items
[14:45:54] [Client thread/TRACE] [FML/]: Recursing into package com.alexl29.chromiumcovered.tabs
And then it doesn't show the mod ingame.
Yes. You would have to subscribe to the HarvestDrops event. For more information on events, check here.
[quote=sageraziel;/members/sageraziel;/forums/mapping-and-modding/mapping-and-modding-tutorials/2282788-1-7-thexfactor117s-forge-modding-tutorials-14?comment=573]
You probably already know that my case is still open, since I quoted it for you, but nonetheless, as you asked, here's letting you know. Awesome job on the new tutorial by the way! I'm going to look into this more. In the meantime, compare code between some of my code: main class and generation class.
[quote=Baconfish;/members/Baconfish;/forums/mapping-and-modding/mapping-and-modding-tutorials/2282788-1-7-thexfactor117s-forge-modding-tutorials-14?comment=575]
Still have some questions unanswered.
(This is the same person as EX_plode, just accidentally posted with a different account) How do I create a new mod, separate from the one being currently developed?
How would I open another already-existing mod to change bits or look at how it works?
How do I use the API of another mod in mine?
How do I make a config file for my mod, so that the user can change settings?
1. For creating a second workspace, I would just setup a whole new workspace (start the process over again), however, there are ways to have multiple mods in one workspace - I just haven't done it that way since I have only one project to work on.
2. To start off, I would say you can't. If the mod is closed-source, you can't really do anything besides play the mod. If the mod is open-source, you can look at the code all you want, and some licenses even let you change it and compile it to fit your needs (although, these are more rare). In the end, most mods you see will allow you to look at their code because it is open source, however, some more popular mods are closed source (not saying all of them are). Just check the licenses before doing anything.
3. You would need to get the libraries of the API loaded into your workspace. There are a few good tutorials on how to do that out there already.
4. Look into my configuration code here. There is really no tutorials out there for these, so I may make one after I finish up the entities. You'll just have to look through some code to figure out how to do it.
If you have any more questions, let me know
So, quoting three people didn't really work. I'll just notify everyone who I was supposed to quote @Skac83 @Baconfish @sageraziel