Jump to content

KGS

Members
  • Posts

    33
  • Joined

  • Last visited

Converted

  • Gender
    Undisclosed
  • Personal Text
    I am new!

KGS's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. I extend vanilla stairs with my own class. I create a few instances of it. The problem is that the lighting is wrong on nearby blocks. Vanilla stairs: My stairs: As you can see, the light level is completely wrong. public class BaseStairs extends BlockStairs { public BaseStairs(Block block, int someInt) { super(block, someInt); } @Override public boolean isOpaqueCube() { return false; } @Override public boolean renderAsNormalBlock() { return false; } } Someone on the #minecraftforge channel suggested I override getAmbientOcclusionLightLevel and return 0.0f, but that made no difference.
  2. Are you trying to be deliberately unhelpful?
  3. The versions of forge which use gradle include minecraft source as a library rather than as sourcecode. This means it cannot be changed.
  4. Are there tutorials or documentation for IRecipe? I wouldn't really use something as undocumented as the IRecipe unless I really had to, and now I do. I want a recipe that accepts any of my custom types of wood, but the output of the recipe depends on the type of wood put into it (i have several variants). Normally I could make a recipe for each type of wood, but that would not be feasible in the long run for practical reason. I have subtypes of wood, and these must be preserved.
  5. I don't understand what you mean. You can store anything you like in a TileEntity. You write the NBT serialisation code yourself and can put whatever you need into it. TileEntities are specifically designed for exactly what it sounds like you're trying to do. Oh that's interesting. I haven't actually dealt with tile entities yet but now that I think about it's obvious they can store anything, seeing that they store inventory data for containers and such. I will look into using tile entities. Fair enough :-) Actually this is probably pretty easy since you only need to prevent spawning on the server, which is also the place you record your block placements. So the client doesn't need to know about your hash table at all. Yes that's what I was thinking too. My worry was that I would have to do some kind of syncing manually between clients, but I guess minecraft automatically synchs clients with whatever is on the server. The reverse, though, to make sure the server is updated when some local changes are made on clients is when you need to be careful... (?) Yeah. I'm not going to write my own hash tables. THAT would be reinventing the wheel Why haven't you been able to test it? (i.e. what's stopping you?) Well I guess I could run a server locally and test with myself only...
  6. Thanks for the replies people. I think you'll find the real issues are memory and speed. How long does it take to generate a hash ? How long does it take to retrieve a set of values (from the hash table) for a single block ? How many blocks in world ? How much memory total for the number of blocks ? Even if you have a single one of your blocks visible, you need to have the data for all of them in memory. Also where do you plan to store the data itself ? Using a TileEntity is a much simpler method, especially if you need to add extra values for each block. Afaik hashing 4 ints should be trivial. I expect at most 30-40 blocks of special metadata. Maybe 100 in extreme situations. I do not want to use a TileEntity because I might want to store more than just bits. Also the problem in general is interesting. I am aware of using multiple blocks to store metadata. It, however, is not as interesting as what I'm trying to get at here. This also relates to another problem I'm working on for my mod. I have a block that when it is placed in a chunk makes sure that no mobs can spawn in that chunk. It does so by adding a listener to events which checks if a spawned living event is triggered from inside a chunk with this particular block. Blocks are stored in a hash table which is a WorldSavedData using x, y, z, w tuples as keys and integers as values (the integer representing the number of these blocks in a particular chunk). What i want to know is how the server/client aspect might interfere with this. This works fine in single player, but I don't actually know if it works in multiplayer as I have been unable to test it.
  7. I'm planning on implementing some new features into my mod and for that I need more metadata per block. Only about a byte per block but I might end up using more than that for other things later. I figured out a way to do it which some people would probably consider extremely hacky. I'm pretty certain it will work in singleplayer, but I don't know much about the multiplayer aspects of MC modding so I come here to ask the question... Would this work? I have a hash table where the value is an int or byte, and the key is a tuple of 4 elements. Block coordinates x, y, z and dimension id. When I want to insert metadata at some location I create a tuple and put the relevant value at that location in the hash table. When I want to read it I can do the same. I save this hash table using the NBT. Known issues: *If a block using this metadata scheme is destroyed I must remember to erase the metadata (though this is not an important issue as only my own blocks will read from here) *If a block is placed in some other dimension such as one created by another mod like Dimensional Doors, then when that dimension is "destroyed" I need to have the hash table erase all entries with data that is keyed to that world. Is there some way to detect when that happens and deal with it easily? *How would this behave in practice in multiplayer? If there are any problems, how would I remedy them?
  8. My custom doors will need to drop items given certain metadata conditions, meaning that I need to implement the getItemDropped method. The problem with that method is that it needs to return an item, and when you create ItemBlocks they have no accesible instance. (you pass the class name to the register method which invokes the constructor internally). Edit: Solved. I found this: Item.getItemFromBlock(KGBlocks.blockArtDecoDoor1)
  9. http://i6.photobucket.com/albums/y207/KGanryuS/2013-12-31_023648_zps0a0d02f3.png~original[/img] This is an aesthetics mod. It features new doors, a particular utility block to be explained further down, and stuff that will be implemented later in development. Fear the darkness no more! With the mobstopper, your darkest and most foreboding castles (or any other constructions, really) will be safe from mobs. What you see is a few of the doors currently implemented in this mod. 4 doors from the Art Deco set, and 2 doors from the Fancy Door set. Note that the door in the middle of the bottom row is not in the mod any longer. It will be reworked. More doors will be added as development proceeds. The block in the foreground is the Mobstopper. Place a mobstopper in a chunk, and mobs will no longer spawn in that chunk. This is useful because of torches. Torches are ugly. Darkness is beautiful. Don't fear the darkness. Embrace it! With the mobstopper! (mobs can still enter chunks with mobstoppers inside them, but they cannot spawn directly within them) Miscellaneous Recipes: Art Deco Door Recipes: Fancy Door Recipes: The mod has been tested but only on my machine and bug reports are welcome (if you find any that is). There is a known rendering issue with the doors facing two particular angles which will be fixed next update (in a week). DOWNLOAD!
  10. Check if the library is still there. Do this by opening the "referenced libraries" folder in eclipse and check if you see a file named something like forgesrc at the top. Another thing you should make sure is that you ran the setupDecompWorkspace command with gradle. This command give you the source included. There's another command that does not give you the source files.
  11. I removed all the set texture code and I made sure only the Block was registered with a creative tab. Still does not show up... I can get normal blocks to show up, and items to show up, but not itemblocks...
  12. I have this block that does not appear in the game (in creative tabs). I will not post all code here, but only that which is relevant... I know some code (texture, most likely) will not work because I'm in the process of porting this from 1.6.4 to 1.7.2 (and these classes are still in development, hence some weird constructor stuff). Any idea what might be wrong? Edit: The block did show up in 1.6.4 before I made some change to support 1.7.2. This is the Item which extends a base item. public class ItemDoorArtDeco1 extends ItemBaseDoor { public ItemDoorArtDeco1(Block block) { super("kgblocks:itemartdecodoor1", block); } } This is the parent item. I will only paste constructor. public class ItemBaseDoor extends ItemBlock { public ItemBaseDoor(String textureName, Block blk) { super(blk); this.maxStackSize = 1; setTextureName(textureName); setCreativeTab(CreativeTabs.tabMisc); this.block = blk; } This is the relevant block. public class BlockArtDecoDoor1 extends BaseDoor { public BlockArtDecoDoor1() { super("kgblocks:blockartdecodoor1"); } } This is the parent block. Again I will ommit all non-constructor code. public abstract class BaseDoor extends Block { public BaseDoor(String textureName) { super(Material.wood); setBlockTextureName(textureName); setHardness(0.5F); float f = 0.5F; float f1 = 1.0F; setBlockBounds(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, f1, 0.5F + f); } Now this code below is from the main mod class. I create the block and pass it to a method called registerBlockWithItemBlock. blockArtDecoDoor1 = new BlockArtDecoDoor1(); registerBlockWithItemBlock(blockArtDecoDoor1, ItemDoorArtDeco1.class, "blockArtDecoDoor"); And here's the method in question: public void registerBlockWithItemBlock(Block block, Class<? extends ItemBlock> itemclass, String name){ block.setBlockName(name); GameRegistry.registerBlock(block, itemclass, name); }
  13. I'm porting a mod to 1.7.2 from 1.6.4. There's some odd problems with the NBT, though. For some reason it seems to fail to read from it properly. I have a class called a Tracker which extends WorldSavedEvent. It contains a hash table that is read and saved to the NBT. Certain things in the game modify the hash table and it is supposed to be persistent between game sessions, but it isn't. The readFromNBT is executed, but does not actually reach the for loop. @Override public void readFromNBT(NBTTagCompound nbt) { NBTTagList tagList = nbt.getTagList("tracker", Constants.NBT.TAG_INT_ARRAY); // Read arrays from tag list and use the arrays as positions to insert blocks into table for (int i = 0; i < tagList.tagCount(); i++) { NBTTagCompound tag = (NBTTagCompound)tagList.getCompoundTagAt(i); int[] arr = tag.getIntArray("position"); addBlock(arr[0], arr[1], arr[2], arr[3]); System.out.println("Reading Block at index: " + i + " - " + arr[0] + " " + arr[1] + " " + arr[2] + " " + arr[3]); } } @Override public void writeToNBT(NBTTagCompound nbt) { NBTTagList itemList = new NBTTagList(); int counter = 0; Set cl = chunk.keySet(); Iterator<ChunkLocation> it = cl.iterator(); while (it.hasNext()){ ChunkLocation temp = it.next(); for (Position p : chunk.get(temp)){ counter ++; NBTTagCompound tag = new NBTTagCompound(); int[] arr = {p.getX(), p.getY(), p.getZ(), p.getW()}; tag.setIntArray("position", arr); itemList.appendTag(tag); } } nbt.setTag("tracker", itemList); KGBlocks.textOut("Blocks saved to NBT: " + counter); } I added Constants.NBT.TAG_INT_ARRAY to the following line. Not sure if this was correct: NBTTagList tagList = nbt.getTagList("tracker", Constants.NBT.TAG_INT_ARRAY); I also replaced tagAt with getCompoundTagAt. Not sure about that either, but tagAt was not available.
  14. So I've attempted to follow at least three different tutorials. I follow them to the letter and I get the same errors every time. Edit: NEVERMIND WHAT WAS HERE BEFORE. I have now solved that previous issue... It was quite stupid :I However, i still get this error message "Project 'Minecraft' is missing required library: 'C:\MinecraftModding\ForgeN\unresolved dependency - forgeSrc 1.7.2-10.12.0.1024'"
  15. Edit: The bug is fixed. Now I have another problem. Previously my doors had an Item an a Block. The Block had a texture consisting of two pieces and the item had another texture that was flat projected like vanilla doors. However, now that I changed the Item to an ItemBlock, it now uses the lower Block texture. This is not right at all! I even pass the ItemBlock the texture it SHOULD use, but it seems to override it.
×
×
  • Create New...

Important Information

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