
mOi!terei
Members-
Posts
6 -
Joined
-
Last visited
Everything posted by mOi!terei
-
yes ok know i knew that this AI- class is totaly false I changed everything and noted the mistakes in the AI class because the executing methods and the problem because of the loops. But I think, that I don't understand the moving. The moveTo-method in the Villager class is called but the Villager don't move. Needs this methode any time to be done? It is possible, that my continueEx. methode to search a target is canceling the move?
-
Good Evening, I tried to give my OwnVillager an AI. But in the case of move it is like the Programm skips this. my methode for move the Villager is: public void moveTo(double x, double y, double z) { final BlockPos coords = new BlockPos(x, y, z); try { if (!this.getNavigator().tryMoveToXYZ((double)coords.getX(), (double)coords.getY(), (double)coords.getZ(), 0.5F)) { final Vec3d vector = new Vec3d(coords.getX()+0.5D, coords.getY(), coords.getZ()); final Vec3d vec3D = RandomPositionGenerator.findRandomTargetBlockTowards((EntityCreature)this, 10, 3, vector); this.setHomePosAndDistance(this.getPos(), 50); if (vec3D != null) { this.getNavigator().tryMoveToXYZ(vec3D.x, vec3D.y, vec3D.z, this.getAIMoveSpeed()); } } } catch (NullPointerException ex) { System.out.println(ex); } } and the part of the AI: public void startExecuting() { switch(this.vil.currentWork) { case ALL_FULL: this.vil.currentWork = EnumWork.WAIT; case IDLE: searchTree(); case SEARCH_MAT: searchTree(); case SEARCH_WORK: work(); case SEARCH_TOOL: searchTool(); case WORK: work(); case EMPTY_INV: emptyInv(); default: } this.vil.currentWork = EnumWork.IDLE; } private void search() { System.out.println(this.vil.getName()+" searches a tree - "+tree); if (this.target == null) { System.out.println(this.vil.getName()+1); this.target = AIHelper.getRandCoords(this.vil, this.limit, this.lastRes); } if (this.target != null) { this.vil.moveTo(this.target.getX(), this.target.getY(), this.target.getZ()); System.out.println(this.vil.getName()+"2_1"); } if (this.vil.searchBox != null && this.vil.world.isMaterialInBB(this.vil.searchBox, Material.WOOD)) { System.out.println(this.vil.getName()+" founds wooden material"); this.currentResource = this.getNewResource(); if (this.currentResource != null) { this.searchLimit = 20; this.vil.getNavigator().clearPath(); } } if (this.target != null && Math.abs(this.vil.posX - this.target.getX()) <= 5.0 && Math.abs(this.vil.posZ - this.target.getZ()) <= 5.0) { System.out.println(this.vil.getName()+4); this.tree = target; this.target = null; this.searchLimit += 10; this.vil.currentWork = EnumWork.WORK; return; } // this.waitABit(20); } I searched the skipped Code with the out.println() and during the game I get: Aaron searches a tree - null Aaron2_1 Aaron searches a tree - null Aaron2_1 Aaron searches a tree - null Aaron2_1 ..... and so on... course this loop the chunks are corrupted and nobody moves ^^' Thanks for help!
-
Thank you very much, my bugs are fixed on this moment
-
Oh ok, this is much shorter and this is my new Code: @Mod.EventHandler public static void registerEntity(RegistryEvent.Register<EntityEntry> event) { // create EntityEntry EntityEntry abstractVil = EntityEntryBuilder.create().id(AbstractVillager.ressource, 0).entity(AbstractVillager.class).build(); // register EntityEntry event.getRegistry().registerAll(abstractVil); } I Think it is it, but my problem still the same: I can hear the Villagers but can't see. when I catch the spawned Villager and replace him I print out the old and the new Villager and the ID. The Result during load a new Village: [18:01:59] [main/INFO] [minecraft/GuiNewChat]: [CHAT] Player53 wurde zu 1112.5, 100.0, -135.5 teleportiert [18:02:00] [Server thread/INFO] [STDOUT]: [com.mOIterei.autonomousVillages.handler.VillageEventHandler:entityJoinedWorldEventHandler:71]: -- Vil: EntityVillager['Dorfbewohner'/2683, l='Neue Welt', x=1119.50, y=65.00, z=-135.50] - ID: 2683 [18:02:00] [Server thread/INFO] [STDOUT]: [com.mOIterei.autonomousVillages.handler.VillageEventHandler:entityJoinedWorldEventHandler:95]: -- newVil: AbstractVillager['Unbekannt'/2684, l='Neue Welt', x=1119.50, y=65.00, z=-135.50] - ID: 2684 [18:02:00] [Server thread/INFO] [STDOUT]: [com.mOIterei.autonomousVillages.handler.VillageEventHandler:entityJoinedWorldEventHandler:71]: -- Vil: EntityVillager['Dorfbewohner'/2685, l='Neue Welt', x=1120.50, y=65.00, z=-135.50] - ID: 2685 [18:02:00] [Server thread/INFO] [STDOUT]: [com.mOIterei.autonomousVillages.handler.VillageEventHandler:entityJoinedWorldEventHandler:95]: -- newVil: AbstractVillager['Unbekannt'/2686, l='Neue Welt', x=1120.50, y=65.00, z=-135.50] - ID: 2686 [18:02:00] [Server thread/INFO] [STDOUT]: [com.mOIterei.autonomousVillages.handler.VillageEventHandler:entityJoinedWorldEventHandler:71]: -- Vil: EntityVillager['Dorfbewohner'/2687, l='Neue Welt', x=1127.50, y=65.00, z=-132.50] - ID: 2687 [18:02:00] [Server thread/INFO] [STDOUT]: [com.mOIterei.autonomousVillages.handler.VillageEventHandler:entityJoinedWorldEventHandler:95]: -- newVil: AbstractVillager['Unbekannt'/2688, l='Neue Welt', x=1127.50, y=65.00, z=-132.50] - ID: 2688 [18:02:00] [Server thread/INFO] [STDOUT]: [com.mOIterei.autonomousVillages.handler.VillageEventHandler:entityJoinedWorldEventHandler:71]: -- Vil: EntityVillager['Dorfbewohner'/2689, l='Neue Welt', x=1127.50, y=65.00, z=-122.50] - ID: 2689 [18:02:00] [Server thread/INFO] [STDOUT]: [com.mOIterei.autonomousVillages.handler.VillageEventHandler:entityJoinedWorldEventHandler:95]: -- newVil: AbstractVillager['Unbekannt'/2690, l='Neue Welt', x=1127.50, y=65.00, z=-122.50] - ID: 2690 [18:02:00] [Server thread/INFO] [STDOUT]: [com.mOIterei.autonomousVillages.handler.VillageEventHandler:entityJoinedWorldEventHandler:71]: -- Vil: EntityVillager['Dorfbewohner'/2691, l='Neue Welt', x=1112.50, y=65.00, z=-134.50] - ID: 2691 [18:02:00] [Server thread/INFO] [STDOUT]: [com.mOIterei.autonomousVillages.handler.VillageEventHandler:entityJoinedWorldEventHandler:95]: -- newVil: AbstractVillager['Unbekannt'/2692, l='Neue Welt', x=1112.50, y=65.00, z=-134.50] - ID: 2692 [18:02:00] [Server thread/INFO] [STDOUT]: [com.mOIterei.autonomousVillages.handler.VillageEventHandler:entityJoinedWorldEventHandler:71]: -- Vil: EntityVillager['Dorfbewohner'/2693, l='Neue Welt', x=1112.50, y=65.00, z=-127.50] - ID: 2693 [18:02:00] [Server thread/INFO] [STDOUT]: [com.mOIterei.autonomousVillages.handler.VillageEventHandler:entityJoinedWorldEventHandler:95]: -- newVil: AbstractVillager['Unbekannt'/2694, l='Neue Welt', x=1112.50, y=65.00, z=-127.50] - ID: 2694 [18:02:00] [Server thread/INFO] [STDOUT]: [com.mOIterei.autonomousVillages.handler.VillageEventHandler:entityJoinedWorldEventHandler:71]: -- Vil: EntityVillager['Dorfbewohner'/2695, l='Neue Welt', x=1114.50, y=65.00, z=-120.50] - ID: 2695 [18:02:00] [Server thread/INFO] [STDOUT]: [com.mOIterei.autonomousVillages.handler.VillageEventHandler:entityJoinedWorldEventHandler:95]: -- newVil: AbstractVillager['Unbekannt'/2696, l='Neue Welt', x=1114.50, y=65.00, z=-120.50] - ID: 2696 [18:02:00] [Server thread/INFO] [STDOUT]: [com.mOIterei.autonomousVillages.handler.VillageEventHandler:entityJoinedWorldEventHandler:71]: -- Vil: EntityVillager['Dorfbewohner'/2697, l='Neue Welt', x=1104.50, y=65.00, z=-132.50] - ID: 2697 [18:02:00] [Server thread/INFO] [STDOUT]: [com.mOIterei.autonomousVillages.handler.VillageEventHandler:entityJoinedWorldEventHandler:95]: -- newVil: AbstractVillager['Unbekannt'/2698, l='Neue Welt', x=1104.50, y=65.00, z=-132.50] - ID: 2698 [18:02:00] [Server thread/INFO] [STDOUT]: [com.mOIterei.autonomousVillages.handler.VillageEventHandler:entityJoinedWorldEventHandler:71]: -- Vil: EntityVillager['Dorfbewohner'/2700, l='Neue Welt', x=1119.50, y=65.00, z=-142.50] - ID: 2700 [18:02:00] [Server thread/INFO] [STDOUT]: [com.mOIterei.autonomousVillages.handler.VillageEventHandler:entityJoinedWorldEventHandler:95]: -- newVil: AbstractVillager['Unbekannt'/2701, l='Neue Welt', x=1119.50, y=65.00, z=-142.50] - ID: 2701 [18:02:00] [Server thread/INFO] [STDOUT]: [com.mOIterei.autonomousVillages.handler.VillageEventHandler:entityJoinedWorldEventHandler:71]: -- Vil: EntityVillager['Dorfbewohner'/2702, l='Neue Welt', x=1126.50, y=64.00, z=-143.50] - ID: 2702 [18:02:00] [Server thread/INFO] [STDOUT]: [com.mOIterei.autonomousVillages.handler.VillageEventHandler:entityJoinedWorldEventHandler:95]: -- newVil: AbstractVillager['Unbekannt'/2703, l='Neue Welt', x=1126.50, y=64.00, z=-143.50] - ID: 2703 [18:02:00] [main/WARN] [minecraft/NetHandlerPlayClient]: Skipping Entity with id -1 [18:02:00] [main/WARN] [minecraft/NetHandlerPlayClient]: Skipping Entity with id -1 [18:02:00] [main/WARN] [minecraft/NetHandlerPlayClient]: Skipping Entity with id -1 [18:02:00] [main/WARN] [minecraft/NetHandlerPlayClient]: Skipping Entity with id -1 [18:02:00] [Server thread/INFO] [STDOUT]: [com.mOIterei.autonomousVillages.handler.VillageEventHandler:entityJoinedWorldEventHandler:71]: -- Vil: EntityVillager['Dorfbewohner'/2706, l='Neue Welt', x=1112.50, y=66.00, z=-159.50] - ID: 2706 [18:02:00] [Server thread/INFO] [STDOUT]: [com.mOIterei.autonomousVillages.handler.VillageEventHandler:entityJoinedWorldEventHandler:95]: -- newVil: AbstractVillager['Unbekannt'/2707, l='Neue Welt', x=1112.50, y=66.00, z=-159.50] - ID: 2707 [18:02:00] [main/WARN] [minecraft/NetHandlerPlayClient]: Skipping Entity with id -1 [18:02:00] [main/WARN] [minecraft/NetHandlerPlayClient]: Skipping Entity with id -1 [18:02:00] [main/WARN] [minecraft/NetHandlerPlayClient]: Skipping Entity with id -1 [18:02:00] [main/WARN] [minecraft/NetHandlerPlayClient]: Skipping Entity with id -1 [18:02:00] [main/WARN] [minecraft/NetHandlerPlayClient]: Skipping Entity with id -1 [18:02:01] [Server thread/INFO] [STDOUT]: [com.mOIterei.autonomousVillages.handler.VillageEventHandler:entityJoinedWorldEventHandler:71]: -- Vil: EntityVillager['Dorfbewohner'/2709, l='Neue Welt', x=1137.50, y=66.00, z=-107.50] - ID: 2709 [18:02:01] [Server thread/INFO] [STDOUT]: [com.mOIterei.autonomousVillages.handler.VillageEventHandler:entityJoinedWorldEventHandler:95]: -- newVil: AbstractVillager['Unbekannt'/2710, l='Neue Welt', x=1137.50, y=66.00, z=-107.50] - ID: 2710 [18:02:01] [main/WARN] [minecraft/NetHandlerPlayClient]: Skipping Entity with id -1 [18:02:01] [main/WARN] [minecraft/NetHandlerPlayClient]: Skipping Entity with id -1 [18:02:01] [Server thread/INFO] [STDOUT]: [com.mOIterei.autonomousVillages.handler.VillageEventHandler:entityJoinedWorldEventHandler:71]: -- Vil: EntityVillager['Dorfbewohner'/2717, l='Neue Welt', x=1112.50, y=65.00, z=-170.50] - ID: 2717 [18:02:01] [Server thread/INFO] [STDOUT]: [com.mOIterei.autonomousVillages.handler.VillageEventHandler:entityJoinedWorldEventHandler:95]: -- newVil: AbstractVillager['Unbekannt'/2718, l='Neue Welt', x=1112.50, y=65.00, z=-170.50] - ID: 2718 [18:02:01] [Server thread/INFO] [STDOUT]: [com.mOIterei.autonomousVillages.handler.VillageEventHandler:entityJoinedWorldEventHandler:71]: -- Vil: EntityVillager['Dorfbewohner'/2719, l='Neue Welt', x=1112.50, y=65.00, z=-169.50] - ID: 2719 [18:02:01] [Server thread/INFO] [STDOUT]: [com.mOIterei.autonomousVillages.handler.VillageEventHandler:entityJoinedWorldEventHandler:95]: -- newVil: AbstractVillager['Unbekannt'/2720, l='Neue Welt', x=1112.50, y=65.00, z=-169.50] - ID: 2720 [18:02:01] [Server thread/INFO] [STDOUT]: [com.mOIterei.autonomousVillages.handler.VillageEventHandler:entityJoinedWorldEventHandler:71]: -- Vil: EntityVillager['Dorfbewohner'/2721, l='Neue Welt', x=1104.50, y=67.00, z=-172.50] - ID: 2721 [18:02:01] [Server thread/INFO] [STDOUT]: [com.mOIterei.autonomousVillages.handler.VillageEventHandler:entityJoinedWorldEventHandler:95]: -- newVil: AbstractVillager['Unbekannt'/2722, l='Neue Welt', x=1104.50, y=67.00, z=-172.50] - ID: 2722 [18:02:01] [main/WARN] [minecraft/NetHandlerPlayClient]: Skipping Entity with id -1 [18:02:01] [main/WARN] [minecraft/NetHandlerPlayClient]: Skipping Entity with id -1 [18:02:01] [main/WARN] [minecraft/NetHandlerPlayClient]: Skipping Entity with id -1 [18:02:01] [main/WARN] [minecraft/NetHandlerPlayClient]: Skipping Entity with id -1 [18:02:03] [Server thread/INFO] [minecraft/IntegratedServer]: Saving and pausing game... [18:02:03] [Server thread/INFO] [minecraft/MinecraftServer]: Saving chunks for level 'Neue Welt'/overworld I can't understand the message because the console write out every time a ID != -1
-
Ok thanks, that was a great Help. Now the Game starts a the Mod do anything, but I'm not sure if this call of EntityEntryBuilder is right. Especially the 'int network' is something I can't understand. what does it mean? I'm not sure if my code is right. Or id I have to call more methods? I removed the EntityRegistry and tried this: EntityEntryBuilder eeb = EntityEntryBuilder.create(); eeb.entity(AbstractVillager.class); eeb.id(AbstractVillager.ressource, 1); for the beginning I use a texture from Minecraft >public static final ResourceLocation ressource = new ResourceLocation("minecraft:textures/entity/villager/villager.png");< but this is not the mistake, or is it? I cath the EntityJoinWorldEvent and replace the spawned Villager with a Villager of mine. But in game I can hear the Villagers but dan't see them.
-
Good Evening, I'm new in minecraft-modding and I have a Problem with register my Entity. I'm sure that this problem is very simple, but I can't find the mistake, maybe course I can't find an actual examble ffor this in Version 1.12.2. ---- Minecraft Crash Report ---- // Quite honestly, I wouldn't worry myself about that. Time: 1/15/19 8:40 PM Description: There was a severe problem during mod loading that has caused the game to fail net.minecraftforge.fml.common.LoaderExceptionModCrash: Caught exception from autonomous Villages (vm) Caused by: java.lang.NullPointerException at net.minecraftforge.fml.common.registry.EntityRegistry.doModEntityRegistration(EntityRegistry.java:211) at net.minecraftforge.fml.common.registry.EntityRegistry.registerModEntity(EntityRegistry.java:173) at com.mOIterei.EntityMod.Main.init(Main.java:76) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at net.minecraftforge.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:626) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at com.google.common.eventbus.Subscriber.invokeSubscriberMethod(Subscriber.java:91) at com.google.common.eventbus.Subscriber$SynchronizedSubscriber.invokeSubscriberMethod(Subscriber.java:150) at com.google.common.eventbus.Subscriber$1.run(Subscriber.java:76) at com.google.common.util.concurrent.MoreExecutors$DirectExecutor.execute(MoreExecutors.java:399) at com.google.common.eventbus.Subscriber.dispatchEvent(Subscriber.java:71) at com.google.common.eventbus.Dispatcher$PerThreadQueuedDispatcher.dispatch(Dispatcher.java:116) at com.google.common.eventbus.EventBus.post(EventBus.java:217) at net.minecraftforge.fml.common.LoadController.sendEventToModContainer(LoadController.java:218) at net.minecraftforge.fml.common.LoadController.propogateStateMessage(LoadController.java:196) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at com.google.common.eventbus.Subscriber.invokeSubscriberMethod(Subscriber.java:91) at com.google.common.eventbus.Subscriber$SynchronizedSubscriber.invokeSubscriberMethod(Subscriber.java:150) at com.google.common.eventbus.Subscriber$1.run(Subscriber.java:76) at com.google.common.util.concurrent.MoreExecutors$DirectExecutor.execute(MoreExecutors.java:399) at com.google.common.eventbus.Subscriber.dispatchEvent(Subscriber.java:71) at com.google.common.eventbus.Dispatcher$PerThreadQueuedDispatcher.dispatch(Dispatcher.java:116) at com.google.common.eventbus.EventBus.post(EventBus.java:217) at net.minecraftforge.fml.common.LoadController.distributeStateMessage(LoadController.java:135) at net.minecraftforge.fml.common.Loader.initializeMods(Loader.java:744) at net.minecraftforge.fml.client.FMLClientHandler.finishMinecraftLoading(FMLClientHandler.java:336) at net.minecraft.client.Minecraft.init(Minecraft.java:581) at net.minecraft.client.Minecraft.run(Minecraft.java:421) at net.minecraft.client.main.Main.main(Main.java:118) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) at net.minecraft.launchwrapper.Launch.main(Launch.java:28) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) at GradleStart.main(GradleStart.java:25) A detailed walkthrough of the error, its code path and all known details is as follows: --------------------------------------------------------------------------------------- -- System Details -- Details: Minecraft Version: 1.12.2 Operating System: Windows 10 (amd64) version 10.0 Java Version: 1.8.0_191, Oracle Corporation Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation Memory: 812226280 bytes (774 MB) / 1037959168 bytes (989 MB) up to 1037959168 bytes (989 MB) JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0 FML: MCP 9.42 Powered by Forge 14.23.5.2768 5 mods loaded, 5 mods active States: 'U' = Unloaded 'L' = Loaded 'C' = Constructed 'H' = Pre-initialized 'I' = Initialized 'J' = Post-initialized 'A' = Available 'D' = Disabled 'E' = Errored | State | ID | Version | Source | Signature | |:----- |:--------- |:------------ |:-------------------------------- |:--------- | | UCHI | minecraft | 1.12.2 | minecraft.jar | None | | UCHI | mcp | 9.42 | minecraft.jar | None | | UCHI | FML | 8.0.99.99 | forgeSrc-1.12.2-14.23.5.2768.jar | None | | UCHI | forge | 14.23.5.2768 | forgeSrc-1.12.2-14.23.5.2768.jar | None | | UCHEE | vm | 1.0 | bin | None | Loaded coremods (and transformers): GL info: ' Vendor: 'NVIDIA Corporation' Version: '3.3.0' Renderer: 'GeForce 8500 GT/PCIe/SSE2' the refered Code-Line is: EntityRegistry.registerModEntity(Berserker.ResLoc, , "Berserker", 2, Main.class, 50, 2, true); I tried <EntityRegistry.registerModEntity(Berserker.ResLoc, , "Berserker", 2, Main.instance, 50, 2, true);> too, but still the same exception; the refered Class-Code with error is: @Mod(modid = References.MOD_ID, name = References.NAME, version = References.VERSION) @EventBusSubscriber public class Main { static int z = 0; public Main() { } @Mod.Instance("Main") public static Main instance; @SidedProxy(clientSide = References.CLIENT_PROXY_CLASS, serverSide = References.COMMON_PROXY_CLASS) public static CommonProxy proxy; @EventHandler public static void PreInit(FMLPreInitializationEvent event) { } @Mod.EventHandler public static void init(FMLInitializationEvent event) { System.out.println("++++++++++++++++++++++++++++++++++++++++++++++\n" +"INIT START !!"); proxy.register(); EntityRegistry.registerModEntity(Berserker.ResLoc, , "Berserker", 2, Main.class, 50, 2, true); System.out.println("++++++++++++++++++++++++++++++++++++++++++++++\n" +"INIT READY !!"); }