Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

SSslimer

Members
  • Posts

    152
  • Joined

  • Last visited

Everything posted by SSslimer

  1. Well I made it, just created 4 texture files for each armor part. Also I have changed the code a bit. I still dont know is that issue connected with my code or its forge error/bug.
  2. So I managed to name a bit: package BetterWorld.mobs; @SideOnly(Side.CLIENT) public abstract class LayerVillagerArmorBase implements LayerRenderer { protected static final ResourceLocation glintTexture = new ResourceLocation("textures/misc/enchanted_item_glint.png"); protected ModelBase model; private final RendererLivingEntity renderLivingEntity; private boolean field_177193_i; private static final Map field_177191_j = Maps.newHashMap(); public LayerVillagerArmorBase(RendererLivingEntity renderLivingEntity) { this.renderLivingEntity = renderLivingEntity; this.setArmorModel(); } public void doRenderLayer(EntityLivingBase entity, float p_177141_2_, float p_177141_3_, float p_177141_4_, float p_177141_5_, float p_177141_6_, float p_177141_7_, float p_177141_8_) { this.renderLayer(entity, p_177141_2_, p_177141_3_, p_177141_4_, p_177141_5_, p_177141_6_, p_177141_7_, p_177141_8_, 3); this.renderLayer(entity, p_177141_2_, p_177141_3_, p_177141_4_, p_177141_5_, p_177141_6_, p_177141_7_, p_177141_8_, 2); this.renderLayer(entity, p_177141_2_, p_177141_3_, p_177141_4_, p_177141_5_, p_177141_6_, p_177141_7_, p_177141_8_, 1); this.renderLayer(entity, p_177141_2_, p_177141_3_, p_177141_4_, p_177141_5_, p_177141_6_, p_177141_7_, p_177141_8_, 0); } public boolean shouldCombineTextures() { return false; } private void renderLayer(EntityLivingBase entity, float p_177182_2_, float p_177182_3_, float p_177182_4_, float p_177182_5_, float p_177182_6_, float p_177182_7_, float p_177182_8_, int armorSlot) { ItemStack itemstack = this.getArmorItemStack(entity, armorSlot); if (itemstack != null && itemstack.getItem() instanceof ItemArmor) { ItemArmor itemarmor = (ItemArmor)itemstack.getItem(); ModelBase modelbase = this.model; modelbase.setModelAttributes(this.renderLivingEntity.getMainModel()); modelbase.setLivingAnimations(entity, p_177182_2_, p_177182_3_, p_177182_4_); modelbase = net.minecraftforge.client.ForgeHooksClient.getArmorModel(entity, itemstack, armorSlot, modelbase); this.showBodyparts(modelbase, armorSlot); boolean flag = this.isPants(armorSlot); this.renderLivingEntity.bindTexture(this.getArmorResource(entity, itemstack, flag ? 2 : 1, null)); { int j = itemarmor.getColor(itemstack); if (j != -1) //Allow this for anything, not only cloth. { float f7 = (float)(j >> 16 & 255) / 255.0F; float f8 = (float)(j >> 8 & 255) / 255.0F; float f9 = (float)(j & 255) / 255.0F; GlStateManager.color(f7, f8, f9, 1.0F); modelbase.render(entity, p_177182_2_, p_177182_3_, p_177182_5_, p_177182_6_, p_177182_7_, p_177182_8_); this.renderLivingEntity.bindTexture(this.getArmorResource(entity, itemstack, flag ? 2 : 1, "overlay")); } { // Render non-cloth armor GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); modelbase.render(entity, p_177182_2_, p_177182_3_, p_177182_5_, p_177182_6_, p_177182_7_, p_177182_8_); } { // Default, Why is this a switch? there were no breaks. if (!this.field_177193_i && itemstack.isItemEnchanted()) { this.renderEnchantEffects(entity, modelbase, p_177182_2_, p_177182_3_, p_177182_4_, p_177182_5_, p_177182_6_, p_177182_7_, p_177182_8_); } } } } } //Gets ItemStack from slot in armor inventory public ItemStack getArmorItemStack(EntityLivingBase entity, int par1) { return entity.getCurrentArmor(par1); } private boolean isPants(int armorSlot) { return armorSlot == 2; } private void renderEnchantEffects(EntityLivingBase entity, ModelBase modelBase, float p_177183_3_, float p_177183_4_, float p_177183_5_, float p_177183_6_, float p_177183_7_, float p_177183_8_, float p_177183_9_) { float f7 = (float)entity.ticksExisted + p_177183_5_; this.renderLivingEntity.bindTexture(glintTexture); GlStateManager.enableBlend(); GlStateManager.depthFunc(514); GlStateManager.depthMask(false); float f8 = 0.5F; GlStateManager.color(f8, f8, f8, 1.0F); for (int i = 0; i < 2; ++i) { GlStateManager.disableLighting(); GlStateManager.blendFunc(768, 1); float f9 = 0.76F; GlStateManager.color(0.5F * f9, 0.25F * f9, 0.8F * f9, 1.0F); GlStateManager.matrixMode(5890); GlStateManager.loadIdentity(); float f10 = 0.33333334F; GlStateManager.scale(f10, f10, f10); GlStateManager.rotate(30.0F - (float)i * 60.0F, 0.0F, 0.0F, 1.0F); GlStateManager.translate(0.0F, f7 * (0.001F + (float)i * 0.003F) * 20.0F, 0.0F); GlStateManager.matrixMode(5888); modelBase.render(entity, p_177183_3_, p_177183_4_, p_177183_6_, p_177183_7_, p_177183_8_, p_177183_9_); } GlStateManager.matrixMode(5890); GlStateManager.loadIdentity(); GlStateManager.matrixMode(5888); GlStateManager.enableLighting(); GlStateManager.depthMask(true); GlStateManager.depthFunc(515); GlStateManager.disableBlend(); } protected abstract void setArmorModel(); protected abstract void showBodyparts(ModelBase modelBase, int armorSlot); /*=================================== FORGE START =========================================*/ /** * More generic ForgeHook version of the above function, it allows for Items to have more control over what texture they provide. * * @param entity Entity wearing the armor * @param stack ItemStack for the armor * @param slot Slot ID that the item is in * @param type Subtype, can be null or "overlay" * @return ResourceLocation pointing at the armor's texture */ public ResourceLocation getArmorResource(net.minecraft.entity.Entity entity, ItemStack stack, int slot, String type) { ItemArmor item = (ItemArmor)stack.getItem(); String texture = ((ItemArmor)stack.getItem()).getArmorMaterial().getName(); String domain = "BetterWorld"; int idx = texture.indexOf(':'); if (idx != -1) { domain = texture.substring(0, idx); texture = texture.substring(idx + 1); } String s1 = String.format("%s:textures/armor/Warior/%s_layer_%d%s.png", domain, texture, (slot == 2 ? 2 : 1), type == null ? "" : String.format("_%s", type)); s1 = net.minecraftforge.client.ForgeHooksClient.getArmorTexture(entity, stack, s1, slot, type); ResourceLocation resourcelocation = (ResourceLocation)field_177191_j.get(s1); if (resourcelocation == null) { resourcelocation = new ResourceLocation(s1); field_177191_j.put(s1, resourcelocation); } return resourcelocation; } /*=================================== FORGE END ===========================================*/ @SideOnly(Side.CLIENT) static final class SwitchArmorMaterial { static final int[] field_178747_a = new int[itemArmor.ArmorMaterial.values().length]; static { try { field_178747_a[itemArmor.ArmorMaterial.LEATHER.ordinal()] = 1; } catch (NoSuchFieldError var5) { ; } try { field_178747_a[itemArmor.ArmorMaterial.CHAIN.ordinal()] = 2; } catch (NoSuchFieldError var4) { ; } try { field_178747_a[itemArmor.ArmorMaterial.IRON.ordinal()] = 3; } catch (NoSuchFieldError var3) { ; } try { field_178747_a[itemArmor.ArmorMaterial.GOLD.ordinal()] = 4; } catch (NoSuchFieldError var2) { ; } try { field_178747_a[itemArmor.ArmorMaterial.DIAMOND.ordinal()] = 5; } catch (NoSuchFieldError var1) { ; } } } } I think that the code bind the whole armor parts textures from given texture file. It would be somehow possible to make own code and more texture files to separate each texture part. What do you think, about that idea?
  3. Ok I will try to name methods and some varibles but those floats will be hard to name in proper way.
  4. When only helmet or chestplate or boots are in slot. http://screenshooter.net/102176810/kesicrv And when only pants, this works, because only pants texture is in separate file(my textures are in 2 layers as other vanilla) http://screenshooter.net/102176810/rvaxqro My code is just copy-paste with some code changes to make what I need. I think that code for armor parts texture possition on file or sth like that might be not working. So to be more precisefull, I have changed texture location and also overrided getCurrentArmor() in entity class to get itemstack from my armor slots. @SideOnly(Side.CLIENT) public abstract class LayerVillagerArmorBase implements LayerRenderer { protected static final ResourceLocation field_177188_b = new ResourceLocation("textures/misc/enchanted_item_glint.png"); protected ModelBase field_177189_c; protected ModelBase field_177186_d; private final RendererLivingEntity field_177190_a; private float field_177187_e = 1.0F; private float field_177184_f = 1.0F; private float field_177185_g = 1.0F; private float field_177192_h = 1.0F; private boolean field_177193_i; private static final Map field_177191_j = Maps.newHashMap(); public LayerVillagerArmorBase(RendererLivingEntity p_i46125_1_) { this.field_177190_a = p_i46125_1_; this.func_177177_a(); } public void doRenderLayer(EntityLivingBase p_177141_1_, float p_177141_2_, float p_177141_3_, float p_177141_4_, float p_177141_5_, float p_177141_6_, float p_177141_7_, float p_177141_8_) { this.func_177182_a(p_177141_1_, p_177141_2_, p_177141_3_, p_177141_4_, p_177141_5_, p_177141_6_, p_177141_7_, p_177141_8_, 4); this.func_177182_a(p_177141_1_, p_177141_2_, p_177141_3_, p_177141_4_, p_177141_5_, p_177141_6_, p_177141_7_, p_177141_8_, 3); this.func_177182_a(p_177141_1_, p_177141_2_, p_177141_3_, p_177141_4_, p_177141_5_, p_177141_6_, p_177141_7_, p_177141_8_, 2); this.func_177182_a(p_177141_1_, p_177141_2_, p_177141_3_, p_177141_4_, p_177141_5_, p_177141_6_, p_177141_7_, p_177141_8_, 1); } public boolean shouldCombineTextures() { return false; } private void func_177182_a(EntityLivingBase p_177182_1_, float p_177182_2_, float p_177182_3_, float p_177182_4_, float p_177182_5_, float p_177182_6_, float p_177182_7_, float p_177182_8_, int p_177182_9_) { ItemStack itemstack = this.func_177176_a(p_177182_1_, p_177182_9_); if (itemstack != null && itemstack.getItem() instanceof ItemArmor) { ItemArmor itemarmor = (ItemArmor)itemstack.getItem(); ModelBase modelbase = this.func_177175_a(p_177182_9_); modelbase.setModelAttributes(this.field_177190_a.getMainModel()); modelbase.setLivingAnimations(p_177182_1_, p_177182_2_, p_177182_3_, p_177182_4_); modelbase = net.minecraftforge.client.ForgeHooksClient.getArmorModel(p_177182_1_, itemstack, p_177182_9_, modelbase); this.func_177179_a(modelbase, p_177182_9_); boolean flag = this.func_177180_b(p_177182_9_); this.field_177190_a.bindTexture(this.getArmorResource(p_177182_1_, itemstack, flag ? 2 : 1, null)); { int j = itemarmor.getColor(itemstack); if (j != -1) //Allow this for anything, not only cloth. { float f7 = (float)(j >> 16 & 255) / 255.0F; float f8 = (float)(j >> 8 & 255) / 255.0F; float f9 = (float)(j & 255) / 255.0F; GlStateManager.color(this.field_177184_f * f7, this.field_177185_g * f8, this.field_177192_h * f9, this.field_177187_e); modelbase.render(p_177182_1_, p_177182_2_, p_177182_3_, p_177182_5_, p_177182_6_, p_177182_7_, p_177182_8_); this.field_177190_a.bindTexture(this.getArmorResource(p_177182_1_, itemstack, flag ? 2 : 1, "overlay")); } { // Non-cloth GlStateManager.color(this.field_177184_f, this.field_177185_g, this.field_177192_h, this.field_177187_e); modelbase.render(p_177182_1_, p_177182_2_, p_177182_3_, p_177182_5_, p_177182_6_, p_177182_7_, p_177182_8_); } { // Default, Why is this a switch? there were no breaks. if (!this.field_177193_i && itemstack.isItemEnchanted()) { this.func_177183_a(p_177182_1_, modelbase, p_177182_2_, p_177182_3_, p_177182_4_, p_177182_5_, p_177182_6_, p_177182_7_, p_177182_8_); } } } } } public ItemStack func_177176_a(EntityLivingBase p_177176_1_, int p_177176_2_) { return p_177176_1_.getCurrentArmor(p_177176_2_ - 1); } public ModelBase func_177175_a(int p_177175_1_) { return this.func_177180_b(p_177175_1_) ? this.field_177189_c : this.field_177186_d; } private boolean func_177180_b(int p_177180_1_) { return p_177180_1_ == 2; } private void func_177183_a(EntityLivingBase p_177183_1_, ModelBase p_177183_2_, float p_177183_3_, float p_177183_4_, float p_177183_5_, float p_177183_6_, float p_177183_7_, float p_177183_8_, float p_177183_9_) { float f7 = (float)p_177183_1_.ticksExisted + p_177183_5_; this.field_177190_a.bindTexture(field_177188_b); GlStateManager.enableBlend(); GlStateManager.depthFunc(514); GlStateManager.depthMask(false); float f8 = 0.5F; GlStateManager.color(f8, f8, f8, 1.0F); for (int i = 0; i < 2; ++i) { GlStateManager.disableLighting(); GlStateManager.blendFunc(768, 1); float f9 = 0.76F; GlStateManager.color(0.5F * f9, 0.25F * f9, 0.8F * f9, 1.0F); GlStateManager.matrixMode(5890); GlStateManager.loadIdentity(); float f10 = 0.33333334F; GlStateManager.scale(f10, f10, f10); GlStateManager.rotate(30.0F - (float)i * 60.0F, 0.0F, 0.0F, 1.0F); GlStateManager.translate(0.0F, f7 * (0.001F + (float)i * 0.003F) * 20.0F, 0.0F); GlStateManager.matrixMode(5888); p_177183_2_.render(p_177183_1_, p_177183_3_, p_177183_4_, p_177183_6_, p_177183_7_, p_177183_8_, p_177183_9_); } GlStateManager.matrixMode(5890); GlStateManager.loadIdentity(); GlStateManager.matrixMode(5888); GlStateManager.enableLighting(); GlStateManager.depthMask(true); GlStateManager.depthFunc(515); GlStateManager.disableBlend(); } @Deprecated //Use the more sensitive version getArmorResource below private ResourceLocation getArmorResource(ItemArmor p_177181_1_, boolean p_177181_2_) { return this.getArmorResource(p_177181_1_, p_177181_2_, (String)null); } @Deprecated //Use the more sensitive version getArmorResource below private ResourceLocation getArmorResource(ItemArmor p_177178_1_, boolean p_177178_2_, String p_177178_3_) { String s1 = String.format("BetterWorld:textures/armor/Warior/%s_layer_%d%s.png", new Object[] {p_177178_1_.getArmorMaterial().getName(), Integer.valueOf(p_177178_2_ ? 2 : 1), p_177178_3_ == null ? "" : String.format("_%s", new Object[]{p_177178_3_})}); ResourceLocation resourcelocation = (ResourceLocation)field_177191_j.get(s1); if (resourcelocation == null) { resourcelocation = new ResourceLocation(s1); field_177191_j.put(s1, resourcelocation); } return resourcelocation; } protected abstract void func_177177_a(); protected abstract void func_177179_a(ModelBase p_177179_1_, int p_177179_2_); /*=================================== FORGE START =========================================*/ /** * More generic ForgeHook version of the above function, it allows for Items to have more control over what texture they provide. * * @param entity Entity wearing the armor * @param stack ItemStack for the armor * @param slot Slot ID that the item is in * @param type Subtype, can be null or "overlay" * @return ResourceLocation pointing at the armor's texture */ public ResourceLocation getArmorResource(net.minecraft.entity.Entity entity, ItemStack stack, int slot, String type) { ItemArmor item = (ItemArmor)stack.getItem(); String texture = ((ItemArmor)stack.getItem()).getArmorMaterial().getName(); String domain = "BetterWorld"; int idx = texture.indexOf(':'); if (idx != -1) { domain = texture.substring(0, idx); texture = texture.substring(idx + 1); } String s1 = String.format("%s:textures/armor/Warior/%s_layer_%d%s.png", domain, texture, (slot == 2 ? 2 : 1), type == null ? "" : String.format("_%s", type)); s1 = net.minecraftforge.client.ForgeHooksClient.getArmorTexture(entity, stack, s1, slot, type); ResourceLocation resourcelocation = (ResourceLocation)field_177191_j.get(s1); if (resourcelocation == null) { resourcelocation = new ResourceLocation(s1); field_177191_j.put(s1, resourcelocation); } return resourcelocation; } /*=================================== FORGE END ===========================================*/ @SideOnly(Side.CLIENT) static final class SwitchArmorMaterial { static final int[] field_178747_a = new int[itemArmor.ArmorMaterial.values().length]; static { try { field_178747_a[itemArmor.ArmorMaterial.LEATHER.ordinal()] = 1; } catch (NoSuchFieldError var5) { ; } try { field_178747_a[itemArmor.ArmorMaterial.CHAIN.ordinal()] = 2; } catch (NoSuchFieldError var4) { ; } try { field_178747_a[itemArmor.ArmorMaterial.IRON.ordinal()] = 3; } catch (NoSuchFieldError var3) { ; } try { field_178747_a[itemArmor.ArmorMaterial.GOLD.ordinal()] = 4; } catch (NoSuchFieldError var2) { ; } try { field_178747_a[itemArmor.ArmorMaterial.DIAMOND.ordinal()] = 5; } catch (NoSuchFieldError var1) { ; } } } }
  5. You really need static and cant you get world another way?
  6. Hey, I am finishing updating my modification to 1.8 and now I have a troubble with binding textures of armor on entity. I had to create own armorlayer class with some necessary changes, but when my entity wears only one part of armor, all textures from texture file are shown. I mean when entity wears helmet, armor and boots are rendered too. I am not sure where to search the error.
  7. Thanks now it works. I dont even want to ask who made that method. Eclipse suggested to use that empty, I should check it befor I wrote that topic.
  8. Hey, a code for picking up items from ground which I had in 1.7 now doesnt work. I tried to find simillar code somewhere in zombie or villager class but I didnt menage. Game crashes after mob spawn, removing that code makes no crashes. Here is my 1.8 code. if (!this.worldObj.isRemote && !this.dead && this.canPickUpItems() == true) { List list = this.worldObj.getEntitiesWithinAABB(EntityItem.class, this.getBoundingBox().expand(1.0D, 0.0D, 1.0D)); Iterator iterator = list.iterator(); while (iterator.hasNext()) { EntityItem entityitem = (EntityItem)iterator.next(); if (!entityitem.isDead && entityitem.getEntityItem() != null) { ItemStack itemstack = entityitem.getEntityItem(); this.inventory.addItemStackToInventory(itemstack); if(this.inventory.addItemStackToInventory(itemstack) != false) { this.onItemPickup(entityitem, 1); entityitem.setDead(); } } } } And here is error log java.lang.NullPointerException: Ticking entity at BetterWorld.mobs.EntityBetterVillager.onLivingUpdate(EntityBetterVillager.java:166) at net.minecraft.entity.EntityLivingBase.onUpdate(EntityLivingBase.java:1827) at net.minecraft.entity.EntityLiving.onUpdate(EntityLiving.java:273) at net.minecraft.world.World.updateEntityWithOptionalForce(World.java:2024) at net.minecraft.world.WorldServer.updateEntityWithOptionalForce(WorldServer.java:758) at net.minecraft.world.World.updateEntity(World.java:1990) at net.minecraft.world.World.updateEntities(World.java:1816) at net.minecraft.world.WorldServer.updateEntities(WorldServer.java:587) at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:774) at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:669) at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:171) at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:540) at java.lang.Thread.run(Unknown Source) A detailed walkthrough of the error, its code path and all known details is as follows: --------------------------------------------------------------------------------------- -- Head -- Stacktrace: at BetterWorld.mobs.EntityBetterVillager.onLivingUpdate(EntityBetterVillager.java:166) at net.minecraft.entity.EntityLivingBase.onUpdate(EntityLivingBase.java:1827) at net.minecraft.entity.EntityLiving.onUpdate(EntityLiving.java:273) at net.minecraft.world.World.updateEntityWithOptionalForce(World.java:2024) at net.minecraft.world.WorldServer.updateEntityWithOptionalForce(WorldServer.java:758) at net.minecraft.world.World.updateEntity(World.java:1990)
  9. Thanks for help and link too. I found in player render class that bow changes texture using EnumAction(100% that 3rd person view works in that way) It should render item in 1st person view too.
  10. Dont use Id, so how can I set my items/blocks in a correct queue in a own tab? I was trying to lowercase everythink but it was the same. By the way. I made it working, some folder names have started form capital letter. Now I am curious how to code bows like stuffs, I cant find code in Bow.class how texture changes when pulling.
  11. Hey, despite setting everythink like in tutorials my textures still dont show. Some necessary code. modid = "BetterWorld" public static Item Aluminum = new ItemAluminum(15029).setUnlocalizedName("Aluminum"); GameRegistry.registerItem(Aluminum, "Aluminum"); public void init(FMLInitializationEvent event) { if(event.getSide() == Side.CLIENT) { RenderItem renderItem = Minecraft.getMinecraft().getRenderItem(); renderItem.getItemModelMesher().register(Aluminum, 0, new ModelResourceLocation("BetterWorld:Aluminum", "inventory")); } } In .json "layer0": "BetterWorld:items/Aluminum" And some screens: http://screenshooter.net/102176810/qcpypxx http://screenshooter.net/102176810/oxdxkbo I was trying to use mod name with small leters and capital too, but nothing changed.
  12. Thanks, by sth I mean not string e.g of player.
  13. Hey, Is sending player in packets by entityid good and safe way or try sth with UUID? I have to send int not sth else to make my code working.
  14. Thanks, I think that is it. I will try to code it and reply soon. Ok, it works.
  15. I should explain better. http://screenshooter.net/100630509/ecprxhg
  16. In 1.7.10 use: ItemStack(Items.dye, 2, 9) First int is probably a number of items crafted at once and the second int is a metadata of color. Find metadata for each color in minecraft wiki.
  17. Hey, I am searching for a code that renders window in gui containers. That window appears when player puts his mouse cursor over slot with item/block. Its blue-black-purple, hard to say. I suscpet that the code is somewhere in RenderItem class, but I may be wrong. Also I didnt manage to finde texture so I assume that window must be rendered by opengl methods. Please paste the code or write am I searching in proper class.
  18. I use Object, some methods cant work with general ai class(its abstract) Object classes are only for a while, they are converted into their oryginal classes. I think that instanceof checks and stuff also arent needed, my refreshing orders packet clears all orders and than sets it again(for me easier) Thanks for confirmating that code should work. So far the code works fine, orders can be added with out crash. I only need to make some order with customization to find out is my code realy working.
  19. Hey, I am working on probably the most difficult part of my orders system - customization of orders. After choosing own customization in gui, packets have to be send. I made write and readBytes methods using sth like: int...args Method returns object(my task) with set parameters. With packets table is send with ints customization numbers(each task customization I will make as an int value) public Object getTaskWithParameters(int id, int...args) { switch(id) { case 1: task = new EntityAIStayHere(villager, [u]some args[/u]); case 2: task = new EntityAIStay(villager, [u]some args[/u]); } return task; } Is that way of setting pars for object is good or I should try sth else? Should I continue working on my code or its only waste of time??
  20. Hey, I want to add achievement to player stats when he clicks a button. Should I send s packet from client to server side or I am wrong??
  21. Fail, I forgot. Now it works, I feel stupid to create a new topic for such with easy error. My question with Object is solved too, its good for my plans that it works in that way
  22. Hey, I am working on method which will set parameters for objects and return that object. Now I have only that mothod. NPE error is in the first code row. public Object getTaskWithParameters(int id) { [u]Object task = EntityAIOrder.instance.getOrderById(id);[/u] System.out.println(task.getClass()); return task; } That method should return the order object by id par. public Object getOrderById(int par) { EntityAIStayHere entityAiStayHere = new EntityAIStayHere(villager, 0); EntityAIStay entityAiStay = new EntityAIStay(villager, 0); switch(par) { case 0: return entityAiStayHere; case 1: return entityAiStay; default: return null; } } I am not sure is my method type correct. Object is good or set to mother task class? I dont know do my task from first method would be a child task class or mother when I replace Object type to mother class object.
  23. Better sollution for refreshing gui: In gui class public void refreshGui() { this.mc.displayGuiScreen(new GuiVillagerOrders(villager, player)); } In packet class GuiVillagerOrders.instance.refreshGui(); Everythink works fine so topic can be closed
  24. Ernio thanks for help, refreshing gui works, very important to close current gui to avoid multiple gui on one screen. You wrote too much, I told you that list etc works fine, only gui refreshing had been to do. elix I dont want to move my packet code into NBT unless I do customization for my tasks. I am sure that I will need to use NBT to save and load tasks when game loads etc. @Offtopic diesieben07 we can read int etc. in packet class only in specific order? Can we read specific byte eg. second or 9th?
  25. Thanks now I need only to get to know how to get an instance of current gui from client.
×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.