Jump to content

Lothrazar

Members
  • Posts

    10
  • Joined

  • Last visited

Everything posted by Lothrazar

  1. I am trying to create a custom villager. I am using the registry system, so I create the proffession first String sage = Const.MODRES+"textures/entity/villager/elder.png"; elderProfession = new VillagerProfession(Const.MODRES+"elder", sage){ @Override public ResourceLocation getSkin() { return sageTexture; } }; Then I add the career which has the trades new VillagerCareer(elderProfession, "sage_career"){ @Override public ITradeList[][] getTrades(){ return sageTrades; } }; Now the trades work just fine, the villager spawns when i do /summon Villager ~ ~ ~ {Profession:5,Career:0} it also spawns naturally with eggs or breeding. But the skin does not register. I looked into EntityVillager.java and see this public int getProfession() { return Math.max(((Integer)this.dataWatcher.get(PROFESSION)).intValue() % 5, 0); } So in other words the %5 sets the maximum limit of 4, its treating ALL villagers registered using forge as profession zero which is farmer. Is there any forge way to do this without relying on reflection or something to override this vanilla method? I know that [a different modder] on twitter fixed this with a core mod, but i want to do this the 'right' way. Full Code: https://github.com/PrinceOfAmber/CyclicMagic/blob/master/src/main/java/com/lothrazar/cyclicmagic/registry/VillageTradeRegistry.java
  2. - Make sure your item is registered as normal with its resource location - Make sure you set the Enum Type of the armor My textures are in /assets/modid/textures/models/armor My Source code https://github.com/PrinceOfAmber/CyclicMagic/blob/master/src/main/java/com/lothrazar/cyclicmagic/item/ItemEmeraldArmor.java
  3. This is not a full answer, but you could try using generating tools such as Mr Crayfish model Creator and try to build a triangle using its interface, and see what the JSON spits out. I know for certain you can make flat planes and rotate their angles, for example to 45 degrees.
  4. I have a solution. Turns out there is a static function in the GUI class that does exactly this Gui.drawModalRectWithCustomSizedTexture No idea if this was there before 1.8.8 since i was just using code on these forums that used 'draw with uv' from world renderer. (if you look at src of that GUI method, it uses almost the exact strategy we used before using worldrenderer) Below is my full method now, noting that my .png size is 176 by 166 , and : protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) { GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); this.mc.getTextureManager().bindTexture(table ); int i = (this.width - this.xSize) / 2; int j = (this.height - this.ySize) / 2; int texture_width = 176; int texture_height = 166; int u=0,v=0; Gui.drawModalRectWithCustomSizedTexture(i,j, u, v, this.xSize,this.ySize,texture_width, texture_height); All my code is on github as "PrinceOfAmber" its all MIT lic. Thanks to everyone who responded.
  5. Just a note that for 1.8.8, you use import net.minecraft.util.ITickable; instead of the now REMOVED import net.minecraft.server.gui.IUpdatePlayerListBox;
  6. Thanks The_Fireplace I will try that. "GuiMaiMenu's renderSkybox" Okay cool I will check it out. "OpenGL.GL_QUADS" Thanks, I am a noob when it comes to OpenGL. Thanks everybody. Basically I am using this to render the icons on custom potion effects, and also for the backgrounds of custom GUI's, and the outlines of custom slots. Also rendering item icons on the f3 screen. There may be better ways to do all of these things without WorldRender, if so let me know!
  7. Update / Progress: This is not a full solution, but it looks like worldrenderer.startDrawingQuads(); is now done like this worldrenderer.func_181668_a(7, worldrenderer.getVertexFormat()); At least, this does not crash. I got the '7' by looking at what it did in 1.8.0 before. Also i know that in 1.8.0 the definition was public void addVertexWithUV(double p_178985_1_, double p_178985_3_, double p_178985_5_, double p_178985_7_, double p_178985_9_) { this.setTextureUV(p_178985_7_, p_178985_9_); this.addVertex(p_178985_1_, p_178985_3_, p_178985_5_); } just an update . I will reply again if i get this fully solved
  8. Just wondering how to draw an item on the screen in 1.8.8. It tells me functions dont exist worldrenderer.startDrawingQuads , worldrenderer.addVertexWithUV In 1.8.0 i would do it like this [embed=425,349] IBakedModel iBakedModel = Minecraft.getMinecraft().getRenderItem().getItemModelMesher().getItemModel(stack); TextureAtlasSprite textureAtlasSprite = Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite(iBakedModel.getTexture().getIconName()); Minecraft.getMinecraft().getTextureManager().bindTexture(TextureMap.locationBlocksTexture); Tessellator tessellator = Tessellator.getInstance(); int height = dim, width = dim; WorldRenderer worldrenderer = tessellator.getWorldRenderer(); //worldrenderer.addVertexData(vertexData); worldrenderer.startDrawingQuads(); worldrenderer.addVertexWithUV((double)(x), (double)(y + height), 0.0, (double)textureAtlasSprite.getMinU(), (double)textureAtlasSprite.getMaxV()); worldrenderer.addVertexWithUV((double)(x + width), (double)(y + height), 0.0, (double)textureAtlasSprite.getMaxU(), (double)textureAtlasSprite.getMaxV()); worldrenderer.addVertexWithUV((double)(x + width), (double)(y), 0.0, (double)textureAtlasSprite.getMaxU(), (double)textureAtlasSprite.getMinV()); worldrenderer.addVertexWithUV((double)(x), (double)(y), 0.0, (double)textureAtlasSprite.getMinU(), (double)textureAtlasSprite.getMinV()); tessellator.draw(); [/embed]
  9. I know this is marked as solved but i just wanted to post my code and how it works for me. My item class [embed=425,349]package com.lothrazar.samscontent.item; import java.util.ArrayList; import java.util.List; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.effect.EntityLightningBolt; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.EnumDyeColor; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.item.ItemTool; import net.minecraft.util.BlockPos; import net.minecraftforge.event.entity.player.PlayerInteractEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.registry.GameRegistry; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import com.google.common.collect.Lists; import com.lothrazar.samscontent.ModLoader; import com.lothrazar.util.*; public class ItemBaseWand extends Item { public ItemBaseWand() { super(); this.setHasSubtypes(true); this.setMaxDamage(0); this.setMaxStackSize(1); this.setCreativeTab(ModLoader.tabSamsContent); /* * * ModelBakery.class * ItemDye.class * * this.variantNames.put(Items.dye, Lists.newArrayList(new String[] {"dye_black", "dye_red", "dye_green", "dye_brown", "dye_blue", "dye_purple", "dye_cyan", "dye_silver", "dye_gray", "dye_pink", "dye_lime", "dye_yellow", "dye_light_blue", "dye_magenta", "dye_orange", "dye_white"})); * */ } @Override public String getUnlocalizedName(ItemStack stack) { int i = stack.getMetadata(); return super.getUnlocalizedName() + "_" + i; } public final static int MAX_META = 19; @Override @SideOnly(Side.CLIENT) public void getSubItems(Item itemIn, CreativeTabs tab, List subItems) { for (int i = 0; i < MAX_META; ++i) { subItems.add(new ItemStack(itemIn, 1, i)); } } public static void addRecipe() { GameRegistry.addRecipe(new ItemStack(ItemRegistry.baseWand) ,"beb" ," b " ," b " , 'e', Items.emerald , 'b', Items.blaze_rod ); if(ModLoader.configSettings.uncraftGeneral) GameRegistry.addSmelting(ItemRegistry.wandBuilding, new ItemStack(Items.emerald,1,0),0); } @SubscribeEvent public void onPlayerInteract(PlayerInteractEvent event) { ItemStack held = event.entityPlayer.getCurrentEquippedItem(); if(held == null) { return; }//empty hand so do nothing if(held.getItem() != ItemRegistry.baseWand ) {return;} if( event.action.LEFT_CLICK_BLOCK == event.action )//TODO: is left click a good strat { int meta = held.getItemDamage(); if(meta >= this.MAX_META) held.setItemDamage(0); else held.setItemDamage(meta + 1);//TODO: shift goes backword System.out.println(held.getItemDamage()); } else { } } } [/embed] Of course i register the item the normal way [embed=425,349] GameRegistry.registerItem(item, name);[/embed] And in my client proxy I have this: [embed=425,349] ItemModelMesher mesher = Minecraft.getMinecraft().getRenderItem().getItemModelMesher(); String name; Item item; for(Block b : BlockRegistry.blocks) { item = Item.getItemFromBlock(b); name = Reference.TEXTURE_LOCATION + b.getUnlocalizedName().replaceAll("tile.", ""); mesher.register(item, 0, new ModelResourceLocation( name , "inventory")); } for(Item i : ItemRegistry.items) { name = Reference.TEXTURE_LOCATION + i.getUnlocalizedName().replaceAll("item.", ""); mesher.register(i, 0, new ModelResourceLocation( name , "inventory")); System.out.println("iii :: "+name); } for (int i = 0; i < ItemBaseWand.MAX_META; ++i) { mesher.register(ItemRegistry.baseWand, i, new ModelResourceLocation(Reference.TEXTURE_LOCATION + "base_wand_"+i , "inventory")); } ModelBakery.addVariantName(ItemRegistry.baseWand, Reference.TEXTURE_LOCATION +"base_wand_0",Reference.TEXTURE_LOCATION +"base_wand_1"); [/embed] Feel free to ask questions or if you want github link. I am sure i could have done things better or in a different way, i am not an expert. My item does switch textures when the data value changes from 0,1,2, etc
×
×
  • Create New...

Important Information

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