Jump to content

Bektor

Forge Modder
  • Posts

    852
  • Joined

  • Last visited

Everything posted by Bektor

  1. Well, how can I rotate the object always around the player, so that he can only see the front of it? And for what is the new VertexBuffer class? I mean, there is now a Tesselator, GameState stuff and VertexBuffer.
  2. Hi, I'm wondering how I can render a 2D Entity in Minecraft. It's not a throwable entity! Here is what I've got so far: if(entity.isDead) return; GlStateManager.pushMatrix(); // store the transformation GlStateManager.translate(posX, posY, posZ); // set viewport to tile entity position to render it double distanceSq = entity.getDistanceSqToEntity(Minecraft.getMinecraft().getRenderViewEntity()); float alpha = (float) (1.f - Math.min(1.d, distanceSq / (650 * .78543))); float size = (float) (.1f + entity.getSize()); this.bindTexture(texture); GlStateManager.disableDepth(); GlStateManager.rotate(-this.getRenderManager().playerViewY, .0f, 1.f, .0f); GlStateManager.rotate(this.getRenderManager().playerViewX, 1.f, 0.f, 0.f); GL11.glScalef(size, size, size); Tessellator tesselator = Tessellator.getInstance(); VertexBuffer vertexbuffer = tesselator.getBuffer(); vertexbuffer.begin(7, DefaultVertexFormats.POSITION); vertexbuffer.pos(posX, posY, posZ); GlStateManager.color(0, 0, 0, alpha); GlStateManager.enableTexture2D(); tesselator.draw(); GlStateManager.enableDepth(); GlStateManager.popMatrix(); The Entity should also rotate, so the player sees it always from the front. I hope someone can help me with this. Thx in advance. Bektor
  3. Well, my friend told me it has to be the one from the router and not the one from the actual computer. And port forwarding is also active. And when using the intern PC IP my friend tells me he can't join. So the IP from the actual computer isn't working.
  4. Hi, I've got a small question: Why am I getting the error: FAILED TO BIND TO PORT! After this error shows up the server direclty closes. What I am now wondering about this is: No program and service is using the port 25565 Using the IP from Hamachi everything works fine, but using the IPv4 from http://www.wieistmeineip.de/ results in the error So why does the IPv4 from http://www.wieistmeineip.de/ results in such an error? Thx in advance. Bektor
  5. task incrementBuildNumber() { dependsOn "reobf" doLast { config.primeval_build = (config.primeval_build.toString().toInteger()) + 1 configFile.withWriter { config.toProperties().store(it, "") } } } jar { appendix = 'universal' } task releaseJars(type: Copy) { from incrementBuildNumber from jar // not sure if this is correct } This is the line in the build.properties: primeval_build=1 So why is it not working?
  6. Well, when looking at my friends... I don't think I'm doing the same mistakes as when I just started.... Ok, thx. And wikipedia is not always a friend, sometimes it turns into an enemy because it explains stuff in such a way that I can't understand it.... And then there are cases where it explains stuff with words google translate does even not know.
  7. The problem with Minecraft Pocket Edition would basically be, the performance. I mean, think about mods like Thaumcraft or large Modpacks like FTB... There is no smartphone which would have enough power for such things.
  8. Ah, ok. Oh and I've found a bug: Sometimes the forum renders Java code without the code formattings and you have to re-load the complete site to fix it. But besides that, it runs very stable. Besides that, if you guys want to make the forum look even more modern at some point, like when migrating to a new software, I've got some insperation for you: https://www.quora.com/What-are-some-modern-forum-software http://forums.marvelheroes.com/ And I personally prefer this style best: https://forums.oculus.com/community/ Even when I don't like the huge letters in the posts.... Oh and I've found this site, seems to be that there is stuff with which a forum can be created: https://vanillaforums.com/ Just a question: Hows the progress?
  9. Well, I can't remember everything. And I don't think that I'm here for only month. I'm here since 2013 (end of 2012 started learning Java). to 1: Oh yeah, the thread stuff. I really hate communication with threads.... every lib does it different.... (Swing vs JavaFX... never got such stuff for the Swing lib working, for JavaFX is was quite easy)... But to come back to the theme... I didn't even know Minecraft has so much thread stuff. I knew just that the chunk generation is done asynchron (even when I never noticed it while writing my own world geneartions). Like when you don't see it you just don't know it is there. to 2: Oh, ok. Seems that I forgot to change it after copying the math code over into the packet. to 3: interpolate? And why I am sending so much packets, well, EntityMotion changes every tick and the location of the entity also. so what is the interpolate thing? I just know motion, so the movement and velocity, so the speed. to 4: Oh, didn't knew the client got only one dimension. I thought the client got all, like the server. Well, I really don't like the vanilla packets, maybe because I don't know the code in them and there are more then I know.... and with all the changes between MC versions the names and so on change also.... (well, I gave up long time ago to remember all the names and all the stuff MC uses because you have to re-learn with the next update most of the stuff again) And what that code does it moving the player around., like a black hole. Well, I always think, that new readers don't want to read over 5 sites of stuff just to fix one problem. I mean, if I would continue those threads I would end up having all these threads in one: http://www.minecraftforge.net/forum/index.php/topic,39419.0.html http://www.minecraftforge.net/forum/index.php/topic,39469.0.html http://www.minecraftforge.net/forum/index.php/topic,38757.0.html http://www.minecraftforge.net/forum/index.php/topic,38745.0.html http://www.minecraftforge.net/forum/index.php/topic,38191.0.html And I'm not the guy who is working on one think until it's fixed. I'm more the guy who is working on one think. If I can't get it to work I start re-concepting it or waiting until someone knows a solution and besides that I'm starting to work on other parts of the mod. Like sometimes I have a problem on the logic side and then start with the render side of the same block and when I've got there a problem I go back to the logic side and wait until I know what's wrong with the render side. And having all of those work flows in one thread whould not really helpfull for anyone reading the stuff, even when then some problems can take a few weeks until I go back to them. And when then a MC updates comes also... Like some problems started in 1.8.9 and then I switched to 1.9 and then to 1.9.4. (one of the reason to do so is to stay updated and because the mod is in WIP yet, no release yet... There was one release long ago... but then I left the modding to others and came back a few month ago starting with a re-concept and new motivation and much more knowledge about Java and a bit abut C++... so the mod had it's last port back in the 1.7.2 times, but I think it was there only a port, too and not really changes... then came back with 1.8.9 ) EDIT: Changed it now to this and processMessage handles now the code which was handles in onMessage before. if(ctx.side != Side.CLIENT) { System.err.println("PacketNote received on wrong side: " + ctx.side); return null; } Minecraft.getMinecraft().addScheduledTask(() -> { processMessage(Minecraft.getMinecraft(), message); }); EDIT 2: Ok, I've found a way to solve this issue without sending explicit a packet. But I'm letting this thread open, because when I find a solution for it here, I may also have less problems in the future with network things. Oh and it would be nice if someone can tell me how such an error happens, so it's easier to track such stuff down.
  10. Well, it can change every tick because it modifies the movement of the Player itself. And how should I check the values, I mean the player movement is client side. Besides that: I don't think the packet was send successfully cause the player movement does not change.
  11. Hi, I've got a small problem. I'm always getting this error: package minecraftplaye.primevalforest.common.network.misc; import io.netty.buffer.ByteBuf; import net.minecraft.client.Minecraft; import net.minecraft.entity.player.EntityPlayer; import net.minecraftforge.fml.common.network.simpleimpl.IMessage; import net.minecraftforge.fml.common.network.simpleimpl.IMessageHandler; import net.minecraftforge.fml.common.network.simpleimpl.MessageContext; public class PacketMy implements IMessage, IMessageHandler<PacketMy, IMessage>{ private double posX; private double posY; private double posZ; private int dimensionID; private int strength; public PacketMy () { super(); } public PacketMy (double posX, double posY, double posZ, int dimensionID, int strength) { this.posX = posX; this.posY = posY; this.posZ = posZ; this.dimensionID = dimensionID; this.strength = strength; } @Override public IMessage onMessage(PacketMy message, MessageContext ctx) { EntityPlayer player = Minecraft.getMinecraft().thePlayer; if(player.worldObj.provider.getDimension() == message.dimensionID) { double moveX = (this.posX + .5d) - (player.posX + .5d); double moveY = (this.posY + .5d) - (player.posY + .5d); double moveZ = (this.posZ + .5d) - (player.posZ + .5d); double distanceSqrt = Math.sqrt(moveX * moveX + moveY * moveY + moveZ * moveZ); player.motionX += moveX / distanceSqrt * (message.strength / 150); player.motionY += moveY / distanceSqrt * (message.strength / 125); player.motionZ += moveZ / distanceSqrt * (message.strength / 150); } return message; } @Override public void fromBytes(ByteBuf buf) { this.posX = buf.readDouble(); this.posY = buf.readDouble(); this.posZ = buf.readDouble(); this.dimensionID = buf.readInt(); this.strength = buf.readInt(); } @Override public void toBytes(ByteBuf buf) { buf.writeDouble(this.posX); buf.writeDouble(this.posY); buf.writeDouble(this.posZ); buf.writeInt(this.dimensionID); buf.writeInt(this.strength); } } package minecraftplaye.primevalforest.common.network; import minecraftplaye.primevalforest.common.lib.Constants; import minecraftplaye.primevalforest.common.network.misc.PacketMy; import net.minecraftforge.fml.common.network.NetworkRegistry; import net.minecraftforge.fml.common.network.simpleimpl.SimpleNetworkWrapper; import net.minecraftforge.fml.relauncher.Side; public class PacketHandler { private static final SimpleNetworkWrapper INSTANCE = NetworkRegistry.INSTANCE.newSimpleChannel(Constants.MOD_ID.toLowerCase()); private static int networkID = 0; public static void init() { getInstance().registerMessage(PacketMy.class, PacketMy.class, getNetworkID(), Side.CLIENT); } private static int getNetworkID() { return networkID++; } public static SimpleNetworkWrapper getInstance() { return PacketHandler.INSTANCE; } } The PacketHandler#init method get's called at the end of the preInit. Here the packet get's send: if(entity instanceof EntityPlayer && !this.worldObj.isRemote) { PacketHandler.getInstance().sendToAllAround(new PacketMy(this.posX, this.posY, this.posZ, this.worldObj.provider.getDimension(), this.getSize()), new TargetPoint(this.worldObj.provider.getDimension(), this.posX, this.posY, this.posZ, 20)); So what am I doing wrong? Just to mention, the packet will be send from a method which get's called in the onUpdate method of the Entity. I just don't know what the error is or what it can be/what can cause such an error? I just know, it worked before, I changed something and it's not working, but I don't know what I changed. EDIT: See also there: http://www.minecraftforge.net/forum/index.php?topic=39512.msg208164#msg208164 Thx in advance. Bektor
  12. Then it should already be called on the client. (Well, it would even not make then sense that for player movement I have to send a packet)
  13. Well, it changes that I don't know how to do it, because the onUpdate method will do it on the server-side, otherwhise it would work. And sending packets does MC Vanilla already.
  14. Well, on the server I'm doing this all in the entity class itself.
  15. Yes. Just the checks for the nearby entities aren't every tick.
  16. hm, no idea. I just have the onUpdate method and add a value to the motion, then multiply it by .8 and call super.moveEntity(). And add only motion when the boolean in the if statement is true, so when a specific entity is nearby.
  17. Yeah, but how can I tell the client to apply the motion without sending packets?
  18. So how can I do that? (Currently the complete logic part is done in the onUpdate() method and a method which get's called by the onUpdate() method.
  19. So I have to send a packet to the client with the values and in the onMessage method I have to apply them to the motion value? EDIT: if I would know how to get access to the entity in a packet
  20. So what need I to do to get it working correctly on my mod?
  21. But why is it so? I mean the server has to send the changes to the client and not the client to the server. Then every entity could move in a different direction on a server. So PlayerA sees the Entity moving south while PlayerB sees the entity moving north --> Server should handle entity movement. I mean, it makes no sense.... And even when I do it client side, I still have to send a custom packet to the client which tells that the entity motion should changed. EDIT: And isn't the movement of other entities in Minecraft also done server-side?
  22. Any ideas what's wrong?
×
×
  • Create New...

Important Information

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