Jump to content

kitsushadow

Members
  • Posts

    134
  • Joined

  • Last visited

Everything posted by kitsushadow

  1. Hey, I have a custom model for an item that id like to render. All the tutorials i've found so far use techne. Seeing as i'm a linux user and wine isn't running techne I opted to use blender. I have exported the blender model as an obj file but i have no idea how to create the model class to import the model. I have the Item renderer class built and ready but i need to have the model class obviously to make it work. Any suggestions or links to tutorials that show how to make the java file for an obj would be welcome. Thanks WORKING CODE
  2. Bump, still haven't made any progress =(
  3. Spoiler is being stupid so here is my current code package com.kitsu.medievalcraft.item; import com.kitsu.medievalcraft.CustomTab; import net.minecraft.command.ICommandSender; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.item.ItemEditableBook; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraft.nbt.NBTTagString; import net.minecraft.world.World; import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.common.registry.LanguageRegistry; public class ItemClayFormBook extends ItemEditableBook { private String name = "clayFormBook"; public ItemClayFormBook() { super(); setCreativeTab(CustomTab.MedievalCraftTab); this.setUnlocalizedName(name); LanguageRegistry.addName(this, name); this.setTextureName(name); this.setMaxStackSize(1); GameRegistry.registerItem(this, name); } private NBTTagList putTableOfContents(NBTTagList bookTagList) { // Create NBT data and add to the book NBTTagCompound tag = new NBTTagCompound(); NBTTagList bookPages = new NBTTagList(); bookTagList.appendTag(new NBTTagString("Test Book")); return bookTagList; } @Override public void onUpdate(ItemStack itemStack, World world, Entity entity, int unknownInt, boolean unknownBool) { NBTTagList bookTagList = new NBTTagList(); bookTagList = putTableOfContents(bookTagList); itemStack.setTagInfo("pages", bookTagList); itemStack.setTagInfo("author", new NBTTagString("Kitsu")); itemStack.setTagInfo("title", new NBTTagString("Test Book")); } }
  4. Experiment with a custom book since some of the Clay Form recipes aren't intuitive enough. I can't get the book to open though.
  5. Thanks, this is definitely the right direction.
  6. indeed, i looked at this. The problem is that this needs direct line of sight while i require general direction, maybe i could make it a range based on where the entity is looking? Gonna give something like that a try.
  7. Good Morning, Still haven't made any further progress on this, if u have idea or suggestion for determining general player look direction plz let me know.
  8. Ok i got the damage check, im reading in the console a position for the mob. Is there a way i can get the direction a player is facing and relate it to the mobs coordinates? also can i get the mobs coordinates?
  9. This example only handles the check. I have the check working. Its the switch that's not working correctly. i'll post the whole class at the end. I have to Override the onItemRightClick since i need the code to run when onItemRightClick occurs. Like I said in my previous post. The code isn't complete because the ItemStack.setItemDamage(); isnt being applied after the return statement. @Override public ItemStack onItemRightClick(ItemStack s, World w, EntityPlayer p) { p.inventory.changeCurrentItem(1); s = p.inventory.getCurrentItem(); y = s.getItemDamage(); if (p.inventory.getCurrentItem() == null) { p.inventory.changeCurrentItem(-1); } else if (s.isItemEqual(new ItemStack(ModItems.forgeHammer, y, y ))) { i = 0; } else p.inventory.changeCurrentItem(-1); s = p.inventory.getCurrentItem(); s.setItemDamage(y); return super.onItemRightClick(s, w, p); } }
  10. Made some progress but i'm still having a serious issue with keeping the damage on the item. Current Code Will correctly check, and switch even if item is damage. However, if the item is damaged it will NOT keep the damage value, instead it will reset the hammer to new. Need to find a way to run s.setItemDamage(y); AFTER the return statement runs. Code Logic: @Override public ItemStack onItemRightClick(ItemStack s, World w, EntityPlayer p) { p.inventory.changeCurrentItem(1); s = p.inventory.getCurrentItem(); y = s.getItemDamage(); if (p.inventory.getCurrentItem() == null) { p.inventory.changeCurrentItem(-1); } else if (s.isItemEqual(new ItemStack(ModItems.forgeHammer, y, y ))) { i = 0; } else p.inventory.changeCurrentItem(-1); s = p.inventory.getCurrentItem(); s.setItemDamage(y); return super.onItemRightClick(s, w, p); }
  11. So I tried all the iterations of what you suggested, -1, 0, 1, -1, OreDictionary.WILDCARD_VALUE 0, OreDictionary.WILDCARD_VALUE 1, OreDictionary.WILDCARD_VALUE OreDictionary.WILDCARD_VALUE, OreDictionary.WILDCARD_VALUE OreDictionary.WILDCARD_VALUE, -1 OreDictionary.WILDCARD_VALUE, 0 OreDictionary.WILDCARD_VALUE, 1
  12. Hmm Short didn't work, and Byte didnt work either also Short.MAX_VALUE and Byte.MAX_VALUE were the only available options. Also u put () after urs, that wasn't a valid option for Short or for Byte.
  13. So I got the checking and switching working, with some big help from a friend. However i've run into another problem. The switch wont work if the item is damaged. Current Semi Working code:
  14. So gave that piece of code a go Current Code: Have a problem: its changing the players slot but its duplicating the sword in the next slot instead of just switching to that slot. I think it has to do with the return statement.
  15. This Code i wrote will check if the item to the left of ur currently equipped item is not null, if not then it will check to see if its the item u want to swap to. If so the swap will occur. It also takes into account items like tools and weapons that could have damage on them.
  16. Yea, got it working exactly how I want it to be. Thanks a lot!
  17. Yea, built my EventHandler class and did a test with player interact event and the event registery is working fine as well. However, I cant find the documentation on LivingUpdateEvent in http://www.minecraftforge.net/wiki/Event_Reference page
  18. LivingDropsEvent is for when you kill an animal. I don't want to kill the animal to get my item. I want the item to drop occasionally from cows just like an egg would. I think your right about having to use an event handler though, that's just not the appropriate one
  19. I'm trying to Overwrite the vanilla cow class with my own cow class. Im attempting to make the cow drop an item similar to how a chicken does. I believe my custom cow class is fine but that Im registering my cowclass incorrectly or that im not disabling the spawn correctly. Please look at my Main and Cow classes and let me know if something is amiss. Thanks in Advance (Also Spoilers dont seem to be working at the time i was writing this post) MedievalCow.class package com.kitsu.medievalcraft.entity; import com.kitsu.medievalcraft.item.ModItems; import net.minecraft.block.Block; import net.minecraft.entity.EntityAgeable; import net.minecraft.entity.SharedMonsterAttributes; import net.minecraft.entity.ai.EntityAIFollowParent; import net.minecraft.entity.ai.EntityAILookIdle; import net.minecraft.entity.ai.EntityAIMate; import net.minecraft.entity.ai.EntityAIPanic; import net.minecraft.entity.ai.EntityAISwimming; import net.minecraft.entity.ai.EntityAITempt; import net.minecraft.entity.ai.EntityAIWander; import net.minecraft.entity.ai.EntityAIWatchClosest; import net.minecraft.entity.passive.EntityCow; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.world.World; public class MedievalCow extends EntityCow { public float field_70886_e; public float destPos; public float field_70884_g; public float field_70888_h; public float field_70889_i = 1.0F; /** The time until the next egg is spawned. */ public int timeUntilNextEgg; public boolean field_152118_bv; private static final String __OBFID = "CL_00001639"; public MedievalCow(World p_i1683_1_) { super(p_i1683_1_); this.setSize(0.9F, 1.3F); this.getNavigator().setAvoidsWater(true); this.tasks.addTask(0, new EntityAISwimming(this)); this.tasks.addTask(1, new EntityAIPanic(this, 2.0D)); this.tasks.addTask(2, new EntityAIMate(this, 1.0D)); this.tasks.addTask(3, new EntityAITempt(this, 1.25D, Items.wheat, false)); this.tasks.addTask(4, new EntityAIFollowParent(this, 1.25D)); this.tasks.addTask(5, new EntityAIWander(this, 1.0D)); this.tasks.addTask(6, new EntityAIWatchClosest(this, EntityPlayer.class, 6.0F)); this.tasks.addTask(7, new EntityAILookIdle(this)); this.timeUntilNextEgg = this.rand.nextInt(10) + 10; } /** * Returns true if the newer Entity AI code should be run */ public boolean isAIEnabled() { return true; } protected void applyEntityAttributes() { super.applyEntityAttributes(); this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(10.0D); this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.20000000298023224D); } /** * Returns the sound this mob makes while it's alive. */ protected String getLivingSound() { return "mob.cow.say"; } /** * Returns the sound this mob makes when it is hurt. */ protected String getHurtSound() { return "mob.cow.hurt"; } /** * Returns the sound this mob makes on death. */ protected String getDeathSound() { return "mob.cow.hurt"; } protected void func_145780_a(int p_145780_1_, int p_145780_2_, int p_145780_3_, Block p_145780_4_) { this.playSound("mob.cow.step", 0.15F, 1.0F); } /** * Returns the volume for the sounds this mob makes. */ protected float getSoundVolume() { return 0.4F; } protected Item getDropItem() { return Items.leather; } /** * Drop 0-2 items of this living's type. @param par1 - Whether this entity has recently been hit by a player. @param * par2 - Level of Looting used to kill this mob. */ public void onLivingUpdate() { super.onLivingUpdate(); this.field_70888_h = this.field_70886_e; this.field_70884_g = this.destPos; this.destPos = (float)((double)this.destPos + (double)(this.onGround ? -1 : 4) * 0.3D); if (this.destPos < 0.0F) { this.destPos = 0.0F; } if (this.destPos > 1.0F) { this.destPos = 1.0F; } if (!this.onGround && this.field_70889_i < 1.0F) { this.field_70889_i = 1.0F; } this.field_70889_i = (float)((double)this.field_70889_i * 0.9D); if (!this.onGround && this.motionY < 0.0D) { this.motionY *= 0.6D; } this.field_70886_e += this.field_70889_i * 2.0F; if (!this.worldObj.isRemote && !this.isChild() && --this.timeUntilNextEgg <= 0) { this.playSound("mob.chicken.plop", 1.0F, (this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F + 1.0F); this.dropItem(Items.egg, 1); this.timeUntilNextEgg = this.rand.nextInt(10) + 10; } } protected void dropFewItems(boolean p_70628_1_, int p_70628_2_) { int j = this.rand.nextInt(4) + this.rand.nextInt(1 + p_70628_2_); int k; for (k = 0; k < j; ++k) { this.dropItem(Items.leather, 1); } j = this.rand.nextInt(3) + 1 + this.rand.nextInt(1 + p_70628_2_); for (k = 0; k < j; ++k) { if (this.isBurning()) { this.dropItem(Items.cooked_beef, 1); } else { this.dropItem(Items.beef, 1); } } } /** * Called when a player interacts with a mob. e.g. gets milk from a cow, gets into the saddle on a pig. */ public boolean interact(EntityPlayer p_70085_1_) { ItemStack itemstack = p_70085_1_.inventory.getCurrentItem(); if (itemstack != null && itemstack.getItem() == Items.bucket && !p_70085_1_.capabilities.isCreativeMode) { if (itemstack.stackSize-- == 1) { p_70085_1_.inventory.setInventorySlotContents(p_70085_1_.inventory.currentItem, new ItemStack(Items.milk_bucket)); } else if (!p_70085_1_.inventory.addItemStackToInventory(new ItemStack(Items.milk_bucket))) { p_70085_1_.dropPlayerItemWithRandomChoice(new ItemStack(Items.milk_bucket, 1, 0), false); } return true; } else { return super.interact(p_70085_1_); } } public EntityCow createChild(EntityAgeable p_90011_1_) { return new EntityCow(this.worldObj); } } ________________________________________________________________________________ Main package com.kitsu.medievalcraft; import net.minecraft.entity.EnumCreatureType; import net.minecraft.entity.passive.EntityCow; import net.minecraft.world.biome.BiomeGenBase; import com.kitsu.medievalcraft.block.ModBlocks; import com.kitsu.medievalcraft.crafting.ModCrafting; import com.kitsu.medievalcraft.entity.EntityShit; import com.kitsu.medievalcraft.entity.MedievalCow; import com.kitsu.medievalcraft.item.ModItems; import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.Mod.EventHandler; import cpw.mods.fml.common.Mod.Instance; import cpw.mods.fml.common.SidedProxy; import cpw.mods.fml.common.event.FMLInitializationEvent; import cpw.mods.fml.common.event.FMLPostInitializationEvent; import cpw.mods.fml.common.event.FMLPreInitializationEvent; import cpw.mods.fml.common.registry.EntityRegistry; @Mod(modid = Main.MODID, name = Main.MODNAME, version = Main.VERSION) public class Main { public static final String MODID = "kitsumedievalcraft"; public static final String MODNAME = "Medieval Craft"; public static final String VERSION = "1.0.0"; @Instance public static Main instance = new Main(); @SidedProxy(clientSide="com.kitsu.medievalcraft.ClientProxy", serverSide="com.kitsu.medievalcraft.CommonProxy") public static CommonProxy proxy; /** * Run before anything else. Read your config, create blocks, items, etc, and * register them with the GameRegistry. */ @EventHandler public void preInit(FMLPreInitializationEvent e) { this.proxy.preInit(e); CustomTab.MedievalTab(); ModItems.init(); ModBlocks.init(); ModCrafting.init(); } /** * Do your mod setup. Build whatever data structures you care about. Register recipes. */ @EventHandler public void init(FMLInitializationEvent e) { this.proxy.init(e); EntityRegistry.registerModEntity(EntityShit.class, "itemShit", 1, this, 64, 10, true); EntityRegistry.registerModEntity(MedievalCow.class, "Medieval Cow", 1, this, 80, 3, true); for (int i = 0; i < BiomeGenBase.getBiomeGenArray().length; i++) { if (BiomeGenBase.getBiomeGenArray() != null) { EntityRegistry.removeSpawn(EntityCow.class, EnumCreatureType.monster, BiomeGenBase.getBiomeGenArray()); } } EntityRegistry.addSpawn(MedievalCow.class, 10, 1, 3, EnumCreatureType.monster, BiomeGenBase.birchForest, BiomeGenBase.forest, BiomeGenBase.jungle, BiomeGenBase.plains, BiomeGenBase.savanna, BiomeGenBase.taiga); } /** * Handle interaction with other mods, complete your setup based on this. */ @EventHandler public void postInit(FMLPostInitializationEvent e) { this.proxy.postInit(e); this.proxy.registerRenderer(); //RenderingRegistry.registerEntityRenderingHandler(EntityShit.class, new RenderSnowball(ModItems.itemShit)); } }
  20. You were right, I uncommented the register renderer and added this.proxy.registerRenderer(); to my main and now its working. Thank You all very much =)
  21. I have this in my Common Proxy class as well public class CommonProxy { public void registerRenderer() { RenderingRegistry.registerEntityRenderingHandler(EntityShit.class, new RenderSnowball(ModItems.itemShit)); } not sure if thats right. Are you saying I need a rendering class?
  22. Entity Class Item Class Entity Registry in Main Everything about the Item works except i get a white cube while the item is being thrown. While in the players inventory and while on the ground it renders as the item. Thanks in advance
  23. Not sure what your suggesting. I am i looking in the wrong place for the source? or did i point to the wrong workspace?
×
×
  • Create New...

Important Information

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