Everything posted by TheSparkst3r
-
Why can't i smelt my own Ore ?
You still shouldn't be putting it in the constructor.
-
[1.7.2] Persist TileEntity data when Block is broken
Yeah, that'd work. But you'll also need to make sure the normal drop is disabled or you'll have 2 items dropping. You'll also need to create an entityitem in the breakBlock method and spawn that in the world manually for your drop.
-
[1.7.2] Persist TileEntity data when Block is broken
Hmm, I was afraid of that. TE uses a tool to dismantle the blocks safely by purposely calling the methods to break the block and saving the tile data in the correct order. You'll have to look around for a method in your block that calls before the tile is deleted so long as you have access to the world and coordinates and able to return the stack to drop.
-
[1.7.2]Adding slots to container after creation and sync
It doesn't at all need to be separate, it just ended up that way. And that's what I'm doing currently(see the container constructor) what I need is for the slots to be added WHILE the gui is open to make it look like its being upgraded. But I probably can merge the inventories it would be far easier to deal with shift clicking that way too.
-
[1.7.2] Persist TileEntity data when Block is broken
You'll need to use the ItemStack's NBTTagCompound. In your Block's getDrops method you should get the TileEntity. TileYours being your TileEntity TileYours tile = (TileYours)world.getTileEntity(x, y, z) You should probably also perform a check on the tile to ensure it is instanceof TileYours Then you need to get the value from the tile. You need to create the getPlayerName method in your tile entity class and insert it into a new stack's nbttag @Override public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int metadata, int fortune) { ArrayList<ItemStack> items = new ArrayList<ItemStack>(); TileEntity t = world.getTileEntity(x, y, z); if (t instanceof TileYours) { TileYours tile = (TileYours)t; String name = tile.getPlayerName(); ItemStack stack = new ItemStack(world.getBlock(x, y, z), 1, metadata); if (!stack.hasTagCompound()) { stack.setTagCompound(new NBTTagCompound()); } stack.getTagCompound().setString("playerName", name); items.add(stack); } return items; } And in your onBlockPlaced you will need do the opposite and set the name in the tileentity
-
Why can't i smelt my own Ore ?
The smelting code is wrong. You need to define if it's a block or not by going to the end of the block your smelting and put .blockID . For 1.6 you do, but this is 1.7, you don't need to do that anymore. You now only need to pass in the Item or block to the method and the appropriate method is inferred
-
Why can't i smelt my own Ore ?
Smelting needs to go after the registration of the blocks/items! And inside load events. You really need to learn Java and thoroughly read beginner tutorials, it's worth doing. I havent checked the syntax, so you may need to import some things if they aren't already. But this is how your main class should look roughly
-
[Solved]Spawning an Item entity in world with NBTdata and information added
Can you add an extra parameter to your entity? You could probably do it so world.spawnEntityInWorld(new EntityKanokaTeleportation(world, entityPlayer, stack.getTagCompound())); If you are calling it in the use item method in Item and have access to the ItemStack And then set a variable in your entity to the tagcompound, then when it lands. After you've created the item stack you can do discDrop.setTagCompound(this.thetagcompound) So your entity would now look like this
-
[1.7.2]Adding slots to container after creation and sync
This has been bugging me for a while and I have absolutely no clue how to do it, so a detailed description of how to do this would be awesome! I have a backpack Each of those 4 3x3 grids are seperate IInventories and are added by upgrading with a pouch item. To upgrade it, you click the grid to add slots to with a "storage" item which is non removable. The grids dont exist if it hasnt been upgraded, however, they are also tripped(A value set in the container to keep all grids) so they stay there while im debugging. I have an invisible button over those areas which when clicked sends a packet, I don't know what to put in this packet to tell it that it needs to add slots though. I also need to be able to add these slots after the container has been initialised and sync them with the client. I have tried calling a method in the container from the packet to add the slots but the slots don't exist on the client and end up getting IOOBoundsExceptions when hovering over where they "should" be. So I imagine this is a sync issue. Thanks for any help in advance This is my code: GUI Container Packet
-
[1.7.2] How to store wiki type info about a block
I presume this is loading from the root dir of the server, is there a way to do the same from a resource pack? But as a last ditch attempt this might be a great solution. Thanks EDIT: I've just realised "ResourceLocation" exists. That might be a solution with a BufferedReader to get the content. Need to look at MC's .json to NBT parser too.
-
[1.6.4] Exchanger recipes
How does it consume the exchanger item? Is this exchange performed via a GUI? Would you provide your current source code please.
-
[1.7.2] How to store wiki type info about a block
I am currently working on a mod which provides information about blocks as a companion mod to WAILA and NEI. It's currently part of another mod but I wish to split it into its own mod. I have all the functionality worked out but I am stuck for a method of storing the info. To test the functionality I've just made classes with the info as variables and pull the classes into a hashmap with the unlocalised name of the stack(passed when info is requested) as the key. Rough specification: -Language support -Non dependant/obtrusive; doesn't complain if a file doesn't exist. I don't want console spam like if textures aren't available. -Modular; a user can add a pack and have it detect and use it. Ties into last point. An example file structure might be: "pack-root"/ assets/ info/ "lang"/ "mod"/ items/ blocks/ The logical choice would be resource packs. And to use .json files for storing the information. I have no idea how load them, though. How should I go about doing this?
-
Server proxy error
Same for me. It's happened to me just now I had updated to 1.5.1 and hadn't run the server yet(Client runs fine) But when i needed to test the server side ticks. This happened! Although this was working correctly in 1.5 and and the files havn't been moved or changed. Im assuming something must have changed 1.5 > 1.5.1 And diesieben my commonproxy exists too. And it worked in 1.5. And the files havn't moved. Sooo, odd. Imma redownload mcp and forge again and see if I had gotten a naff build before. EDIT: The decompiling feature in MCP takes SOOOO long
-
Spawn item on the ground
A better solution public boolean onItemUse(ItemStack item, EntityPlayer player, World world, int x, int y, int z, int par7, float xFloat, float yFloat, float zFloat) { //Can the player alter this block? if (!player.canPlayerEdit(x, y, z, par7, item)) { return false; } //Was the block clicked on a dirt block? if(world.getBlockId(x, y, z) == Block.blockDirt.blockID){ world.spawnEntityInWorld(new EntityItem(world, x, y, z, new ItemStack(Blah item here))); return true; } return false; } This goes in your item class
-
Spawn item on the ground
world.spawnEntityInWorld(new EntityItem(world, x, y, z, new ItemStack(Blah item here))); Should do what you want
-
ISimpleBlockRenderingHandler issue
I require a block to use both render passes. This is for an ore which i need the have two "layers" One being a stone background with the outline of the ore parts another being a semi transparent layer with the ore parts on. My problem is that renderWorldBlock isnt being run therefore my block isnt rendering although renderInventoryBlock does run. I've tested this by putting in test outputs and only renderInventoryBlock seems to run. Here is my code for the oreRenderer package mods.anotherWorld.common.dimension.tyteonblocks.render; import mods.anotherWorld.client.ClientProxy; import mods.anotherWorld.common.Base.GlobalIDs; import net.minecraft.block.Block; import net.minecraft.client.renderer.RenderBlocks; import net.minecraft.client.renderer.Tessellator; import net.minecraft.world.IBlockAccess; import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler; import cpw.mods.fml.common.FMLLog; public class BlockSaltOreRenderer implements ISimpleBlockRenderingHandler { @Override public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) { FMLLog.warning("Inventory"); } @Override public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) { FMLLog.warning("World"); return true; } @Override public boolean shouldRender3DInInventory() { return false; } @Override public int getRenderId() { return GlobalIDs.SaltOreRenderID; } } So im pretty stumped really. Anyone got any ideas why renderWorldBlock isn't running?
-
[1.4] I have Problems with redstone.
//Does your the block emit power? public boolean canProvidePower() { return true; } //Does this block provide strong(Direct power) public int isProvidingStrongPower(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5) { //Some check to determine if the block should emit any power and returns a boolean value. Example name = isPowering return isPowering; } Weak power will be handled according with normal propagation rules AFAIK I haven't tested this so I'm not sure it works but I just had a read of restone torch class to see what that does. This is very basic, if you don't understand this please go learn Java and read and understand as much of the MC source code as you can. It really helps. For example go and look at how other similar functioning blocks work.
-
New modder, how do I update to 1.5.1
When forge has installed itself it creates a minecraft folder in the mcp/src directory. put all your files in there. Then in eclipse, right click on the minecraft project and press refresh. That should look for all the files in the src folder and show them in eclipse. If you need help updating your mod to 1.5.1 you can PM me and ill try my best to help you
-
Help!?! - Black Screen after install of latest forge
Wrong forum! Go to the forge help forum this is for modding with forge. Well Ill answer your question though. You're trying to install forge on the wrong MC version. Also for crash logs use http://paste.minecraftforge.net/ to paste huge text. I found this quote from Eloraam I thought it was quite funny and fitting “I installed RPForge XXX.XXX on Minecraft Y.Z.A, and it crashes.” Well, yes. I wish I could make it so that running the wrong version would unlock a special mode where magical fairies sprinkle fairy dust on you twice every hour, but that’s just not the world we live in.
-
how do i render custom block models?
Go look at my mod. I have custom block models in it which is what you want. https://github.com/Sparkst3r/Another-World Look at the onLoad class here https://github.com/Sparkst3r/Another-World/blob/master/mods/anotherWorld/common/Base/onLoad.java Look at https://github.com/Sparkst3r/Another-World/blob/master/mods/anotherWorld/common/dimension/tyteonblocks/BlockSpaceCactus.java Look at all the files in here. https://github.com/Sparkst3r/Another-World/tree/master/mods/anotherWorld/common/dimension/tyteonblocks/render This is the base for everything you want. DO NOT STRAIGHT UP COPY THIS. You are allowed to, but I'd much prefer you read the code and understand how it works and implement your own way. Also it's pretty inneficiant. I really need to clean out all the unneccissary stuff
-
[Solved] How to render Custom particles on MC 1.5??
Thanks DrZhark. That helped me fix my particles for 1.5 Although I'm having another problem with this. When ever I spawn my particle in the world. Every other particle in the world doesnt render, they are either invisible or just not rendering altogether. I've fixed my problem with having every particle in the world turning into my plasma particle, but fixing that caused this. I also get no error when this occurs. My ClientProxy public class ClientProxy extends CommonProxy{ @SidedProxy(clientSide = "mods.anotherWorld.client.ClientProxy", serverSide = "mods.anotherWorld.common.CommonProxy") public static ClientProxy proxy; /** * Spawns a Plasma particle * @param world The world to spawn the particle in * @param x X location to spawn the particle at * @param y Y location to spawn the particle at * @param z Z location to spawn the particle at * @param xVel X velocity to spawn the particle with * @param yVel Y velocity to spawn the particle with * @param zVel Z velocity to spawn the particle with * @param colour RGB colour to spawn the particle as */ @SideOnly(Side.CLIENT) public void spawnPlasma(World world, double x, double y, double z, double xVel, double yVel, double zVel, float[] colour) { EntityFXPlasma fx = new EntityFXPlasma(Minecraft.getMinecraft().theWorld, x, y, z, xVel, yVel, zVel, colour); FMLClientHandler.instance().getClient().effectRenderer.addEffect((EntityFX)fx); } } My spawning code. The particle velocity is determined by the meta data(Direction) of the block @SideOnly(Side.CLIENT) @Override public void randomDisplayTick(World world, int x, int y, int z, Random par5Random) { for (int i = 0; i < 100; i++) { double xStart = 0; double yStart = 0; double zStart = 0; float red = 0F; float green = (float) (0.1 + (Math.random() * 0.3)); float blue = (float) (0.1 + (Math.random() * 0.9)); float[] colour = {red, green, blue}; double xVel = 0.0D; double zVel = 0.0D; if (world.getBlockMetadata(x, y, z) == 1) { xVel = 0.0D; zVel = -0.5D; xStart = (x + 0.1) + (Math.random() * 0.9); yStart = (y + 0.1) + (Math.random() * 0.9); zStart = (z + 0.1) + (Math.random() * -6); } if (world.getBlockMetadata(x, y, z) == 2) { xVel = 0.5D; zVel = 0.0D; xStart = (x + 0.1) + (Math.random() * 6); yStart = (y + 0.1) + (Math.random() * 0.9); zStart = (z + 0.1) + (Math.random() * 0.9); } if (world.getBlockMetadata(x, y, z) == 3) { xVel = 0.0D; zVel = 0.5D; xStart = (x + 0.1) + (Math.random() * 0.9); yStart = (y + 0.1) + (Math.random() * 0.9); zStart = (z + 0.1) + (Math.random() * 6); } if (world.getBlockMetadata(x, y, z) == 4) { xVel = -0.5D; zVel = 0.0D; xStart = (x + 0.1) + (Math.random() * -6); yStart = (y + 0.1) + (Math.random() * 0.9); zStart = (z + 0.1) + (Math.random() * 0.9); } AnotherWorld.proxyClient.spawnPlasma(FMLClientHandler.instance().getClient().theWorld, xStart, yStart, zStart, xVel, 0.0D, zVel, colour); } } And using DrZhark's renderParticle method above with the path changed to my 16x16 particle texture
-
ChunkProvider explain...
I'd like some info on this for my mod(Also adds a dimension) too
-
getRenderType() for blocks?
It should return the render ID of a custom renderer for a block so this is the code I use in my liquid renderer. @Override public int getRenderType() { return BasicBlocks.TriCSRenderID; }
-
Thermal Expansion API Help
After looking around the API i found a method that printed out all the items registered in the registry. And it contained some of the basic blocks and items but hardened glass wasn't there so I'm guessing i was requesting a non existent block and that caused the NPE Also if you want to look at my mod, it's on Github. I'm pretty new to modding, so my ways around doing things aren't exactly elegant. I would imagine Lex would cringe at my code if he saw it! Please poke me with a stick if I've made a stupid mistake too! https://github.com/Sparkst3r/Another-World Plus I'm only 14 and haven't had much experience yet! Anyway thanks for your help
-
Thermal Expansion API Help
I am trying to make a recipe with TE hardened Glass And I've tried this private void addCrafting() { if (ModsExist.teExists) { ItemStack glass = ItemRegistry.getItem("ItemBlockHardenedGlass", 1); ItemStack dye = new ItemStack(Item.dyePowder, 1, 1); ItemStack sil = new ItemStack(BasicItems.SiliconChip); GameRegistry.addRecipe(new ItemStack(this, 4), new Object[]{ " G ", " D ", " S ", 'G', glass, 'D', dye, 'S', sil }); } And the ItemRegistry.getItem() in the TE API private static final Map<String, ItemStack> registry = new TreeMap<String, ItemStack>(); /** * Returns an ItemStack containing the item that corresponds to the provided name. * * @param name * Name of the item. * @param qty * Requested quantity of the item. */ public static ItemStack getItem(String name, int qty) { ItemStack result = registry.get(name); if (result != null) { result = result.copy(); result.stackSize = qty; } return result; } As far as i know ItemRegistry.getItem(); Takes a string as a name of an item which I think is "ItemBlockHardenedGlass" and an integer for item count and create a new ItemStack of HardenedGlass, that i can use in the crafting recipe. But instead i get an NPE java.lang.NullPointerException at net.minecraft.item.crafting.CraftingManager.addRecipe(CraftingManager.java:200) at cpw.mods.fml.common.registry.GameRegistry.addShapedRecipe(GameRegistry.java:259) at cpw.mods.fml.common.registry.GameRegistry.addRecipe(GameRegistry.java:254) at anotherWorld.common.basicItems.ItemRedLED.addCrafting(ItemRedLED.java:32) at anotherWorld.common.basicItems.ItemRedLED.<init>(ItemRedLED.java:18) at anotherWorld.common.basicItems.BasicItems.addItems(BasicItems.java:23) at anotherWorld.common.onLoad.onLoading(onLoad.java:11) at anotherWorld.common.AnotherWorld.load(AnotherWorld.java:53) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at cpw.mods.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:487) at sun.reflect.GeneratedMethodAccessor3.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:69) at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:45) at com.google.common.eventbus.EventBus.dispatch(EventBus.java:317) at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:300) at com.google.common.eventbus.EventBus.post(EventBus.java:268) at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:153) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:69) at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:45) at com.google.common.eventbus.EventBus.dispatch(EventBus.java:317) at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:300) at com.google.common.eventbus.EventBus.post(EventBus.java:268) at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:86) at cpw.mods.fml.common.Loader.initializeMods(Loader.java:676) at cpw.mods.fml.client.FMLClientHandler.finishMinecraftLoading(FMLClientHandler.java:207) at net.minecraft.client.Minecraft.startGame(Minecraft.java:456) at net.minecraft.client.MinecraftAppletImpl.startGame(MinecraftAppletImpl.java:44) at net.minecraft.client.Minecraft.run(Minecraft.java:744) at java.lang.Thread.run(Unknown Source) And I'm sure that my mod loads after TE so it shouldn't be that it cant find the method, my only ideas is that that isnt the name of the block. But there is no listing of the blocks, or im using completely the wrong method to do what I want. Also if i substitute the hardened glass for say an arrow or an item from my mod. It works fine So i dont know Anyway if you know what im doing wrong, please tell me!
IPS spam blocked by CleanTalk.