
VulcanForge
Members-
Posts
6 -
Joined
-
Last visited
Everything posted by VulcanForge
-
Hello all, I have been developing a mod which is going to require a large number of new dimensions soon. I am having difficulty understanding how the World, WorldProvider, BiomeGenBase, Chunk, and ChunkProvider classes all work together. I have made an educated guess but I would like to have my ideas validated. Before I start, I know that there are lots of existing tutorials. I have not been able to get the big picture out of them because they guide the reader through lots of small steps, instead of explaining the purpose of each class. I am not new to Java or coding and all I want to learn is the API. So please answer this question instead of re-directing me to a tutorial. Thanks for your time. What I'm guessing is that when a Chunk is created for the first time, it uses a ChunkProvider to generate its basic terrain (probably stone and perhaps caves and such?) using the Perlin noise algorithms. Then the appropriate BiomeGen adds the layers of soil, ores, trees, and other decorative blocks? The WorldProvider determines which BiomeGen's to apply to each chunk, and handles such things as multi-biomed worlds (WorldProviderSurface) and single-biomed worlds (WorldProviderHell). Does all this seem to be correct? And which methods should I override to control the stone population process? I am fairly sure that I can control dirt, sand, trees, and all such features with BiomeGen, but I can't figure out how I would remove all blocks from a chunk, which I will need to do to create a space dimension. Once again, thanks in advance for your help.
-
[1.7.10] attackEntityFrom called only on client side
VulcanForge replied to VulcanForge's topic in Modder Support
Update: I know what's going on. I'm not in range to the entity from the server's perspective. Earlier, I had been calling setDead() outside of the if(!world.isRemote) block and the client would remove my copy but the server would retain its. I finally fixed that, but then I assumed that this problem had something to do with the same thing. But I'm guessing that my client is being optimistic that I'm in range to the entity, but the server is ignoring the packet because it calculates my range too high. Sorry to bother you guys, but it may be worthwhile to know that the client can be a bit out of sync even on an SP world. -
To start off, here's my code: @Override public boolean attackEntityFrom(DamageSource damage, float damageLevel) { if(!(damage.getEntity() instanceof EntityPlayer)) return false; FMLLog.getLogger().info("In method"); if(!worldObj.isRemote) { this.dropItem(STItem.phaserDrill, 1); FMLLog.getLogger().info("Item dropped"); setDead(); return true; } return false; } As you would expect, "In method" is logged whenever I hit the entity, but "Item dropped" is only logged when it's called server-side. But for some reason, I have to hit the entity many many times before it's called server-side. Here's an excerpt from my logs: [19:00:51] [Client thread/INFO] [FML]: In method [19:00:51] [server thread/INFO] [FML]: In method [19:00:51] [server thread/INFO] [FML]: Item dropped [19:01:00] [Client thread/INFO] [FML]: In method [19:01:03] [Client thread/INFO] [FML]: In method [19:01:06] [Client thread/INFO] [FML]: In method [19:01:07] [Client thread/INFO] [FML]: In method [19:01:08] [Client thread/INFO] [FML]: In method [19:01:09] [Client thread/INFO] [FML]: In method [19:01:15] [Client thread/INFO] [FML]: In method [19:01:15] [Client thread/INFO] [FML]: In method [19:01:15] [server thread/INFO] [FML]: In method [19:01:15] [server thread/INFO] [FML]: Item dropped [19:01:18] [Client thread/INFO] [FML]: In method [19:01:18] [server thread/INFO] [FML]: In method [19:01:18] [server thread/INFO] [FML]: Item dropped As you can see, the server is hit and miss on calling attackEntityFrom(). Is attackEntityFrom() not supposed to be called on both sides all the time or what? And one more question. What's the significance of the Boolean value I'm returning? I assume that it returns true if the method actually does something, but maybe my problem has something to do with my return statement?
-
Having difficulty writing a rendering class
VulcanForge replied to VulcanForge's topic in Modder Support
Yes, now I can see the entity the way I intended. I also discovered that the argument to the render(float) method is the scale. However, the entity vanishes when being viewed from certain angles. I can see it from some angles and not from others. Anyone have any insights? Maybe a call to glEnable() and glDisable() with one of the filter constants? -
Having difficulty writing a rendering class
VulcanForge replied to VulcanForge's topic in Modder Support
Well, that code doesn't seem much different than what I did, except for some graphics effects things. Maybe I need to do bindTexture()? Or scale it? I really have no idea. -
Hello all, I'm new to entities, modelling, and rendering (though I do know how to mod blocks and items and have a good knowledge of Java). I read about five different tutorials on how to mod custom entities in 1.7 (I'm not going with 1.8 because it's too much hassle for me), but for some reason I simply can't get my entity to render properly. My entity has its own class, it's registered, and it even appeared as a white block before I wrote the rendering class. I made a model in Techne, exported it as Java and a texturemap, put the texturemap under src/main/resources/assets/rendertestmod/textures/entity/drill.png, and fixed up the Java file the way other tutorials said to do it. Then I wrote the rendering class the way the tutorials said, but whenever I summon my entity, I now get an extremely strange pattern of textures floating in the air, that seem to follow me, and definitely don't conform to the shape of the model I made. I'll put the code below. package com.example.rendertestmod; import net.minecraft.client.model.ModelBase; import net.minecraft.client.model.ModelRenderer; import net.minecraft.entity.Entity; public class ModelDrill extends ModelBase { ModelRenderer Base; ModelRenderer Bit; public ModelDrill() { textureWidth = 64; textureHeight = 64; Base = new ModelRenderer(this, 0, 0); Base.addBox(0F, 0F, 0F, 16, 8, ; Base.setRotationPoint(-8F, 0F, -4F); Base.setTextureSize(64, 64); Base.mirror = true; setRotation(Base, 0F, 0F, 0F); Bit = new ModelRenderer(this, 0, 16); Bit.addBox(-8F, -2F, -2F, 8, 4, 4); Bit.setRotationPoint(-8F, 4F, 0F); Bit.setTextureSize(64, 64); Bit.mirror = true; setRotation(Bit, 0F, 0F, 0F); } public void render(float f5) { Base.render(f5); Bit.render(f5); } private void setRotation(ModelRenderer model, float x, float y, float z) { model.rotateAngleX = x; model.rotateAngleY = y; model.rotateAngleZ = z; } public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity e) { super.setRotationAngles(f, f1, f2, f3, f4, f5, e); } } package com.example.rendertestmod; import org.lwjgl.opengl.GL11; import net.minecraft.client.renderer.entity.Render; import net.minecraft.entity.Entity; import net.minecraft.util.ResourceLocation; public class RenderDrill extends Render { static ModelDrill drill = new ModelDrill(); public RenderDrill() { // TODO Auto-generated constructor stub } @Override public void doRender(Entity e, double f1, double f2, double f3, float f4, float f5) { GL11.glPushMatrix(); drill.render(.0625F); GL11.glPopMatrix(); } @Override protected ResourceLocation getEntityTexture(Entity p_110775_1_) { // TODO Auto-generated method stub return new ResourceLocation("rendertestmod:textures/entity/drill.png"); } } package com.example.rendertestmod; import net.minecraft.entity.Entity; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.world.World; public class EntityDrill extends Entity { public EntityDrill(World w) { super(w); // TODO Auto-generated constructor stub } @Override protected void entityInit() { // TODO Auto-generated method stub } @Override protected void readEntityFromNBT(NBTTagCompound p_70037_1_) { // TODO Auto-generated method stub } @Override protected void writeEntityToNBT(NBTTagCompound p_70014_1_) { // TODO Auto-generated method stub } } About the rendering class: I used render(.0625F) because that's what I saw in another code file in another mod. I have no idea what that float argument means. Also, there were no errors during startup even when I changed the texture name to gibberish, so I feel like I might be doing something wrong about the location of the texture, but I don't know what. Sorry if this sounds like a noobish question, and sorry if I wasn't supposed to ask questions about such basic topics on this forum, but the tutorials are not very helpful. I'll post screenshots of my Eclipse setup if you need to see those. Also, bear in mind that this is just an experiment for me to find out the basics of rendering entities. That's why the entity does nothing except sit there and display its textures to me.