Jump to content

Dijkstra

Forge Modder
  • Posts

    89
  • Joined

  • Last visited

Everything posted by Dijkstra

  1. Well it works, but after the player is in their new spot the can't break anything think it must be syncing cause reloging and dying fixes it Edit: Don't know if it only being on the server side makes a difference
  2. is there a way to set the player's spawn point to the block they are standing on, I thought this would do it but still end up at world spawn when I die player.setSpawnPoint(player.getPosition(), true);
  3. Is there way on some first joins the server to tp them random pos with a given range of chunks from 0,0 like the spread player command i am cruelty thinking is on ent joined world see if its a player and then see if got an nbt tag if it does not have tp and random x and random z cord set their spawn there give them the tag. The only issue is i am sure how to get surface y
  4. hence my start script downloading it if does not exists would this get me any installer or will it just work with 1.11 http://files.minecraftforge.net/maven/net/minecraftforge/forge/${MCVER}-${FORGEVER}/forge-${MCVER}-${FORGEVER}-installer.jar"
  5. was think that there is a pattern to file names and locations then
  6. I working on a server startup script and there be a big upset over curse not allowing pack to have minecraft jar in so now my start script downloads by wget or curl if it not found, was wondering if i could do the same with the forge jar and it libs just for overkill.
  7. First of all, XML is much better than JSON and would much better in my situation And thanks one little thing is all it takes
  8. Unfortunately no i need to a packet of basic config data in form of XML, from the server to the client so that they both have the same settings
  9. Looking up package management, trying to send a string later to be some XML from the server to the player when they join only found 1.10.2/1.9 tutorials, would though it has not changed that much any most where from client to server so had to change a little, so the encoding is working, but when it get around sending it, i get this from the log a disconnect from the world as if it was server. My code: Clearly, I have done something wrong along the way but do not know now where
  10. So got this and it works if (player.inventory.addItemStackToInventory(rewrad)){ player.inventoryContainer.detectAndSendChanges(); } else{ playerMP.worldObj.spawnEntityInWorld(new EntityItem(playerMP.worldObj, playerMP.posX, playerMP.posY, playerMP.posZ, rewrad)); } but will look into ItemHandlerHelper.giveItemToPlayer when i get an chance.
  11. So i am guessing player.inventory.addItemStackToInventory(item) player.inventory.detectAndSendChanges() not being at my development environment although it end yo being something more like this if (player.inventory.addItemStackToInventory(item)) { player.inventory.detectAndSendChanges() } else{ playerMP.worldObj.spawnEntityInWorld(new EntityItem(playerMP.worldObj, playerMP.posX, playerMP.posY, playerMP.posZ, item)); }
  12. this is what the method getReward does public ItemStack getReward() { return reward.copy(); } This is in my ModdedAchievement class, item stacks are set in the constructor Is it fine having copying the item stack there or should i do public ItemStack getReward() { return reward; } ItemStack rewrad = moddedAchievement.getReward().copy(); To me it does not seem to make much different
  13. So this is all guess work bu i have up with this for NBT NBTTagCompound nbt = new NBTTagCompound(); nbt.setString("modle", "blockDiamond"); nbt.setString("owner",player.getDisplayNameString()); nbt.setString("date", String.format("%1$td/%1$tm/%1$tY", System.currentTimeMillis())); ItemStack item= moddedAchievement.item(); item= new ItemStack(item.getItem(), item.stackSize, iem.getMetadata(), nbt); This is obviously wrong but this is my first attempt of giving a item stack NBT I have also tire the write to nbt method with no luck away the item stack is added to player like this player.inventory.addItemStackToInventory(item) if it is important all this is only happening server side
  14. I have method that is called on only the server side that result player.inventory.addItemStackToInventory(item) be called if all conditions are meet, but because it is only called on the server side the client does not update util you click in the slot it put in. If there away to invoke this update, right after player.inventory.addItemStackToInventory(item) is called.
  15. I got something that works!, Draco18s hope the method parameters are more to your liking, I do not know if there is any way to make this more efficient, if there is I would be more than happy to find out. private void checkAchivment(Achievement achievement, ItemStack item, EntityPlayer player) { if (!player.worldObj.isRemote && player instanceof EntityPlayerMP && achievement instanceof ModdedAchievement) { EntityPlayerMP playerMP = ((EntityPlayerMP) player); StatisticsManagerServer file = playerMP.getStatFile(); if (!file.hasAchievementUnlocked(achievement) && file.canUnlockAchievement(achievement)) { ModdedAchievement moddedAchievement = ((ModdedAchievement) achievement); if (moddedAchievement.getTarget().getItem().equals(item.getItem())) { if(moddedAchievement.getReward() != null){ ItemStack rewrad = moddedAchievement.getReward(); if (!player.inventory.addItemStackToInventory(rewrad)) { playerMP.worldObj.spawnEntityInWorld(new EntityItem(playerMP.worldObj, playerMP.posX, playerMP.posY, playerMP.posZ, rewrad)); } } playerMP.addStat(achievement); } } } } diesieben07 for my how are my achievements initialized public class ModdedAchievement extends Achievement { private static AchievementPage moddedAchievements; public static final Achievement[] achievments = new Achievement[]{ new ModdedAchievement("blockDiamond", 0, 0, Blocks.DIAMOND_BLOCK, null, itemStack(Blocks.DIRT, 2).copy(), itemStack(Blocks.DIAMOND_BLOCK)) }; public static void init(){ moddedAchievements = new AchievementPage(MOD_NAME, achievments); AchievementPage.registerAchievementPage(moddedAchievements); } } At the moment I have just the one test one that gives you reward of of 2 dirt for making a diamond block
  16. @SubscribeEvent public void onCraft(PlayerEvent.ItemCraftedEvent e){ Logging.info("Item CRafted"); checkAchivment(achievments[0], new ItemStack(Blocks.DIRT, 2), new ItemStack(Blocks.DIAMOND_BLOCK), e.crafting, e.player); }
  17. I was kind of hopping not use tile entities, as to man tile entities = lags
  18. Why call hasAchievement, in single player i always get false, do not know if i am meant to target the method at the integrated server as before my method was like this and do stuff was always being called even after getting the achievement. private void checkAchivment(Achievement achievement, ItemStack item, ItemStack item1, ItemStack item2, EntityPlayer player){ Logging.info("Checking..."); if(item1.getItem().equals(item2.getItem())){ Logging.info("Items Match"); if(!player.hasachievement(achievement)){ //do stuff } } } P.S. Thanks TheMasterGabriel that looks like it should work on both sides
  19. In the crafted item event i get and player and item and there is method on the player that I can run called hasAchievement, but looking into that it always returns false, in single player, looked in to how entity player mp does and came up with this !Minecraft.getMinecraft().getIntegratedServer().getPlayerList().getPlayerStatsFile(player).hasAchievementUnlocked(achievement) works in singles player but crashes the client on a server Full method private void checkAchivment(Achievement achievement, ItemStack item, ItemStack item1, ItemStack item2, EntityPlayer player){ Logging.info("Checking..."); if(item1.getItem().equals(item2.getItem())){ Logging.info("Items Match"); if(Minecraft.getMinecraft().isIntegratedServerRunning()){ Logging.info("I am single player"); if(!Minecraft.getMinecraft().getIntegratedServer().getPlayerList().getPlayerStatsFile(player).hasAchievementUnlocked(achievement)){ //do stuff } } else { Logging.info("I am a server"); if(!player.hasAchievement(achievement)){ //do stuff } } } } I am not happy was this part of the method and fell there should be better way of checking if the player has an achievement also if(Minecraft.getMinecraft().isIntegratedServerRunning()){ Logging.info("I am single player"); if(!Minecraft.getMinecraft().getIntegratedServer().getPlayerList().getPlayerStatsFile(player).hasAchievementUnlocked(achievement)){ //do stuff } } else { Logging.info("I am a server"); if(!player.hasAchievement(achievement)){ //do stuff } } Edit: Working method for give a reward with an achievement: https://gist.github.com/Dijkstra1/30eb97f26aacfd3a1af3258f9a37f2e3
  20. I have a block when craft it comes with two NBT values, but it is my understanding that when block is placed it will loss these tags, and strand blocks them self can not have NBT, is there any way my block can keep this data, after being placed in the world.
  21. How to make GUI that only shows texts and buttons that lead to more text, not bound ttile entities or block, and has no inventory.
  22. I been looking in to how JSON models, and the about the only useful thing i found out is the scale has been from 1.8 to 1.9, but nothing on to make blocks curved faces, would like for some of blocks to have curved do not know to much about json have a model creator, but it does allow curved faces.
  23. I have implemented layer render, and I was happy to see layer being render, but it seem to want move by self when it should sticking the player i.e selves, have the players coming in and out of them when they move, the park that goes over the hand, seems spin or be hang down, I have looked the armor layer class has help me lot but can not help with this.
  24. Return true is just for testing so i can print the files it is asking for to the log. So do i need to make an empty mcmate file for each image I want to load this as it asks for mcmeta files instead of files
  25. My IResourcePack ask for mcmeta files, instead of images, have done something wrong it is definitely requesting files from my IResourcePack so it wired up right. IResourcePack Class:
×
×
  • Create New...

Important Information

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