Jump to content

Recommended Posts

Posted

this is what my cod looks like:

package Eclipse7.RedDiamonds.common;

 

import Eclipse7.RedDiamonds.armor.RedDiamondArmor;

import Eclipse7.RedDiamonds.item.ItemRedDiamond;

import Eclipse7.RedDiamonds.item.ItemRedDiamondAxe;

import Eclipse7.RedDiamonds.item.ItemRedDiamondHoe;

import Eclipse7.RedDiamonds.item.ItemRedDiamondPickaxe;

import Eclipse7.RedDiamonds.item.ItemRedDiamondShovel;

import Eclipse7.RedDiamonds.item.ItemRedDiamondSword;

import net.minecraft.block.Block;

import net.minecraft.block.material.Material;

import net.minecraft.item.EnumArmorMaterial;

import net.minecraft.item.EnumToolMaterial;

import net.minecraft.item.Item;

import cpw.mods.fml.common.Mod;

import cpw.mods.fml.common.registry.GameRegistry;

import Eclipse7.RedDiamonds.block.*;

import net.minecraftforge.common.EnumHelper;

 

@Mod(modid = "RedDiamonds", name ="RedDiamonds", version = "0.1 Alpha")

 

public class RedDiamonds {

//EnumMaterials

public static EnumToolMaterial toolRedDiamond = EnumHelper.addToolMaterial("REDDIAMOND", 3, 2000, 12.0F, 4.0F, 30);

public static EnumArmorMaterial armorRedDiamond = EnumHelper.addArmorMaterial("REDDIAMOND", 40, new int [] {4, 8, 7, 4}, 30);

//Registrations

public static Item RedDiamondPickaxe = new ItemRedDiamondPickaxe(2000, toolRedDiamond).setUnlocalizedName("RedDiamondPickaxe");

public static Item RedDiamondSword = new ItemRedDiamondSword(2001, toolRedDiamond).setUnlocalizedName("RedDiamondSword");

public static Item RedDiamondShovel = new ItemRedDiamondShovel(2002, toolRedDiamond).setUnlocalizedName("RedDiamondShovel");

public static Item RedDiamondAxe = new ItemRedDiamondAxe(2003, toolRedDiamond).setUnlocalizedName("RedDiamondAxe");

public static Item RedDiamondHoe = new ItemRedDiamondHoe(2004, toolRedDiamond).setUnlocalizedName("RedDiamondHoe");

public static Block RedDiamondBlock = new BlockRedDiamondBlock(1000, Material.iron).setUnlocalizedName("RedDiamondBlock");

public static Item RedDiamond =new ItemRedDiamond(2005).setUnlocalizedName("RedDiamond");

public static Item RedDiamondHelmet = new RedDiamondArmor(2006, armorRedDiamond, 0, 0, "reddiamond").setUnlocalizedName("RedDiamondHelmet");

public static Item RedDiamondChestplate = new RedDiamondArmor(2007, armorRedDiamond, 0, 1, "reddiamond").setUnlocalizedName("RedDiamondChestplate");

public static Item RedDiamondLeggings = new RedDiamondArmor(2008, armorRedDiamond, 0, 2, "reddiamond").setUnlocalizedName("RedDiamondLeggings");

public static Item RedDiamondBoots = new RedDiamondArmor(2009, armorRedDiamond, 0, 3, "reddiamond").setUnlocalizedName("RedDiamondBoots");

 

 

 

 

 

LanguageRegistry.addName(RedDiamondBlock= ("RedDiamond Block");

 

GameRegistry.addRecipe(new ItemStack(RedDiamondPickaxe, 1) new Object [] {

"***", " X ", " X ", 'X', Item.stick, '*', RedDiamond

});

GameRegistry.addRecipe(new ItemStack(RedDiamondSword, 1), new Object [] {

" * ", " * ", " X ", '*', Item.stick, 'X', RedDiamond

};

GameRegistry.addRecipe(new ItemStack(RedDiamondShovel, 1), new Object [] {

" * ", " X ", " X ", 'X', Item.stick, '*', RedDiamond

});

GameRegistry.addRecipe = new ItemStack(RedDiamondAxe, 1, new Object [] {

"** ", "*X ", " X ", 'X', Item.stick, '*', RedDiamond

});

GameRegistry.addRecipe(new ItemStack(RedDiamondHoe, 1), new Object [] {

"** ", " X ", " X ", 'X', Item.stick, '*', RedDiamond

});

GameRegistry.addRecipe(new ItemStack (RedDiamondBlock), new Object [] {

"XXX", "XXX", "XXX", 'X', RedDiamond

})

GameRegistry.addRecipe(new ItemStack(RedDiamond), new Object [] {

"XXX", "X*X", "XXX", 'X', Item.redstone, '*', Item.diamond

});

GameRegistry.addRecipe(new ItemStack(RedDiamondChestplate), new Object [] {

"X X", "XXX", "XXX", 'X', RedDiamond

});

GameRegistry.addRecipe(new ItemStack(RedDiamondLeggings), new Object [] {

"XXX", "X X", "X X"

});

GameRegistry.addRecipe(new ItemStack(RedDiamondBoots), new Object [] {

"X X", "X X", 'X', RedDiamond

};

 

};

my errors:

[iNFO] [sTDOUT] java.lang.Error: Unresolved compilation problems:

2013-08-18 20:28:08 [iNFO] [sTDOUT] Syntax error on token "(", delete this token

2013-08-18 20:28:08 [iNFO] [sTDOUT] Syntax error on token(s), misplaced construct(s)

2013-08-18 20:28:08 [iNFO] [sTDOUT] Syntax error on token "addRecipe", = expected after this token

2013-08-18 20:28:08 [iNFO] [sTDOUT] Syntax error on token ")", AssignmentOperator expected after this token

2013-08-18 20:28:08 [iNFO] [sTDOUT] Syntax error on token(s), misplaced construct(s)

2013-08-18 20:28:08 [iNFO] [sTDOUT] Syntax error on token "(", = expected

2013-08-18 20:28:08 [iNFO] [sTDOUT] Syntax error on token ",", invalid AssignmentOperator

2013-08-18 20:28:08 [iNFO] [sTDOUT] Syntax error on token(s), misplaced construct(s)

2013-08-18 20:28:08 [iNFO] [sTDOUT] Syntax error on token "(", = expected

2013-08-18 20:28:08 [iNFO] [sTDOUT] Syntax error on token ")", delete this token

2013-08-18 20:28:08 [iNFO] [sTDOUT] Syntax error on token "addRecipe", VariableDeclaratorId expected after this token

2013-08-18 20:28:08 [iNFO] [sTDOUT] Syntax error on token(s), misplaced construct(s)

2013-08-18 20:28:08 [iNFO] [sTDOUT] Syntax error on token "(", = expected

2013-08-18 20:28:08 [iNFO] [sTDOUT] Syntax error on token ")", delete this token

2013-08-18 20:28:08 [iNFO] [sTDOUT] Syntax error on token(s), misplaced construct(s)

2013-08-18 20:28:08 [iNFO] [sTDOUT] Syntax error on token "(", = expected

2013-08-18 20:28:08 [iNFO] [sTDOUT] Syntax error on token ")", delete this token

2013-08-18 20:28:08 [iNFO] [sTDOUT] Syntax error on token "GameRegistry", delete this token

2013-08-18 20:28:08 [iNFO] [sTDOUT] Syntax error on token(s), misplaced construct(s)

2013-08-18 20:28:08 [iNFO] [sTDOUT] Syntax error on token "(", = expected

2013-08-18 20:28:08 [iNFO] [sTDOUT] Syntax error on token ")", delete this token

2013-08-18 20:28:08 [iNFO] [sTDOUT] Syntax error on token(s), misplaced construct(s)

2013-08-18 20:28:08 [iNFO] [sTDOUT] Syntax error on token "(", = expected

2013-08-18 20:28:08 [iNFO] [sTDOUT] Syntax error on token ")", delete this token

2013-08-18 20:28:08 [iNFO] [sTDOUT] Syntax error on token(s), misplaced construct(s)

2013-08-18 20:28:08 [iNFO] [sTDOUT] Syntax error on token "(", = expected

2013-08-18 20:28:08 [iNFO] [sTDOUT] Syntax error on token ",", invalid AssignmentOperator

Posted

 

 

Please use the spoiler tags....

 

 

I am Mew. The Legendary Psychic. I behave oddly and am always playing practical jokes.

 

I have also found that I really love making extremely long and extremely but sometimes not so descriptive variables. Sort of like what I just did there xD

Posted

Your mod writed FULLY wrong. There are MEGATONS of errors. Just follow tutorials.

[spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler]LOL,Its nothing interesting here

[spoiler=Spoiler]And here too

[spoiler=Spoiler]But that image is pretty good

 

 

 

 

 

 

 

 

 

 

 

 

Posted

You can't just dump code into a class declaration; it has to be inside a method or part of a field assignment (core Java concept I guess you could say). Your mistakes are when you try to register the crafting recipes in the middle of your mod class. Try working through the tutorials like PlatonCraft said... Also might want to work on your Java

I like to make mods, just like you. Here's one worth checking out

Posted

<the more you know>

well you CAN run code staticly using this format

public class MyClass{
public static int member1;
public static float member2;
{
    member1 = 5;
    member2 = member1*2;
}

 

which is valid ... but yeah java syntax error shouldnt get to us

</the more you know>

how to debug 101:http://www.minecraftforge.net/wiki/Debug_101

-hydroflame, author of the forge revolution-

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Ah, it appears I spoke too soon, I still need a little help here. I now have the forceloading working reliably.  However, I've realized it's not always the first tick that loads the entity.  I've seen it take anywhere from 2-20ish to actually go through, in which time my debugging has revealed that the chunk is loaded, but during which time calling  serverLevelIn.getEntity(uuidIn) returns a null result.  I suspect this has to do with queuing and how entities are loaded into the game.  While not optimal, it's acceptable, and I don't think there's a whole ton I can do to avoid it. However, my concern is that occasionally teleporting an entity in this manner causes a lag spike.  It's not every time and gives the appearance of being correlated with when other chunks are loading in.  It's also not typically a long spike, but can last a second or two, which is less than ideal.  The gist of how I'm summoning is here (although I've omitted some parts that weren't relevant.  The lag occurs before the actual summon so I'm pretty confident it's the loading, and not the actual summon call). ChunkPos chunkPos = new ChunkPos(entityPosIn); if (serverLevelIn.areEntitiesLoaded(chunkPos.toLong())) { boolean isSummoned = // The method I'm using for actual summoning is called here. Apart from a few checks, the bulk of it is shown later on. if (isSummoned) { // Code that runs here just notifies the player of the summon, clears it from the queue, and removes the forceload } } else { // I continue forcing the chunk until the summon succeeds, to make sure it isn't inadvertently cleared ForgeChunkManager.forceChunk(serverLevelIn, MODID, summonPosIn, chunkPos.x, chunkPos.z, true, true); } The summon code itself uses serverLevelIn.getEntity(uuidIn) to retrieve the entity, and moves it as such.  It is then moved thusly: if (entity.isAlive()) { entity.moveTo(posIn.getX(), posIn.getY(), posIn.getZ()); serverLevelIn.playSound(null, entity, SoundEvents.ENDERMAN_TELEPORT, SoundSource.NEUTRAL, 1.0F, 1.0F); return true; } I originally was calling .getEntity() more frequently and didn't have the check for whether or not entities were loaded in place to prevent unnecessary code calls, but even with those safety measures in place, the lag still persists.  Could this just be an issue with 1.18's lack of optimization in certain areas?  Is there anything I can do to mitigate it?  Is there a performance boosting mod I could recommend alongside my own to reduce the chunk loading lag? At the end of the day, it does work, and I'm putting measures in place to prevent players from abusing the system to cause lag (i.e. each player can only have one queued summon at a time-- trying to summon another replaces the first call).  It's also not an unacceptable level of lag, IMO, given the infrequency of such calls, and the fact that I'm providing the option to toggle off the feature if server admins don't want it used.  However, no amount of lag is ideal, so if possible I'd love to find a more elegant solution-- or at least a mod recommendation to help improve it. Thanks!
    • When i start my forge server its on but when i try to join its come a error Internal Exception: java.lang.OutOfMemoryError: Requested array size exceeds VM limit Server infos: Linux Minecraft version 1.20.1 -Xmx11G -Xms8G
    • Also add the latest.log from your logs-folder
    • Add the mods in groups
  • Topics

×
×
  • Create New...

Important Information

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