-
Posts
785 -
Joined
-
Last visited
Everything posted by ItsAMysteriousYT
-
Oh yea -LINESTRIP - sry
-
I created a custom vehicle entity that can be loaded from a simple txt file. Now i want that entities are saved through world saving. So i added an ID to my vehicleFIle(file comes in the entities construuctor to define it) and save this entity in onEntityWriteToNBT. Somehow the value is not there when the entity respawns. This is my saving code: @Override public void readEntityFromNBT(NBTTagCompound tagCompund) { NBTTagCompound vehicletag = tagCompund.getCompoundTag("VehicleTag"); this.fuellevel = vehicletag.getDouble("Fuel"); if (file == null) if (Vehicles.getFromId(vehicletag.getInteger("FileID")) != null) { this.file = Vehicles.getFromId(vehicletag.getInteger("FileID")); } } @Override public void writeEntityToNBT(NBTTagCompound tagCompund) { NBTTagCompound tag = new NBTTagCompound(); tag.setDouble("Fuel", this.fuellevel); tagCompund.setInteger("FileID", file.getID()); tagCompund.setTag("VehicleTag", tag); }
-
Spawning my entity causes gamecrash[STILL UNSOLVED]
ItsAMysteriousYT replied to ItsAMysteriousYT's topic in Modder Support
This happens: -
Spawning my entity causes gamecrash[STILL UNSOLVED]
ItsAMysteriousYT replied to ItsAMysteriousYT's topic in Modder Support
And the second constuctor with arguments - right. Just tried that afte ctx.getServerHandler().playerEntitity.worldObj didn't work. -
Spawning my entity causes gamecrash[STILL UNSOLVED]
ItsAMysteriousYT replied to ItsAMysteriousYT's topic in Modder Support
Okay - i wrote the packet, handler& stuff and now i call network.sendToServer() when the RETURN key is pressed, but somehow the vehicleEntity that i get from the id is null. This is my packetHandler Code: package itsamysterious.mods.reallifemod.core.packets; import java.util.UUID; import itsamysterious.mods.reallifemod.RealLifeMod; import itsamysterious.mods.reallifemod.core.lifesystem.RLMPlayerProps; import itsamysterious.mods.reallifemod.core.vehicles.EntityVehicle; import net.minecraft.client.Minecraft; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.util.IThreadListener; import net.minecraft.world.World; import net.minecraft.world.WorldServer; import net.minecraftforge.fml.common.network.simpleimpl.IMessageHandler; import net.minecraftforge.fml.common.network.simpleimpl.MessageContext; public class MountHandler implements IMessageHandler<MountVehicleMessage, MountVehicleMessage>{ @Override public MountVehicleMessage onMessage(final MountVehicleMessage message, final MessageContext ctx) { final EntityPlayer player = ctx.getServerHandler().playerEntity; IThreadListener mainThread = (WorldServer) ctx.getServerHandler().playerEntity.worldObj; // or Minecraft.getMinecraft() on the client mainThread.addScheduledTask( new Runnable() { @Override public void run() { World world = Minecraft.getMinecraft().theWorld; EntityVehicle v=(EntityVehicle)world.getEntityByID(message.vehicleId); if(v!=null){ v.interactFirst(ctx.getServerHandler().playerEntity); } } }); return null; } } and this is my packet: package itsamysterious.mods.reallifemod.core.packets; import java.util.UUID; import io.netty.buffer.ByteBuf; import itsamysterious.mods.reallifemod.core.vehicles.EntityVehicle; import net.minecraft.entity.player.EntityPlayer; import net.minecraftforge.fml.common.network.ByteBufUtils; import net.minecraftforge.fml.common.network.simpleimpl.IMessage; import net.minecraftforge.fml.common.registry.EntityRegistry; import sun.awt.image.ByteBandedRaster; public class MountVehicleMessage implements IMessage { public int vehicleId; public MountVehicleMessage(int id){ this.vehicleId=id; } @Override public void fromBytes(ByteBuf buf) { vehicleId = buf.readInt(); } @Override public void toBytes(ByteBuf buf) { buf.writeInt(vehicleId); } } -
Using rectangles wouldn't be good for that, they would be filled. Easier to use are GL11.GL_LINES or GL11.GL_LINE_STIPPLE You'll have to use the WorldRenderer for that. Do it like this: GLStateManager.pushMatrix() GLStateManager.pushAttrib(); WorldRenderer renderer =Tessellator.getInstance().getWorldRenderer(); renderer.startDrawing(GL11.GL_LINES); //Your code here e.e renderer.addVertex(x,y,z); Tessellator.getInstance().draw(); GLStateManager.popMatrix() GLStateManager.popAttrib(); EDIT: if you wanna change the color of the line do renderer.setColorOpaque(red, green, blue) or renderer.setColorRGBA(red, green, blue,alpha) the color/alpha values are all ints from 0-255 The difference between GL:LINES and GL_LINESTIPPLE is, that with GL_LINES every two vertices will be drawn as one line, means if you draw three vertices, the one will be invisible. If you wan't these lines to connect up use GL_LINESTIPPLE.
-
Spawning my entity causes gamecrash[STILL UNSOLVED]
ItsAMysteriousYT replied to ItsAMysteriousYT's topic in Modder Support
Oh - didn't see that post from Failender, thank you ALso - does anybody have an idea for that righclick problem? I checked every method, but found nothing that would explain that weird bug. Maybe im just blind -
Spawning my entity causes gamecrash[STILL UNSOLVED]
ItsAMysteriousYT replied to ItsAMysteriousYT's topic in Modder Support
What do i use then? -
Spawning my entity causes gamecrash[STILL UNSOLVED]
ItsAMysteriousYT replied to ItsAMysteriousYT's topic in Modder Support
Okay - can you help me mounting the entity with pressing enter? I know that ill have to send a packet, but not what to send in the packet. The player that should mount i have, but how can i get the entity that should be mounted/how can i send it? -
Spawning my entity causes gamecrash[STILL UNSOLVED]
ItsAMysteriousYT replied to ItsAMysteriousYT's topic in Modder Support
I think this method should normally work - as it does for the EntityBoat class too. public boolean interactFirst(EntityPlayer player) { if (this.riddenByEntity != null && this.riddenByEntity instanceof EntityPlayer && this.riddenByEntity != player) { return true; } else { if (!this.worldObj.isRemote) { player.mountEntity(this); } return true; } } I also looked if i probably cancel a PlayInteractWithEntityEvent or EntityInteractEvent somewhere, but didn't find anything. EDIT: There seam to be this error now, but it does not crash the game: -
Spawning my entity causes gamecrash[STILL UNSOLVED]
ItsAMysteriousYT replied to ItsAMysteriousYT's topic in Modder Support
Im trying to fix that problem for over two weeks now. The spawning stuff was just a bug that appeard along the process. If you found the problem, please tell me i really have run out of possible fixing ideas. Even the mounting with pressing enter won't work(Well, thats because i don't know how to propperly send the entityvehicle that i want to mount in a packet). -
Spawning my entity causes gamecrash[STILL UNSOLVED]
ItsAMysteriousYT replied to ItsAMysteriousYT's topic in Modder Support
What? Is it this simple? Im searching for a solution on this so long am i just missing something? -
Spawning my entity causes gamecrash[STILL UNSOLVED]
ItsAMysteriousYT replied to ItsAMysteriousYT's topic in Modder Support
Okay - i solved that spawning problem now - other bugs: Cant interact with the entity -
Spawning my entity causes gamecrash[STILL UNSOLVED]
ItsAMysteriousYT replied to ItsAMysteriousYT's topic in Modder Support
Okay - now it spawns correctly after i commented the airDrag out of the calulation. But still - i can not rightclick on the entity. -
Spawning my entity causes gamecrash[STILL UNSOLVED]
ItsAMysteriousYT replied to ItsAMysteriousYT's topic in Modder Support
In that double constructor EntityVehicle(World w, VehicleFile f, double x, double y, double z) -
Spawning my entity causes gamecrash[STILL UNSOLVED]
ItsAMysteriousYT replied to ItsAMysteriousYT's topic in Modder Support
Okay - removed your name from the title and managed to spawn the entity. I found out that the VehicleFile (The file that defines how fast i tcan be, how to render it etc) is null. But i am setting it in the constructor. So - maybe im doing something wrong there? -
Spawning my entity causes gamecrash[STILL UNSOLVED]
ItsAMysteriousYT replied to ItsAMysteriousYT's topic in Modder Support
I know, im waiting for a possibility to render objmodels as items. And i tried having a 2d texture for my block but somehow the model became invisible now, But thats another problem - any idea how i can fix that crash? -
Im lost trying to fix my entityclass. When i spawn the entity, the game crashes, sometimes the entity is being removed after one tick (F3+B so i saw the boundingbox dissappear). Im trying to make the movement client/server correct by 'simulating' it on the client and then updating it for the server. Diesieben07 told me that this was the right way. Well anyway, i can't see if it is correct, cuz my entity doesn't even spawn. So here is the spawn code: @Override public ItemStack onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPlayer playerIn) { System.out.println("Placing " + f.vehicleName); BlockPos pos = Minecraft.getMinecraft().objectMouseOver.getBlockPos(); if (!worldIn.isRemote && worldIn.getBlockState(pos).getBlock() != Blocks.air) { EntityVehicle vehicle = new EntityVehicle(worldIn, f, pos.getX(), pos.getY() + 1, pos.getZ()); worldIn.spawnEntityInWorld(vehicle); } return itemStackIn; } And here is the entity code: And here is the error that i get:
-
Im rendering some models with quite a lot of vertices and im searching for a way to make rendering faster. Any suggestions or usefull functions i can use?
-
How do I make my Truck work? Help Me!!!
ItsAMysteriousYT replied to WitherBoss2000's topic in Modder Support
I say this only one more time - before you start messing up your code - PLAN THE WHOLE THING ON PAPER! And the move straffing field is not in the entitity itself, it is in the ridingEntity. We will not write your mod for you, try figuring it out. We will help you if you run in some problems, but youll have to do the main part of it on your own. -
Block of code that causes entity to fall (gravity)
ItsAMysteriousYT replied to Asweez's topic in Modder Support
I used to know it in 1.7, but i would have to search for it now -
[1.8] Render not taking into account the world lighting.
ItsAMysteriousYT replied to Jedispencer21's topic in Modder Support
Do GL11.glDisable(GL11.GL_LIGHTING) and enable it after your rendering code has passed. -
Im trying to set my custom rotation value of a TileEntity in the onBlockPlacedBy method of the block. But somehow the rotation keeps all the same. What i do atm is this: @Override public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack) { super.onBlockPlacedBy(worldIn, pos, state, placer, stack); TileEntity tileentity = worldIn.getTileEntity(pos); if (tileentity instanceof TileEntity_Electric){ TileEntity_Electric tile = (TileEntity_Electric)tileentity; tile.rotation = MathHelper.floor_double((double)(placer.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3; System.out.println("Succesfully rotated "+tile.getClass().getName()); } }
-
Bind textures that are not in the resources folder?
ItsAMysteriousYT replied to ItsAMysteriousYT's topic in Modder Support
Hm - yea okay, i thought therid be an other way, but okay then ill do it like this