import net.minecraftforge.common.util.*;
import net.minecraft.client.renderer.texture.*;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
public class journey_mazeBlock {
public journey_mazeBlock(){}
public static BlockMazeBlock block;
public static Object instance;public int addFuel(ItemStack fuel){return 0;}
public void serverLoad(FMLServerStartingEvent event){}
public void preInit(FMLPreInitializationEvent event){
GameRegistry.registerBlock(block, "MazeBlock");
}
public void registerRenderers(){}
public void load(){
}
public void generateSurface(World world, Random random, int chunkX, int chunkZ){}
public void generateNether(World world, Random random, int chunkX, int chunkZ){}
static class BlockMazeBlock extends Block
{
public int isProvidingStrongPower(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5){
return red?1:0;
}
public void onNeighborBlockChange(World world, int i, int j, int k, Block l){
EntityPlayer entity = Minecraft.getMinecraft().thePlayer;
if (Block.getIdFromBlock(l) > 0 && l.canProvidePower() && world.isBlockIndirectlyGettingPowered(i, j, k)){
I don't want to credit myself for being stupid, so I'll just tell you one of my "out-of-the-know" friends sent me this asking what the heck he should do. I hadn't the slightest clue, but knew he was obviously making a mod. So I came here for help. Anyways, the source file he sent me was 352kb big. I assumed i could just split it into 4 files, but when I tried that out something went wrong and I gave up and later came here. And I've heard of Mcreator, but it's not being used, I'm pretty sure it would make the block mcreator_maze or something with "mcreator" in it.
Ya'll are being really harsh. This isn't even his code, his friend just asked him for help. Instead of assaulting him because he doesn't know as much Java as you do, instead help him with his problem AND EXPLAIN WHY IT WORKS don't waste your time writing a reply that doesn't help the OP. Don't waste my time by making me read it. And even if it was his code, you guys are being rude. This isn't 4chan.
To OP: So where you'd normally paste in the schematic, instead put in load1(); load2(); load3(); etc
Then create each of those methods like "public void load1() { }" etc
And inside each of those methods, paste part of the original schematic file, effectively splitting the code.
Also, the other people do kind of have a point. That is really messy code, and uses all the bad practices, especially with that static method.
Ya'll are being really harsh. This isn't even his code, his friend just asked him for help. Instead of assaulting him because he doesn't know as much Java as you do, instead help him with his problem AND EXPLAIN WHY IT WORKS don't waste your time writing a reply that doesn't help the OP. Don't waste my time by making me read it. And even if it was his code, you guys are being rude. This isn't 4chan.
To OP: So where you'd normally paste in the schematic, instead put in load1(); load2(); load3(); etc
Then create each of those methods like "public void load1() { }" etc
And inside each of those methods, paste part of the original schematic file, effectively splitting the code.
Also, the other people do kind of have a point. That is really messy code, and uses all the bad practices, especially with that static method.
It's MCreator code, what else do you expect to see?
Regarding breaking up the methods, I think there is also a limit of 64K or something in the class. So you may have to break the classes up as well. Realistically, schematics can get big really fast -- a 10 x 10 x 10 room may be described 1000 blocks (assuming an uncompressed 1 for 1 format).
So best method is actually to use a file resource to hold the schematic files.
Ya'll are being really harsh. This isn't even his code, his friend just asked him for help. Instead of assaulting him because he doesn't know as much Java as you do, instead help him with his problem AND EXPLAIN WHY IT WORKS don't waste your time writing a reply that doesn't help the OP. Don't waste my time by making me read it. And even if it was his code, you guys are being rude. This isn't 4chan.
To OP: So where you'd normally paste in the schematic, instead put in load1(); load2(); load3(); etc
Then create each of those methods like "public void load1() { }" etc
And inside each of those methods, paste part of the original schematic file, effectively splitting the code.
Also, the other people do kind of have a point. That is really messy code, and uses all the bad practices, especially with that static method.
The thing is, these forums are not for Java help, they're for Minecraft help, and a lot of people here seem to be really pushy about that, including me to a degree. As said many times, if this is MCreator help, that's the only replies the OP will get, as they honestly cannot be helped further, they're trying to comprehend something outside of MCreator's capabilities, even if it's a workaround for a flaw. But yeah, people shouldn't just yell at the OP.
I don't want to credit myself for being stupid, so I'll just tell you one of my "out-of-the-know" friends sent me this asking what the heck he should do. I hadn't the slightest clue, but knew he was obviously making a mod. So I came here for help. Anyways, the source file he sent me was 352kb big. I assumed i could just split it into 4 files, but when I tried that out something went wrong and I gave up and later came here. And I've heard of Mcreator, but it's not being used, I'm pretty sure it would make the block mcreator_maze or something with "mcreator" in it.
Just saying, and I don't mean to sound rude or something, but if you have no idea what's wrong with his code, nor you being part of the development of his mod, you shouldn't be the one to come onto the forums and ask for help for him. I don't know if you have had experience with programming or modding or not, so what we say you may misinterpret and tell him false information, so it's probably a good idea to instead get him himself to ask the question on here.
Anyways, what he is looking for is something called Object-Oriented Programming (or OOP) practices. Essentially, OOP is where you take up one part of the code you want to write, and place it in it's own method / function and class file (maybe), dedicated to that part. So say if you were trying to render something. Instead of having a bunch of code to set up the pre-render code, you could instead take this out and place it in a method called setupRender() or whatever, and call that instead, and it could be in the class called RenderUtils or RenderHelper or whatever. Essentially, it's taking code, and breaking it down into simple, modular steps. Java is heavily based around the OOP way of programming, and as such, it's essential to understand what OOP is, how it works, and how to integrate an OOP style of programming into your own programming style, both for Java in general, and modding too.
The code could also use a cleanup, as mentioned, there are lots of unused imports, inefficient code segments, and useless methods. Those may or may not help in fixing the error.
Also, I don't know if this is correct or not, but if he is indeed using MCreator, I'd heavily advise against that. MCreator is incredibly limited in what it can do, you're limited by what the program allows you to do, the code it generates is incredibly messy, and as you can maybe tell from some of the replies, MCreator is very despised around here, if you come for help when you're using MCreator or any other mod generator, you've pretty much just signed a deathwish.
Rollback Post to RevisionRollBack
Author of the Clarity, Serenity, Sapphire & Halcyon shader packs for Minecraft: Java Edition.
The thing is, these forums are not for Java help, they're for Minecraft help, and a lot of people here seem to be really pushy about that, including me to a degree. As said many times, if this is MCreator help, that's the only replies the OP will get, as they honestly cannot be helped further, they're trying to comprehend something outside of MCreator's capabilities, even if it's a workaround for a flaw. But yeah, people shouldn't just yell at the OP.
Just saying, and I don't mean to sound rude or something, but if you have no idea what's wrong with his code, nor you being part of the development of his mod, you shouldn't be the one to come onto the forums and ask for help for him. I don't know if you have had experience with programming or modding or not, so what we say you may misinterpret and tell him false information, so it's probably a good idea to instead get him himself to ask the question on here.
Anyways, what he is looking for is something called Object-Oriented Programming (or OOP) practices. Essentially, OOP is where you take up one part of the code you want to write, and place it in it's own method / function and class file (maybe), dedicated to that part. So say if you were trying to render something. Instead of having a bunch of code to set up the pre-render code, you could instead take this out and place it in a method called setupRender() or whatever, and call that instead, and it could be in the class called RenderUtils or RenderHelper or whatever. Essentially, it's taking code, and breaking it down into simple, modular steps. Java is heavily based around the OOP way of programming, and as such, it's essential to understand what OOP is, how it works, and how to integrate an OOP style of programming into your own programming style, both for Java in general, and modding too.
The code could also use a cleanup, as mentioned, there are lots of unused imports, inefficient code segments, and useless methods. Those may or may not help in fixing the error.
Also, I don't know if this is correct or not, but if he is indeed using MCreator, I'd heavily advise against that. MCreator is incredibly limited in what it can do, you're limited by what the program allows you to do, the code it generates is incredibly messy, and as you can maybe tell from some of the replies, MCreator is very despised around here, if you come for help when you're using MCreator or any other mod generator, you've pretty much just signed a deathwish.
You forgot the part where you are not allowed to decompile MCreator code.
"The Resource is not on the build of a Java project" I'm not stupid. The problem is I didn't know how to get around the java 64k limit, because it has never been a problem before. And the fix for it is the method: setupRender() which I know EXACTLY what it is doing.
"The Resource is not on the build of a Java project" I'm not stupid. The problem is I didn't know how to get around the java 64k limit, because it has never been a problem before. And the fix for it is the method: setupRender() which I know EXACTLY what it is doing.
I think the point was that it is a Java limit, not Minecraft. However, with that being said I think some Java, some Eclipse, some github type questions are okay if in moderation. But it is also true that there are TONS of other places to get info about solutions to Java problems.
It reminds me about the Yahoo Answers site -- people go there to ask questions that they can easily get the answer for with quick Google search or simply Wikipedia. For example, I just checked Yahoo Answers and a recent question was "how do I make a safe room for a new kitten?". I mean why would someone ask the question on Yahoo Answers instead of just looking up the hundreds of articles on exactly that subject?
Anyway, almost every question possible about Java has been asked before. In fact on StackOverflow (a common site for Java discussion) you will be seriously flamed if you ask a question that has been ever been asked before.
Move the overflowing code to a new method and call that method from the end of the last method, simple.
Splitting your code up into more logical segments is ideal, whether it be via resources/datasets or just a crap load of helper methods (even if they're private). For structure generation, having one method for each "chunk" of structure for example (doesn't have to be an actual Minecraft chunk, could be your own X*Y size) could get around this, and also conveniently pave the way for having your structure created via procedural generation - that is, where each "room" is randomly selected from a pool of valid candidates.
EDIT: I support the resource file method. Text files of "maps" where each ascii character is a certain block, or something like that. Would make the class(es) 95% smaller.
I really need help, thanks.
Code without schematic code:
import cpw.mods.fml.client.*;
import cpw.mods.fml.client.registry.*;
import cpw.mods.fml.common.*;
import cpw.mods.fml.common.asm.*;
import cpw.mods.fml.common.asm.transformers.*;
import cpw.mods.fml.common.discovery.*;
import cpw.mods.fml.common.discovery.asm.*;
import cpw.mods.fml.common.event.*;
import cpw.mods.fml.common.functions.*;
import cpw.mods.fml.common.network.*;
import cpw.mods.fml.common.registry.*;
import cpw.mods.fml.common.toposort.*;
import cpw.mods.fml.common.versioning.*;
import cpw.mods.fml.relauncher.*;
import cpw.mods.fml.server.*;
import net.minecraft.block.*;
import net.minecraft.block.material.*;
import net.minecraft.client.*;
import net.minecraft.client.audio.*;
import net.minecraft.client.entity.*;
import net.minecraft.client.gui.*;
import net.minecraft.client.gui.achievement.*;
import net.minecraft.client.gui.inventory.*;
import net.minecraft.client.model.*;
import net.minecraft.client.multiplayer.*;
import net.minecraft.client.particle.*;
import net.minecraft.client.renderer.*;
import net.minecraft.client.renderer.culling.*;
import net.minecraft.client.renderer.entity.*;
import net.minecraft.client.renderer.tileentity.*;
import net.minecraft.client.settings.*;
import net.minecraft.command.*;
import net.minecraft.crash.*;
import net.minecraft.creativetab.*;
import net.minecraft.dispenser.*;
import net.minecraft.enchantment.*;
import net.minecraft.entity.*;
import net.minecraft.entity.ai.*;
import net.minecraft.entity.boss.*;
import net.minecraft.entity.effect.*;
import net.minecraft.entity.item.*;
import net.minecraft.entity.monster.*;
import net.minecraft.entity.passive.*;
import net.minecraft.entity.player.*;
import net.minecraft.entity.projectile.*;
import net.minecraft.inventory.*;
import net.minecraft.item.*;
import net.minecraft.item.crafting.*;
import net.minecraft.nbt.*;
import net.minecraft.network.*;
import net.minecraft.network.rcon.*;
import net.minecraft.pathfinding.*;
import net.minecraft.potion.*;
import net.minecraft.profiler.*;
import net.minecraft.server.*;
import net.minecraft.server.dedicated.*;
import net.minecraft.server.gui.*;
import net.minecraft.server.integrated.*;
import net.minecraft.server.management.*;
import net.minecraft.src.*;
import net.minecraft.stats.*;
import net.minecraft.tileentity.*;
import net.minecraft.util.*;
import net.minecraft.village.*;
import net.minecraft.world.*;
import net.minecraft.world.biome.*;
import net.minecraft.world.chunk.*;
import net.minecraft.world.chunk.storage.*;
import net.minecraft.world.demo.*;
import net.minecraft.world.gen.*;
import net.minecraft.world.gen.feature.*;
import net.minecraft.world.gen.layer.*;
import net.minecraft.world.gen.structure.*;
import net.minecraft.world.storage.*;
import net.minecraftforge.classloading.*;
import net.minecraftforge.client.*;
import net.minecraftforge.client.event.*;
import net.minecraftforge.client.event.sound.*;
import net.minecraftforge.common.*;
import net.minecraftforge.event.*;
import net.minecraftforge.event.entity.*;
import net.minecraftforge.event.entity.item.*;
import net.minecraftforge.event.entity.living.*;
import net.minecraftforge.event.entity.minecart.*;
import net.minecraftforge.event.entity.player.*;
import net.minecraftforge.event.terraingen.*;
import net.minecraftforge.event.world.*;
import net.minecraftforge.oredict.*;
import net.minecraftforge.transformers.*;
import net.minecraft.init.*;
import java.util.*;
import net.minecraftforge.common.util.*;
import net.minecraft.client.renderer.texture.*;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
public class journey_mazeBlock {
public journey_mazeBlock(){}
public static BlockMazeBlock block;
public static Object instance;public int addFuel(ItemStack fuel){return 0;}
public void serverLoad(FMLServerStartingEvent event){}
public void preInit(FMLPreInitializationEvent event){
GameRegistry.registerBlock(block, "MazeBlock");
}
public void registerRenderers(){}
public void load(){
}
static{
block = (BlockMazeBlock)(new BlockMazeBlock().setHardness(2.0F)
.setResistance(10.0F)
.setLightLevel(0.0F)
.setBlockName("MazeBlock")
.setBlockTextureName("Maze")
.setLightOpacity(0)
.setStepSound(Block.soundTypeStone)
.setCreativeTab(CreativeTabs.tabBlock)
);block.setBlockBounds(0.0F,0.0F,0.0F,1.0F,1.0F,1.0F);
Block.blockRegistry.addObject(211, "MazeBlock", block);
block.setHarvestLevel("pickaxe", 10);
}
public void generateSurface(World world, Random random, int chunkX, int chunkZ){}
public void generateNether(World world, Random random, int chunkX, int chunkZ){}
static class BlockMazeBlock extends Block
{
int a1 = 0,a2 = 0,a3 = 0,a4 = 0,a5 = 0,a6 = 0;
IIcon gor = null, dol = null, st1 = null, st2 = null, st3 = null, st4 = null;
boolean red = false;
protected BlockMazeBlock()
{
super(Material.ground);
}
public int isProvidingStrongPower(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5){
return red?1:0;
}
public void onNeighborBlockChange(World world, int i, int j, int k, Block l){
EntityPlayer entity = Minecraft.getMinecraft().thePlayer;
if (Block.getIdFromBlock(l) > 0 && l.canProvidePower() && world.isBlockIndirectlyGettingPowered(i, j, k)){
if(true){
boolean place = true;
if(place){
world.setBlock(i+0, j+0, k+0, Block.getBlockById(7), 0, 2);
}
}
}
}
@SideOnly(Side.CLIENT)
@Override
public IIcon getIcon(int i, int par2){
if (i == 0)
return gor;
else if (i == 1)
return dol;
else if (i == 2)
return st1;
else if (i == 3)
return st2;
else if (i == 4)
return st4;
else if (i == 5)
return st3;
else
return gor;
}
@SideOnly(Side.CLIENT)
@Override
public void registerBlockIcons(IIconRegister reg){
this.gor = reg.registerIcon("Maze");
this.dol = reg.registerIcon("Maze");
this.st1 = reg.registerIcon("Maze");
this.st2 = reg.registerIcon("Maze");
this.st3 = reg.registerIcon("Maze");
this.st4 = reg.registerIcon("Maze");
}
public int getRenderType(){
return 0;
}
@Override
public int tickRate(World world)
{
return 10;
}
public int quantityDropped(Random par1Random){
return 1;
}
}
}
To OP: So where you'd normally paste in the schematic, instead put in load1(); load2(); load3(); etc
Then create each of those methods like "public void load1() { }" etc
And inside each of those methods, paste part of the original schematic file, effectively splitting the code.
Also, the other people do kind of have a point. That is really messy code, and uses all the bad practices, especially with that static method.
It's MCreator code, what else do you expect to see?
So best method is actually to use a file resource to hold the schematic files.
The thing is, these forums are not for Java help, they're for Minecraft help, and a lot of people here seem to be really pushy about that, including me to a degree. As said many times, if this is MCreator help, that's the only replies the OP will get, as they honestly cannot be helped further, they're trying to comprehend something outside of MCreator's capabilities, even if it's a workaround for a flaw. But yeah, people shouldn't just yell at the OP.
Just saying, and I don't mean to sound rude or something, but if you have no idea what's wrong with his code, nor you being part of the development of his mod, you shouldn't be the one to come onto the forums and ask for help for him. I don't know if you have had experience with programming or modding or not, so what we say you may misinterpret and tell him false information, so it's probably a good idea to instead get him himself to ask the question on here.
Anyways, what he is looking for is something called Object-Oriented Programming (or OOP) practices. Essentially, OOP is where you take up one part of the code you want to write, and place it in it's own method / function and class file (maybe), dedicated to that part. So say if you were trying to render something. Instead of having a bunch of code to set up the pre-render code, you could instead take this out and place it in a method called setupRender() or whatever, and call that instead, and it could be in the class called RenderUtils or RenderHelper or whatever. Essentially, it's taking code, and breaking it down into simple, modular steps. Java is heavily based around the OOP way of programming, and as such, it's essential to understand what OOP is, how it works, and how to integrate an OOP style of programming into your own programming style, both for Java in general, and modding too.
The code could also use a cleanup, as mentioned, there are lots of unused imports, inefficient code segments, and useless methods. Those may or may not help in fixing the error.
Also, I don't know if this is correct or not, but if he is indeed using MCreator, I'd heavily advise against that. MCreator is incredibly limited in what it can do, you're limited by what the program allows you to do, the code it generates is incredibly messy, and as you can maybe tell from some of the replies, MCreator is very despised around here, if you come for help when you're using MCreator or any other mod generator, you've pretty much just signed a deathwish.
Author of the Clarity, Serenity, Sapphire & Halcyon shader packs for Minecraft: Java Edition.
My Github page.
The entire Minecraft shader development community now has its own Discord server! Feel free to join and chat with all the developers!
You forgot the part where you are not allowed to decompile MCreator code.
Actually didn't know that was against the MCreator ToS. But, if it is, yeah, that is also true.
EDIT: Removed the accidental double reply. Stupid forums didn't want to update the posts to include mine.
Author of the Clarity, Serenity, Sapphire & Halcyon shader packs for Minecraft: Java Edition.
My Github page.
The entire Minecraft shader development community now has its own Discord server! Feel free to join and chat with all the developers!
I think the point was that it is a Java limit, not Minecraft. However, with that being said I think some Java, some Eclipse, some github type questions are okay if in moderation. But it is also true that there are TONS of other places to get info about solutions to Java problems.
It reminds me about the Yahoo Answers site -- people go there to ask questions that they can easily get the answer for with quick Google search or simply Wikipedia. For example, I just checked Yahoo Answers and a recent question was "how do I make a safe room for a new kitten?". I mean why would someone ask the question on Yahoo Answers instead of just looking up the hundreds of articles on exactly that subject?
Anyway, almost every question possible about Java has been asked before. In fact on StackOverflow (a common site for Java discussion) you will be seriously flamed if you ask a question that has been ever been asked before.
Splitting your code up into more logical segments is ideal, whether it be via resources/datasets or just a crap load of helper methods (even if they're private). For structure generation, having one method for each "chunk" of structure for example (doesn't have to be an actual Minecraft chunk, could be your own X*Y size) could get around this, and also conveniently pave the way for having your structure created via procedural generation - that is, where each "room" is randomly selected from a pool of valid candidates.
EDIT: I support the resource file method. Text files of "maps" where each ascii character is a certain block, or something like that. Would make the class(es) 95% smaller.