Jump to content

Lua

Members
  • Posts

    191
  • Joined

  • Last visited

Converted

  • Gender
    Male
  • Location
    United Kingdom
  • Personal Text
    Dev of Arcticraft

Lua's Achievements

Creeper Killer

Creeper Killer (4/8)

3

Reputation

  1. Hi, Im adding background music but Ive ran into a problem making sure no other music is playing before I play mine. Heres what I got @SubscribeEvent public void playMyMusic(ClientTickEvent event) { Random rand = new Random(); ISound soundCache = null; SoundHandler handler = Minecraft.getMinecraft().getSoundHandler(); int i = rand.nextInt(1000); if(soundCache == null || !handler.isSoundPlaying(soundCache)) { if(i == 0) { System.out.println("playing sound"); soundCache = new PositionedSoundRecord(new ResourceLocation(Arcticraft.MOD_ID + ":records.frozen_feelings"), 1.0F, 1.0F, 1.0F, 1.0F, 1.0F); handler.playSound(soundCache); } } } My sound plays but it will play over the top of any currently playing which I dont want. Obviously, its playing because soundCache does = null but thats because I have no idea how ISound works and didnt get any google results.
  2. I bind the texture to the model in TESR but I just wanted the icons to be different and now they are. getIconFromDamage was exactly what I needed.
  3. Yeah, i just need the icons to be differenet thats all.
  4. In the item class I did register em with and now theyre just invisible. @SideOnly(Side.CLIENT) public static final String[] iciclesTextures = new String[]{"icicle", "icicle", "icicle", "icicle_ud","icicle_ud", "icicle_ud"}; @SideOnly(Side.CLIENT) private IIcon[] texture; public void registerIcons(IIconRegister iconRegister) { this.texture = new IIcon[iciclesTextures.length]; for (int i = 0; i < iciclesTextures.length; ++i) { this.texture[i] = iconRegister.registerIcon(Arcticraft.MOD_ID + ":" + iciclesTextures[i]); } } Im not quite sure how I would just render em on RenderItem
  5. Ok so I tried making a IItemRenderer and I came up with this and yes I registered it in the clientProxy. package net.arcticraft.item.render; import net.arcticraft.main.Arcticraft; import net.minecraft.item.ItemStack; import net.minecraftforge.client.IItemRenderer; public class ItemIcicleRender implements IItemRenderer{ public ItemIcicleRender(){} @Override public boolean handleRenderType(ItemStack item, ItemRenderType type) { return true; } @Override public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) { return true; } @Override public void renderItem(ItemRenderType type, ItemStack item, Object... data) { System.out.println(item.getItemDamage()); if(item.getItemDamage() == 0 && item.getItemDamage() == 1 && item.getItemDamage() == 2) { item.getItem().setTextureName(Arcticraft.MOD_ID + ":icicle"); } else { item.getItem().setTextureName(Arcticraft.MOD_ID + ":icicle_ud"); } } } But they just come up as the missing texture texture(the purple black squares one). Is this because I commented out the getIcon and registerIcon in the block method? Probably, but I shouldnt need em should since its a tileentity w/ model and it uses the same texture.
  6. Is there a way to check that no background music is already playing first before I play mine?
  7. Yeah, the icon in your hand. Not the actual block texture.
  8. Noooo, the texture for the actual blocks should be the same, I just want the icons to differ.
  9. package net.arcticraft.tileentity.renderers; import net.arcticraft.block.BlockIcicle; import net.arcticraft.main.Arcticraft; import net.arcticraft.tileentity.TileEntityIcicle; import net.arcticraft.tileentity.models.ModelBlockIcicle; import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ResourceLocation; import org.lwjgl.opengl.GL11; import cpw.mods.fml.client.FMLClientHandler; public class TileEntityIcicleRender extends TileEntitySpecialRenderer{ private ModelBlockIcicle model; public TileEntityIcicleRender(){ model = new ModelBlockIcicle(); } public void renderAModelAt(TileEntityIcicle tileEntity, double x, double y, double z, float f) { TileEntityIcicle icicle = (TileEntityIcicle) tileEntity; icicle = (TileEntityIcicle) tileEntity.getWorldObj().getTileEntity(tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord); int meta = 0; if(tileEntity.getWorldObj() != null) { meta = tileEntity.getBlockMetadata(); icicle.rotation = meta; } FMLClientHandler.instance().getClient().renderEngine.bindTexture(new ResourceLocation(Arcticraft.MOD_ID, "textures/blocks/modeled_blocks/icicle.png")); GL11.glPushMatrix(); GL11.glEnable(GL11.GL_NORMALIZE); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glTranslatef((float) x + 0.5F, (float) y + 1.5F, (float) z + 0.5F); GL11.glScalef(1.0F, -1F, -1F); GL11.glRotatef(icicle.rotation * 90, 0.0F, 1.0F, 0.0F); if(icicle.type == 0 || icicle.type == 3) { // large GL11.glScalef(2.0F, 1.0F, 1F); } else if(icicle.type == 1 || icicle.type == 4) { // regular GL11.glScalef(1.5F, 1F, 1F); } else if(icicle.type == 2 || icicle.type == 5) { // small GL11.glScalef(1.0F, 1F, 1F); } if(icicle.upsideDown){ GL11.glRotatef(180, 1, 0, 0); GL11.glTranslatef(0, (float) -1.5F, 0); } model.renderAll(); GL11.glPopMatrix(); } @Override public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float par8) { this.renderAModelAt((TileEntityIcicle) tileEntity, x, y, z, par8); } }
  10. So what could I do instead? Because right now they all just use the icicle icon.
  11. Hi, I've created a metadata block with 6 subtypes(0-5). The block is a tile entity with a special renderer and it uses the same model but just rotated a bit. However, I want the icon for the 0-2 blocks to be one icon and the 3-5 blocks be another. Obviously, its got to with getIcon method but I can't get them to be different and I thought this would be a really simple task. Heres the relevant code: @SideOnly(Side.CLIENT) @Override public void registerBlockIcons(IIconRegister iconRegister) { this.blockIcon = iconRegister.registerIcon(Arcticraft.MOD_ID + ":icicle_ud"); this.icicle = iconRegister.registerIcon(Arcticraft.MOD_ID + ":icicle"); } @SideOnly(Side.CLIENT) public IIcon getIcon(int side, int meta) { if(meta == 3 || meta == 4 || meta == 5){ return this.blockIcon; } else{ return this.icicle; } }
×
×
  • Create New...

Important Information

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