-
[1.18.1] Cant detect custom entity in world
I solved it, when i create entity, i checking if entity name have more than 14 letter, when i delete it, everything works fine.
-
[1.18.1] Cant detect custom entity in world
im trying to use this: event.getEntity().getServer().overworld().getEntity(UUID.fromString(findEntity.getName().getString().substring(14))).getUUID(); //findEntity its armor stand with name "MyEntityInWorld" + entity UUID but it says: UUID string too large Do you know why? EDIT: i figuret out, i need substring(15).
-
[1.18.1] Cant detect custom entity in world
try now
-
[1.18.1] Cant detect custom entity in world
https://github.com/N0tN0t/ModDebugging
-
[1.18.1] Cant detect custom entity in world
but that what i want. I want while making structure in the world, events will be happend with all players. @SubscribeEvent public static void OnBlockPlaced(BlockEvent.EntityPlaceEvent event) { BlockState blockState = event.getPlacedBlock(); if (blockState.is(Blocks.REDSTONE_TORCH)) { Entity ent = null; if (server == null && ent != null) { Iterable<Entity> entities = event.getEntity().getServer().overworld().getAllEntities(); for (Entity enti : entities) { if (enti.getName().getString().length() > 12) { if (enti.getName().getString().substring(0, 14).equals("EventsActived")) { ent = enti; } } } } if (server == null && ent == null) { ent = EntityType.ARMOR_STAND.create(event.getWorld().getServer().overworld()); } if (server == null) { server = event.getEntity().getServer(); ent.setNoGravity(true); ent.setInvisible(true); ent.setInvulnerable(true); ent.setCustomName(new TextComponent("EventsActived")); ent.moveTo(new Vec3(0,-66,0)); event.getWorld().addFreshEntity(ent); } } } I dont know how to save data to world, with capabilities that because i making armorstand in world and then i catch it in tick method
-
[1.18.1] Cant detect custom entity in world
private static int tickCounter; public static MinecraftServer server = null; @SubscribeEvent public static void OnPlayerTickEvent(TickEvent.PlayerTickEvent event) { tickCounter++; if (tickCounter >= new Random().nextInt(Math.round(2000 / speed), Math.round(4000 / speed) { Entity findEntity = null; Iterable<Entity> allEnt = minecraftServer.overworld().getAllEntities(); for (Entity findedEntity:allEnt) { MyMod.LOGGER.info(findedEntity) if (findedEntity.getName().getString().equals("MyEntity")) { findEntity = findedEntity; } } if (findEntity != null))) { tickFunction(event.player.getServer(), new Random().nextInt(70,randomSpread)); tickCounter = 0; } } } public static boolean tickFunction(MinecraftServer minecraftServer,int randomEvent) { boolean played = false; List<ServerPlayer> players = minecraftServer.getPlayerList().getPlayers(); //------ //other code to randomEvent //------ if (randomEvent >= 70 && randomEvent < 81) { for (Player player:players) { for (long x = Math.round(player.position().x) - 20; x < player.position().x + 20; x++) { for (long y = Math.round(player.position().y) - 20; y < player.position().y + 20; y++) { for (long z = Math.round(player.position().z) - 20; z < player.position().z + 20; z++) { if (played == false) { if (new Random().nextInt(20) == new Random().nextInt(20)) { Entity findEntity = null; Iterable<Entity> allEnt = minecraftServer.overworld().getAllEntities(); for (Entity findedEntity:allEnt) { if (findedEntity.getName().getString().equals("MyEntity")) { findEntity = findedEntity; } } if (findEntity == null) { if (player.level.getBlockState(new BlockPos(new Vec3(x, y, z))).getBlock() == Blocks.AIR && player.level.getBlockState(new BlockPos(new Vec3(x, y + 1, z))).getBlock() == Blocks.AIR && player.level.getBlockState(new BlockPos(new Vec3(x, y - 1, z))).getBlock() != Blocks.AIR) { MyMod.LOGGER.info("8"); Entity entity = EntityInit.MY_ENTITY.get().create(minecraftServer.overworld()); entity.setInvulnerable(true); entity.moveTo(x, y, z); entity.lookAt(EntityAnchorArgument.Anchor.FEET,player.position()); minecraftServer.overworld().addFreshEntity(entity); played = true; } } } } } } } } } return played; } }
-
[1.18.1] Cant detect custom entity in world
While i using /summon and enable tick event with entity name output everything fine but when i use Entity entity = EntityInit.MY_ENTITY.get().create(minecraftServer.overworld()); entity.setInvulnerable(true); entity.moveTo(x, y, z); entity.lookAt(EntityAnchorArgument.Anchor.FEET,player.position()); entity.setCustomName("MyEntity"); minecraftServer.overworld().addFreshEntity(entity); i cant find my enity with Entity findEntity = null; Iterable<Entity> allEnt = world.getAllEntities(); for (Entity findedEntity:allEnt) { if (findedEntity.getName().getString().equals("MyEntity")) { MyEntity.LOGGER.info("Success"); findEntity = findedEntity; } } in output nothing and after: Iterable<Entity> allEnt = world.getAllEntities(); for (Entity findedEntity:allEnt) { MyMod.LOGGER.info(findedEntity) } still dont want to find it. But while i use /summon, its works normal and i can see it in output...
-
[1.18.1] Spawning custom Entity
Ok, with that code everything works Entity entity = EntityInit.MY_ENTITY.get().create(minecraftServer.overworld());
-
[1.18.1] Spawning custom Entity
Im already register my entity because i can spawn it with /summon public class EntityInit { private EntityInit() {} public static final DeferredRegister<EntityType<?>> ENTITIES = DeferredRegister.create(ForgeRegistries.ENTITIES,MyMod.MODID); public static final RegistryObject<EntityType<MyEntity>> MY_ENTITY = ENTITIES.register(MyMod.MODID,() -> EntityType.Builder.of(MyEntity::new, MobCategory.CREATURE).sized(1,2) .build(new ResourceLocation(MyMod.MODID,"my_entity").toString())); public static void init() { ENTITIES.register(FMLJavaModLoadingContext.get().getModEventBus()); } } i need to SPAWN it or make EntityType to spawn with: entity - EntityType.TYPE.create(world); world.addFreshEntity(entity);
-
[1.18.1] Spawning custom Entity
Im trying to create custom EntityType with (This is in EntityClass) public static final EntityType<MyEntity> MY_ENTITY_TYPE = register("mymod", EntityType.Builder.<GuestEntity>of(MytEntity::new, MobCategory.CREATURE).sized(0.5F, 1.975F).clientTrackingRange(10)); @Nonnull public static <T extends IForgeRegistryEntry> T setup(@Nonnull final T entry, @Nonnull final ResourceLocation registryName) { Preconditions.checkNotNull(entry, "entry to setup must not be null!"); Preconditions.checkNotNull(registryName, "registry name to assign must not be null!"); entry.setRegistryName(registryName); if (entry instanceof EntityType) { ((EntityType) entry).setRegistryName(registryName.getNamespace() + "." + registryName.getPath()); } return entry; } private static <T extends Entity> EntityType<T> register(String p_20635_, EntityType.Builder<T> p_20636_) { return Registry.register(Registry.ENTITY_TYPE, p_20635_, p_20636_.build(p_20635_)); } and spawn with it my entity in player tick event Entity entity = MyEntity.MY_ENTITY_TYPE.create(minecraftServer.overworld()); entity.setCustomName(new TextComponent("MyEnt")); entity.setInvulnerable(true); entity.moveTo(x,y,z); minecraftServer.overworld().addFreshEntity(entity); but while im using it, it says there is errors in java.lang.UnsupportedOperationException: Reflective setAccessible(true) disabled java.lang.IllegalAccessException: class io.netty.util.internal.PlatformDependent0$6 (in module io.netty.all) cannot access class jdk.internal.misc.Unsafe (in module java.base) because module java.base does not export jdk.internal.misc to module io.netty.all [16:47:16] [Render thread/ERROR] [ne.mi.fm.ja.FMLModContainer/]: Exception caught during firing event: null [16:47:16] [Render thread/ERROR] [ne.mi.fm.ja.FMLModContainer/LOADING]: Caught exception during event net.minecraftforge.event.entity.EntityAttributeCreationEvent@1e2445f6 dispatch for modid mymod java.lang.ExceptionInInitializerError: null Caused by: java.lang.IllegalStateException: Can not register to a locked registry. Modder should use Forge Register methods. at TRANSFORMER/[email protected]/com.mine.mymod.common.entity.MyEntity.register(MyEntity.java:61) at TRANSFORMER/[email protected]/com.mine.mymod.common.entity.MytEntity.<clinit>(MyEntity.java:29) at TRANSFORMER/[email protected]/com.mine.mymod.events.CommonModEvents.registerAttributes(CommonModEvents.java:15) java.lang.Exception: Mod Loading has failed @SubscribeEvent public static void registerAttributes(EntityAttributeCreationEvent event) { event.put(EntityInit.MY_ENTITY.get(), MyEntity.createAttributes().build()); } can someone help me with it or give other methods to spawn custom entity and create custom EntityType?
-
[1.18.1] Summon custom entity crush.
Can someone help me with error? ---- Minecraft Crash Report ---- // Shall we play a game? Time: 06.02.2022, 02:32 Description: Unexpected error java.lang.NullPointerException: Cannot invoke "net.minecraft.client.renderer.entity.EntityRenderer.shouldRender(net.minecraft.world.entity.Entity, net.minecraft.client.renderer.culling.Frustum, double, double, double)" because "entityrenderer" is null at net.minecraft.client.renderer.entity.EntityRenderDispatcher.shouldRender(EntityRenderDispatcher.java:116) ~[forge-1.18.1-39.0.64_mapped_official_1.18.1-recomp.jar%2377!/:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A} at net.minecraft.client.renderer.LevelRenderer.renderLevel(LevelRenderer.java:1207) ~[forge-1.18.1-39.0.64_mapped_official_1.18.1-recomp.jar%2377!/:?] {re:classloading,pl:runtimedistcleaner:A} at net.minecraft.client.renderer.GameRenderer.renderLevel(GameRenderer.java:1056) ~[forge-1.18.1-39.0.64_mapped_official_1.18.1-recomp.jar%2377!/:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A} at net.minecraft.client.renderer.GameRenderer.render(GameRenderer.java:831) ~[forge-1.18.1-39.0.64_mapped_official_1.18.1-recomp.jar%2377!/:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A} at net.minecraft.client.Minecraft.runTick(Minecraft.java:1040) ~[forge-1.18.1-39.0.64_mapped_official_1.18.1-recomp.jar%2377!/:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A} at net.minecraft.client.Minecraft.run(Minecraft.java:660) ~[forge-1.18.1-39.0.64_mapped_official_1.18.1-recomp.jar%2377!/:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A} at net.minecraft.client.main.Main.main(Main.java:205) ~[forge-1.18.1-39.0.64_mapped_official_1.18.1-recomp.jar%2377!/:?] {re:classloading,pl:runtimedistcleaner:A} at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?] {} at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[?:?] {} at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?] {} at java.lang.reflect.Method.invoke(Method.java:568) ~[?:?] {} at net.minecraftforge.fml.loading.targets.ForgeClientUserdevLaunchHandler.lambda$launchService$0(ForgeClientUserdevLaunchHandler.java:38) ~[fmlloader-1.18.1-39.0.64.jar%230!/:?] {} at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:37) [modlauncher-9.1.0.jar%2310!/:?] {} at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:53) [modlauncher-9.1.0.jar%2310!/:?] {} at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:71) [modlauncher-9.1.0.jar%2310!/:?] {} at cpw.mods.modlauncher.Launcher.run(Launcher.java:106) [modlauncher-9.1.0.jar%2310!/:?] {} at cpw.mods.modlauncher.Launcher.main(Launcher.java:77) [modlauncher-9.1.0.jar%2310!/:?] {} at cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:26) [modlauncher-9.1.0.jar%2310!/:?] {} at cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:23) [modlauncher-9.1.0.jar%2310!/:?] {} at cpw.mods.bootstraplauncher.BootstrapLauncher.main(BootstrapLauncher.java:149) [bootstraplauncher-1.0.0.jar:?] {} A detailed walkthrough of the error, its code path and all known details is as follows: --------------------------------------------------------------------------------------- -- Head -- Thread: Render thread Stacktrace: at net.minecraft.client.renderer.entity.EntityRenderDispatcher.shouldRender(EntityRenderDispatcher.java:116) ~[forge-1.18.1-39.0.64_mapped_official_1.18.1-recomp.jar%2377!/:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A} at net.minecraft.client.renderer.LevelRenderer.renderLevel(LevelRenderer.java:1207) ~[forge-1.18.1-39.0.64_mapped_official_1.18.1-recomp.jar%2377!/:?] {re:classloading,pl:runtimedistcleaner:A} at net.minecraft.client.renderer.GameRenderer.renderLevel(GameRenderer.java:1056) ~[forge-1.18.1-39.0.64_mapped_official_1.18.1-recomp.jar%2377!/:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A} -- Affected level -- Details: All players: 1 total; [LocalPlayer['Dev'/230, l='ClientLevel', x=1.38, y=44.00, z=-10.91]] Chunk stats: 961, 505 Level dimension: minecraft:overworld Level spawn location: World: (0,77,0), Section: (at 0,13,0 in 0,4,0; chunk contains blocks 0,-64,0 to 15,319,15), Region: (0,0; contains chunks 0,0 to 31,31, blocks 0,-64,0 to 511,319,511) Level time: 182 game time, 182 day time Server brand: forge Server type: Integrated singleplayer server Stacktrace: at net.minecraft.client.multiplayer.ClientLevel.fillReportDetails(ClientLevel.java:407) ~[forge-1.18.1-39.0.64_mapped_official_1.18.1-recomp.jar%2377!/:?] {re:classloading,pl:runtimedistcleaner:A} at net.minecraft.client.Minecraft.fillReport(Minecraft.java:2248) ~[forge-1.18.1-39.0.64_mapped_official_1.18.1-recomp.jar%2377!/:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A} at net.minecraft.client.Minecraft.run(Minecraft.java:682) ~[forge-1.18.1-39.0.64_mapped_official_1.18.1-recomp.jar%2377!/:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A} at net.minecraft.client.main.Main.main(Main.java:205) ~[forge-1.18.1-39.0.64_mapped_official_1.18.1-recomp.jar%2377!/:?] {re:classloading,pl:runtimedistcleaner:A} at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?] {} at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[?:?] {} at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?] {} at java.lang.reflect.Method.invoke(Method.java:568) ~[?:?] {} at net.minecraftforge.fml.loading.targets.ForgeClientUserdevLaunchHandler.lambda$launchService$0(ForgeClientUserdevLaunchHandler.java:38) ~[fmlloader-1.18.1-39.0.64.jar%230!/:?] {} at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:37) [modlauncher-9.1.0.jar%2310!/:?] {} at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:53) [modlauncher-9.1.0.jar%2310!/:?] {} at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:71) [modlauncher-9.1.0.jar%2310!/:?] {} at cpw.mods.modlauncher.Launcher.run(Launcher.java:106) [modlauncher-9.1.0.jar%2310!/:?] {} at cpw.mods.modlauncher.Launcher.main(Launcher.java:77) [modlauncher-9.1.0.jar%2310!/:?] {} at cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:26) [modlauncher-9.1.0.jar%2310!/:?] {} at cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:23) [modlauncher-9.1.0.jar%2310!/:?] {} at cpw.mods.bootstraplauncher.BootstrapLauncher.main(BootstrapLauncher.java:149) [bootstraplauncher-1.0.0.jar:?] {} -- Last reload -- Details: Reload number: 1 Reload reason: initial Finished: Yes Packs: Default, Mod Resources -- System Details -- Details: Minecraft Version: 1.18.1 Minecraft Version ID: 1.18.1 Operating System: Windows 10 (amd64) version 10.0 Java Version: 17.0.1, Oracle Corporation Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode, sharing), Oracle Corporation Memory: 2168815440 bytes (2068 MiB) / 3198156800 bytes (3050 MiB) up to 4261412864 bytes (4064 MiB) CPUs: 12 Processor Vendor: GenuineIntel Processor Name: Intel(R) Core(TM) i5-10400F CPU @ 2.90GHz Identifier: Intel64 Family 6 Model 165 Stepping 3 Microarchitecture: unknown Frequency (GHz): 2,90 Number of physical packages: 1 Number of physical CPUs: 6 Number of logical CPUs: 12 Graphics card #0 name: NVIDIA GeForce RTX 3060 Graphics card #0 vendor: NVIDIA (0x10de) Graphics card #0 VRAM (MB): 4095,00 Graphics card #0 deviceId: 0x2503 Graphics card #0 versionInfo: DriverVersion=30.0.14.7168 Memory slot #0 capacity (MB): 8192,00 Memory slot #0 clockSpeed (GHz): 2,67 Memory slot #0 type: DDR4 Memory slot #1 capacity (MB): 8192,00 Memory slot #1 clockSpeed (GHz): 2,67 Memory slot #1 type: DDR4 Virtual memory max (MB): 27518,29 Virtual memory used (MB): 18456,29 Swap memory total (MB): 11264,00 Swap memory used (MB): 229,76 JVM Flags: 1 total; -XX:HeapDumpPath=MojangTricksIntelDriversForPerformance_javaw.exe_minecraft.exe.heapdump Launched Version: MOD_DEV Backend library: LWJGL version 3.2.2 SNAPSHOT Backend API: NVIDIA GeForce RTX 3060/PCIe/SSE2 GL version 3.2.0 NVIDIA 471.68, NVIDIA Corporation Window size: 854x480 GL Caps: Using framebuffer using OpenGL 3.2 GL debug messages: Using VBOs: Yes Is Modded: Definitely; Client brand changed to 'forge'; Server brand changed to 'forge' Type: Integrated Server (map_client.txt) Graphics mode: fancy Resource Packs: Current Language: English (US) CPU: 12x Intel(R) Core(TM) i5-10400F CPU @ 2.90GHz Server Running: true Player Count: 1 / 8; [ServerPlayer['Dev'/230, l='ServerLevel[New World]', x=1.38, y=44.00, z=-10.91]] Data Packs: vanilla, mod:forge, mod:mymod ModLauncher: 9.1.0+9.1.0+main.6690ee51 ModLauncher launch target: forgeclientuserdev ModLauncher naming: mcp ModLauncher services: mixin PLUGINSERVICE eventbus PLUGINSERVICE object_holder_definalize PLUGINSERVICE runtime_enum_extender PLUGINSERVICE capability_token_subclass PLUGINSERVICE accesstransformer PLUGINSERVICE runtimedistcleaner PLUGINSERVICE mixin TRANSFORMATIONSERVICE fml TRANSFORMATIONSERVICE FML Language Providers: [email protected] javafml@null Mod List: forge-1.18.1-39.0.64_mapped_official_1.18.1-recomp|Minecraft |minecraft |1.18.1 |DONE |Manifest: a1:d4:5e:04:4f:d3:d6:e0:7b:37:97:cf:77:b0:de:ad:4a:47:ce:8c:96:49:5f:0a:cf:8c:ae:b2:6d:4b:8a:3f |Forge |forge |39.0.64 |DONE |Manifest: NOSIGNATURE main |My Mod |mymod |0.0NONE |DONE |Manifest: NOSIGNATURE Crash Report UUID: 72afbdd8-4878-44fb-bccc-4495c694bb66 FML: 39.0 Forge: net.minecraftforge:39.0.64 if you need to see my scripts, i can show it.
-
[1.18.1] Entity with player model and skin.
need to create it with standart minecraft library or make a new entity, model for it and textures?
-
[1.18.1] Entity with player model and skin.
Is that posible to make entity with player model and skin? While im trying to use Player player = new Player() Entity player = EntityType.PLAYER.create(world) player.moveTo(new Vec3(...)) world.addFreshEntity(player) and ect, my minecraft crush or nothing happend. Or i need to create my own entity with player form?
-
[1.17] Loop stopping the game
Can you send an example of counting ticks function please?
-
[1.17] Loop stopping the game
When im using BlockEvent.EntityPlaceEvent to detect when block is placed try { Thread.sleep(4000); event.getWorld().setBlock(event.getPos(), Blocks.AIR.defaultBlockState(), Constants.BlockFlags.BLOCK_UPDATE); LightningBolt bolt = new LightningBolt(EntityType.LIGHTNING_BOLT, event.getEntity().level); bolt.moveTo(new Vec3(event.getPos().getX(), event.getPos().getY() - 1, event.getPos().getZ())); event.getWorld().addFreshEntity(bolt); while (true) { Thread.sleep(1000); String msg = ChatFormatting.RED+"Hello : )"; event.getEntity().sendMessage(new TextComponent(msg),event.getEntity().getUUID()); } } catch (InterruptedException e) { e.printStackTrace(); } And the leave the world, game just infinity saving world screen. Someone know how to make loop without infinity loading screen after leaving?
IPS spam blocked by CleanTalk.