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

Right/Left Click


8iggy
 Share

Recommended Posts

Hello! I want to figure out how to send a right click entity packet and to click a item in an container packet. For the right click I want to right click an NPC/EnitityPlayer and for the click a item in an inventory I want to be able to click an item in a certain slot of a container. Hope someone can help me out!

Link to comment
Share on other sites

10 hours ago, Luis_ST said:

which version did you use since EntityPlayer class doesn't exist?

Oh my bad it's just in spigot/paper api you use EntityPlayer for NPCs. I just mean how can I right click a entity.

Link to comment
Share on other sites

I'm not sure if I understood your question, what do mean by "how can I right click an Entity". To answer your question aim at the Entity and click the right mouse button...!

Another attempt to answer your question there is EntityInteractEvent.RightClick

Link to comment
Share on other sites

19 hours ago, Luis_ST said:

I'm not sure if I understood your question, what do mean by "how can I right click an Entity". To answer your question aim at the Entity and click the right mouse button...!

Another attempt to answer your question there is EntityInteractEvent.RightClick

Can you show me an example on how to call the event? I'm not trying to figure out when the player right clicks. but how to right click using code.

Link to comment
Share on other sites

Ok I found out some info but I'm not sure if it will work. 

controller.interactWithEntity(player, entity, Hand.MAIN_HAND);

Note: controller is PlayerController

I'm not sure if this will work on a server or if I'm doing it right.

Link to comment
Share on other sites

19 hours ago, Luis_ST said:

there is a method you can overwrite not sure how the method is called look into the Villager class, it's also an example how to open a Container 

ok thanks. but does my method work?

controller.interactWithEntity(player, entity, Hand.MAIN_HAND);

 

Link to comment
Share on other sites

18 hours ago, diesieben07 said:

Stop trying to automate the game from the client side. Write a server side mod and do it properly.

How do you do that? And could you still answer my question? will it work on a server?

Link to comment
Share on other sites

20 hours ago, Luis_ST said:

the code you are using is execute on client and the server will be notified, but you should do this on server and notify the client 

Ok. I don't fully understand what writing a server side mod means. Is there a way you could explain it better? And even if I understood I still don't know how to make a server side mod.

Link to comment
Share on other sites

What we mean by making a server side mod is making a mod thast uses server logic to manipulate the containers directly instead of making a mod that automates things client side, which would be classified as a cheat mod and would make us very sad

This is my Forum Signature, I am currently attempting to transform it into a small guide for fixing easier issues using spoiler blocks to keep things tidy.

 

As the most common issue I feel I should put this outside the main bulk:

The only official source for Forge is https://files.minecraftforge.net, and the only site I trust for getting mods is CurseForge.

If you use any site other than these, please take a look at the StopModReposts project and install their browser extension, I would also advise running a virus scan.

 

For players asking for assistance with Forge please expand the spoiler below and read the appropriate section(s) in its/their entirety.

Spoiler

Logs (Most issues require logs to diagnose):

Spoiler

Please post logs using one of the following sites (Thank you Lumber Wizard for the list):

https://gist.github.com/100MB Requires member (Free)

https://pastebin.com/: 512KB as guest, 10MB as Pro ($$$)

https://hastebin.com/: 400KB

Do NOT use sites like Mediafire, Dropbox, OneDrive, Google Drive, or a site that has a countdown before offering downloads.

 

What to provide:

...for Crashes and Runtime issues:

Minecraft 1.14.4 and newer:

Post debug.log

Older versions:

Please update...

 

...for Installer Issues:

Post your installer log, found in the same place you ran the installer

This log will be called either installer.log or named the same as the installer but with .log on the end

Note for Windows users:

Windows hides file extensions by default so the installer may appear without the .jar extension then when the .log is added the log will appear with the .jar extension

 

Where to get it:

Mojang Launcher: When using the Mojang launcher debug.log is found in .minecraft\logs.

 

Curse/Overwolf: If you are using the Curse Launcher, their configurations break Forge's log settings, fortunately there is an easier workaround than I originally thought, this works even with Curse's installation of the Minecraft launcher as long as it is not launched THROUGH Twitch:

Spoiler
  1. Make sure you have the correct version of Forge installed (some packs are heavily dependent on one specific build of Forge)
  2. Make a launcher profile targeting this version of Forge.
  3. Set the launcher profile's GameDir property to the pack's instance folder (not the instances folder, the folder that has the pack's name on it).
  4. Now launch the pack through that profile and follow the "Mojang Launcher" instructions above.

Video:

Spoiler

 

 

 

or alternately, 

 

Fallback ("No logs are generated"):

If you don't see logs generated in the usual place, provide the launcher_log.txt from .minecraft

 

Server Not Starting:

Spoiler

If your server does not start or a command window appears and immediately goes away, run the jar manually and provide the output.

 

Reporting Illegal/Inappropriate Adfocus Ads:

Spoiler

Get a screenshot of the URL bar or copy/paste the whole URL into a thread on the General Discussion board with a description of the Ad.

Lex will need the Ad ID contained in that URL to report it to Adfocus' support team.

 

Posting your mod as a GitHub Repo:

Spoiler

When you have an issue with your mod the most helpful thing you can do when asking for help is to provide your code to those helping you. The most convenient way to do this is via GitHub or another source control hub.

When setting up a GitHub Repo it might seem easy to just upload everything, however this method has the potential for mistakes that could lead to trouble later on, it is recommended to use a Git client or to get comfortable with the Git command line. The following instructions will use the Git Command Line and as such they assume you already have it installed and that you have created a repository.

 

  1. Open a command prompt (CMD, Powershell, Terminal, etc).
  2. Navigate to the folder you extracted Forge’s MDK to (the one that had all the licenses in).
  3. Run the following commands:
    1. git init
    2. git remote add origin [Your Repository's URL]
      • In the case of GitHub it should look like: https://GitHub.com/[Your Username]/[Repo Name].git
    3. git fetch
    4. git checkout --track origin/master
    5. git stage *
    6. git commit -m "[Your commit message]"
    7. git push
  4. Navigate to GitHub and you should now see most of the files.
    • note that it is intentional that some are not synced with GitHub and this is done with the (hidden) .gitignore file that Forge’s MDK has provided (hence the strictness on which folder git init is run from)
  5. Now you can share your GitHub link with those who you are asking for help.

[Workaround line, please ignore]

 

Link to comment
Share on other sites

17 hours ago, DaemonUmbra said:

What we mean by making a server side mod is making a mod thast uses server logic to manipulate the containers directly instead of making a mod that automates things client side, which would be classified as a cheat mod and would make us very sad

Well I'm not making a hacked client... but I can't prove it to you guys either. I'll try and do stuff more on my own from now on as it seems you don't want to help me since I'm making a "Cheat Mod".

Link to comment
Share on other sites

8 minutes ago, 8iggy said:

Well I'm not making a hacked client... but I can't prove it to you guys either. I'll try and do stuff more on my own from now on as it seems you don't want to help me since I'm making a "Cheat Mod".

Nobody said that, it suggests it but if you write a normal mod we will help you.

It would also be helpful if you could show a little more of your code so that we can better understand what you are doing, so we could help you
normally you open a container via NetworkHooks#openGui which you should execute on server, the client will be automatically notified to open the associated screen

Edited by Luis_ST
Link to comment
Share on other sites

5 minutes ago, Luis_ST said:

Nobody said that, it suggests it but if you write a normal mod we will help you.

It would also be helpful if you could show a little more of your code so that we can better understand what you are doing, so we could help you
normally you open a container via NetworkHooks#openGui which you should execute on server, the client will be automatically notified to open the associated screen

Ok. So how would I make a INamedContainerProvider? I've never used it so I don't know how to make one.

Link to comment
Share on other sites

you could use SimpleNamedContainerProvider it's a default implementation
which Container do you want to open?

Edit: as the second parameter you could use a lambda expression with the parameters int, PlayerInventory and PlayerEntity and return the Container you want to open

Edited by Luis_ST
Link to comment
Share on other sites

5 minutes ago, Luis_ST said:

you could use SimpleNamedContainerProvider it's a default implementation
which Container do you want to open?

Edit: as the second parameter you could use a lambda expression with the parameters int, PlayerInventory and PlayerEntity and return the Container you want to open

I'm not sure what container I want to open. Is there a way to get a container with windowId?

Link to comment
Share on other sites

8 minutes ago, 8iggy said:

I'm not sure what container I want to open

the way i told you, is only for custom Containers, for vanilla Containers you should use ServerPlayerEntity#openMenu

8 minutes ago, 8iggy said:

Is there a way to get a container with windowId?

it is given in the lambda, you should use it, when open a vanilla Container you don't need the id

Edited by Luis_ST
Link to comment
Share on other sites

1 minute ago, Luis_ST said:

the way i told you, is only for custom Containers, for vanilla Containers you should use ServerPlayerEntity#openMenu

it is given in the lambda, you should use it, when open a vanilla Container you don't need the id

Ok let me start over. I don't have a container. No variable, No Title, No Nothing. Now I want get a container. What is the best way to do so?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share



  • Recently Browsing

    No registered users viewing this page.

  • Posts

    • so my 1.16.5 game is crashing and i dont know why could someone help this is what the crash report says        ---- Minecraft Crash Report ---- // Uh... Did I do that? Time: 12/8/21 6:48 PM Description: Rendering overlay net.minecraftforge.fml.config.ConfigFileTypeHandler$ConfigLoadingException: Failed loading config file neat-client.toml of type CLIENT for modid neat     at net.minecraftforge.fml.config.ConfigFileTypeHandler.lambda$reader$1(ConfigFileTypeHandler.java:61) ~[?:?] {re:classloading}     at net.minecraftforge.fml.config.ConfigFileTypeHandler$$Lambda$3947/30466991.apply(Unknown Source) ~[?:?] {}     at net.minecraftforge.fml.config.ConfigTracker.openConfig(ConfigTracker.java:104) ~[?:?] {re:classloading}     at net.minecraftforge.fml.config.ConfigTracker.lambda$loadConfigs$1(ConfigTracker.java:83) ~[?:?] {re:classloading}     at net.minecraftforge.fml.config.ConfigTracker$$Lambda$3946/1787282788.accept(Unknown Source) ~[?:?] {}     at java.lang.Iterable.forEach(Iterable.java:75) ~[?:1.8.0_51] {}     at java.util.Collections$SynchronizedCollection.forEach(Collections.java:2062) ~[?:1.8.0_51] {}     at net.minecraftforge.fml.config.ConfigTracker.loadConfigs(ConfigTracker.java:83) ~[?:?] {re:classloading}     at net.minecraftforge.fml.ModLoader.lambda$null$18(ModLoader.java:208) ~[?:?] {re:classloading}     at net.minecraftforge.fml.ModLoader$$Lambda$3945/1261700299.run(Unknown Source) ~[?:?] {}     at net.minecraftforge.fml.DistExecutor.unsafeRunWhenOn(DistExecutor.java:125) ~[?:?] {re:classloading}     at net.minecraftforge.fml.ModLoader.loadMods(ModLoader.java:208) ~[?:?] {re:classloading}     at net.minecraftforge.fml.client.ClientModLoader.lambda$startModLoading$7(ClientModLoader.java:132) ~[?:?] {re:classloading,pl:runtimedistcleaner:A}     at net.minecraftforge.fml.client.ClientModLoader$$Lambda$3937/2101375146.run(Unknown Source) ~[?:?] {}     at net.minecraftforge.fml.client.ClientModLoader.lambda$createRunnableWithCatch$4(ClientModLoader.java:123) ~[?:?] {re:classloading,pl:runtimedistcleaner:A}     at net.minecraftforge.fml.client.ClientModLoader$$Lambda$2956/1769605448.run(Unknown Source) ~[?:?] {}     at net.minecraftforge.fml.client.ClientModLoader.startModLoading(ClientModLoader.java:132) ~[?:?] {re:classloading,pl:runtimedistcleaner:A}     at net.minecraftforge.fml.client.ClientModLoader.lambda$onResourceReload$2(ClientModLoader.java:114) ~[?:?] {re:classloading,pl:runtimedistcleaner:A}     at net.minecraftforge.fml.client.ClientModLoader$$Lambda$3933/525193238.run(Unknown Source) ~[?:?] {}     at net.minecraftforge.fml.client.ClientModLoader.lambda$createRunnableWithCatch$4(ClientModLoader.java:123) ~[?:?] {re:classloading,pl:runtimedistcleaner:A}     at net.minecraftforge.fml.client.ClientModLoader$$Lambda$2956/1769605448.run(Unknown Source) ~[?:?] {}     at java.util.concurrent.CompletableFuture$AsyncRun.run(CompletableFuture.java:1618) ~[?:1.8.0_51] {}     at java.util.concurrent.CompletableFuture$AsyncRun.exec(CompletableFuture.java:1610) ~[?:1.8.0_51] {}     at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289) ~[?:1.8.0_51] {}     at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056) ~[?:1.8.0_51] {}     at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1689) ~[?:1.8.0_51] {re:computing_frames}     at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157) ~[?:1.8.0_51] {} Caused by: com.electronwill.nightconfig.core.io.ParsingException: Not enough data available     at com.electronwill.nightconfig.core.io.ParsingException.notEnoughData(ParsingException.java:22) ~[core-3.6.3.jar:?] {}     at com.electronwill.nightconfig.core.io.ReaderInput.directReadChar(ReaderInput.java:36) ~[core-3.6.3.jar:?] {}     at com.electronwill.nightconfig.core.io.AbstractInput.readChar(AbstractInput.java:49) ~[core-3.6.3.jar:?] {}     at com.electronwill.nightconfig.core.io.AbstractInput.readCharsUntil(AbstractInput.java:123) ~[core-3.6.3.jar:?] {}     at com.electronwill.nightconfig.toml.TableParser.parseKey(TableParser.java:166) ~[toml-3.6.3.jar:?] {}     at com.electronwill.nightconfig.toml.TableParser.parseDottedKey(TableParser.java:145) ~[toml-3.6.3.jar:?] {}     at com.electronwill.nightconfig.toml.TableParser.parseNormal(TableParser.java:55) ~[toml-3.6.3.jar:?] {}     at com.electronwill.nightconfig.toml.TomlParser.parse(TomlParser.java:44) ~[toml-3.6.3.jar:?] {}     at com.electronwill.nightconfig.toml.TomlParser.parse(TomlParser.java:37) ~[toml-3.6.3.jar:?] {}     at com.electronwill.nightconfig.core.io.ConfigParser.parse(ConfigParser.java:113) ~[core-3.6.3.jar:?] {}     at com.electronwill.nightconfig.core.io.ConfigParser.parse(ConfigParser.java:219) ~[core-3.6.3.jar:?] {}     at com.electronwill.nightconfig.core.io.ConfigParser.parse(ConfigParser.java:202) ~[core-3.6.3.jar:?] {}     at com.electronwill.nightconfig.core.file.WriteSyncFileConfig.load(WriteSyncFileConfig.java:73) ~[core-3.6.3.jar:?] {}     at com.electronwill.nightconfig.core.file.AutosaveCommentedFileConfig.load(AutosaveCommentedFileConfig.java:85) ~[core-3.6.3.jar:?] {}     at net.minecraftforge.fml.config.ConfigFileTypeHandler.lambda$reader$1(ConfigFileTypeHandler.java:57) ~[?:?] {re:classloading}     ... 26 more A detailed walkthrough of the error, its code path and all known details is as follows: --------------------------------------------------------------------------------------- -- Head -- Thread: Render thread Stacktrace:     at net.minecraftforge.fml.config.ConfigFileTypeHandler.lambda$reader$1(ConfigFileTypeHandler.java:61) ~[?:?] {re:classloading}     at net.minecraftforge.fml.config.ConfigFileTypeHandler$$Lambda$3947/30466991.apply(Unknown Source) ~[?:?] {}     at net.minecraftforge.fml.config.ConfigTracker.openConfig(ConfigTracker.java:104) ~[?:?] {re:classloading}     at net.minecraftforge.fml.config.ConfigTracker.lambda$loadConfigs$1(ConfigTracker.java:83) ~[?:?] {re:classloading}     at net.minecraftforge.fml.config.ConfigTracker$$Lambda$3946/1787282788.accept(Unknown Source) ~[?:?] {}     at java.lang.Iterable.forEach(Iterable.java:75) ~[?:1.8.0_51] {}     at java.util.Collections$SynchronizedCollection.forEach(Collections.java:2062) ~[?:1.8.0_51] {}     at net.minecraftforge.fml.config.ConfigTracker.loadConfigs(ConfigTracker.java:83) ~[?:?] {re:classloading}     at net.minecraftforge.fml.ModLoader.lambda$null$18(ModLoader.java:208) ~[?:?] {re:classloading}     at net.minecraftforge.fml.ModLoader$$Lambda$3945/1261700299.run(Unknown Source) ~[?:?] {}     at net.minecraftforge.fml.DistExecutor.unsafeRunWhenOn(DistExecutor.java:125) ~[?:?] {re:classloading}     at net.minecraftforge.fml.ModLoader.loadMods(ModLoader.java:208) ~[?:?] {re:classloading} -- Overlay render details -- Details:     Overlay name: net.minecraft.client.gui.ResourceLoadProgressGui Stacktrace:     at net.minecraft.client.renderer.GameRenderer.func_195458_a(GameRenderer.java:807) ~[?:?] {re:classloading,pl:accesstransformer:B,xf:OptiFine:default}     at net.minecraft.client.Minecraft.func_195542_b(Minecraft.java:977) [?:?] {re:mixin,pl:accesstransformer:B,pl:runtimedistcleaner:A,re:classloading,pl:accesstransformer:B,pl:mixin:APP:mixins.betterthirdperson.json:MinecraftMixin,pl:mixin:A,pl:runtimedistcleaner:A}     at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:607) [?:?] {re:mixin,pl:accesstransformer:B,pl:runtimedistcleaner:A,re:classloading,pl:accesstransformer:B,pl:mixin:APP:mixins.betterthirdperson.json:MinecraftMixin,pl:mixin:A,pl:runtimedistcleaner:A}     at net.minecraft.client.main.Main.main(Main.java:184) [?:?] {re:classloading,pl:runtimedistcleaner:A}     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_51] {}     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_51] {}     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_51] {}     at java.lang.reflect.Method.invoke(Method.java:497) ~[?:1.8.0_51] {}     at net.minecraftforge.fml.loading.FMLClientLaunchProvider.lambda$launchService$0(FMLClientLaunchProvider.java:51) [forge-1.16.5-36.2.19.jar:36.2] {}     at net.minecraftforge.fml.loading.FMLClientLaunchProvider$$Lambda$490/1712666248.call(Unknown Source) [forge-1.16.5-36.2.19.jar:36.2] {}     at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:37) [modlauncher-8.0.9.jar:?] {}     at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:54) [modlauncher-8.0.9.jar:?] {}     at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:72) [modlauncher-8.0.9.jar:?] {}     at cpw.mods.modlauncher.Launcher.run(Launcher.java:82) [modlauncher-8.0.9.jar:?] {}     at cpw.mods.modlauncher.Launcher.main(Launcher.java:66) [modlauncher-8.0.9.jar:?] {} -- System Details -- Details:     Minecraft Version: 1.16.5     Minecraft Version ID: 1.16.5     Operating System: Windows 10 (amd64) version 10.0     Java Version: 1.8.0_51, Oracle Corporation     Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation     Memory: 1150823848 bytes (1097 MB) / 2147483648 bytes (2048 MB) up to 2147483648 bytes (2048 MB)     CPUs: 4     JVM Flags: 10 total; -XX:HeapDumpPath=MojangTricksIntelDriversForPerformance_javaw.exe_minecraft.exe.heapdump -Xss1M -XX:+IgnoreUnrecognizedVMOptions -Xmx2G -XX:+UnlockExperimentalVMOptions -XX:+UseG1GC -XX:G1NewSizePercent=20 -XX:G1ReservePercent=20 -XX:MaxGCPauseMillis=50 -XX:G1HeapRegionSize=32M     ModLauncher: 8.0.9+86+master.3cf110c     ModLauncher launch target: fmlclient     ModLauncher naming: srg     ModLauncher services:          /mixin-0.8.4.jar mixin PLUGINSERVICE          /eventbus-4.0.0.jar eventbus PLUGINSERVICE          /forge-1.16.5-36.2.19.jar object_holder_definalize PLUGINSERVICE          /forge-1.16.5-36.2.19.jar runtime_enum_extender PLUGINSERVICE          /accesstransformers-3.0.1.jar accesstransformer PLUGINSERVICE          /forge-1.16.5-36.2.19.jar capability_inject_definalize PLUGINSERVICE          /forge-1.16.5-36.2.19.jar runtimedistcleaner PLUGINSERVICE          /mixin-0.8.4.jar mixin TRANSFORMATIONSERVICE          /OptiFine_1.16.5_HD_U_G8.jar OptiFine TRANSFORMATIONSERVICE          /forge-1.16.5-36.2.19.jar fml TRANSFORMATIONSERVICE      FML: 36.2     Forge: net.minecraftforge:36.2.19     FML Language Providers:          javafml@36.2         minecraft@1     Mod List:          forge-1.16.5-36.2.19-client.jar                   |Minecraft                     |minecraft                     |1.16.5              |COMMON_SET|Manifest: NOSIGNATURE         MouseTweaks-2.14-mc1.16.2.jar                     |Mouse Tweaks                  |mousetweaks                   |2.14                |COMMON_SET|Manifest: NOSIGNATURE         BetterF3-1.1.3-forge-1.16.5.jar                   |BetterF3 Forge                |betterf3forge                 |1.1.3               |COMMON_SET|Manifest: NOSIGNATURE         toughnessbar-6.1.jar                              |Toughness Bar                 |toughnessbar                  |6.1                 |COMMON_SET|Manifest: NOSIGNATURE         jei-1.16.5-7.7.1.130.jar                          |Just Enough Items             |jei                           |7.7.1.130           |COMMON_SET|Manifest: NOSIGNATURE         incontrol-1.16-5.2.2.jar                          |InControl                     |incontrol                     |1.16-5.2.2          |COMMON_SET|Manifest: NOSIGNATURE         torohealth-1.16.4-forge-4.jar                     |ToroHealth                    |torohealth                    |NONE                |COMMON_SET|Manifest: NOSIGNATURE         SpartanShields-1.16.5-2.1.2.jar                   |Spartan Shields               |spartanshields                |2.1.2               |COMMON_SET|Manifest: NOSIGNATURE         Neat 1.7-27.jar                                   |Neat                          |neat                          |1.7-27              |COMMON_SET|Manifest: NOSIGNATURE         Waystones_1.16.5-7.6.3.jar                        |Waystones                     |waystones                     |7.6.3               |COMMON_SET|Manifest: NOSIGNATURE         Clumps-6.0.0.27.jar                               |Clumps                        |clumps                        |6.0.0.27            |COMMON_SET|Manifest: NOSIGNATURE         journeymap-1.16.5-5.7.3.jar                       |Journeymap                    |journeymap                    |5.7.3               |COMMON_SET|Manifest: NOSIGNATURE         structurescompass-1.16.5-1.2.0.jar                |Structures Compass            |structurescompass             |1.16.5-1.2.0        |COMMON_SET|Manifest: NOSIGNATURE         comforts-forge-1.16.5-4.0.1.3.jar                 |Comforts                      |comforts                      |1.16.5-4.0.1.3      |COMMON_SET|Manifest: NOSIGNATURE         OreExcavation-1.8.157.jar                         |Ore Excavation                |oreexcavation                 |1.8.157             |COMMON_SET|Manifest: e7:68:1c:0d:b9:7e:cf:f8:f3:40:9c:84:c5:39:d7:a4:59:78:b0:6b:c3:fd:b7:4f:69:18:a3:88:e3:76:8c:3f         NaturesCompass-1.16.5-1.9.1-forge.jar             |Nature's Compass              |naturescompass                |1.16.5-1.9.1-forge  |COMMON_SET|Manifest: NOSIGNATURE         BetterThirdPerson-Forge-1.16.4-1.5.1.jar          |Better Third Person           |betterthirdperson             |1.5.1               |COMMON_SET|Manifest: NOSIGNATURE         ImprovedBackpacks-1.6.2.0.jar                     |Improved Backpacks            |improvedbackpacks             |1.6.2.0             |COMMON_SET|Manifest: NOSIGNATURE         forge-branders-spawnermod-1.16.5-1.8.14.jar       |Enhanced Mob Spawners         |spawnermod                    |1.8.14              |COMMON_SET|Manifest: NOSIGNATURE         Bookshelf-Forge-1.16.5-10.3.29.jar                |Bookshelf                     |bookshelf                     |10.3.29             |COMMON_SET|Manifest: eb:c4:b1:67:8b:f9:0c:db:dc:4f:01:b1:8e:61:64:39:4c:10:85:0b:a6:c4:c7:48:f0:fa:95:f2:cb:08:3a:e5         EnchantmentDescriptions-1.16.5-7.0.12.jar         |EnchantmentDescriptions       |enchdesc                      |7.0.12              |COMMON_SET|Manifest: eb:c4:b1:67:8b:f9:0c:db:dc:4f:01:b1:8e:61:64:39:4c:10:85:0b:a6:c4:c7:48:f0:fa:95:f2:cb:08:3a:e5         Construction-Wand-Mod-1.16.5.jar                  |Construction Wand             |constructionwand              |1.16.5-2.4          |COMMON_SET|Manifest: NOSIGNATURE         forge-1.16.5-36.2.19-universal.jar                |Forge                         |forge                         |36.2.19             |COMMON_SET|Manifest: 22:af:21:d8:19:82:7f:93:94:fe:2b:ac:b7:e4:41:57:68:39:87:b1:a7:5c:c6:44:f9:25:74:21:14:f5:0d:90         FastLeafDecay-v25.jar                             |FastLeafDecay                 |fastleafdecay                 |v25                 |COMMON_SET|Manifest: NOSIGNATURE         CosmeticArmorReworked-1.16.5-v4.jar               |CosmeticArmorReworked         |cosmeticarmorreworked         |1.16.5-v4           |COMMON_SET|Manifest: 5e:ed:25:99:e4:44:14:c0:dd:89:c1:a9:4c:10:b5:0d:e4:b1:52:50:45:82:13:d8:d0:32:89:67:56:57:01:53         DungeonsArise-1.16.5-2.1.47-release.jar           |When Dungeons Arise           |dungeons_arise                |2.1.47              |COMMON_SET|Manifest: NOSIGNATURE     Crash Report UUID: 0200d0f1-6fd6-42d6-ab81-b889d2884274     Launched Version: 1.16.5-forge-36.2.19     Backend library: LWJGL version 3.2.2 build 10     Backend API: Intel(R) HD Graphics 4600 GL version 4.3.0 - Build 20.19.15.5058, Intel     GL Caps: Using framebuffer using OpenGL 3.0     Using VBOs: Yes     Is Modded: Definitely; Client brand changed to 'forge'     Type: Client (map_client.txt)     Graphics mode: fancy     Resource Packs:      Current Language: English (US)     CPU: 4x Intel(R) Core(TM) i5-4570T CPU @ 2.90GHz     OptiFine Version: OptiFine_1.16.5_HD_U_G8     OptiFine Build: 20210515-161946     Render Distance Chunks: 8     Mipmaps: 0     Anisotropic Filtering: 1     Antialiasing: 0     Multitexture: false     Shaders: null     OpenGlVersion: 4.3.0 - Build 20.19.15.5058     OpenGlRenderer: Intel(R) HD Graphics 4600     OpenGlVendor: Intel     CpuCount: 4
    • Sorry, I thought originally this was a forge problem , so I made it for this. Anyway, I have THIS for the tick() method ...  public void tick() { if (level.getServer() != null) { super.tick(); } One of my friends told me I needed to check if it was NOT null before the super because otherwise, it was crashing when the entity was spawed- if that's not the solution , then what do i do to stop it from crashing? Here is a pastebin of that crash. Thanks by the way for trying to help me. https://pastebin.com/Qk37BRA6
    • How do you know it's the attributes' problem? For me it sounds more like it's not ticking. (maybe forgot to call super, or the server is frozen.)   Btw you're on the wrong sub forum
    • Basically, my attributes for my TankEntity are not going through. I'm DIRECTLY porting from 1.17, and it worked fine on 1.17 and 16, so I'm pretty confused here. The Entity extends Pig and within it, this is for creating the attributes. public static AttributeSupplier.Builder createAttributes() { return Pig.createLivingAttributes() .add(Attributes.MAX_HEALTH, 90.0D) .add(Attributes.MOVEMENT_SPEED, 0.14f) .add(Attributes.KNOCKBACK_RESISTANCE, 10.0D) .add(Attributes.FOLLOW_RANGE, 0.0D); } Then, in my EntityTypes Registry, I add the attributes.  @Mod.EventBusSubscriber(modid = TankMod.MOD_ID, bus = Mod.EventBusSubscriber.Bus.MOD) public class TankModEntityTypes { ..... @SubscribeEvent public static void entityAttributesInit(EntityAttributeCreationEvent event) { event.put(TANK_ENTITY_TYPE.get(), TankEntity.createAttributes().build()); } I just don't understand why its not working. This worked fine , before. The Entity spawns, but it weirdly just floats in the air, and when hit it goes red and doesn't stop being red. When the player rides it, its health also doesn't go down. Really strange stuff.  I looked at some other mods which have entity attributes, and it works fine in them. If there's anything else I need to show let me know.
    • Catch up with the last topic with rendering, this is something that I took a while to learn from nothing to this stage. (I only shoot from right side) public static List<Pair<BlockRayTraceResult, Float>> rayTraceAndPenetrateBlocks4(World world, List<Vector3d> vecs, float health, Function<BlockState, Float> getHealthReduction) { List<Pair<BlockRayTraceResult, Float>> results = new ArrayList<>(); if (vecs.isEmpty()) return results; Vector3d startVec = vecs.get(0); for (int i=0;i<vecs.size()-1;i++) { Vector3d vec = vecs.get(i); Vector3d next = vecs.get(i + 1); BlockPos pos = new BlockPos(vec); BlockPos pos2 = new BlockPos(next); BlockState blockstate = world.getBlockState(pos); BlockState blockstate2 = world.getBlockState(pos2); if (blockstate.getBlock() instanceof BarrierBlock && blockstate2.getBlock() instanceof BarrierBlock) continue; VoxelShape blockShape = blockstate.getCollisionShape(world, pos, ISelectionContext.dummy()); VoxelShape blockShape2 = blockstate2.getCollisionShape(world, pos2, ISelectionContext.dummy()); BlockRayTraceResult blockResult; boolean empty = blockShape.isEmpty() || blockShape.toBoundingBoxList().stream().noneMatch((bb) -> bb.offset(pos).contains(vec)); boolean empty2 = blockShape2.isEmpty() || blockShape2.toBoundingBoxList().stream().noneMatch((bb) -> bb.offset(pos2).contains(next)); if ((isRayTraceIgnorableBlock(blockstate, blockShape) && isRayTraceIgnorableBlock(blockstate2, blockShape2))) continue; if (empty && !empty2) blockResult = world.rayTraceBlocks(vec, next, pos2, blockShape2, blockstate2); else if (!empty && empty2) blockResult = world.rayTraceBlocks(next, vec, pos, blockShape, blockstate); else blockResult = world.rayTraceBlocks(vec, next, pos, blockShape, blockstate); if (blockResult != null) { health -= getHealthReduction.apply(blockstate); results.add(new Pair<>(blockResult, (float) startVec.distanceTo(blockResult.getHitVec()))); if (health <= 0) break; } } return results; } public static List<Vector3d> getAllVectors2(Vector3d startVec, Vector3d endVec, int distance) { List<Vector3d> vecs = new ArrayList<>(); Vector3d step = endVec.subtract(startVec).normalize(); int rayTraceCount = 20; for (int i=0;i<distance;i++) for (int j=0;j<rayTraceCount;j++) vecs.add(startVec.add(step.scale(i).add(step.scale((float) j / (float) rayTraceCount)))); return vecs; } The vecs passed into the first method comes from the second method. The concept is to gather a collection of vectors, and the do ray trace between each of them. The first method can be a lot more simplified but not on my case since I also do entity penetrations, with damage calculations...etc. Anyways, if you only do normal raytracing what you will get will be something like:   Black Block represents a solid block Gray Block represents air or empty shaped block Green dots represents the positions we ray trace between. Blue dots represents the ray trace hit result. As you can see, the ray trace hit will not (unlikely) hit the surface when coming out of a block, therefore we need to detect the situation and ray trace back wards: So we get the "entering" and "exiting" points.   Here comes the rendering part once again, once you have let the client know where is hit you can perform the rendering based on the ray trace result. private static void renderObjectAt(Minecraft minecraft, EnvironmentObjectEffect object, World world, MatrixStack stack, float size, float offsetScale, ResourceLocation texture) { Vector3d vec = object.getVec(); stack.push(); Vector3d view = Minecraft.getInstance().gameRenderer.getActiveRenderInfo().getProjectedView(); double x = vec.x - view.getX(); double y = vec.y - view.getY(); double z = vec.z - view.getZ(); if (Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2) + Math.pow(z, 2)) > 100.0F) return; stack.translate(x, y, z); Direction direction = object.getDirection(); if (direction != null) { Vector3i offset = direction.getDirectionVec(); stack.translate(offset.getX() * offsetScale, offset.getY() * offsetScale, offset.getZ() * offsetScale); rotateByDirection(stack, direction); } else { stack.rotate(minecraft.getRenderManager().getCameraOrientation()); stack.rotate(Vector3f.ZP.rotationDegrees(180.0F)); } if (object.doBlend()) { Color colour = new Color(world.getBlockState(object.getPos()).getMaterialColor(world, object.getPos()).colorValue); RenderSystem.color4f(colour.getRed() / 255.0F, colour.getGreen() / 255.0F, colour.getBlue() / 255.0F, object.getTransparency()); } AVAClientUtil.blit(stack, texture, -size, -size, size, size); RenderSystem.color4f(1.0F, 1.0F, 1.0f, 1.0F); stack.pop(); } direction is facing from the BlockRayTraceResult, and doBlend is true so it will look better with the block behind it. The offset is required otherwise it will be on the same level with the block, the offset scale is a small number so there will not be an obvious gap between the wall and the texture object, the scale also prevents multiple objects overlap, for example when I have multiple "renderable objects": for (EnvironmentObjectEffect bulletHole : AVACommonUtil.cap(world).getBulletHoles()) renderObjectAt(minecraft, bulletHole, world, stack, 0.075F, 0.01F, BULLET_HOLE); for (EnvironmentObjectEffect blood : AVACommonUtil.cap(world).getBloods()) renderObjectAt(minecraft, blood, world, stack, 0.525F, 0.011F, BLOOD); for (EnvironmentObjectEffect knifeHole : AVACommonUtil.cap(world).getKnifeHoles()) renderObjectAt(minecraft, knifeHole, world, stack, 0.095F, 0.0105F, KNIFE_HOLE); for (EnvironmentObjectEffect grenadeMark : AVACommonUtil.cap(world).getGrenadeMarks()) renderObjectAt(minecraft, grenadeMark, world, stack, 2.5F, 0.075F, GRENADE_MARK); bullet hole < knife hole < blood < grenade mark (level) Red Image    
  • Topics

  • Who's Online (See full list)

×
×
  • Create New...

Important Information

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