Jump to content

mnn

Members
  • Posts

    298
  • Joined

  • Last visited

Everything posted by mnn

  1. I'd use the onUpdate method, test player for creative mode and mark it so it won't be called again. Not tested, but it could look like this: if(!stack.hasTagCompound()){ stack.setTagCompound(new NBTTagCompound()); if(player.capabilities.isCreativeMode){ // do stuff when cheated } }
  2. there's quite large topic about custom packets - http://www.minecraftforge.net/wiki/Packet_Handling
  3. looks really nice (I was thinking about implementing it too, now I'll have more time for my "main" mod ). EDIT: the download service is a bit unpleasant - the need to register just to download one little file? If I were you I'd reconsider it...
  4. if (player.getCurrentEquippedItem().getItemName().equals("item.My Block")) it's not best practice to use strings to identify items, use IDs. if (par1World.isRemote) { if (mymod.ReplaceBlock) { par1World.setBlockWithNotify(par2, par3, par4, mymod.myblockID); mymod.ReplaceBlock = false; } } so, your block-replacing code is supposed to run only on client? also take a look at mymod.ReplaceBlock if it does really what you wanted. if it's only set here then it means that only once after mod initialization (if its default value is true) one block changes ~ only 1 block after launching minecraft will be affected.
  5. http://www.minecraftforge.net/forum/index.php/topic,5968.0.html I don't know why the topic has been locked - the problem hasn't been solved there. I got same problem - solution is easy, import the right EventBus . import net.minecraftforge.event.EventBus -> import com.google.common.eventbus.EventBus;
  6. I haven't done any multiblock structure (yet), but I think it could be solved either using metadata or TEs. in both ways the "slaves" would save master's position when being created and then on clicking/interacting they would just "redirect" event to the master (without searching around, actively looking for a maste block). in your case you would just call master's onBlockActivated instead. the code you pasted is strange, how could it ever work? you create new TE and then ask if it's the same as one in the world - it can be never the same. you can do something like this (pseudo code): TAB = table with shifts (like { {1,0,1}, {1,0,0}, ... }) foreach S in TAB do TE = getTE; <- coordinates being calculated from S (the shift of x,y and z) if TE != null and TE.getClass() == TileEntitySuperCalc.class then call it's onBlockActivated with correct parameters end foreach damn it, gcewing was faster
  7. diesieben07 is of course right, you should only force this if you have something important to update like furnace changes texture (~starts/stops wokring). definitely do not sync progress of cooking every tick. vanilla furnace is a great example of the GUI (it's not too hard to implement synchronization of integer variables of TE using same technique). it will only differ from your solution in furnace changin texture - you'll do it with TE's sync packet or by changing metadata, not by replacing a block like the vanilla funace does.
  8. this should work: GameRegistry.addRecipe(new ItemStack(expMelter), " x ", "xxx", "xxx", 'x', woodStack);
  9. you can force it to send an update of the TE. worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); (and no, normally it synchronizes TEs more frequently, not only on a chunk load.)
  10. CovertJaguar answered my question . Here's his solution (I hope he doesn't mind): It works like a charm (if you want to see actual code, it's available here)
  11. playing one note: BlockNote.java, method "onBlockEventReceived". so something like par1World.playSoundEffect((double)par2 + 0.5D, (double)par3 + 0.5D, (double)par4 + 0.5D, "note.harp", 3.0F, var7); where par2-par4 you would use coordinates of a player (posX..posZ). when item is right-clicked method "onItemRightClick" is triggered, there will be probably part of your code. test for shift - "player.isSneaking()". the music playing would be probably handled in tick handler (of a server?), where it would remember how much ticks passed from start of a song and when it's next note's turn it would call playSoundEffect on a position of a saved player (!more players can play a song at the same time!). [basic item creation: http://www.minecraftforge.net/wiki/Basic_Items] you'll need to learn how to create GUI and how to use custom packets to keep it in sync with server: http://www.minecraftforge.net/wiki/Containers_and_GUIs http://www.minecraftforge.net/wiki/Packet_Handling selected song would be probably saved in ItemStack or just in item damage. this text may not be complete/exact, but it should show you a possible way of doing it (I hope ).
  12. and what is does or doesn't? from a quick look at the block class I would say the TE is not being created. maybe: @Override public boolean hasTileEntity(int metadata) { return true; } or even: @Override public void onBlockAdded(World par1World, int par2, int par3, int par4) { super.onBlockAdded(par1World, par2, par3, par4); par1World.setBlockTileEntity(par2, par3, par4, createTileEntity(par1World, par1World.getBlockMetadata(par2, par3, par4))); }
  13. If custom biome is made properly (calls constructor BiomeGenBase(int)), normal mobs should spawn there on its own. If your looking for spawning custom mobs then it's done like this: EntityRegistry.addSpawn(EntityDuck.class, 7, 1, 2, EnumCreatureType.creature, YOUR_BIOME);
  14. I wrote a pm to Vswe (creator of steve carts). Some time passed but unfortunately he hasn't responded . As you wrote I should try asking also CovertJaguar, maybe I'll have better luck with him.
  15. this was happening to me when I forgot to register TE (GameRegistry.registerTileEntity), not sure if it's your case though.
  16. Take a look at Mod annotation (I think it's what you want). example: @Mod(modid = "moen-jaffas-power", name = "Jaffas - power", version = Reference.Version, dependencies = "required-after:moen-jaffas;required-after:moen-monnef-core") @NetworkMod(clientSideRequired = true, serverSideRequired = false) public class mod_jaffas_power { ... EDIT: there is also soft dependency - without the "required" part, e.g.: @Mod(modid = Reference.ModId, name = Reference.ModName, version = Reference.Version, dependencies = "after:Forestry;after:BuildCraft|Energy;after:ExtrabiomesXL")
  17. Hello, I managed to copy and modify original cart to use my renderer. But I'm stuck on minecraft bug (it's not too much visible in-game because original carts are pretty symmetric) - the cart renderer does not "remember" (or use) a direction it's moving, so all south-north rails render cart's direction one way and a second way east-west rails - it renders always one rotation (for 2 moving directions). So when running in a circle, half of the time the cart is actually going backwards... Not sure, if it's understandable so I'm adding a video: Rendering (and a lot of minecart) code uses de-obfuscated but not "translated" names, I'm really lost here... Any ideas? (code is here, but as I wrote I didn't changed it much) EDIT: solution: http://www.minecraftforge.net/forum/index.php/topic,5763.msg31451.html#msg31451
  18. I recently added my first mob, so the code may not be perfect, but it works (= ducks do spawn). I'm not sure if the spawning worked without the global method. private void registerDuck() { EntityRegistry.registerGlobalEntityID(EntityDuck.class, "jaffasDuck", DuckEntityID, ColorHelper.getInt(0, 127, 75), ColorHelper.getInt(200, 200, 255)); EntityRegistry.registerModEntity(EntityDuck.class, "jaffasDuck", DuckEntityID, this, 160, 1, true); LanguageRegistry.instance().addStringLocalization("entity.jaffasDuck.name", "en_US", "Duck"); } private void registerDuckSpawns() { EntityRegistry.addSpawn(EntityDuck.class, 7, 1, 2, EnumCreatureType.creature, taigaHills, jungle, jungleHills); // low EntityRegistry.addSpawn(EntityDuck.class, 10, 1, 3, EnumCreatureType.creature, plains, taiga, forestHills); // med EntityRegistry.addSpawn(EntityDuck.class, 15, 2, 6, EnumCreatureType.creature, swampland, river, beach, forest);// high } Also creatures (passive mobs) do not despawn (and there is a monster cap), so make sure you're trying it on new chunks or in a new world .
  19. Thank you for fast answer. My mod isn't a core one, is there any other way of storing save-specific or dimension-specific data?
  20. I'm looking for a way how to save nbt data to the dimension/player/all worlds? So far I found out that entity has getEntityData, but it cannot be used to save data for a player (after death it disappears). I saw that in changlog it is mentioned (per-dimension), but is there any documentation for forge (not javadoc, I can browse through classes in my IDE, but without knowledge of class/method names it's useless)? Tutorials on forge wiki do not cover much
  21. maybe something like: GameRegistry.registerPlayerTracker(new onPlayerJoin()); also you have to implement whole interface to be able to make an instance of that class (you can't make an instance of an abstract class).
  22. not sure (haven't used it) but have a look at ChunkEvent. also if you'll be replacing all dirt blocks on chunk load it might cause lags.
  23. the map will work, but all mod blocks and items will be removed.
  24. take a look at events: http://www.minecraftforum.net/topic/1419836-forge-4x-events-howto/ http://www.minecraftforge.net/wiki/Event_Reference#LivingAttackEvent some (maybe all) of the questions could be solved by properly reacting to specific events.
  25. that's nice of you to share your working code, me (and probably other noobies) appreciate this behaviour i would suggest reconsidering data representation of direction - string operations are not fastest, also this representation wastes memory and network resources (bigger packets). "USE" ~ 3bytes ~ 256^3 = 16 777 216: it can represent 16 777 216 values (not counting size information of a string instance). but you only uses 16+1 values for directions, you could easily store it in 1 byte (e.g. using enum)
×
×
  • Create New...

Important Information

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