Jump to content

Firestarme

Members
  • Posts

    17
  • Joined

  • Last visited

Converted

  • Gender
    Undisclosed

Firestarme's Achievements

Tree Puncher

Tree Puncher (2/8)

3

Reputation

  1. yeh, i used @EventHandeler, but i cant see why @preInit wouldn't work
  2. It seems that registerIcons only gets called if you register the block/item in preInit. What confuses me is what the string in the par1IconRegister.registerIcon() actually means. Is it supposed to be a path, the file names of the textures (if so, then why the colons) or something completely different. The reason im asking is that i am trying to apply different icons to different damage items, so if i add a +3 to Main.modid +":"+ this.getUnlocalizedName() will it load modidname3 ?
  3. ive been trying to create a custom block by following a tutorial written for modloader ( http://www.minecraftforum.net/topic/1483366-universal-subarakis-one-stop-custom-block-tutorial-make-it-with-techne/ ) but i think there is something i am missing. The problem i am having is converting the normal block to the one rendered by the tile entity. my code: Block:https://github.com/Firestarme/Fires_Cars/blob/Development/common/firestarme/fires_cars/common/BlockMachine.java Render:https://github.com/Firestarme/Fires_Cars/blob/Development/common/firestarme/fires_cars/common/RenderMachine.java ItemBlock:https://github.com/Firestarme/Fires_Cars/blob/Development/common/firestarme/fires_cars/common/ItemBlockMachine.java TileEntity:https://github.com/Firestarme/Fires_Cars/blob/Development/common/firestarme/fires_cars/common/TileEntityMachine.java Main :https://github.com/Firestarme/Fires_Cars/blob/Development/common/firestarme/fires_cars/common/fires_carsMain.java Model :https://github.com/Firestarme/Fires_Cars/blob/Development/common/firestarme/fires_cars/common/ModelDerrik.java
  4. My current system uses motion, but that only gets what direction the player is trying to move, not what keys are being pressed ( i may try to separate the motion in to two vectors representing ad & ws but i recon there is an easier way to do this). Position is much the same as motion, and would be very hard to resolve back to the original keys. Finally, a key handler was my first idea for controlling motion, unfortunately, it overrides vanilla key bindings so when the player exits the car, they can no longer move.
  5. Ive been trying to make a vehicle mod, but the only way i can find of allowing the player to control motion is by using the mounted entity's motion values. What i want to achieve is for the ws keys to control forward/backward motion and for the ad keys to steer it. Is there any way of tapping in to the player's key handler so it can be used to control the car ?
  6. If you are interested in making a custom block from scratch, take a look at this : http://www.minecraftforum.net/topic/1483366-universal-subarakis-one-stop-custom-block-tutorial-make-it-with-techne/ its written for modloader, but most of the code is still relevant and very useful. I find it is also very good at explaining what some of the numbers do, so you are able to fiddle around with them and create your own features.
  7. From what you have said, i believe you are trying to make something happen when an entity is right-clicked with a certain item. I don't think there is a specific function for doing this, but try putting this in the target entity's code: public boolean interact(EntityPlayer par1) { if(par1.getCurrentEquippedItem().getItem().shiftedIndex == <your item>.shiftedIndex) { <your code here> return true; } else { return false; } Basically, this is called when you right-click an entity. Then, it compares the players currently equipped item to the one you want them to use. if they are holding that item, it executes your code, otherwise it does nothing. hope this helped
  8. public boolean interact(EntityPlayer par1EntityPlayer){ // add your code here } you would have to put this in the EntityPlayer.class. The argument par1EntityPlayer is the player that has right clicked the other player
  9. i have recently created a car entity, but when you are in the car, it randomly jumps up and down. i have reveiwed the code and i really don't know what is causing this. the EntityVehicle class: (code deactivated with // omitted) package firestarme.fires_cars.common; import net.minecraft.src.AABBPool; import net.minecraft.src.AxisAlignedBB; import net.minecraft.src.DamageSource; import net.minecraft.src.Entity; import net.minecraft.src.EntityPlayer; import net.minecraft.src.ModLoader; import net.minecraft.src.NBTTagCompound; import net.minecraft.src.World; import org.lwjgl.input.Keyboard; public class EntityVehicle extends Entity{ public float speed = 0; public float maxSpeed; public float fallSpeed = 0; public float maxFallSpeed = 0.4F; public float acceleration; public float drag; public float yaw; public boolean isOffroad = false; public float climbAcceleration; public float climb = 0F; public boolean mounted = false; public Entity passenger; public double velocityX; public double velocityY; public double velocityZ; public EntityVehicle(World par1World) { super(par1World); // TODO Auto-generated constructor stub } @Override protected void entityInit() { // TODO Auto-generated method stub } @Override protected void readEntityFromNBT(NBTTagCompound var1) { // TODO Auto-generated method stub } @Override protected void writeEntityToNBT(NBTTagCompound var1) { // TODO Auto-generated method stub } } public void addSpeed(float Sp){ if(speed < maxSpeed){ speed = speed + Sp; } } public void addfallSpeed(float Fsp){ if(fallSpeed < maxFallSpeed){ fallSpeed = fallSpeed + Fsp; } } public void applyDrag(){ if(speed > 0.01){ this.addSpeed(-drag); }else if(speed < 0.01){ this.speed = 0; }else{ speed = 0; } } public boolean attackEntityFrom(DamageSource par1DamageSource, int par2) { if (this.func_85032_ar()) { return false; } else if (!this.worldObj.isRemote && !this.isDead) { this.dropItemWithOffset(fires_carsMain.Car.shiftedIndex, 1, 0.0F); this.setDead(); } return true; } public void onUpdate(){ if(this.riddenByEntity != null){ this.motionX += this.riddenByEntity.motionX; this.motionZ += this.riddenByEntity.motionZ; } move(); } public void move() { if(riddenByEntity != null) { velocityZ = Math.cos(rotationYaw * 0.0174532925) * speed; velocityX = Math.sin(rotationYaw* 0.0174532925) * -speed; if(isCollidedHorizontally) { velocityY = -fallSpeed; } velocityZ = 0.0002; this.addVelocity(velocityX, velocityY, velocityZ); this.moveEntity(this.motionX, this.motionY, this.motionZ); } } public boolean interact(EntityPlayer par1EntityPlayer) { if (this.riddenByEntity != null && this.riddenByEntity instanceof EntityPlayer && this.riddenByEntity != par1EntityPlayer) { return true; } else { if (!this.worldObj.isRemote) { par1EntityPlayer.mountEntity(this); } return true; } } public AxisAlignedBB getCollisionBox(Entity par1Entity) { return par1Entity.boundingBox; } public AxisAlignedBB getBoundingBox() { return this.boundingBox; } } and yes, i know its a bit of a mess at the moment, but i will clean it up when it is finished.
  10. all the tutorials with openGl are insanely complex and based around coding your own game. While trying to render my own entities, i found this : http://www.minecraftforum.net/topic/1483366-universal-subarakis-one-stop-custom-block-tutorial-make-it-with-techne/ its written for modloader but it explains rendering well. It may even help you more as it is made for creating custom blocks.
  11. i don't think it is as complex as it seems, so i wrote out a little example below. This probably wont work straight off, but it may give you something to start on . try declaring an int for the orientation, then 6 arrays, one for each block side. int orientation; int side1[]; int side2[]; // etc. then write out the arrays so that array[orientation] = the texture icon you want. int side1[] = {1,1,1,0}; int side2[] = {1,1,0,1}; //etc. then use getBlockTextureFromSide public int getBlockTextureFromSide(int side){ switch(side){ case 1: return side1[orientation]; break; case 2: return side2[orientation]; break; //etc. } } then use this tutorial to help you save the variable orientation so that it is not reset when the client is closed. http://www.minecraftforge.net/wiki/How_to_use_NBT_Tag_Compound
  12. for everyone else who is having the same problem, have a look at this tutorial. http://www.minecraftforum.net/topic/1483366-universal-subarakis-one-stop-custom-block-tutorial-make-it-with-techne/ It is written for modloader and it is for making custom blocks, but it explains the render file really well.
  13. ah, i see what you mean. I tried to do that my self, but i found it is far easier to use several meta-data blocks as the orientation. However, i tried creating a tile entity and using nbt tagging to save the texture for each block. I never got it to work, but im quite new to modding so you may have a better chance
  14. look at the vanilla furnace code, that changes the meta data of the block dependent on where the player is facing(which i think is what you are trying to achieve )
  15. I am working on my first mod and i have really thrown myself in at the deep end . I am trying to make a mod with various cars trucks etc. , but i don't have a clue how to render it. I have tried adapting the boat renderer but that does not seem to work. Can anyone help me or point me towards a good tutorial about rendering entities.
×
×
  • Create New...

Important Information

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