Mmkay, now in a different mod that I am still working on, I am trying to get blocks to work, but it doesn't like me XD. The classes are here, along with the errors.
public class CompObsidianBlock extends ItemBlock{
protected CompObsidianBlock(Material p_i45394_1_) {
1 super(rock);
setHarvestLevel("pickaxe", 3);
2 setHardness(55.0F).setStepSound(Block.soundTypeStone);
return;
}
public Block setBlockName(String string) {
return null;
}
}
1. "rock" cannot be resolved to a variable. If I change rock to p_i45394_1_, it tells me to change the type of p_i45394_1_ to block and then I get error 1 in CompressedToolsBlocks.
2. The method setHardness(float) is undefined for the type CompObsidianBlock.
I am completely new to modding , i do know a few basics of programming not much do
Can you give me a good tutorial on how to make forge mods please.
Also if not in the tutorial, which program should i use?
It would like to able to make as first mod a quick crafting mod , it let's you connect hotkeys and such so when in a crafting table it autocrafts the sword taking the items in your iventory automatic.
TheGrovesyProject101 has some quick, basic tutorials that will get you started, even if he does take a few extra steps. I use Eclipse, and it's a really good program for writing Java.
TheGrovesyProject101 has some quick, basic tutorials that will get you started, even if he does take a few extra steps. I use Eclipse, and it's a really good program for writing Java.
Mmkay, now in a different mod that I am still working on, I am trying to get blocks to work, but it doesn't like me XD. The classes are here, along with the errors.
public class CompObsidianBlock extends ItemBlock{
protected CompObsidianBlock(Material p_i45394_1_) {
1 super(rock);
setHarvestLevel("pickaxe", 3);
2 setHardness(55.0F).setStepSound(Block.soundTypeStone);
return;
}
public Block setBlockName(String string) {
return null;
}
}
1. "rock" cannot be resolved to a variable. If I change rock to p_i45394_1_, it tells me to change the type of p_i45394_1_ to block and then I get error 1 in CompressedToolsBlocks.
2. The method setHardness(float) is undefined for the type CompObsidianBlock.
Im not so sure about the first one, but on the second spoiler, you put "public class CompObsidianBlock extends ItemBlock" (Line # 10), and I wasn't sure If you meant to put ItemBlock or Block. Here's my code for my block:
BlockLavaCrystalBlock:
[/size]
package com.tnvols02.BetterStuff.blocks;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.creativetab.CreativeTabs;
public class BlockLavaCrystalBlock extends Block{
public BlockLavaCrystalBlock(int i, Material rock) {
super(rock);
this.setCreativeTab(CreativeTabs.tabBlock);
this.setStepSound(soundTypeStone);
this.setHardness(12f);
this.setResistance(20f);
this.setLightLevel(0.8f);
this.setBlockName("LavaCrystalBlock");
this.setBlockTextureName("betterstuff:LavaCrystalBlock");
}
}
[size=medium]
As you can see, I put "BlockLavaCrystalBlock extends Block{", not ItemBlock. I'm not completely sure this will fix it, just reply
-Tnv
EDIT:
Don't forget to put [.CODE] [./CODE] (Without the dots) tags for your code, it makes code much easier to read
Rollback Post to RevisionRollBack
"On the Internet, you can pretty much be whatever you want. It's strange that so many people choose to be stupid."
"I tried programming once... haven't touched a computer since."
Im not so sure about the first one, but on the second spoiler, you put "public class CompObsidianBlock extends ItemBlock" (Line # 10), and I wasn't sure If you meant to put ItemBlock or Block. Here's my code for my block:
BlockLavaCrystalBlock:
[/size]
package com.tnvols02.BetterStuff.blocks;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.creativetab.CreativeTabs;
public class BlockLavaCrystalBlock extends Block{
public BlockLavaCrystalBlock(int i, Material rock) {
super(rock);
this.setCreativeTab(CreativeTabs.tabBlock);
this.setStepSound(soundTypeStone);
this.setHardness(12f);
this.setResistance(20f);
this.setLightLevel(0.8f);
this.setBlockName("LavaCrystalBlock");
this.setBlockTextureName("betterstuff:LavaCrystalBlock");
}
}
[size=medium]
As you can see, I put "BlockLavaCrystalBlock extends Block{", not ItemBlock. I'm not completely sure this will fix it, just reply
-Tnv
EDIT:
Don't forget to put [.CODE] [./CODE] (Without the dots) tags for your code, it makes code much easier to read
Thanks for the tip! Thank you so much, that cleared up all the errors.
I am completely new to modding , i do know a few basics of programming not much do
Can you give me a good tutorial on how to make forge mods please.
Also if not in the tutorial, which program should i use?
It would like to able to make as first mod a quick crafting mod , it let's you connect hotkeys and such so when in a crafting table it autocrafts the sword taking the items in your iventory automatic.
This teaches you about basic stuff like blocks, items, creativetabs, ai and entities.
If after that you are looking into some more functions, study the files in minecraft's src.
this method, for example, works and comes right out from BlockSoulSand.java.
You can make a soul sand block (sort of) with this following method:
public AxisAlignedBB getCollisionBoundingBoxFromPool(World p_149668_1_, int p_149668_2_, int p_149668_3_, int p_149668_4_) { float f = 0.125F; return AxisAlignedBB.getAABBPool().getAABB((double)p_149668_2_, (double)p_149668_3_, (double)p_149668_4_, (double)(p_149668_2_ + 1), (double)((float)(p_149668_3_ + 1) - f), (double)(p_149668_4_ + 1)); }
public void onEntityCollidedWithBlock(World p_149670_1_, int p_149670_2_, int p_149670_3_, int p_149670_4_, Entity p_149670_5_) { p_149670_5_.motionX *= 0.4D; //This is the Speed(0.4 is soulsand speed) p_149670_5_.motionZ *= 0.4D; //This is the Speed } }
the MotionX and MotionZ is the speed of the block. Put this into the block file. Its a nice thing to know
This is now happening with my CompressedToolsBlocks.mainRegistry(); line.
EDIT: Wait, tnv's code helped fix that.
Welcome
-Tnv
EDIT: Anyone know anything about the LavaFurnace (First post on this page)? Any help is great. Btw, there isn't a crash report, just no gui when I right-click the furnace
Rollback Post to RevisionRollBack
"On the Internet, you can pretty much be whatever you want. It's strange that so many people choose to be stupid."
"I tried programming once... haven't touched a computer since."
EDIT: Anyone know anything about the LavaFurnace (First post on this page)? Any help is great. Btw, there isn't a crash report, just no gui when I right-click the furnace
I Recommend Looking at some old tutorials and trying to edit it so it works out.
Or i guess you could look at some examples in minecraft's src to try something, IDK.
I Recommend Looking at some old tutorials and trying to edit it so it works out.
Or i guess you could look at some examples in minecraft's src to try something, IDK.
I did, and I found ScrathForFun's tutorial, but it's 15 tutorials long, and each of them are 15-20 mins.... so that's gonna be my last option xD, but thanks for the suggestion.
Btw, I put this in my LavaFurnaceGui Class, and still the same result. AND I have the texture.
public static final ResourceLocation texture = new ResourceLocation("betterstuff/textures/gui/LavaFurnaceGui.png");
You can look at my first post for more info (Pg. 10, post 1).
Rollback Post to RevisionRollBack
"On the Internet, you can pretty much be whatever you want. It's strange that so many people choose to be stupid."
"I tried programming once... haven't touched a computer since."
Oops, I made a topic on my question right before I saw this. But I couldn't help myself. How do you texture a fluid block, I'm following the forge wiki tutorial on making a custom fluid, but it just has the untextured, purple black texture on it. Thanks in advance
Oops, I made a topic on my question right before I saw this. But I couldn't help myself. How do you texture a fluid block, I'm following the forge wiki tutorial on making a custom fluid, but it just has the untextured, purple black texture on it. Thanks in advance
Look at BlockClassicFluid and BlockFiniteFluid in package 'net.minecraftforge.fluids'. They can help you.
If a player does a Weapon Swing, which other clients will get a notification packet about it? (To start rendering the initial player swinging on their screen.)
a.) Players within a specific (maybe render) distance.
b.) All players in that Dimension. (Overworld, Nether, custom dimensions etc...)
c.) All players on the server
I feel like answer a.) would be the best, because the smallest ammount of packets would be generated and sent that way, but what is this distance and does it worth it to calculate who is in range on every single time when a packet should be sent?
The distance is if it is rendering the player from the current client, and i'd say it's worth it.
I am completely new to modding , i do know a few basics of programming not much do
Can you give me a good tutorial on how to make forge mods please.
Also if not in the tutorial, which program should i use?
It would like to able to make as first mod a quick crafting mod , it let's you connect hotkeys and such so when in a crafting table it autocrafts the sword taking the items in your iventory automatic.
EDIT: Anyone know anything about the LavaFurnace (First post on this page)? Any help is great. Btw, there isn't a crash report, just no gui when I right-click the furnace
What class exactly would that go in? The GuiHandler class? Im sure its obvious xD
-Tnv
EDIT: LavaFurnaceGuiHandler.class:
package com.tnvols02.BetterStuff.blocks.gui;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import com.tnvols02.BetterStuff.tileentities.LavaFurnaceTileEntity;
import cpw.mods.fml.common.network.IGuiHandler;
public class LavaFurnaceGuiHandler implements IGuiHandler{
NetworkRegistry.INSTANCE.registerGuiHandler(this, LavaFurnaceGuiHandler);
@Override
public Object getServerGuiElement(int ID, EntityPlayer player, World world,
int x, int y, int z) {
TileEntity entity = world.getTileEntity(x, y, z);
switch(ID) {
case 0:
if(entity != null && entity instanceof LavaFurnaceTileEntity) {
return new LavaFurnaceContainer(player.inventory, (LavaFurnaceTileEntity) entity);
}else{
return null;
}
}
return null;
}
@Override
public Object getClientGuiElement(int ID, EntityPlayer player, World world,
int x, int y, int z) {
TileEntity entity = world.getTileEntity(x, y, z);
switch(ID) {
case 0:
if(entity != null && entity instanceof LavaFurnaceTileEntity) {
return new LavaFurnaceGui(player.inventory, (LavaFurnaceTileEntity)entity);
}
}
return null;
}
}
Everywhere I try to add in "NetworkRegistry.INSTANCE.registerGuiHandler(this, LavaFurnaceGuiHandler);", I get an error on LavaFurnaceGuiHandler: "Syntax error on token "LavaFurnaceGuiHandler", VariableDeclaratorId expected after this token"
Rollback Post to RevisionRollBack
"On the Internet, you can pretty much be whatever you want. It's strange that so many people choose to be stupid."
"I tried programming once... haven't touched a computer since."
What class exactly would that go in? The GuiHandler class? Im sure its obvious xD
-Tnv
EDIT: LavaFurnaceGuiHandler.class:
package com.tnvols02.BetterStuff.blocks.gui;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import com.tnvols02.BetterStuff.tileentities.LavaFurnaceTileEntity;
import cpw.mods.fml.common.network.IGuiHandler;
public class LavaFurnaceGuiHandler implements IGuiHandler{
NetworkRegistry.INSTANCE.registerGuiHandler(this, LavaFurnaceGuiHandler);
@Override
public Object getServerGuiElement(int ID, EntityPlayer player, World world,
int x, int y, int z) {
TileEntity entity = world.getTileEntity(x, y, z);
switch(ID) {
case 0:
if(entity != null && entity instanceof LavaFurnaceTileEntity) {
return new LavaFurnaceContainer(player.inventory, (LavaFurnaceTileEntity) entity);
}else{
return null;
}
}
return null;
}
@Override
public Object getClientGuiElement(int ID, EntityPlayer player, World world,
int x, int y, int z) {
TileEntity entity = world.getTileEntity(x, y, z);
switch(ID) {
case 0:
if(entity != null && entity instanceof LavaFurnaceTileEntity) {
return new LavaFurnaceGui(player.inventory, (LavaFurnaceTileEntity)entity);
}
}
return null;
}
}
Everywhere I try to add in "NetworkRegistry.INSTANCE.registerGuiHandler(this, LavaFurnaceGuiHandler);", I get an error on LavaFurnaceGuiHandler: "Syntax error on token "LavaFurnaceGuiHandler", VariableDeclaratorId expected after this token"
What class exactly would that go in? The GuiHandler class? Im sure its obvious xD -Tnv EDIT: LavaFurnaceGuiHandler.class:
package com.tnvols02.BetterStuff.blocks.gui; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; import com.tnvols02.BetterStuff.tileentities.LavaFurnaceTileEntity; import cpw.mods.fml.common.network.IGuiHandler; public class LavaFurnaceGuiHandler implements IGuiHandler{ NetworkRegistry.INSTANCE.registerGuiHandler(this, LavaFurnaceGuiHandler); @Override public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { TileEntity entity = world.getTileEntity(x, y, z); switch(ID) { case 0: if(entity != null && entity instanceof LavaFurnaceTileEntity) { return new LavaFurnaceContainer(player.inventory, (LavaFurnaceTileEntity) entity); }else{ return null; } } return null; } @Override public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { TileEntity entity = world.getTileEntity(x, y, z); switch(ID) { case 0: if(entity != null && entity instanceof LavaFurnaceTileEntity) { return new LavaFurnaceGui(player.inventory, (LavaFurnaceTileEntity)entity); } } return null; } }
Everywhere I try to add in "NetworkRegistry.INSTANCE.registerGuiHandler(this, LavaFurnaceGuiHandler);", I get an error on LavaFurnaceGuiHandler: "Syntax error on token "LavaFurnaceGuiHandler", VariableDeclaratorId expected after this token"
it would go in the main mod class, under the preinit method
Hah, hilarious.
So no one knows mine?
CompressedToolsBlocks:
package com.compressedtools.block;
import com.compressedtools.lib.Strings;
import cpw.mods.fml.common.registry.GameRegistry;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.creativetab.CreativeTabs;
import cpw.mods.fml.common.registry.LanguageRegistry;
public class CompressedToolsBlocks {
public static void mainRegistry() {
registerBlock();
}
1. public static Block CompObsidian = new CompObsidianBlock(Material.rock)
.setBlockName("CompressedObsidian")
.setCreativeTab(CreativeTabs.tabBlock)
.setBlockTextureName(Strings.MODID + ":CompObsidianBlock");
boolean requiresNoTool = false;
private static void registerBlock() {
}
}
1. (this only happens if error 2 in the 2nd spoiler is fixed)
CompObsidianBlock:
package com.compressedtools.block;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.item.ItemBlock;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.util.IIcon;
public class CompObsidianBlock extends ItemBlock{
protected CompObsidianBlock(Material p_i45394_1_) {
1 super(rock);
setHarvestLevel("pickaxe", 3);
2 setHardness(55.0F).setStepSound(Block.soundTypeStone);
return;
}
public Block setBlockName(String string) {
return null;
}
}
1. "rock" cannot be resolved to a variable. If I change rock to p_i45394_1_, it tells me to change the type of p_i45394_1_ to block and then I get error 1 in CompressedToolsBlocks.
2. The method setHardness(float) is undefined for the type CompObsidianBlock.
TheGrovesyProject101 has some quick, basic tutorials that will get you started, even if he does take a few extra steps. I use Eclipse, and it's a really good program for writing Java.
Obsidian... That's my trademark... sort of...
My YouTube: http://www.youtube.c...C62DSkPDLz_owQ/
If the spacing is weird on any of my posts, I probably forgot to turn off my Japanese IME.
I too use Eclipse, and I found some really good tutorials, by TheMchewy.
YT Channel: https://www.youtube.com/user/TheMchewy
Ep. 1:
Also, any help on my post (the first on this page)
-Tnv
"On the Internet, you can pretty much be whatever you want. It's strange that so many people choose to be stupid."
"I tried programming once... haven't touched a computer since."
Im not so sure about the first one, but on the second spoiler, you put "public class CompObsidianBlock extends ItemBlock" (Line # 10), and I wasn't sure If you meant to put ItemBlock or Block. Here's my code for my block:
BlockLavaCrystalBlock:
-Tnv
EDIT:
Don't forget to put [.CODE] [./CODE] (Without the dots) tags for your code, it makes code much easier to read
"On the Internet, you can pretty much be whatever you want. It's strange that so many people choose to be stupid."
"I tried programming once... haven't touched a computer since."
Thanks for the tip! Thank you so much, that cleared up all the errors.
Obsidian... That's my trademark... sort of...
My YouTube: http://www.youtube.c...C62DSkPDLz_owQ/
If the spacing is weird on any of my posts, I probably forgot to turn off my Japanese IME.
This is now happening with my CompressedToolsBlocks.mainRegistry(); line.
EDIT: Wait, tnv's code helped fix that.
Obsidian... That's my trademark... sort of...
My YouTube: http://www.youtube.c...C62DSkPDLz_owQ/
If the spacing is weird on any of my posts, I probably forgot to turn off my Japanese IME.
I Recommend Eclipse Standard.
http://www.eclipse.org/downloads/
if youre looking for something more recent:
http://www.minecraftforum.net/topic/2389683-172-forge-add-new-block-item-entity-ai-creative-tab-language-localization-block-textures-side-textures/
If after that you are looking into some more functions, study the files in minecraft's src.
this method, for example, works and comes right out from BlockSoulSand.java.
You can make a soul sand block (sort of) with this following method:
public AxisAlignedBB getCollisionBoundingBoxFromPool(World p_149668_1_, int p_149668_2_, int p_149668_3_, int p_149668_4_)
{
float f = 0.125F;
return AxisAlignedBB.getAABBPool().getAABB((double)p_149668_2_, (double)p_149668_3_, (double)p_149668_4_, (double)(p_149668_2_ + 1), (double)((float)(p_149668_3_ + 1) - f), (double)(p_149668_4_ + 1));
}
public void onEntityCollidedWithBlock(World p_149670_1_, int p_149670_2_, int p_149670_3_, int p_149670_4_, Entity p_149670_5_)
{
p_149670_5_.motionX *= 0.4D; //This is the Speed(0.4 is soulsand speed)
p_149670_5_.motionZ *= 0.4D; //This is the Speed
}
}
Have Fun Modding!
I'm not crazy, i'm just not user friendly
--> Click here to get BETA ACCESS to this mod and upcoming server! <--
Welcome
-Tnv
EDIT: Anyone know anything about the LavaFurnace (First post on this page)? Any help is great. Btw, there isn't a crash report, just no gui when I right-click the furnace
"On the Internet, you can pretty much be whatever you want. It's strange that so many people choose to be stupid."
"I tried programming once... haven't touched a computer since."
I Recommend Looking at some old tutorials and trying to edit it so it works out.
Or i guess you could look at some examples in minecraft's src to try something, IDK.
I'm not crazy, i'm just not user friendly
--> Click here to get BETA ACCESS to this mod and upcoming server! <--
I did, and I found ScrathForFun's tutorial, but it's 15 tutorials long, and each of them are 15-20 mins.... so that's gonna be my last option xD, but thanks for the suggestion.
Btw, I put this in my LavaFurnaceGui Class, and still the same result. AND I have the texture.
You can look at my first post for more info (Pg. 10, post 1).
"On the Internet, you can pretty much be whatever you want. It's strange that so many people choose to be stupid."
"I tried programming once... haven't touched a computer since."
It might be because those are the only ores that should generate in the Overworld. The other ores also do not appear in the Blocks tab.
Obsidian... That's my trademark... sort of...
My YouTube: http://www.youtube.c...C62DSkPDLz_owQ/
If the spacing is weird on any of my posts, I probably forgot to turn off my Japanese IME.
Nope :/ But thanks for that
EDIT: There isn't anything in the log/console. No errors or anything, either...
"On the Internet, you can pretty much be whatever you want. It's strange that so many people choose to be stupid."
"I tried programming once... haven't touched a computer since."
Look at BlockClassicFluid and BlockFiniteFluid in package 'net.minecraftforge.fluids'. They can help you.
Copy the sugar cane class, start with a carbon copy of sugar cane, then slowly alter it to fit your block, one step at a time.
The distance is if it is rendering the player from the current client, and i'd say it's worth it.
You need a world provider, a teleporter, and a blockportal. Here is a tutorial by wuppy29: http://wuppy29.blogspot.com/2013/08/wuppys-minecraft-forge-modding_7477.html
http://www.minecraftforge.net/wiki/Basic_Modding
That is registering a gui handler, so make a class that implements IGuiHandler. Here is a tutorial for adding a gui: http://www.minecraftforge.net/wiki/Containers_and_GUIs
Just in case, this is what you use to register a guihandler:
97
What class exactly would that go in? The GuiHandler class? Im sure its obvious xD
-Tnv
EDIT: LavaFurnaceGuiHandler.class:
Everywhere I try to add in "NetworkRegistry.INSTANCE.registerGuiHandler(this, LavaFurnaceGuiHandler);", I get an error on LavaFurnaceGuiHandler: "Syntax error on token "LavaFurnaceGuiHandler", VariableDeclaratorId expected after this token"
"On the Internet, you can pretty much be whatever you want. It's strange that so many people choose to be stupid."
"I tried programming once... haven't touched a computer since."
Heres My GUIHandler Class:
package com.periodiccraft.pcm;
[
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import cpw.mods.fml.common.network.IGuiHandler;
import cpw.mods.fml.common.network.NetworkRegistry;
public class GuiHandler implements IGuiHandler
{
public GuiHandler() {
//NetworkRegistry.INSTANCE.registerGuiHandler(PeriodicCraft.instance, this);
}
@Override
public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
TileEntity entity = world.getTileEntity(x, y, z);
if(entity != null) {
switch(ID) {
case PeriodicCraft.guiIDLiquidDI:
if(entity instanceof TileEntityLiquidDi) {
return new GuiLiquidDi(player.inventory, (TileEntityLiquidDi) entity);
}
}
}
return null;
}
I'm not crazy, i'm just not user friendly
--> Click here to get BETA ACCESS to this mod and upcoming server! <--
it would go in the main mod class, under the preinit method
97
Ummm......... this may sound stupid, but I can't find "preinit" or "init" anywhere
EDIT: God, Im so retarded.. u said main mod class xD
EDIT #2: I take that back, I can't anywhere to put it without errors, either...
BetterStuff.class (Base mod file):
EDIT #3: I do have to replace "GUI_HANDLER" with "LavaFurnaceGuiHandler", right?
"On the Internet, you can pretty much be whatever you want. It's strange that so many people choose to be stupid."
"I tried programming once... haven't touched a computer since."
yes, replace GUI_HANDLER with LavaFurnaceGuiHandler, and put the registering in a method, preferrably the init or preinit methods.
XD
97