Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

peanutexexe

Members
  • Posts

    32
  • Joined

  • Last visited

Everything posted by peanutexexe

  1. I finish this thread I change [1.17.1] projectile error to [solved][1.17.1] projectile error my english is very low
  2. Thank you I don’t see init registring
  3. error code [11:46:17] [Server thread/FATAL]: Error executing task on Server java.lang.NullPointerException: Registry Object not present: pmw:fmj556en at java.util.Objects.requireNonNull(Objects.java:334) ~[?:?] at net.minecraftforge.fmllegacy.RegistryObject.get(RegistryObject.java:120) ~[forge-1.17.1-37.0.8_mapped_official_1.17.1-recomp.jar%2372%2378!:?] at net.peanutexe.PMW.Entity.FMJ556En.<init>(FMJ556En.java:31) ~[%2377!:?] at net.peanutexe.PMW.Items.Gun.Assault.HK416Fac.use(HK416Fac.java:34) ~[%2377!:?] at net.minecraft.world.item.ItemStack.use(ItemStack.java:243) ~[forge-1.17.1-37.0.8_mapped_official_1.17.1-recomp.jar%2373!:?] at net.minecraft.server.level.ServerPlayerGameMode.useItem(ServerPlayerGameMode.java:284) ~[forge-1.17.1-37.0.8_mapped_official_1.17.1-recomp.jar%2373!:?] at net.minecraft.server.network.ServerGamePacketListenerImpl.handleUseItem(ServerGamePacketListenerImpl.java:995) ~[forge-1.17.1-37.0.8_mapped_official_1.17.1-recomp.jar%2373!:?] at net.minecraft.network.protocol.game.ServerboundUseItemPacket.handle(ServerboundUseItemPacket.java:23) ~[forge-1.17.1-37.0.8_mapped_official_1.17.1-recomp.jar%2373!:?] at net.minecraft.network.protocol.game.ServerboundUseItemPacket.handle(ServerboundUseItemPacket.java:7) ~[forge-1.17.1-37.0.8_mapped_official_1.17.1-recomp.jar%2373!:?] at net.minecraft.network.protocol.PacketUtils.lambda$ensureRunningOnSameThread$0(PacketUtils.java:21) ~[forge-1.17.1-37.0.8_mapped_official_1.17.1-recomp.jar%2373!:?] at net.minecraft.server.TickTask.run(TickTask.java:17) ~[forge-1.17.1-37.0.8_mapped_official_1.17.1-recomp.jar%2373!:?] at net.minecraft.util.thread.BlockableEventLoop.doRunTask(BlockableEventLoop.java:139) ~[forge-1.17.1-37.0.8_mapped_official_1.17.1-recomp.jar%2373!:?] at net.minecraft.util.thread.ReentrantBlockableEventLoop.doRunTask(ReentrantBlockableEventLoop.java:22) ~[forge-1.17.1-37.0.8_mapped_official_1.17.1-recomp.jar%2373!:?] at net.minecraft.server.MinecraftServer.doRunTask(MinecraftServer.java:775) ~[forge-1.17.1-37.0.8_mapped_official_1.17.1-recomp.jar%2373!:?] at net.minecraft.server.MinecraftServer.doRunTask(MinecraftServer.java:162) ~[forge-1.17.1-37.0.8_mapped_official_1.17.1-recomp.jar%2373!:?] at net.minecraft.util.thread.BlockableEventLoop.pollTask(BlockableEventLoop.java:112) ~[forge-1.17.1-37.0.8_mapped_official_1.17.1-recomp.jar%2373!:?] at net.minecraft.server.MinecraftServer.pollTaskInternal(MinecraftServer.java:758) ~[forge-1.17.1-37.0.8_mapped_official_1.17.1-recomp.jar%2373!:?] at net.minecraft.server.MinecraftServer.pollTask(MinecraftServer.java:752) ~[forge-1.17.1-37.0.8_mapped_official_1.17.1-recomp.jar%2373!:?] at net.minecraft.util.thread.BlockableEventLoop.runAllTasks(BlockableEventLoop.java:100) ~[forge-1.17.1-37.0.8_mapped_official_1.17.1-recomp.jar%2373!:?] at net.minecraft.server.MinecraftServer.waitUntilNextTick(MinecraftServer.java:737) ~[forge-1.17.1-37.0.8_mapped_official_1.17.1-recomp.jar%2373!:?] at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:687) ~[forge-1.17.1-37.0.8_mapped_official_1.17.1-recomp.jar%2373!:?] at net.minecraft.server.MinecraftServer.lambda$spin$2(MinecraftServer.java:258) ~[forge-1.17.1-37.0.8_mapped_official_1.17.1-recomp.jar%2373!:?] at java.lang.Thread.run(Thread.java:831) [?:?]
  4. error projectile shoot code
  5. I found method is EntityRenderers.register(EntityList.Entity.get(), ThrownItemRenderer::new) (this method is only Item Projectile)
  6. I tried code but now error Description: Mod loading error has occurred java.lang.Exception: Mod Loading has failed at net.minecraftforge.fmllegacy.CrashReportExtender.dumpModLoadingCrashReport(CrashReportExtender.java:69) ~[forge-1.17.1-37.0.12_mapped_official_1.17.1-recomp.jar%2372%2378!:?] {re:classloading} at net.minecraftforge.fmlclient.ClientModLoader.completeModLoading(ClientModLoader.java:183) ~[forge-1.17.1-37.0.12_mapped_official_1.17.1-recomp.jar%2372%2378!:?] {re:classloading,pl:runtimedistcleaner:A} at net.minecraft.client.Minecraft.lambda$new$1(Minecraft.java:555) ~[forge-1.17.1-37.0.12_mapped_official_1.17.1-recomp.jar%2373!:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A} at net.minecraft.Util.ifElse(Util.java:361) ~[forge-1.17.1-37.0.12_mapped_official_1.17.1-recomp.jar%2373!:?] {re:classloading} at net.minecraft.client.Minecraft.lambda$new$2(Minecraft.java:549) ~[forge-1.17.1-37.0.12_mapped_official_1.17.1-recomp.jar%2373!:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A} at net.minecraft.client.gui.screens.LoadingOverlay.render(LoadingOverlay.java:135) ~[forge-1.17.1-37.0.12_mapped_official_1.17.1-recomp.jar%2373!:?] {re:classloading,pl:runtimedistcleaner:A} at net.minecraft.client.renderer.GameRenderer.render(GameRenderer.java:873) ~[forge-1.17.1-37.0.12_mapped_official_1.17.1-recomp.jar%2373!:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A} at net.minecraft.client.Minecraft.runTick(Minecraft.java:1039) ~[forge-1.17.1-37.0.12_mapped_official_1.17.1-recomp.jar%2373!:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A} at net.minecraft.client.Minecraft.run(Minecraft.java:659) ~[forge-1.17.1-37.0.12_mapped_official_1.17.1-recomp.jar%2373!:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A} at net.minecraft.client.main.Main.main(Main.java:186) ~[forge-1.17.1-37.0.12_mapped_official_1.17.1-recomp.jar%2373!:?] {re:classloading,pl:runtimedistcleaner:A} at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?] {} at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:78) ~[?:?] {} at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?] {} at java.lang.reflect.Method.invoke(Method.java:567) ~[?:?] {} at net.minecraftforge.fml.loading.targets.ForgeClientUserdevLaunchHandler.lambda$launchService$0(ForgeClientUserdevLaunchHandler.java:38) ~[fmlloader-1.17.1-37.0.12.jar%233!:?] {} at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:37) [modlauncher-9.0.7.jar%238!:?] {} at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:53) [modlauncher-9.0.7.jar%238!:?] {} at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:71) [modlauncher-9.0.7.jar%238!:?] {} at cpw.mods.modlauncher.Launcher.run(Launcher.java:106) [modlauncher-9.0.7.jar%238!:?] {} at cpw.mods.modlauncher.Launcher.main(Launcher.java:77) [modlauncher-9.0.7.jar%238!:?] {} at cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:26) [modlauncher-9.0.7.jar%238!:?] {} at cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:23) [modlauncher-9.0.7.jar%238!:?] {} at cpw.mods.bootstraplauncher.BootstrapLauncher.main(BootstrapLauncher.java:84) [bootstraplauncher-0.1.15.jar:?] {} A detailed walkthrough of the error, its code path and all known details is as follows: --------------------------------------------------------------------------------------- -- Head -- Thread: Render thread Stacktrace: at net.peanutexe.PMW.PMW.clientSetup(PMW.java:137) ~[%2377!:?] {re:classloading} -- MOD pmw -- Details: Mod File: main Failure message: Example Mod (pmw) encountered an error during the sided_setup event phase java.lang.ClassCastException: class net.minecraft.client.model.geom.EntityModelSet cannot be cast to class net.minecraft.client.renderer.entity.EntityRendererProvider (net.minecraft.client.model.geom.EntityModelSet and net.minecraft.client.renderer.entity.EntityRendererProvider are in module minecraft@1.17.1 of loader 'TRANSFORMER' @3fc05ea2) Mod Version: 0.0NONE Mod Issue URL: NOT PROVIDED Exception message: java.lang.ClassCastException: class net.minecraft.client.model.geom.EntityModelSet cannot be cast to class net.minecraft.client.renderer.entity.EntityRendererProvider (net.minecraft.client.model.geom.EntityModelSet and net.minecraft.client.renderer.entity.EntityRendererProvider are in module minecraft@1.17.1 of loader 'TRANSFORMER' @3fc05ea2) Stacktrace: at net.peanutexe.PMW.PMW.clientSetup(PMW.java:137) ~[%2377!:?] {re:classloading} at net.minecraftforge.eventbus.EventBus.doCastFilter(EventBus.java:247) ~[eventbus-5.0.3.jar%237!:?] {} at net.minecraftforge.eventbus.EventBus.lambda$addListener$11(EventBus.java:239) ~[eventbus-5.0.3.jar%237!:?] {} at net.minecraftforge.eventbus.EventBus.post(EventBus.java:302) ~[eventbus-5.0.3.jar%237!:?] {} at net.minecraftforge.eventbus.EventBus.post(EventBus.java:283) ~[eventbus-5.0.3.jar%237!:?] {} at net.minecraftforge.fml.javafmlmod.FMLModContainer.acceptEvent(FMLModContainer.java:120) ~[javafmllanguage-1.17.1-37.0.12.jar%2374!:?] {} at net.minecraftforge.fml.ModContainer.lambda$buildTransitionHandler$4(ModContainer.java:121) ~[fmlcore-1.17.1-37.0.12.jar%2376!:?] {} at java.util.concurrent.CompletableFuture$AsyncRun.run(CompletableFuture.java:1800) ~[?:?] {} at java.util.concurrent.CompletableFuture$AsyncRun.exec(CompletableFuture.java:1792) ~[?:?] {} at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:295) ~[?:?] {} at java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1016) ~[?:?] {} at java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1665) ~[?:?] {} at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1598) ~[?:?] {} at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:183) ~[?:?] {} and Main.java package net.peanutexe.PMW; import ca.weblite.objc.Proxy; import com.mojang.blaze3d.vertex.PoseStack; import net.minecraft.client.Game; import net.minecraft.client.Minecraft; import net.minecraft.client.main.GameConfig; import net.minecraft.client.model.geom.EntityModelSet; import net.minecraft.client.particle.ParticleEngine; import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.RenderBuffers; import net.minecraft.client.renderer.RenderType; import net.minecraft.client.renderer.SpriteCoordinateExpander; import net.minecraft.client.renderer.block.model.ItemTransforms; import net.minecraft.client.renderer.entity.*; import net.minecraft.client.renderer.entity.layers.RenderLayer; import net.minecraft.client.renderer.texture.Stitcher; import net.minecraft.resources.ResourceLocation; import net.minecraft.server.packs.resources.PreparableReloadListener; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.projectile.Snowball; import net.minecraft.world.item.CreativeModeTab; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Blocks; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.client.model.ItemLayerModel; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.RegistryEvent; import net.minecraftforge.event.entity.player.PlayerInteractEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.InterModComms; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent; import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent; import net.minecraftforge.fml.event.lifecycle.InterModEnqueueEvent; import net.minecraftforge.fml.event.lifecycle.InterModProcessEvent; import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; import net.minecraftforge.fmlclient.registry.ClientRegistry; import net.minecraftforge.fmlserverevents.FMLServerStartingEvent; import net.peanutexe.PMW.Items.Entity.FMJ556En; import net.peanutexe.PMW.registry.*; import net.peanutexe.PMW.util.Gun556LeftClickPacket; import net.peanutexe.PMW.util.PacketHandler; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import java.awt.image.renderable.RenderContext; import java.rmi.registry.Registry; import java.util.function.Supplier; import java.util.stream.Collectors; import static com.ibm.icu.lang.UCharacter.GraphemeClusterBreak.T; // The value here should match an entry in the META-INF/mods.toml file @Mod("pmw") public class PMW { // Directly reference a log4j LOGGER. public static final Logger LOGGER = LogManager.getLogger(); public static final String MOD_ID = "pmw"; public PMW() { // Register the setup method for modloading FMLJavaModLoadingContext.get().getModEventBus().addListener(this::setup); // Register the enqueueIMC method for modloading FMLJavaModLoadingContext.get().getModEventBus().addListener(this::enqueueIMC); // Register the processIMC method for modloading FMLJavaModLoadingContext.get().getModEventBus().addListener(this::processIMC); FMLJavaModLoadingContext.get().getModEventBus().addListener(this::clientSetup); init(); // Register ourselves for server and other game events we are interested in MinecraftForge.EVENT_BUS.register(this); } @Mod.EventBusSubscriber(modid = PMW.MOD_ID, bus = Mod.EventBusSubscriber.Bus.FORGE, value = Dist.CLIENT) public static class EventListener { @SubscribeEvent public static void emptyLeftClick(PlayerInteractEvent.LeftClickEmpty event) { PacketHandler.HANDLER.sendToServer(new Gun556LeftClickPacket()); } } private void init() { BulletRegistry.init(); GunRegistry.init(); EntityList.init(); HealRegistry.init(); } private void setup(final FMLCommonSetupEvent event) { // some preinit code LOGGER.info("HELLO FROM PREINIT"); LOGGER.info("DIRT BLOCK >> {}", Blocks.DIRT.getRegistryName()); PacketHandler.register(); } /*public static final CreativeModeTab Heal_Tab = new CreativeModeTab("heal_tab") { @Override public ItemStack makeIcon() { return new ItemStack(HealRegistry.SALEWA.get()); } };*/ public static final CreativeModeTab Assault_Tab = new CreativeModeTab("assault_tab") { @Override public ItemStack makeIcon() { return new ItemStack(GunRegistry.HK416.get()); } }; /*public static final CreativeModeTab Carbine_Tab = new CreativeModeTab("carbine_tab") { @Override public ItemStack makeIcon() { return new ItemStack(GunRegistry.M4A1.get()); } };*/ public static final CreativeModeTab BulletGroup = new CreativeModeTab("bullet_tab") { @Override public ItemStack makeIcon() { return new ItemStack(BulletRegistry.FMJ556.get()); } }; private void clientSetup(final FMLClientSetupEvent event) { Supplier<Minecraft> minecraft = Minecraft::getInstance; EntityRendererProvider<FMJ556En> renderers = (EntityRendererProvider<FMJ556En>) minecraft.get().getEntityModels(); event.enqueueWork(() -> EntityRenderers.register(EntityList.FMJ556Entity.get(), renderers)); } private void enqueueIMC(final InterModEnqueueEvent event) { // some example code to dispatch IMC to another mod InterModComms.sendTo("examplemod", "helloworld", () -> { LOGGER.info("Hello world from the MDK"); return "Hello world";}); } private void processIMC(final InterModProcessEvent event) { // some example code to receive and process InterModComms from other mods LOGGER.info("Got IMC {}", event.getIMCStream(). map(m->m.getMessageSupplier().get()). collect(Collectors.toList())); } // You can use SubscribeEvent and let the Event Bus discover methods to call @SubscribeEvent public void onServerStarting(FMLServerStartingEvent event) { // do something when the server starts LOGGER.info("HELLO from server starting"); } // You can use EventBusSubscriber to automatically subscribe events on the contained class (this is subscribing to the MOD // Event bus for receiving Registry Events) @Mod.EventBusSubscriber(bus=Mod.EventBusSubscriber.Bus.MOD) public static class RegistryEvents { @SubscribeEvent public void onBlocksRegistry(final RegistryEvent.Register<Block> blockRegistryEvent) { // register a new block here LOGGER.info("HELLO from Register Block"); } } } FMJ556En.java package net.peanutexe.PMW.Entity; import net.minecraft.network.protocol.Packet; import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.item.Item; import net.minecraft.world.entity.projectile.ThrowableItemProjectile; import net.minecraft.world.level.Level; import net.minecraft.world.phys.EntityHitResult; import net.minecraft.world.phys.HitResult; import net.minecraftforge.fmllegacy.network.NetworkHooks; import net.peanutexe.PMW.registry.BulletRegistry; import net.peanutexe.PMW.registry.EntityList; public class FMJ556En extends ThrowableItemProjectile { public static final float BASE_SPEED = 20F; public static final int TICKS = 1; public FMJ556En(EntityType<FMJ556En> p_37432_, Level world) { super(p_37432_, world); } public FMJ556En(LivingEntity entity, Level world) { super(EntityList.FMJ556Entity.get(), entity, world); } public FMJ556En(double x, double y, double z, Level world) { super(EntityList.FMJ556Entity.get(), x, y, z, world); } @Override protected Item getDefaultItem() { return BulletRegistry.BULLET_DEFAULT.get().asItem(); } /*@Override protected void onImpact(RayTraceResult result) { if (result.getType() == RayTraceResult.Type.ENTITY) { Entity entity = ((EntityRayTraceResult) result).getEntity(); int damage = 2; entity.attackEntityFrom(DamageSource.causeThrownDamage(this, this.getEntity()), (float) damage); } if (!world.isRemote) { this.remove(); } }*/ @Override protected void onHit(HitResult p_37260_) { if (p_37260_.getType() == HitResult.Type.ENTITY) { Entity entity = ((EntityHitResult) p_37260_).getEntity(); double damage = 1.5; entity.hurt(DamageSource.thrown(this, this.getOwner()), (float) damage); } if (!level.isClientSide) { this.remove(true); } } @Override public Packet<?> getAddEntityPacket() { return NetworkHooks.getEntitySpawningPacket(this); } } EntityList.java package net.peanutexe.PMW.registry; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.MobCategory; import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; import net.minecraftforge.fmllegacy.RegistryObject; import net.minecraftforge.registries.DeferredRegister; import net.minecraftforge.registries.ForgeRegistries; import net.peanutexe.PMW.Entity.FMJ556En; import net.peanutexe.PMW.PMW; public class EntityList { public static final DeferredRegister<EntityType<?>> ENTITIES = DeferredRegister.create(ForgeRegistries.ENTITIES, PMW.MOD_ID); public static void init() { ENTITIES.register(FMLJavaModLoadingContext.get().getModEventBus()); } public static final RegistryObject<EntityType<FMJ556En>> FMJ556Entity = ENTITIES.register( "fmj556_en", () -> EntityType.Builder .<FMJ556En>of(FMJ556En::new, MobCategory.MISC) .sized(0.25f, 0.25f) .build("fmj556_en")); }
  7. if you have example code? I can't code out how to use it
  8. 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.17.1-37.0.9_mapped_official_1.17.1-recomp.jar%2373!:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A} at net.minecraft.client.renderer.LevelRenderer.renderLevel(LevelRenderer.java:1053) ~[forge-1.17.1-37.0.9_mapped_official_1.17.1-recomp.jar%2373!:?] {re:classloading,pl:runtimedistcleaner:A} at net.minecraft.client.renderer.GameRenderer.renderLevel(GameRenderer.java:1049) ~[forge-1.17.1-37.0.9_mapped_official_1.17.1-recomp.jar%2373!:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A} at net.minecraft.client.renderer.GameRenderer.render(GameRenderer.java:829) ~[forge-1.17.1-37.0.9_mapped_official_1.17.1-recomp.jar%2373!:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A} at net.minecraft.client.Minecraft.runTick(Minecraft.java:1039) ~[forge-1.17.1-37.0.9_mapped_official_1.17.1-recomp.jar%2373!:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A} at net.minecraft.client.Minecraft.run(Minecraft.java:659) ~[forge-1.17.1-37.0.9_mapped_official_1.17.1-recomp.jar%2373!:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A} at net.minecraft.client.main.Main.main(Main.java:186) ~[forge-1.17.1-37.0.9_mapped_official_1.17.1-recomp.jar%2373!:?] {re:classloading,pl:runtimedistcleaner:A} at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?] {} at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:78) ~[?:?] {} at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?] {} at java.lang.reflect.Method.invoke(Method.java:567) ~[?:?] {} at net.minecraftforge.fml.loading.targets.ForgeClientUserdevLaunchHandler.lambda$launchService$0(ForgeClientUserdevLaunchHandler.java:38) ~[fmlloader-1.17.1-37.0.9.jar%233!:?] {} at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:37) [modlauncher-9.0.7.jar%238!:?] {} at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:53) [modlauncher-9.0.7.jar%238!:?] {} at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:71) [modlauncher-9.0.7.jar%238!:?] {} at cpw.mods.modlauncher.Launcher.run(Launcher.java:106) [modlauncher-9.0.7.jar%238!:?] {} at cpw.mods.modlauncher.Launcher.main(Launcher.java:77) [modlauncher-9.0.7.jar%238!:?] {} at cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:26) [modlauncher-9.0.7.jar%238!:?] {} at cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:23) [modlauncher-9.0.7.jar%238!:?] {} at cpw.mods.bootstraplauncher.BootstrapLauncher.main(BootstrapLauncher.java:84) [bootstraplauncher-0.1.15.jar:?] {}
  9. if don't SpriteRenderer using, crashing game(save world..)
  10. I don't Think in event.enqueueWork() this is my Main package net.peanutexe.PMW; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.entity.EntityRenderer; import net.minecraft.client.renderer.entity.EntityRendererProvider; import net.minecraft.client.renderer.entity.ItemRenderer; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.CreativeModeTab; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Blocks; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.RegistryEvent; import net.minecraftforge.event.entity.player.PlayerInteractEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.InterModComms; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent; import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent; import net.minecraftforge.fml.event.lifecycle.InterModEnqueueEvent; import net.minecraftforge.fml.event.lifecycle.InterModProcessEvent; import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; import net.minecraftforge.fmlclient.registry.RenderingRegistry; import net.minecraftforge.fmlserverevents.FMLServerStartingEvent; import net.peanutexe.PMW.Items.Entity.FMJ556En; import net.peanutexe.PMW.registry.BulletRegistry; import net.peanutexe.PMW.registry.EntityList; import net.peanutexe.PMW.registry.GunRegistry; import net.peanutexe.PMW.registry.HealRegistry; import net.peanutexe.PMW.util.Gun556LeftClickPacket; import net.peanutexe.PMW.util.PacketHandler; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import java.util.function.Supplier; import java.util.stream.Collectors; // The value here should match an entry in the META-INF/mods.toml file @Mod("pmw") public class PMW { // Directly reference a log4j LOGGER. public static final Logger LOGGER = LogManager.getLogger(); public static final String MOD_ID = "pmw"; public PMW() { // Register the setup method for modloading FMLJavaModLoadingContext.get().getModEventBus().addListener(this::setup); // Register the enqueueIMC method for modloading FMLJavaModLoadingContext.get().getModEventBus().addListener(this::enqueueIMC); // Register the processIMC method for modloading FMLJavaModLoadingContext.get().getModEventBus().addListener(this::processIMC); //FMLJavaModLoadingContext.get().getModEventBus().addListener(this::clientSetup); init(); // Register ourselves for server and other game events we are interested in MinecraftForge.EVENT_BUS.register(this); } @Mod.EventBusSubscriber(modid = PMW.MOD_ID, bus = Mod.EventBusSubscriber.Bus.FORGE, value = Dist.CLIENT) public static class EventListener { @SubscribeEvent public static void emptyLeftClick(PlayerInteractEvent.LeftClickEmpty event) { PacketHandler.HANDLER.sendToServer(new Gun556LeftClickPacket()); } } private void init() { BulletRegistry.init(); GunRegistry.init(); EntityList.init(); HealRegistry.init(); } private void setup(final FMLCommonSetupEvent event) { // some preinit code LOGGER.info("HELLO FROM PREINIT"); LOGGER.info("DIRT BLOCK >> {}", Blocks.DIRT.getRegistryName()); PacketHandler.register(); } /*public static final CreativeModeTab Heal_Tab = new CreativeModeTab("heal_tab") { @Override public ItemStack makeIcon() { return new ItemStack(HealRegistry.SALEWA.get()); } };*/ public static final CreativeModeTab Assault_Tab = new CreativeModeTab("assault_tab") { @Override public ItemStack makeIcon() { return new ItemStack(GunRegistry.HK416.get()); } }; /*public static final CreativeModeTab Carbine_Tab = new CreativeModeTab("carbine_tab") { @Override public ItemStack makeIcon() { return new ItemStack(GunRegistry.M4A1.get()); } };*/ public static final CreativeModeTab BulletGroup = new CreativeModeTab("bullet_tab") { @Override public ItemStack makeIcon() { return new ItemStack(BulletRegistry.FMJ556.get()); } }; private void clientSetup(final FMLClientSetupEvent event) { registerEntityModels(event.enqueueWork()); } private void registerEntityModels(Supplier<Minecraft> minecraft) { ItemRenderer renderer = minecraft.get().getItemRenderer(); RenderingRegistry.registerEntityRenderingHandler(EntityList.FMJ556Entity.get(), (renderManager) -> new Sprite(renderManager, renderer)); } private void enqueueIMC(final InterModEnqueueEvent event) { // some example code to dispatch IMC to another mod InterModComms.sendTo("examplemod", "helloworld", () -> { LOGGER.info("Hello world from the MDK"); return "Hello world";}); } private void processIMC(final InterModProcessEvent event) { // some example code to receive and process InterModComms from other mods LOGGER.info("Got IMC {}", event.getIMCStream(). map(m->m.getMessageSupplier().get()). collect(Collectors.toList())); } // You can use SubscribeEvent and let the Event Bus discover methods to call @SubscribeEvent public void onServerStarting(FMLServerStartingEvent event) { // do something when the server starts LOGGER.info("HELLO from server starting"); } // You can use EventBusSubscriber to automatically subscribe events on the contained class (this is subscribing to the MOD // Event bus for receiving Registry Events) @Mod.EventBusSubscriber(bus=Mod.EventBusSubscriber.Bus.MOD) public static class RegistryEvents { @SubscribeEvent public static void onBlocksRegistry(final RegistryEvent.Register<Block> blockRegistryEvent) { // register a new block here LOGGER.info("HELLO from Register Block"); } } } EntityList.java package net.peanutexe.PMW.registry; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.MobCategory; import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; import net.minecraftforge.fmllegacy.RegistryObject; import net.minecraftforge.registries.DeferredRegister; import net.minecraftforge.registries.ForgeRegistries; import net.peanutexe.PMW.Items.Entity.FMJ556En; import net.peanutexe.PMW.PMW; public class EntityList { public static final DeferredRegister<EntityType<?>> ENTITIES = DeferredRegister.create(ForgeRegistries.ENTITIES, PMW.MOD_ID); public static void init() { ENTITIES.register(FMLJavaModLoadingContext.get().getModEventBus()); } public static final RegistryObject<EntityType<FMJ556En>> FMJ556Entity = ENTITIES.register( "fmj556_en", () -> EntityType.Builder .<FMJ556En>of(FMJ556En::new, MobCategory.MISC) .sized(0.25f, 0.25f) .build("fmj556_en")); } FMJ556En.java package net.peanutexe.PMW.Items.Entity; import net.minecraft.network.protocol.Packet; import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.item.Item; import net.minecraft.world.entity.projectile.ThrowableItemProjectile; import net.minecraft.world.level.Level; import net.minecraft.world.phys.EntityHitResult; import net.minecraft.world.phys.HitResult; import net.minecraftforge.fmllegacy.network.NetworkHooks; import net.peanutexe.PMW.registry.BulletRegistry; import net.peanutexe.PMW.registry.EntityList; public class FMJ556En extends ThrowableItemProjectile { public static final float BASE_SPEED = 20F; public static final int TICKS = 1; public FMJ556En(EntityType<FMJ556En> p_37432_, Level world) { super(p_37432_, world); } public FMJ556En(LivingEntity entity, Level world) { super(EntityList.FMJ556Entity.get(), entity, world); } public FMJ556En(double x, double y, double z, Level world) { super(EntityList.FMJ556Entity.get(), x, y, z, world); } @Override protected Item getDefaultItem() { return BulletRegistry.BULLET_DEFAULT.get().asItem(); } /*@Override protected void onImpact(RayTraceResult result) { if (result.getType() == RayTraceResult.Type.ENTITY) { Entity entity = ((EntityRayTraceResult) result).getEntity(); int damage = 2; entity.attackEntityFrom(DamageSource.causeThrownDamage(this, this.getEntity()), (float) damage); } if (!world.isRemote) { this.remove(); } }*/ @Override protected void onHit(HitResult p_37260_) { if (p_37260_.getType() == HitResult.Type.ENTITY) { Entity entity = ((EntityHitResult) p_37260_).getEntity(); double damage = 1.5; entity.hurt(DamageSource.thrown(this, this.getOwner()), (float) damage); } if (!level.isClientSide) { this.remove(true); } } @Override public Packet<?> getAddEntityPacket() { return NetworkHooks.getEntitySpawningPacket(this); } } now I don't doing Runs
  11. I making Entity Renderer but getMinecraftSupplier() is none
  12. i found. it is 1.17.1 = "level.isClientSide" 1.16.5-36.1.0~ = "world.isClientSide"
  13. I making projectile but level.isRemote(world.isRemote) I don't found
  14. Thank you I don't check Vanilla how to check Vanilla?
  15. where is world? I found World substitute. World replace Level
  16. I create entity but error EntityClassification
×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.