Jump to content

WorldsEnder

Members
  • Posts

    153
  • Joined

  • Last visited

Everything posted by WorldsEnder

  1. Try it yourself or look at "EntityLivingBase#onLivingUpdate(), line 50", it says else if (this.isClientWorld()) { if (this.isAIEnabled()) { this.worldObj.theProfiler.startSection("newAi"); this.updateAITasks(); this.worldObj.theProfiler.endSection(); } //.... EDIT: I want the mod to run on an integrated server aswell, just so you know.
  2. The main part of the question is about the AI... why should the AI be executed ONLY on the Client and not on the Server, is there some secret I haven't found yet? How does target selection work if the AI is not present on the server at all? Also (real source from EntityLivingBase): public boolean isClientWorld() { return !this.worldObj.isRemote; } WHAT? WHAT???!?!?!?!? I can confirm that this returns true for the <s>CLIENT</s>SERVER?!?!! Edit: Eclipse tells me that world.isRemote is set to true wherever it is accessed.. unless the write-access find has bugs I can't understand why it should EVER be set to false
  3. Hi guys, I stumbled over something really, really weird today and I can't wrap my head around it. Suppose I have an entity (`entity`) and I want to execute some AI task on the server only. A few things I have noticed so far: The entities AI is ONLY getting executed on the CLIENT because the AITaskManager has an if clause that is true when `entity.isClientWorld()`. Now, nothing special, but that IS a problem. Where do I execute my AI (reliantly) on the server only? Secondly, I thought `world.isRemote` is `true` for clients but it turns out that #isClientWorld() return `!worldObj.isRemote()`. Can somebody enlighten me where to place my AI logic? What use is it to execute AI on Client only? Is world.isRemote true or false on Clients?
  4. Doesn't the wrapper take care of the proper direction/prevent sending in the wrong direction? Nope, he doesn't, the Client will attempt to send un Unregistered Message afaik and that will fail (?why is it called DecoderException then?) diesieben07's solution works... as most of the times
  5. Hello guys, I have a problem with the following code: @Mod(modid = MHFCReference.main_modid, name = MHFCReference.main_name, version = MHFCReference.main_version) public class MHFCMain { @Mod.Instance(MHFCReference.main_modid) public static MHFCMain instance; public static Logger logger; public static final PacketPipeline packetPipeline = new PacketPipeline(); @Mod.EventHandler public void preInit(FMLPreInitializationEvent pre) { logger = pre.getModLog(); packetPipeline.registerPacket(MessageAttackHandler.class, MessageAIAttack.class, Side.CLIENT); } } ///------ PacketPipeline.java // import..... public class PacketPipeline { public final SimpleNetworkWrapper networkPipe = NetworkRegistry.INSTANCE .newSimpleChannel("MHFC"); private int discriminator = 0; public <REQ extends IMessage, ANS extends IMessage> void registerPacket( Class<? extends IMessageHandler<REQ, ANS>> messageHandler, Class<REQ> requestMessageType, Side side) { if (discriminator == 255) { MHFCMain.logger .error("Tried to register more than 256 message types"); return; } MHFCMain.logger .info(String .format("Registered message %s with Handler %s for Side %s at Side %s with discriminator 0x%x", requestMessageType, messageHandler, side, MHFCMain.proxy.getSide(), discriminator)); networkPipe.registerMessage(messageHandler, requestMessageType, discriminator++, side); } } ////-------------- MessageAIAttack.java //import....; public class MessageAIAttack<T extends EntityLivingBase & IMangedAttacks<T>> implements IMessage { private int entityId; private int attackIndex; public MessageAIAttack(T entity, int attackIndex) { this.entityId = entity.getEntityId(); this.attackIndex = attackIndex; } @Override public void fromBytes(ByteBuf buf) { entityId = buf.readInt(); attackIndex = buf.readInt(); } @Override public void toBytes(ByteBuf buf) { buf.writeInt(entityId); buf.writeInt(attackIndex); } /** * Used to retrieve the meant actual entity on client side. May return * <code>null</code> if the entity isn't loaded on client side. * * @return the entity */ @SuppressWarnings("unchecked") @SideOnly(Side.CLIENT) public <U extends EntityLivingBase & IMangedAttacks<U>> IMangedAttacks<U> getEntity() { return (IMangedAttacks<U>) Minecraft.getMinecraft().theWorld .getEntityByID(entityId); } public int getAttackIndex() { return this.attackIndex; } } /////---------MessageAttackHandler.java //import... public class MessageAttackHandler implements IMessageHandler<MessageAIAttack, IMessage> { @Override public IMessage onMessage(MessageAIAttack message, MessageContext ctx) { IMangedAttacks<?> entity = message.getEntity(); entity.getAttackManager().setAttack(message.getAttackIndex()); return null; } } The message is sent from the AI on both sides with the following call: MHFCMain.packetPipeline.networkPipe.sendToAll(new MessageAIAttack<T>()); I get the following output (not full output but the important parts):
  6. I just want to add a note for all of you that read this: Things that you have to copy to your build.gradle: Make sure to include this after the minecraft {...} tab.
  7. Can I compile my mod without obfuscating the resulting code? I want to use the compiled jar as a dependency in one of my other mods which I launch from the eclipse workspace so I need an unobfuscated result. I don't want to link to the source directly because I don't want to provide that source on the github if possible, just the final (unobfuscated) jar.
  8. May I just leave the following link here? https://github.com/WorldSEnder/MCAnm
  9. Doesn't seem to work because that doesn't even offer the options (only task added is "resolveGitDependencies")... Another (related) question: How can I apply a local plugin? Currently I am downloading it from maven but I think I found an alternative branch that resolves the issue but that isn't up at maven, so I would download it and build it manually and then apply the built file locally... how can I do this?
  10. You have forgotten to override the method getHealth() as it seems? and google the Exception-Class next time ("AbstractMethodError" which will tell you that . Given that the first line is it tells me that getHealth() is not overridden (coded) in EntityVamacheron. Note: This should be caught by the compiler, what do you use, IntelliJ right? Look here. An error like this should be generated. I can't tell you how you can enable detection if disabled because I use eclipse.
  11. Status: Tested, and it gives me errors, specifically telling me that some .pom wasn't found on files.minecraft.net/.../....pom. Either I'm doing something wrong or it doesn't work straight forward. Can someone give/link an example that uses this already? PS Script: buildscript { repositories { mavenCentral() maven { name = "forge" url = "http://files.minecraftforge.net/maven" } maven { name = "sonatype" url = "https://oss.sonatype.org/content/repositories/snapshots/" } } dependencies { classpath 'org.batcha.gradle.plugins:git-dependencies:0.2' classpath 'net.minecraftforge.gradle:ForgeGradle:1.2-SNAPSHOT' } } apply plugin: 'forge' apply plugin: 'eclipse' apply plugin: 'git-dependencies' version = "1.0" group= "com.yourname.modid" // http://maven.apache.org/guides/mini/guide-naming-conventions.html archivesBaseName = "modid" sourceCompatibility = 1.7 targetCompatibility = 1.7 minecraft { version = "1.7.10-10.13.0.1180" runDir = "eclipse/assets" } dependencies { // // initGitDependencies -> clones locally = checkout // refreshGitDependencies -> refresh = pull compile('com.github.worldsender.mcanm:mcanm:0.0.101a_1710').ext.git = 'https://github.com/WorldSEnder/MCAnm' // you may put jars on which you depend on in ./libs // or you may define them like so.. //compile "some.group:artifact:version:classifier" //compile "some.group:artifact:version" // real examples //compile 'com.mod-buildcraft:buildcraft:6.0.8:dev' // adds buildcraft to the dev env //compile 'com.googlecode.efficient-java-matrix-library:ejml:0.24' // adds ejml to the dev env // for more info... // http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html // http://www.gradle.org/docs/current/userguide/dependency_management.html } processResources { // this will ensure that this task is redone when the versions change. inputs.property "version", project.version inputs.property "mcversion", project.minecraft.version // replace stuff in mcmod.info, nothing else from(sourceSets.main.resources.srcDirs) { include 'mcmod.info' // replace version and mcversion expand 'version':project.version, 'mcversion':project.minecraft.version } // copy everything else, thats not the mcmod.info from(sourceSets.main.resources.srcDirs) { exclude 'mcmod.info' } }
  12. But is it recursive, though great work, don't quit pls , where do you do that and how? (exact source would be a good start) I didn't understand stencil functions, really =|
  13. I wondered if there was an easy way to add any gradle-like github mod to the dependecies of my mod. Let's say there is a github-repo at /author/repo, is there an easy way I can tell gradlew to always keep track of that repo/a specific branch/tag/release that gets cloned and added as a dependency to my mod? Doing it manually is really tedious sometimes... (downloading, building, copying into ./lib/, ...)
  14. As far as I understand this function you get an (empty) List passed in from Forge and should add your hitboxes to it. Also remember that in minecraft Y-axis is up. So the code you are looking for looks something like this (I guess, not tested): @Override public void addCollisionBoxesToList(World world, int x, int y, int z, AxisAlignedBB blockBounds, List<> list, Entity collidingEntity) { // you should use blockBounds as a "mask". Only the intersection of all BoundingBoxes and blockBounds should be added // (this basically means that you should offset your bounding box by the block's position) // The list is the list you should add your bounding boxes to by calling list.add(AxisAlignedBoundBox); // Also by sure that you add different bounding box objects for every bounding box. The bounds are NOT copied when you add // it to the list so changes to the added box will be reflected in the list. Just instantiate a new AxisAlignedBoundingBox for // every box you add. // You may use collidingEntity to let different entities board (only players?) }
  15. I guess it would be easier just to turn the displayed picture/world view (not GUI though) turned around. This is my first thought on your project.
  16. Totally agree with jabelar. Go for the space them out tactic, it appears to work really good. I've once seen the method and it looks really really good.
  17. You could use the techne-modeller (http://techne.zeux.me/) to model your mob/something (it has a nice workflow) and export that to .java file which is the model.
  18. It is a method named EntityRenderer#setupFog() that does this and it seems like when the event is cancelled all further interactions with Fog are cancelled. This means that GL11.glFogi(); is never called and you have to do it yourself. Note: You may also want to call GL11.glFogf(GL11.GL_FOG_START, whereFogStarts); GL11.glFogf(GL11.GL_FOG_END, whereFogIsAtFullValue); I didn't try it out though and I don't really see what could change except that fog is linearly sampled.... try it out, I guess.
  19. The integer you give is a color multiplier so every pixel on the texture gets premultiplied by the value. It is a RGB value as integer so the you have 0xFFFFFF = (255, 255, 255)rgb, 0x00FF00 = (0, 255, 0)rgb, etc. This explains the default in Item which is 0xFFFFFF or 16777215. Now you have to override this method because Block#getRenderType() returns 0 which causes RenderBlocks#renderBlockByRenderType() to call RenderBlocks#renderStandardBlock() which will ultimately call for Block#colorMultiplier() which is overridden by BlockLeaves an thus has to be overridden by you again to return the correct result. This is how I understand it, so try and override colorMultiplier(IBlockAccess block, int x, int y, int z). PS: I have added the second paragraph so that you can figure this out by yourself next time Feel free to ask for more explanation
  20. The question seems simple: When and how should I use the different levels of the logger? I have two stages of developement: dev and release. Now I figured out that I should avoid having to call log with Level.DEBUG in the release but what about the other levels? Where is the difference between trace and info for example? We have the following levels: OFF, FATAL, ERROR, WARN, INFO, DEBUG, TRACE. OFF: should not be used at all? FATAL: is it good style to log in case something went wrong and NOT throw an exception (do both?) ERROR: I don't understand this Level, maybe when loading something not completly necessary, like a missing file? WARN: okay, this is pretty clear, we do this if some (API-)user gave us wrongly formatted input but we can recover. INFO: is this meant to info the final user? If so, how deep of an understanding should I assume? DEBUG: should I include this in the final product, after all? TRACE: how often should I use this feature? excessively?
  21. LexManos points out in his tutorial for forge that you should include gradlew, gradlew.bat and gradle/ in your github repo so that anyone can build your project just by checking out your master branch.
  22. You could also mention the class net.minecraft.network.PacketBuffer for advanced and optimized read/writing.
  23. Hi, possibly you know this plugin for stackexchange: https://github.com/nathan-osman/Stack-Alert Basically what is does is to check if there is a new answer/post to any of your questions and displays this in your browser. Is this possible with http://www.minecraftforge.net? It offers to click on a specific message and then opens a new tab with the related thread. This allows one to close the stackexchange tab and does the checking for you.
  24. Like the question says: What is the difference between FMLCommonHandler.instance().bus() and MinecraftForge.EVENT_BUS? What of both should I use? Btw: What is FMLEventChannel used for?
  25. I use the following .gitignore: # push src/ only * !src/ !gradle/ !gradlew !gradlew.bat !README.md !LICENSE !build.gradle *.class # Mobile Tools for Java (J2ME) .mtj.tmp/ # Package Files # *.war *.ear # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml hs_err_pid* All one needs to build is the "gradle/" and the "src/" directory aswell as the "gradlew" and "gradlew.bat" and the "build.gradle" file. This explains the .gitignore file: First I ignore all files, then I unignore all files mentioned above. The other ignores are default from GitHub.
×
×
  • Create New...

Important Information

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