
Naiten
Members-
Posts
325 -
Joined
-
Last visited
Everything posted by Naiten
-
[1.7.2][Not needed now]Making an uncollideable block
Naiten replied to Naiten's topic in Modder Support
Yes, he can. And what do you think I can describe more? I want the damn block not to collide any entity and not to stop my locomotive. -
[1.7.2][Not needed now]Making an uncollideable block
Naiten replied to Naiten's topic in Modder Support
I want to make a dynamic lighting for my locomotives, but this block somehow collides with the loco and stops it. -
Here's my code: public class BlockLight extends Block{ public BlockLight(Material par1){ super(Material.air); this.setLightLevel(1.0F); this.setResistance(1000.0F); this.blockParticleGravity = 0.0F; } @Override public boolean isCollidable(){ return false; } @Override public boolean canCollideCheck(int p_149678_1_, boolean p_149678_2_){ return false; } @Override public void onEntityCollidedWithBlock(World p_149670_1_, int p_149670_2_, int p_149670_3_, int p_149670_4_, Entity p_149670_5_){ Minecraft.getMinecraft().ingameGUI.getChatGUI().printChatMessage(new ChatComponentTranslation("ouch", new Object[0])); } @Override public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int i, int j, int k){ return null; } @Override public boolean isOpaqueCube(){ return false; } @Override public boolean renderAsNormalBlock() { return false; } @Override public int getRenderType(){ return -1; } @Override public int quantityDropped(Random par1Random){ return 0; } @Override public boolean canDropFromExplosion(Explosion par1Explosion){ return false; } } And it still collides (i'm getting „ouch“ messages). Any ideas?
-
Ugh... I can't understand it. Guess i have to wait for more detailed ones.
-
http://www.minecraftforge.net/wiki/Tutorials says that tutorial is for current version. I'm making key input.
-
I'm still updating my mod to 1.7.2, and now i have problem with packets. I follow next tutorial, but my IDE says „PacketHandler cannot be resolved to a type“. What shall i do?
-
Idk what was this caused by, but after i re-wrote the code in another way, the problem disappeared.
-
No, i'm spawning it in both sides. I only spawn effects on client.
-
So, here's the code for my projectile and part of the cannon code that launches the projectile. public class Shot_2 extends Entity{ public Shot_2(World par1World) { super(par1World); this.setSize(0.125F, 0.125F); this.entityCollisionReduction = 0.5F; } @Override public void onUpdate(){ this.onEntityUpdate(); } @Override public void onEntityUpdate(){ this.prevDistanceWalkedModified = this.distanceWalkedModified; this.prevPosX = this.posX; this.prevPosY = this.posY; this.prevPosZ = this.posZ; this.prevRotationPitch = this.rotationPitch; this.prevRotationYaw = this.rotationYaw; this.motionX *= 0.95; this.motionY *= 0.95; this.motionZ *= 0.95; if(this.posY < -64.0D){ this.kill(); } this.addVelocity(0, -0.004D, 0); this.doBlockCollisions(); int i = MathHelper.floor_double(posX); int j = MathHelper.floor_double(posY); int k = MathHelper.floor_double(posZ); if(worldObj.getBlockId(i, j, k) > 0){ worldObj.createExplosion(this, this.posX, this.posY, this.posZ, 4.0F, true); } this.posX += this.motionX; this.posY += this.motionY; this.posZ += this.motionZ; this.setPosition(this.posX, this.posY, this.posZ); } public boolean canBeRidden(){ return false; } @Override protected void playStepSound(int par1, int par2, int par3, int par4){ } @Override public AxisAlignedBB getCollisionBox(Entity par1Entity){ if(par1Entity != riddenByEntity && par1Entity.ridingEntity != this){ return this.boundingBox; } return null; } @Override public AxisAlignedBB getBoundingBox(){ return this.boundingBox; } @Override public boolean canBeCollidedWith(){ return false; } @Override public boolean canBePushed(){ return false; } @Override protected void readEntityFromNBT(NBTTagCompound nbttagcompound){ } @Override protected void writeEntityToNBT(NBTTagCompound nbttagcompound){ } } public void onEntityUpdate(){ ... if(shoot){ if(shooting == 0){ if(worldObj.isRemote){ for(byte i = 0; i < 23; i++){ muzzlePos.onUpdate(); worldObj.spawnParticle("explode", muzzlePos.getX(), muzzlePos.getY(), muzzlePos.getZ(), 0, 0, 0); } } worldObj.playSoundAtEntity(this, "row:howitzer_shot", 1.0F, 1.0F); Shot_2 shot = new Shot_2(worldObj); shot.setLocationAndAngles(...); shot.addVelocity(...); worldObj.spawnEntityInWorld(shot); } } } The problem is next — blocks are destroyed only in client world. After I save/load, all damaged blocks are restored. Any ideas how to fix this?
-
[1.6.x][Kinda like solved]Controlling player animations?
Naiten replied to Naiten's topic in Modder Support
Oh, okay. I gotta find something else instead... -
[1.6.x][Kinda like solved]Controlling player animations?
Naiten replied to Naiten's topic in Modder Support
When the player walks, walking animation is applied to player's model. When the player rides an entity, sitting or standing animation is applied. I want to apply walking animation while the player is riding an entity. What is not clear here? -
The title says. I have a rideable entity and i want to play ‟walking” animation for the riding player. How do i perform that?
-
Ughmm, no they are not. Moreover, the disposition may . I do use «sneak» unmount, 'cause it's default and any other is not known to me.
-
So, i have a ridable entity (actually, rolling stock for my RoW mod) and from some time dismounting it crashes the game. I have no idea why, and logs cannot lit a light on this. Here's the console: As i guess, significant lines are: java.lang.ArithmeticException: / by zero <...> All players: 1 total; [EntityClientPlayerMP['Player941'/301, l='MpServer', x=374,50, y=NaN, z=94,41]] I see that the crash is caused by the division by zero, and it's somehow connected with renderer, but where is the problem exactly? Or where should i try to find it? And how is renderer connected with dismounting? And second issue — if dismounting has run successfully and not crashed the game, the player is teleported to entity's X, Y + some value, Z coordinates. I don't like that and want to dismount player in a certain position, but can find not a line of code that performs dismounting. Any ideas where that method is situated and how can i effect it?
-
Is your model bigger than 1x1x1 cube? If yes, try messing with public AxisAlignedBB getRenderBoundingBox() in your TE.
-
//Into your TE class @SideOnly(Side.CLIENT) @Override public double getMaxRenderDistanceSquared(){ return 65536.0D; //Or any other number }
-
Take some word that can be used in the description of your mod, and add ‘craft’. Joking, but some famous mods do it just like that.
-
[1.6.2]Separating the code on client and server sides?
Naiten replied to Naiten's topic in Modder Support
Damn. I lost the sight of that. Tried what you've said, and the engine wasn't glitching. But wheel rotation broke, so i started messing with the code, and now i can't get «non-glitchy motion» state again -.- Facepalm. -
[1.6.2]Separating the code on client and server sides?
Naiten replied to Naiten's topic in Modder Support
Well, this is what i have come to: public void onEntityUpdate(){ /* * Code that is not concerned to motion * <...> */ if(this.worldObj.isRemote){ this.setPositionAndRotation(this.posX, this.posY, this.posZ, this.rotationYaw, this.rotationPitch); this.moveEntity(this.motionX, this.motionY, this.motionZ); this.correctCartPositionOnRail(); this.motionX *= 0.95; this.motionY *= 0.95; this.motionZ *= 0.95; }else{ /* * Code that does something with motion * <...> */ this.moveEntity(this.motionX, this.motionY, this.motionZ); this.correctCartPositionOnRail(); this.motionX *= 0.95; this.motionY *= 0.95; this.motionZ *= 0.95; } } And, what i got: http://www.youtube.com/watch?v=WA5JJtbYoNc Not really bad, but still kinda desynced, as i see. -
How do you get a custom modelled block to face the player?
Naiten replied to Jacknoshima's topic in Modder Support
1. If you are using TileEntity you don't need ISimpleBlockRenderingHandler. 2. adjustRotatePivotViaMeta() makes no sense at all. 3. Check out the tutorial section, there's one with working rotation. Briefly: //This goes into onBlockPlacedBy( int dir = MathHelper.floor_double((double)((entityLivingBase.rotationYaw * 4F) / 360F) + 0.5D) & 3; world.setBlockMetadataWithNotify(x, y, z, dir, 0); //This goes into renderer int dir = world.getBlockMetadata(i, j, k); GL11.glPushMatrix(); GL11.glTranslatef(0.5F, 0, 0.5F); GL11.glRotatef(dir * (-90F), 0F, 1F, 0F); /* * Place your rendering code here. */ GL11.glPopMatrix(); -
[1.6.4][1.6.2][1.5.2] [Forge] [SSP/SMP] Expanded Rails Mod v1.3
Naiten replied to BlazeAxtrius's topic in Mods
Colourful, but as for me, too unrealistic. Have luck. -
[1.6.2]Separating the code on client and server sides?
Naiten replied to Naiten's topic in Modder Support
I can't get why server would store position, but not motion. And how is movement or collision (physics, in more general terms) dealing with visuals? And if every client process movements by itself, can't they (clients) run with different frequency and desync? -
So, i have an entity with tons of different code in it's onUpdate(). And i know i can use if(worldObj.isRemote) to check if the code is run on server or client side. Now i want to understand which parts should i run on every side. For example, which side should i use when operating motion variables or moveEntity()?
-
No, it does not.