coolboy4531
-
Posts
584 -
Joined
-
Last visited
Posts posted by coolboy4531
-
-
Well, I don't think you can contain base classes in plugins
-
Like Draco said, but I'll explain it more.
Use the onItemRightClick method to activate this method:
@Override public String getItemDisplayName(ItemStack par1ItemStack) { return "replacewithitemname"; }
If you wish to switch back and forth between two different names.
Then make an array that switches between two variables, and depending on which variable use the code above.
-
Legit. Thanks for Google-ing it for me
-
How do I use TickEvent?
-
-
Look at the vanilla coding (if you are using BASE classes)
-
Never mind, guys, thanks for everything
I told you I am an idiotic freak, with no knowledge.
<----------------------
<----------------------
<----------------------
<----------------------
I forgot to add this:
public int getRenderType() { return Block.fire.getRenderType(); }
-
xAlright alright, sorry
Well, overriding getIcon works, everything works fine, except there is now one little problem.
The fire block itself now, isn't like the actual fire block from vanilla minecraft.
It has appeared that it is exactly like a block, and all the sides of the block have the fire texture.
Fire Texture Picture: http://i.imgur.com/1y2dgBs.png
-
This is what I use.
Main Class:
public Item music1; music1 = new ItemRecordMusic(11111, "musicone").setCreativeTab(CreativeTabs.tabMisc).setUnlocalizedName("musicDiskOne"); //The first box is for item ID, and the second box is for file name. //The file would be located in: \resources\mod\streaming\musicone.ogg
ItemRecordMusic
package com.musicraft.main; import java.util.List; import net.minecraft.block.Block; import net.minecraft.block.BlockJukeBox; import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemRecord; import net.minecraft.item.ItemStack; import net.minecraft.world.World; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; public class ItemRecordMusic extends ItemRecord { public final String recordName; public ItemRecordMusic(int par1, String par2Str) { super(par1, par2Str); this.recordName = par2Str; this.maxStackSize = 1; this.setCreativeTab(CreativeTabs.tabMisc); } public void getSubBlocks(int par1, CreativeTabs par2CreativeTabs, List par3List) { } public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10) { if (par3World.getBlockId(par4, par5, par6) == Block.jukebox.blockID && par3World.getBlockMetadata(par4, par5, par6) == 0) { if (par3World.isRemote) { return true; } else { ((BlockJukeBox)Block.jukebox).insertRecord(par3World, par4, par5, par6, par1ItemStack); par3World.playAuxSFXAtEntity((EntityPlayer)null, 1005, par4, par5, par6, this.itemID); --par1ItemStack.stackSize; return true; } } else { return false; } } @SideOnly(Side.CLIENT) public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) { if (this.recordName == "musicone") { par3List.add("HappyDays - " + this.recordName); } } @SideOnly(Side.CLIENT) @Override public void updateIcons(IconRegister par1IconRegister) { this.iconIndex = par1IconRegister.registerIcon(this.recordName); } @Override public String getRecordTitle() { return "HappyDays"; } }
Some fields, you might have to change by yourself, but this is what I use, and it works fine.
Remember that the file needs to be in OGG format!
-
Did what you said, now I'm getting worse errors
NullPointerException ):
2013-06-24 11:07:40 [iNFO] [sTDERR] java.lang.NullPointerException 2013-06-24 11:07:40 [iNFO] [sTDERR] at net.minecraft.block.BlockFire.getIcon(BlockFire.java:487) 2013-06-24 11:07:40 [iNFO] [sTDERR] at net.minecraft.block.Block.getBlockTexture(Block.java:540) 2013-06-24 11:07:40 [iNFO] [sTDERR] at net.minecraft.client.renderer.RenderBlocks.getBlockIcon(RenderBlocks.java:8141) 2013-06-24 11:07:40 [iNFO] [sTDERR] at net.minecraft.client.renderer.RenderBlocks.renderStandardBlockWithColorMultiplier(RenderBlocks.java:5926) 2013-06-24 11:07:40 [iNFO] [sTDERR] at net.minecraft.client.renderer.RenderBlocks.renderStandardBlock(RenderBlocks.java:4163) 2013-06-24 11:07:40 [iNFO] [sTDERR] at net.minecraft.client.renderer.RenderBlocks.renderBlockByRenderType(RenderBlocks.java:445) 2013-06-24 11:07:40 [iNFO] [sTDERR] at net.minecraft.client.renderer.WorldRenderer.updateRenderer(WorldRenderer.java:226) 2013-06-24 11:07:40 [iNFO] [sTDERR] at net.minecraft.client.renderer.RenderGlobal.updateRenderers(RenderGlobal.java:1535) 2013-06-24 11:07:40 [iNFO] [sTDERR] at net.minecraft.client.renderer.EntityRenderer.renderWorld(EntityRenderer.java:1119) 2013-06-24 11:07:40 [iNFO] [sTDERR] at net.minecraft.client.renderer.EntityRenderer.updateCameraAndRender(EntityRenderer.java:991) 2013-06-24 11:07:40 [iNFO] [sTDERR] at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:871) 2013-06-24 11:07:40 [iNFO] [sTDERR] at net.minecraft.client.Minecraft.run(Minecraft.java:760)
-
Well, now I can't I have a crash report, of not be able from this block to cast to BlockFire, and I " DO NOT " want to extend BlockFire because I don't want players to get hurt from it.
-
Example Code [You won't learn anything if you copy paste o_O]
1 -
Place the code in (onItemRightClick)
if (par1Player.isSneaking) { //call method to plant } if (!(par1Player.isSneaking)) { //eat the item }
2 -
//calling a method when u eat the item. //maybe creating a potioneffect, and when it goes to 00:00, or player.getActivePotionEffect() <-- most effective way, then go to startTimer() public void startTimer(EntityPlayer player, World par1World) { if (player.getActivePotionEffect() != null) { //do a loop, or something until the player's potion effect == null //then: par1World.createExplosion(player.posX, player.posY, player.posZ); } }
-
Trying to create a new Fire Block, that does no damage when a player walks into it.
Loaded up the game, the item looks good in my hands, but when I place it down, it appears as an invisible block, it does not render in-game.
Help?
[blockFakeFire]
package liquidblocks.client; import java.util.Random; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; public class BlockFakeFire extends Block { private boolean smoke; protected BlockFakeFire(int i, int j, boolean flag) { super(i, Material.fire); setTickRandomly(true); smoke = flag; } /** * Is this block (a) opaque and (b) a full 1m cube? This determines whether or not to render the shared face of two * adjacent blocks and also whether the player can attach torches, redstone wire, etc to this block. */ public boolean isOpaqueCube() { return false; } /** * Returns which pass should this block be rendered on. 0 for solids and 1 for alpha */ public int getRenderBlockPass() { return 1; } public void registerIcons(IconRegister iconRegister) { blockIcon = iconRegister.registerIcon("liquidblocks:fakefire"); } /** * If this block doesn't render as an ordinary block it will return False (examples: signs, buttons, stairs, etc) */ public boolean renderAsNormalBlock() { return false; } /** * The type of render function that is called for this block */ public int getRenderType() { return 180; } /** * Returns whether this block is collideable based on the arguments passed in Args: blockMetaData, unknownFlag */ public boolean canCollideCheck(int i, boolean flag) { return true; } /** * Returns Returns true if the given side of this block type should be rendered (if it's solid or not), if the * adjacent block is at the given coordinates. Args: blockAccess, x, y, z, side */ public boolean isBlockSolid(IBlockAccess iblockaccess, int i, int j, int k, int l) { return true; } /** * How many world ticks before ticking */ public int tickRate() { return 30; } /** * A randomly called display update to be able to add particles or other items for display */ public void randomDisplayTick(World world, int i, int j, int k, Random random) { if (random.nextInt(24) == 0) { world.playSoundEffect((float)i + 0.5F, (float)j + 0.5F, (float)k + 0.5F, "fire.fire", 1.0F + random.nextFloat(), random.nextFloat() * 0.7F + 0.3F); } if (smoke) { for (int l = 0; l < 5; l++) { float f = (float)i + random.nextFloat(); float f1 = (float)j + random.nextFloat(); float f2 = (float)k + random.nextFloat(); world.spawnParticle("largesmoke", f, f1, f2, 0.0D, 0.0D, 0.0D); } } } }
Main Class - Part of it
Block block3 = (new BlockFakeFire(fireID, 31, false)).setCreativeTab(CreativeTabs.tabBlock).setUnlocalizedName("fakefire").setLightValue(1.0F); GameRegistry.registerBlock(block3, "FireWall"); LanguageRegistry.addName(block3, "Fire Wall");
-
On your @SidedProxy
it is declared that it can't find the class named Client.class, which you have named ClientProxy.class.
Easy fix: V V V V V V V FIX RIGHT THERE
@SidedProxy(clientSide="SoldierW518.Soldiers_Mod.ClientProxy", serverSide="SoldierW518.Soldiers_Mod.CommonProxy") public static CommonProxy proxy;
Old Code:
@SidedProxy(clientSide="SoldierW518.Soldiers_Mod.Client", serverSide="SoldierW518.Soldiers_Mod.CommonProxy") public static CommonProxy proxy;
New Code:
@SidedProxy(clientSide="SoldierW518.Soldiers_Mod.ClientProxy", serverSide="SoldierW518.Soldiers_Mod.CommonProxy") public static CommonProxy proxy;
-
I usually don't use "ModLoader.openGUI()"
I use this and it works fine:
[This is included in your "BlockInfusionTable."
mc.displayGuiScreen(new GuiInfusionTable(player, world, x, y, z));
-
Do you have a Client or Common Proxy?
You need to register your CraftingHandler.
If you don't have a Client/Common Proxy, go here.
Outdated, but working:
Add an @Init in your ClientProxy.
Then put this in:
MinecraftForge.EVENT_BUS.register(new ModCraftingHandler());
-
You are seriously mentally retarded.
No offense.
Learn java.
The vanilla WorldGenMinable only makes ores spawn when the dimension uses the vanilla: "Stone"
You need to create a new GenMinable if you want the ores to spawn in a custom: "Stone"
-
Since I'm nice I'm going to make this the EASY way.
package your.package; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.passive.EntitySquid; import net.minecraft.item.Item; import net.minecraftforge.event.ForgeSubscribe; import net.minecraftforge.event.entity.living.LivingDropsEvent; public class Event_LivingDrops { public static double rand; @ForgeSubscribe public void onEntityDrop(LivingDropsEvent event) { if (event.source.getDamageType().equals("player")) { //Checks for Damage Type. rand = Math.random(); //Initializes double "rand" System.out.println("Killed something."); if (event.entityLiving instanceof EntitySheep) { //Checks the entity killed. System.out.println("Killed a sheep."); if (rand < 1D) { //Makes drop 100% drop chance. Example: (0.25D = 25%, 1D = 100%, etc.); event.entityLiving.dropItem(Item.bone.itemID); //Use "itemID" not "shiftedIndex" //itemID is used for MCP, shiftedIndex is only used when already converted to .class. } } } } }
Also, remember to put this in your Proxy class.
You need to register this class for Forge to be able to know it is an event.
Put it in the @Init of your proxy.
MinecraftForge.EVENT_BUS.register(new Event_LivingDrops());
This should work! Read the "//"s for information.
Good Luck!
-
Remove the Vanilla GuiInventory, with something else?
Or change the keybinds?
-
What does the error say?
-
Pusedo Code:
public void populate(IChunkProvider ichunkprovider, int i, int j) { BlockSand.fallInstantly = true; int k = i * 16; int l = j * 16; random.setSeed(worldObj.getSeed()); long l1 = (random.nextLong() / 2L) * 2L + 1L; long l2 = (random.nextLong() / 2L) * 2L + 1L; random.setSeed((long)i * l1 + (long)j * l2 ^ worldObj.getSeed()); double d = 0.25D; if(random.nextInt(32) == 0) { int i1 = k + random.nextInt(16); int j5 = random.nextInt(64) + 32; int j10 = l + random.nextInt(16); (new OreGenMinable(YOURMOD.ore.blockID, //amt in each vein)).generate(worldObj, random, i1, j5, j10); }
Create new class named OreGenMinable. Put this in:
package tut; import java.util.Random; import net.minecraft.util.MathHelper; import net.minecraft.world.World; import net.minecraft.world.gen.feature.WorldGenerator; public class OreGenMinable extends WorldGenerator { private int minableBlockID; private int numberOfBlocks; public OreGenMinable(int i, int j) { minableBlockID = i; numberOfBlocks = j; } public boolean generate(World world, Random random, int i, int j, int k) { float f = random.nextFloat() * 3.151593F; double d = (float)(i + + (MathHelper.sin(f) * (float)numberOfBlocks) / 8F; double d1 = (float)(i + - (MathHelper.sin(f) * (float)numberOfBlocks) / 8F; double d2 = (float)(k + + (MathHelper.cos(f) * (float)numberOfBlocks) / 8F; double d3 = (float)(k + - (MathHelper.cos(f) * (float)numberOfBlocks) / 8F; double d4 = j + random.nextInt(3) + 2; double d5 = j + random.nextInt(3) + 2; for(int l = 0; l <= numberOfBlocks; l++) { double d6 = d + ((d1 - d) * (double)l) / (double)numberOfBlocks; double d7 = d4 + ((d5 - d4) * (double)l) / (double)numberOfBlocks; double d8 = d2 + ((d3 - d2) * (double)l) / (double)numberOfBlocks; double d9 = (random.nextDouble() * (double)numberOfBlocks) / 16D; double d10 = (double)(MathHelper.sin(((float)l * 3.141593F) / (float)numberOfBlocks) + 1.0F) * d9 + 1.0D; double d11 = (double)(MathHelper.sin(((float)l * 3.141593F) / (float)numberOfBlocks) + 1.0F) * d9 + 1.0D; int i1 = MathHelper.floor_double(d6 - d10 / 2D); int j1 = MathHelper.floor_double(d7 - d11 / 2D); int k1 = MathHelper.floor_double(d8 - d10 / 2D); int l1 = MathHelper.floor_double(d6 + d10 / 2D); int i2 = MathHelper.floor_double(d7 + d11 / 2D); int j2 = MathHelper.floor_double(d8 + d10 / 2D); for(int k2 = i1; k2 <= l1; k2++) { double d12 = (((double)k2 + 0.5D) - d6) / (d10 / 2D); if(d12 * d12 >= 1.0D) { continue; } for(int l2 = j1; l2 <= i2; l2++) { double d13 = (((double)l2 + 0.5D) - d7) / (d11 / 2D); if(d12 * d12 + d13 * d13 >= 1.0D) { continue; } for(int i3 = k1; i3 <= j2; i3++) { double d14 = (((double)i3 + 0.5D) - d8) / (d10 / 2D); if(d12 * d12 + d13 * d13 + d14 * d14 < 1.0D && world.getBlockId(k2, l2, i3) == YOURMOD.STONE.blockID && world.getBlockMetadata(k2, l2, i3) <= 1) //Put your dimension's basic material (stone) { world.setBlock(k2, l2, i3, minableBlockID); } } } } } return true; } }
-
To add a float in a custom configuration file you need to do this:
//Using f1 as the float name. float f1 = Float.parseFloat(config.get(Configuration.CATEGORY_GENERAL, "changetoanything", ""+3.14F).getValue()); //This basically adds 3.14 to the thing you enter.
-
Ok, I tried GL11. Didn't work, sadly.
-
When creating your new armor, for example.
public static Item newArmor;
@Init
public void init(FMLInitalizationEvent event)
{
newArmor = (new ItemArmor(//stuff)).getArmorTexture("armor_1")//etc.
}
[1.6.4]Subscript in item name
in Modder Support
Posted
If you mean Minecraft subtext then continue reading, if not this is for others who need help lolz (complete waste of time ikr)
I believe as in subscript you mean the text under the item name.
Going to upload image on imgur because forums glitchy for me [ http://i.imgur.com/6wjgfxG.png ]
Code for that (make sure you extend Item, ItemSword, or whatever just a class that can take Item's method of addInformation.
TL;DR: code v v v
Just telling you this so no more questions (colors):
Add \u00a7 plus the Color Code found here: [ http://minecraft.gamepedia.com/Formatting_codes ]
An example for the color 'DARK RED' would be:
Reason to use \u00a7 is that you can not decompile § without errors.
Colors TL;DR: \u00a7 = §