Everything posted by loawkise
-
[1.7.2] Did the system time change, or is the server overloaded?
Sorry, forgot about the code tags. Here is the whole interact method (https://gist.github.com/WillR27/504d06491a9d0f44ed43), and I am getting the dead code error under: if (itemstack == null && !this.worldObj.isRemote) { chat.printChatMessage(new ChatComponentText("XP: " + this.xp + "/" + this.requiredXP + " | " + "Level: " + this.level)); chat.printChatMessage(new ChatComponentText("Health: " + (int) this.getHealth() + "/" + (int) this.maxHealth + " | " + "Attack Damage: " + (int) this.attackDamage)); }
-
[1.7.2] Did the system time change, or is the server overloaded?
I did use: Item item = itemstack.getItem(); But it gave me a "dead code" error underneath: { chat.printChatMessage(new ChatComponentText("XP: " + this.xp + "/" + this.requiredXP + " | " + "Level: " + this.level)); chat.printChatMessage(new ChatComponentText("Health: " + (int) this.getHealth() + "/" + (int) this.maxHealth + " | " + "Attack Damage: " + (int) this.attackDamage)); }
-
[1.7.2] Did the system time change, or is the server overloaded?
Never mind, it just needed some brackets
-
[1.7.2] Did the system time change, or is the server overloaded?
I added itemstack != null to the if statement, but it still gives me the error and crashes my game. if ( itemstack != null && itemstack.getItem() == Blocklings.itemWoodenUpgrade && this.currentUpgradeTier == 1 && this.level >= 2 || temstack.getItem() == Blocklings.itemCobblestoneUpgrade && this.currentUpgradeTier == 2 && this.level >= 3 || itemstack.getItem() == Blocklings.itemStoneUpgrade && this.currentUpgradeTier == 3 && this.level >= 4 || itemstack.getItem() == Blocklings.itemIronUpgrade && this.currentUpgradeTier == 4 && this.level >= 5 || itemstack.getItem() == Blocklings.itemLapisLazuliUpgrade && this.currentUpgradeTier == 5 && this.level >= 6 || itemstack.getItem() == Blocklings.itemGoldUpgrade && this.currentUpgradeTier == 6 && this.level >= 7 || itemstack.getItem() == Blocklings.itemDiamondUpgrade && this.currentUpgradeTier == 7 && this.level >= 8 || itemstack.getItem() == Blocklings.itemEmeraldUpgrade && this.currentUpgradeTier == 8 && this.level >= 9 || itemstack.getItem() == Blocklings.itemObsidianUpgrade && this.currentUpgradeTier == 9 && this.level >= 10 )
-
[1.7.2] Did the system time change, or is the server overloaded?
The only problem I am having now is that it I get a NullPointerException here, but I don't exactly know why. Any ideas? itemstack.getItem() == Blocklings.itemWoodenUpgrade && this.currentUpgradeTier == 1 && this.level >= 2 ||
-
[1.7.2] Did the system time change, or is the server overloaded?
Thank you so much. I have read though the DRY page and have started to apply it some other classes and it literally has cut the class down by 90%. I am now just removing any errors in the code and testing to make sure it works
-
[1.7.2] Did the system time change, or is the server overloaded?
Wow, you'd do that! That's kind of a lot of work, but if you would I would highly appreciate it. If there is anything you need from me don't hesitate to ask.
-
[1.7.2] Did the system time change, or is the server overloaded?
Thanks, that sounds great. I can fix the indentation no problem, it is better to do it sooner rather than later https://gist.github.com/WillR27/338ecfe4a6d1e343c40f I believe that should be a whole lot better.
-
[1.7.2] Did the system time change, or is the server overloaded?
I will post it on github. I'm still newish to modding and have never really used switch before. https://gist.github.com/WillR27/2de7adce851332197381 For some reason it still has really weird indentation but highlighting an line numbers is fixed.
-
[1.7.2] Did the system time change, or is the server overloaded?
I spawn roughly 10 - 15 and they are all attacking something when things start going bad. Could it just be the shear size of the blockling class itself?
-
[1.7.2] Did the system time change, or is the server overloaded?
I overwrite quite a lot of methods, plus the class is pretty big because they have a built in xp and levelling system.
-
[1.7.2] Did the system time change, or is the server overloaded?
I am not too sure if there is anything wrong with it: this.getNavigator().setAvoidsWater(false); this.getNavigator().setCanSwim(true); this.tasks.addTask(1, new EntityAISwimming(this)); this.tasks.addTask(2, this.aiSit); this.tasks.addTask(3, new EntityAIAttackOnCollide(this, 1.0D, false)); this.tasks.addTask(4, new EntityAIFollowOwner(this, 1.0D, 12.0F, 1.0F)); this.tasks.addTask(5, new EntityAIWander(this, 1.0D)); this.tasks.addTask(6, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F)); this.tasks.addTask(6, new EntityAILookIdle(this)); this.targetTasks.addTask(1, new EntityAIHurtByTarget(this, true)); this.targetTasks.addTask(2, new EntityAIOwnerHurtByTarget(this)); this.targetTasks.addTask(3, new EntityAIOwnerHurtTarget(this)); this.setTamed(false); Also some more errors started cropping up that you may find useful:
-
[1.7.2] Did the system time change, or is the server overloaded?
Here is what comes up when the lag spikes occur: [09:50:25] [server thread/WARN]: Something's taking too long! 'root.levels.New World.tick.entities.regular.tick.ai.newAi' took aprox 2297.20861 ms [09:50:25] [server thread/WARN]: Something's taking too long! 'root.levels.New World.tick.entities.regular.tick.ai' took aprox 2297.396424 ms [09:50:25] [server thread/WARN]: Something's taking too long! 'root.levels.New World.tick.entities.regular.tick' took aprox 2297.491871 ms [09:50:25] [server thread/WARN]: Something's taking too long! 'root.levels.New World.tick.entities.regular' took aprox 2308.833617 ms [09:50:25] [server thread/WARN]: Something's taking too long! 'root.levels.New World.tick.entities' took aprox 2308.994747 ms [09:50:25] [server thread/WARN]: Something's taking too long! 'root.levels.New World.tick' took aprox 2312.519436 ms [09:50:25] [server thread/WARN]: Something's taking too long! 'root.levels.New World' took aprox 2312.805776 ms [09:50:25] [server thread/WARN]: Something's taking too long! 'root.levels' took aprox 2313.091774 ms I am not entirely sure though what the source of this would be, but I am assuming my packets perhaps.
-
[1.7.2] Did the system time change, or is the server overloaded?
Me neither, I will look into it further and post any findings.
-
[1.7.2] Problem with setting Item CreativeTab
That is literally it, nothing in my init methods. I think it just creates an ID depending on what isn't used. It works fine and I can easily set an item to appear in the tab.
-
[1.7.2] Did the system time change, or is the server overloaded?
I only send it when the entity attacks and when the world loads because I have to sync some variables to the model and texture.
-
[1.7.2] Did the system time change, or is the server overloaded?
I am using packets yes. I am not sure what could be causing it because I am not too familiar with packets as I am newish to modding. These are all the packet classes, which work, but I am not familiar with how they work so I can't seem to figure out why they are causing this error, if they are.
-
[1.7.2] Using Dyes in Crafting Recipes
Ahh right, sorry, I misunderstood.
-
[1.7.2] Using Dyes in Crafting Recipes
This is all I use: new ItemStack(Item.getItemById(351), 1, 4) 351 being for dyes and the 4 for the metadata. In this case it is lapis.
-
[1.7.2] Problem with setting Item CreativeTab
I just made my tab like this inside my main class: public static CreativeTabs tabName = new CreativeTabs("tabName") { @Override public Item getTabIconItem() { return Items.apple; } };
-
[1.7.2] Did the system time change, or is the server overloaded?
Developer, and it keeps getting progressively worse the longer the world is open. Is it due to a memory leak or something?
-
[1.7.2] Did the system time change, or is the server overloaded?
I keep getting these errors but can't figure out why. They don't happen when a specific event takes place, well not that I know of, so I can't figure out the cause. [19:08:29] [server thread/WARN]: Can't keep up! Did the system time change, or is the server overloaded? Running 14900ms behind, skipping 298 tick(s) [19:08:41] [server thread/WARN]: Can't keep up! Did the system time change, or is the server overloaded? Running 2154ms behind, skipping 43 tick(s) [19:08:59] [server thread/WARN]: Can't keep up! Did the system time change, or is the server overloaded? Running 2479ms behind, skipping 49 tick(s)
-
[1.7.2] Entity Stops Attacking Mid Fight
My entity often jut loses interest in the mob it is attacking. It is a tamed mob that attacks when the player punches something. It will eventually start attacking again but I am not sure how to fix it.
-
[1.7.2] Changing A Mobs Max Health
Okay, I have spent a good 3 hours sat doing what you said and I now fully understand and appreciate the importance of doing as much as you can yourself. I actually managed to solve it by myself and realised why it was happening and I can apply it to other situations. So I guess I should thank you for persevering with me (I could tell it was frustrating you a bit) and pushing to get the point across because it has and will benefit me greatly in the future
-
[1.7.2] Changing A Mobs Max Health
I figured out now why it wasn't working by adding println() statements like you said. Basically when the mob spawns the applyEntityAttributes() method is called before the constructor and I was initializing the maxHealth field in the constructor which meant it only happened after the attributes were applied so it now works. But I have one last problem, I cannot reapply entity attributes to a mob as I get the error mentioned before where it says "Attribute is already registered!" and the game crashes which makes sense. So I am wondering if there is a way around this. I know that the wolves are able to update their max health when they are tamed but there is no indication of the applyEntityAttributes() method being called again so I don't understand why their health updates but not mine. If anyone knows that would be great but if not I will just continue to try and figure it out.
IPS spam blocked by CleanTalk.