Jump to content

Jammy780

Members
  • Posts

    23
  • Joined

  • Last visited

Everything posted by Jammy780

  1. Hello, I think this is probably just me being stupid but I cannot find out how to do this. I have sound working in my mod however, when the volume is changed it doesn't effect the volume of my mods sound. I used the tutorial found here: http://www.minecraftforge.net/wiki/Sounds_For_Forge_1.3.2 which makes it work perfect just without volume change. Edit: Never mind it does change the volume, it didn't before. The other thing is when I play the sound, I want it to stop when the block stops being active (or when its destroyed), I've checked how the furnace does it with its animation but it doesn't stop the sound and I can't find anything to show a way to stop the sound. The sound I use is quite long so maybe I need to get short sounds since it seems minecraft uses short sounds? Thanks for the help, Jammy780
  2. Thanks for replying, I've taken another look and I understand how they work, but I don't understand how I can put the texture on my block. As far as I can gather, they override the texture in the block index to make it animated, which I can do with mine but I don't understand how it attaches itself to the block since mine is a custom rendered block with an individual texture file.
  3. Hello everyone, I'm trying to add TextureFX to a custom rendered block and I don't know how! I understand how it does it for the watch but I just cannot understand how I can add it to a block. Ok, well this is the block I want to add the texture too: http://i.imgur.com/Enz5f.png I'm trying to make it similar to the watch, I just don't understand how I can make the animated texture "attach" itself to the block, I think I've got to add it to the render file but I'm not sure how and where. If somebody could just point me in the right direction it would be so helpful! Please can somebody help me before I shout like a maniac! Thank you in advance
  4. Thank you so much, it was just that bit of info I needed. I understand how it works now and I now have a working double block!! I love you so much! You help but don't spoon feed which is soooo much better because it means we actually learn! Thanks again!
  5. It's the same block class its just placing two next to each other.
  6. Hello there! I've been trying to make a block that is two blocks along (like a door on its side) I have managed to create the block side by side, but the trouble I am having now is when I destroy it. I've managed to get it to destroy both parts but it also destroys the block behind it too. I have already checked the door block class and also the bed but I just cannot figure it out and its getting really annoying! If somebody could show me a tutorial or just point me in the right direction I would be very very great full! Thank you in advance, Jammy780
  7. Go to .minecraft and find the modloader.txt and forge logs and paste them here. Then somebody can help you.
  8. Do you mean so a user can load your mod, close Minecraft and change ID's of blocks/items that you allow them to? If this is what you mean then yes. If not then could you explain more please?
  9. I'm sure I did that already! it worked, thank you so much!
  10. This issue only happened in SMP. I would sit down but be in a position like in the image in the main post. It only happens after I updated from build 72. I'm not using the whole old version, I'm only using two files from build 72. I'm not actually supposed to render anything, it only happens when I sit down which is supposed to be an invisible entity for the player to sit down on.
  11. I'VE FIXED IT!! WOOHOOOOOOO! HOWEVER it does mean I have to use a modified version of Forge now . It seems to be the changes in this build: http://lexmanos.no-ip.org:8080/job/Forge/83/changes#detail0 I copied an older build of the code (build 72 and the two files were PacketEntitySpawn.java and PacketHandlerClient.java) all I had to do was fix a couple of problems (extend PacketHandlerBase, add unimplemented methods and change one bit of code (check below)) and it works like a charm now. Not sure why this problem happens, could a forge god explain why please? change: if (networkmod.toString().equals(entry.getValue())) { ForgeHooks.networkMods.put(entry.getKey(), networkmod); } to: if (networkmod.toString().equals(entry.getValue())) { ForgeHooks.networkMods.put((Integer) entry.getKey(), networkmod); }
  12. It's not a tile entity, just an entity like a boat or minecart but it doesn't move.
  13. Thank you for your help so far but I have no idea where I'd start to debug it, maybe I'm thinking about it wrong but nothing I seem to do changes the white column. It's really annoying Anymore ideas what might be causing it? I've tried adding a render file but it still shows up.
  14. So I need to make a blank render file? Like I would for a normal entity just don't include anything to actually render anything?
  15. This should help you. http://www.minecraftforum.net/topic/1067901-how-to-make-a-minecraft-mod-tutorials-with-videos-14042012/page__fromsearch__1
  16. Hi there, I'm having some problems and I think its forge related because when I used an older version of Forge it worked without error. This is my problem: That white block never came up before, but now every chair I sit on it comes up with this. Note: this works fine in SSP, the problem is only in SMP! Please could somebody offer some help? these are the codes I'm using: Mod file code SSP/SMP: MinecraftForge.registerEntity(EntityMountableBlock.class, mod_JammyFurniture.instance, 5, 5, 160, true); BlockMountable.java in SSP/SMP package net.minecraft.src.JAMMY780.util; import java.util.List; import net.minecraft.src.AxisAlignedBB; import net.minecraft.src.Block; import net.minecraft.src.EntityPlayer; import net.minecraft.src.Material; import net.minecraft.src.World; /*ITOS: MP client version. *This class is for your convenience. It is not necessary for your block to be a subclass of this class. *As long as your block has and/or calls the methods specified here it can use the EntityMountableBlock *class. If your class is a subclass to this class you don't have to do anything to be able to mount it, *just make sure that the blockActivated methods are not overridden. */ public class BlockMountable extends Block { //This constructor just pass thing on. public BlockMountable(int x, Material material) { super(x, material); } //This constructor just pass thing on. public BlockMountable(int x, int y, Material material) { super(x, y, material); } //This method use the main blockActivated with the default mounting position. public boolean blockActivated(World world, int i, int j, int k, EntityPlayer entityplayer) { return blockActivated(world, i, j, k, entityplayer, 0.5F, 1.0F, 0.5F, 0, 0, 0, 0); } //This method use the main blockActivated with a custom mounting height. public static boolean blockActivated(World world, int i, int j, int k, EntityPlayer entityplayer, float y) { return blockActivated(world, i, j, k, entityplayer, 0.5F, y, 0.5F, 0, 0, 0, 0); } //This is the main blockActivated method that specifies what happens when a player interact with the block. public static boolean blockActivated(World world, int i, int j, int k, EntityPlayer entityplayer, float x, float y, float z, int north, int south, int east, int west) { if (!world.isRemote) { //Looks for EMBs up to 1 block away from the activated block. Hopefully you didn't set the mounting position further away than this. List<EntityMountableBlock> list = world.getEntitiesWithinAABB(EntityMountableBlock.class, AxisAlignedBB.getBoundingBoxFromPool(i, j, k, i + 1.0D, j + 1.0D, k + 1.0D).expand(1D, 1D, 1D)); for (EntityMountableBlock entitytocheck : list) { //Looks for an EMB created by this block. if (entitytocheck.orgBlockPosX == i && entitytocheck.orgBlockPosY == j && entitytocheck.orgBlockPosZ == k) { //Player wants to get off the block. if (entitytocheck.riddenByEntity == entityplayer) { entitytocheck.interact(entityplayer); return true; } //EMB is used by someone else. if (entitytocheck.riddenByEntity != entityplayer && entitytocheck.riddenByEntity != null) { return true; } //EMB exist but no-one is sitting on it (bug). entitytocheck.setDead(); break; } } //Sets coordinates for mounting a north oriented block. float mountingX = i + x; float mountingY = j + y; float mountingZ = k + z; //Changes coordinates for mounting to compensate for none-north block orientation. if(north != south) { int md = world.getBlockMetadata(i, j, k); if (md == east) { mountingX = i + 1 - z; mountingZ = k + x; } else if (md == south) { mountingX = i + 1 - x; mountingZ = k + 1 - z; } else if (md == west) { mountingX = i + z; mountingZ = k + 1 - x; } } //Creates a new EMB if none had been created already or if the old one was bugged. EntityMountableBlock nemb = new EntityMountableBlock(world, entityplayer, i, j, k, mountingX, mountingY, mountingZ); world.spawnEntityInWorld(nemb); nemb.interact(entityplayer); return true; } return true; } } EntityMountableBlock.java - SSP package net.minecraft.src.JAMMY780.util; import net.minecraft.src.Entity; import net.minecraft.src.EntityPlayer; import net.minecraft.src.NBTTagCompound; import net.minecraft.src.Profiler; import net.minecraft.src.World; import net.minecraft.src.forge.IEntityInteractHandler; /*ITOS: MP client version. *This class acts as a bridge between the mountable block and the player. *This entity is what the player actually mounts instead of the block. *An entity of this class is created by the mountable block upon activation *and is killed when it's no longer used. */ public class EntityMountableBlock extends Entity { //These variables keep track of the block that created the entity. A bit backwards, I know. public int orgBlockPosX; public int orgBlockPosY; public int orgBlockPosZ; public int orgBlockID; public EntityMountableBlock (World world) { super(world); } //This constructor seems to be required by ModLoaderMp. public EntityMountableBlock (World world, double d, double d1, double d2) { super(world); noClip = true; preventEntitySpawning = true; width = 0.0F; height = 0.0F; setPosition(d, d1, d2); } //This constructor is called by the mountable block. public EntityMountableBlock (World world, EntityPlayer entityplayer, int i, int j, int k, float mountingX, float mountingY, float mountingZ) { super(world); noClip = true; preventEntitySpawning = true; width = 0.0F; height = 0.0F; orgBlockPosX = i; orgBlockPosY = j; orgBlockPosZ = k; orgBlockID = world.getBlockId(i, j, k); setPosition(mountingX, mountingY, mountingZ); } //This method handles mounting and dismounting. public boolean interact(EntityPlayer entityplayer) { if (!super.interact(entityplayer)) { if (!worldObj.isRemote && (riddenByEntity == null || riddenByEntity == entityplayer)) { entityplayer.mountEntity(this); return true; } else { return false; } } else { return true; } } //The following methods are for most parts redundant, simplified versions of those in Entity but they also delete unused EMBs. public void onUpdate() { onEntityUpdate(); } public void onEntityUpdate() { Profiler.startSection("entityBaseTick"); if(riddenByEntity == null || riddenByEntity.isDead) { setDead(); } else if(worldObj.getBlockId(orgBlockPosX, orgBlockPosY, orgBlockPosZ) != orgBlockID) { interact((EntityPlayer) riddenByEntity); } ticksExisted++; Profiler.endSection(); } //The following methods are required by the Entity class but I don't know what they are for. public void entityInit() {} public void readEntityFromNBT(NBTTagCompound nbttagcompound) {} public void writeEntityToNBT(NBTTagCompound nbttagcompound) {} } EntityMountableBlock.java - SMP package net.minecraft.src.JAMMY780.util; import net.minecraft.src.Entity; import net.minecraft.src.EntityPlayer; import net.minecraft.src.EntityPlayerMP; import net.minecraft.src.ModLoader; import net.minecraft.src.NBTTagCompound; import net.minecraft.src.Packet39AttachEntity; import net.minecraft.src.Profiler; import net.minecraft.src.World; import net.minecraft.src.forge.IEntityInteractHandler; /*ITOS: MP server version. *This class acts as a bridge between the mountable block and the player. *This entity is what the player actually mounts instead of the block. *An entity of this class is created by the mountable block upon activation *and is killed when it's no longer used. */ public class EntityMountableBlock extends Entity { //These variables keep track of the block that created the entity. A bit backwards, I know. public int orgBlockPosX; public int orgBlockPosY; public int orgBlockPosZ; public int orgBlockID; public EntityMountableBlock (World world) { super(world); } //This constructor seems to be required by ModLoaderMp. public EntityMountableBlock (World world, double d, double d1, double d2) { super(world); noClip = true; preventEntitySpawning = true; width = 0.0F; height = 0.0F; setPosition(d, d1, d2); } //This constructor is called by the mountable block. public EntityMountableBlock (World world, EntityPlayer entityplayer, int i, int j, int k, float mountingX, float mountingY, float mountingZ) { super(world); noClip = true; preventEntitySpawning = true; width = 0.0F; height = 0.0F; orgBlockPosX = i; orgBlockPosY = j; orgBlockPosZ = k; orgBlockID = world.getBlockId(i, j, k); setPosition(mountingX, mountingY, mountingZ); } //This method handles mounting and dismounting. public boolean interact(EntityPlayer entityplayer) { if (!super.interact(entityplayer)) { if (!worldObj.isRemote && (riddenByEntity == null || riddenByEntity == entityplayer)) { entityplayer.mountEntity(this); Packet39AttachEntity packet = new Packet39AttachEntity(entityplayer, this); for(Object entity : ModLoader.getMinecraftServerInstance().configManager.playerEntities) { EntityPlayerMP player = (EntityPlayerMP)entity; if(entityplayer.entityId == player.entityId) continue; player.playerNetServerHandler.sendPacket(packet); } return true; } else { return false; } } else { return true; } } //The following methods are for most parts redundant, simplified versions of those in Entity but they also delete unused EMBs. public void onUpdate() { onEntityUpdate(); } public void onEntityUpdate() { Profiler.startSection("entityBaseTick"); if(riddenByEntity == null || riddenByEntity.isDead) { setDead(); } else if(worldObj.getBlockId(orgBlockPosX, orgBlockPosY, orgBlockPosZ) != orgBlockID) { interact((EntityPlayer) riddenByEntity); } ticksExisted++; Profiler.endSection(); } //The following methods are required by the Entity class but I don't know what they are for. public void entityInit() {} public void readEntityFromNBT(NBTTagCompound nbttagcompound) {} public void writeEntityToNBT(NBTTagCompound nbttagcompound) {} } BlockActivated from both of my chairs - SSP/SMP public boolean blockActivated(World world, int i, int j, int k, EntityPlayer entityplayer) { int l = world.getBlockMetadata(i, j, k); if(entityplayer.getCurrentEquippedItem() != null && entityplayer.getCurrentEquippedItem().getItem() instanceof ItemSign) { return false; } else { l %= 4; if(l == 0) { entityplayer.rotationYaw = 180F; } if(l == 1) { entityplayer.rotationYaw = -90F; } if(l == 2) { entityplayer.rotationYaw = 0F; } if(l == 3) { entityplayer.rotationYaw = 90F; } float x = 0, y = 0, z = 0; if(l == 0) { x = 0.5F; y = 0.5F; z = 0.5F; } if(l == 1) { x = 0.5F; y = 0.5F; z = 0.5F; } if(l == 2) { x = 0.5F; y = 0.5F; z = 0.5F; } if(l == 3) { x = 0.5F; y = 0.5F; z = 0.5F; } return BlockMountable.blockActivated(world, i, j, k, entityplayer, x, y, z, 0, 2, 1, 3); } }
  17. Just about by the looks of his subs. Glad it helped, nobody would help me when I tried to find the same thing. If you need anymore help please ask!
  18. I had the same problem when I first started modding. Check this out, this guy is amazing. I'd recommend subbing him. The video is in four parts. Hope it helps you
  19. Well one thing I've wanted recently is this; I have a plant pot block and want to be able to make it so you can use flowers/saplings/ect on it without having to edit the base files. I know it's only something simple and probably pointless but if it's easy to do then I'd appreciate it
  20. I love you. <3 Thank you so much I misunderstood what you meant, but it works perfectly now, thank you so so so much!!
  21. This? ModLoader.registerEntityID(EntityMountableBlock.class, "MountableBlock", 242); I've done that and it still doesn't do anything and also the "Could not find entity info for 0 : -14" isn't coming up anymore. It only comes up when I use MinecraftForge.registerEntity();
  22. Hey, I'm having a problem with registering my entities. This is the code I'm using at the moment; MinecraftForge.registerEntity(EntityMountableBlock.class, mod_JammyFurniture.instance, 242, 5, 160, false); I get the error: Could not find entity info for 0 : -14 I get the same error for this; ModLoader.registerEntityID(EntityMountableBlock.class, "MountableBlock", 242); and the same if I have both of them together. I had it working on SMP without Forge but now its not working, it works perfectly in SSP. The code I had before on for ModLoaderMP was this: ModLoaderMp.registerNetClientHandlerEntity(EntityMountableBlock.class, 242); That worked perfectly so I know that its the way I'm registering them. Also something else to note; this entity is supposed to allow me to sit on a chair, it bends my legs like I'm sat in the chair but I can still move around and if I press F5 I can see my legs bent as I'm walking. Any help will be greatly appreciated. Kind regards
×
×
  • Create New...

Important Information

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