Jump to content

knokko

Members
  • Posts

    255
  • Joined

  • Last visited

Everything posted by knokko

  1. You can put blocks in ItemStacks too. Just use Item.getItemFromBlock() and Block.getBlockFromItem
  2. hello guys, I am trying to make a custom dimension. But the dimension generates exactly like the nether whatever I do. I have been 1 time in my "real" dimension. I have changed my code back to that but I can't really reach it anymore. Here are my codes: @EventHandler public void init(FMLInitializationEvent event){ RPGEvents.registerEvents(); RPGentities.registerEntities(); RPGTileEntities.registerTileEntities(); RecipeHandler.load(); proxy.registerRenderThings(); proxy.registerKeyBindings(); GameRegistry.registerWorldGenerator(new RPGGenerator(), 1); dimensionId = DimensionManager.getNextFreeDimId(); DimensionManager.registerProviderType(dimensionId, Generator.class, true); DimensionManager.registerDimension(dimensionId, dimensionId); } public class Generator extends WorldProvider { @Override public String getDimensionName() { return "Dark World"; } public int getAverageGroundLevel(){ return 10; } public boolean canRespawnHere(){ return true; } public IChunkProvider createChunkGenerator(){ return new DarkChunkGenerator(worldObj); } } public class DarkChunkGenerator implements IChunkProvider { public World world; public DarkChunkGenerator(World worldObj){ world = worldObj; } @Override public boolean chunkExists(int x, int z) { return false; } @Override public Chunk provideChunk(int x, int z) { Chunk chunk = new Chunk(world, x, z); return chunk; } @Override public Chunk loadChunk(int x, int z) { return null; } @Override public void populate(IChunkProvider provider, int x, int z) { } @Override public boolean saveChunks(boolean b, IProgressUpdate update) { return true; } @Override public boolean unloadQueuedChunks() { return false; } @Override public boolean canSave() { return true; } @Override public String makeString() { return "dark world "; } @Override public List getPossibleCreatures(EnumCreatureType creatureType, int x, int y, int z) { return null; } @Override public ChunkPosition func_147416_a(World world, String string, int x, int y, int z) { return null; } @Override public int getLoadedChunkCount() { return 10; } @Override public void recreateStructures(int x, int z) { } @Override public void saveExtraData() { } } public class RPGGenerator implements IWorldGenerator{ @Override public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider) { int randomX = chunkX * 16 + random.nextInt(16); int randomZ = chunkZ * 16 + random.nextInt(16); int y = BlockFeatures.getHighestBlock(world, randomX, randomZ); int randomizer = random.nextInt(400); if(randomizer == 50 && y >= 0 && world.provider.dimensionId == 0){ RPGBuildings.makeHouse(world, randomX, y, randomZ, randomX + random.nextInt(48) + 16, y + random.nextInt(10) + 10, randomZ + random.nextInt(20) + 10, Blocks.brick_block, Blocks.planks); } if(world.provider.dimensionId == KnokkoRPG.dimensionId){ System.out.println("IWorldGenerator is called!"); world.setBlock(0, 100, 0, Blocks.obsidian); } } } IWorldGenerator is really spamming in the console but doesn't place any obsidian... This is how I travel to my dimension: public class TestItem extends Item { public ItemStack onItemRightClick(ItemStack item, World world, EntityPlayer player){ player.swingItem(); player.travelToDimension(KnokkoRPG.dimensionId); return item; } }
  3. I have never placed mob spawners in java codes. I can only do things like this in the game using /setblock. I hope somebody else knows better how this works.
  4. Than you are destroying the block on the client side, destroy it on the server side.
  5. What is your java version and when do you get this error?
  6. For question 6: world.getWorldInfo().isHardcoreModeEnabled()
  7. if you are using eclipse, you can look in Referenced Libraries, ForgeSrc, net.minecraft.item.crafting for some examples. But I have never done this kind of thing so I can't help you further than this tip.
  8. Is this a vanilla block or a custom block? I don't understand it.
  9. You probably got a big error in your console, show it!
  10. It was an error of me that there was so much data anyway, I am rewriting my worldata, now it is more than 50 times shorter. Now the buffer contents is 150, and the packet arrives without problems. I think I am done.
  11. What is so difficult? You can easily update your fuse in onUpdate();
  12. Ok, I dit what you said. Here is the new message in the console. Buffer contents: 812026 Buffer contents: 812025 The crash reappeared of course. But I don't know the limit and I know almost nothing about bytes, so is this too much? Here is the toString method of the nbt tag I want to send: It wouldn't surprise me if this is just too much data.
  13. For getting the player who died, you can use LivingDeathEvent. this has the entity and his coordinates. Than you only have to remove the old death message using event.setCanceled(true); in ServerChatEvent
  14. hello, I am trying to send a nbt tag from sever to client using packets. But I get a long error at my fromBytes(ByteBuf) method. There is really much data in the nbt tag. Does anybody know why I get this error: Here is the message class: public class NBTMessage implements IMessage{ public NBTTagCompound nbt; @Override public void fromBytes(ByteBuf buf) { nbt = ByteBufUtils.readTag(buf); } @Override public void toBytes(ByteBuf buf) { ByteBufUtils.writeTag(buf, nbt); } public NBTMessage() {} public NBTMessage(NBTTagCompound compound){ nbt = compound; } public static class Handler implements IMessageHandler<NBTMessage, IMessage> { @Override public IMessage onMessage(NBTMessage message, MessageContext ctx) { System.out.println("nbt = " + message.nbt); WorldData.nbt = message.nbt; return null; } } } This is the method I use that sends and receives the packet: public static void updateClient(World world){ if(world != null){ WorldData data = get(world); if(!world.isRemote){ KnokkoRPG.network.sendToAll(new NBTMessage(data.players)); } if(world.isRemote){ data.players = nbt; } } }
  15. Shift + right click the folder where your mod is stored and choose "open command prompt here" or something like that and than use graldew build.
  16. You can make a simple system: left click the block for taking xp. right click the block for storing xp, this is very easy.
  17. Do that in the folder where your mod is.
  18. Make your bullet entities extend EntityThrowable and change the gravityVelocity.
  19. You are spawning your mob on a really strange place, your x coord = special your y coord = xp your z coord = upgrade, Use things like player.posX instead of random numbers like xp.
  20. You could give wires metadata for what direction they send energy, maybe that will make it a lot easier for you and players.
  21. I have found the problem, the rayTrace method in entityLivingBase uses the posX field op EntityPlayer, and this field has a different value on the serverside. I have read rayTrace and used the good parts of it to let my method work. Thank you for the tip.
  22. You can mark every block that sends or receive and so make the best way for the energy. So the energy trys to go to the receiver, than it will nog go back to the sender.
  23. Copying it to an own class is probably a good idea, the error seems to be in rayTrace and not in my own methods. But why haven't it caused a crash on my integrated server?
  24. World has a method called findNearestStructure(), I have never used it but I think this can help you. If you find out what the good String is, you may be able to locate desert temples and replace the chests.
  25. You only need to set a boolean if the block has got energy from the other block, and don't let it send energy if the boolean is true.
×
×
  • Create New...

Important Information

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