Fabricators-of-Create / Create

[Fabric Mod] Building Tools and Aesthetic Technology
MIT License
834 stars 188 forks source link

Crash on killing mobs #1096

Closed corentin-godefroy closed 3 months ago

corentin-godefroy commented 8 months ago

Describe the Bug

When a mob is killed by a deployer (using a sword in my tests), a crash occurs.

Reproduction Steps

  1. Use a deployer (horizontal in my tests)
  2. Apply sword an punch statement
  3. Power it with creative motor (256 rotation speed in my tests)
  4. place and block a mob in front of the deployer.
  5. Wait to the death ...

Expected Result

The mob is killed, and the deployer drop collected items by the funnel.

Screenshots and Videos

crash-report.txt

https://github.com/Fabricators-of-Create/Create/assets/48216051/15c159fe-094f-47fd-93c7-4fa366a19bd6

Crash Report or Log

(https://github.com/Fabricators-of-Create/Create/files/12508015/crash-report.txt

Operating System

Windows 11

Mod Version

0.5.1d

Minecraft Version

1.20.1

Other Mods

None

Additional Context

No response

Nehroz commented 8 months ago

Same issue here, equal version: Fabri Mod Version 0.5.1-d-build.1161 on MC 1.20.1 https://pastebin.com/gcWBTQ6e Tested any direction, yields the same result.

Decimate-Studios commented 8 months ago

I have the same glitch on the 1.20.1 version.

corentin-godefroy commented 8 months ago

and it make it with tool on the hand too.

fabien-gigante commented 7 months ago

stack trace:

java.lang.NullPointerException: Cannot invoke "java.util.List.forEach(java.util.function.Consumer)" because "capturedDrops" is null
    at com.simibubi.create.content.kinetics.deployer.DeployerHandler.activateInner(DeployerHandler.java:207)
    at com.simibubi.create.content.kinetics.deployer.DeployerHandler.activate(DeployerHandler.java:134)
    at com.simibubi.create.content.kinetics.deployer.DeployerBlockEntity.activate(DeployerBlockEntity.java:358)
    at com.simibubi.create.content.kinetics.deployer.DeployerBlockEntity.tick(DeployerBlockEntity.java:244)
    at com.simibubi.create.foundation.blockEntity.SmartBlockEntityTicker.tick(SmartBlockEntityTicker.java:15)

Temporary fix, at minimum to prevent the game from crashing ?

List<ItemEntity> capturedDrops = entity.finishCapturingDrops();
if (capturedDrops != null) capturedDrops.forEach(e -> player.getInventory()
unrealmanchen commented 7 months ago

same problem with same version on fabric annoying

fabien-gigante commented 7 months ago

Maybe a more permanent fix could be to introduce counting of drops captures ?

    @Unique
    private int capturedDropsCount = 0;

    @Override
    public void startCapturingDrops() {
        if (capturedDropsCount == 0)
            capturedDrops = new ArrayList<>();
        capturedDropsCount++;
    }

    @Override
    public List<ItemEntity> finishCapturingDrops() {
        List<ItemEntity> captured = capturedDrops;
        if (capturedDropsCount > 0)
            capturedDropsCount--;
        if (capturedDropsCount == 0)
            capturedDrops = null;
        return captured;
    }
RWRmrfrog commented 7 months ago

The first fix just causes the game to crash when the deployer deals any damage to a mob. Where would I put the code for the second fix?

fabien-gigante commented 7 months ago

Thanks for your feedback. Closing the PR #1121 for the first proposal since it's obviously not good enough.

I was thinking about entity/src/main/java/io/github/fabricators_of_create/porting_lib/entity/mixin/EntityMixin.java for the second approach. But I didn't test it yet...

fabien-gigante commented 7 months ago

Last proposal tested. Seems to be working for me.

ARitz-Cracker commented 7 months ago

can confirm @fabien-gigante's solution works, I can now build an automated blaze rod farm in peace.

Decimate-Studios commented 7 months ago

Can someone explain to me how to apply this fix?

paulwsully commented 6 months ago

Any sort of ETA on the release with this fix going out? I'm also perfectly happy pulling the project down and compiling it myself if anyone is able to tell me where I should place the fix that fabien-gigante has.

ARitz-Cracker commented 6 months ago

@paulwsully feel free to use the version we've compiled for use on our server: https://dl.x64.icu/mc_packs/DrakeServ2/mods/create-fabric-0.5.1-d-localmc1.20.1.jar This also contains fixes for issues #1134 and #1080

ST-DDT commented 6 months ago

Any sort of ETA on the release with this fix going out? I'm also perfectly happy pulling the project down and compiling it myself if anyone is able to tell me where I should place the fix that fabien-gigante has.

Checkout the PR:

Athae1218 commented 5 months ago

@paulwsully feel free to use the version we've compiled for use on our server: https://dl.x64.icu/mc_packs/DrakeServ2/mods/create-fabric-0.5.1-d-localmc1.20.1.jar This also contains fixes for issues #1134 and #1080

Using this prevents create addon mods from working, any reason for this?

ST-DDT commented 5 months ago

Using this prevents create addon mods from working, any reason for this?

I'm using my self compiled version with those fixes with addons just fine. What are you refering to with "prevent"? An error or a bug? Which addons are you trying to use?

kailrim commented 5 months ago

Using this prevents create addon mods from working, any reason for this?

I'm using my self compiled version with those fixes with addons just fine. What are you refering to with "prevent"? An error or a bug? Which addons are you trying to use?

Sorry different user and different tangent - first of all thanks for compiling the fix! It does indeed fix the crash issue but I observed that now the deployers don't create experience when killing mobs :( anymore. Regular drops are created/collected correctly though.

ST-DDT commented 5 months ago

now the deployers don't create experience when killing mobs :( anymore.

Did they ever? There is a separate mod/addon for that: Create Enchantment Industries. I have it running on my server and the exp orbs get generated perfectly fine.

Athae1218 commented 5 months ago

Using this prevents create addon mods from working, any reason for this?

I'm using my self compiled version with those fixes with addons just fine. What are you refering to with "prevent"? An error or a bug? Which addons are you trying to use?

Dang thanks for replying so fast. Currently it crashes on startup, and says that create deco does not work with the compiled version. For reference the only thing I am changing is going from Create create-fabric-0.5.1-d-build.1161+mc1.20.1 to your compiled version.

ST-DDT commented 5 months ago

Currently it crashes on startup, and says that create deco does not work with the compiled version.

Do you have a stracktrace?

Athae1218 commented 5 months ago

Do you have a stracktrace?

Incompatible mods found! net.fabricmc.loader.impl.FormattedException: Some of your mods are incompatible with the game or each other! A potential solution has been determined, this may resolve your problem:

Poopooracoocoo commented 5 months ago

@Athae1218 You see the mod resolver window because Create Deco depends on the exact version of official Create. You can override it using a Fabric Dependency Override. https://github.com/talrey/CreateDeco/issues/105#issuecomment-1860003640

ST-DDT commented 4 months ago

I used the official version and just replaced the related files, maybe that saves you from changing other stuff. create-fabric-0.5.1-d-build.1161+mc1.20.1-patched2.jar.zip

Athae1218 commented 4 months ago

Seems to work great, thank you!

stefan09103 commented 4 months ago

Maybe a more permanent fix could be to introduce counting of drops captures ?

  @Unique
  private int capturedDropsCount = 0;

  @Override
  public void startCapturingDrops() {
      if (capturedDropsCount == 0)
          capturedDrops = new ArrayList<>();
      capturedDropsCount++;
  }

  @Override
  public List<ItemEntity> finishCapturingDrops() {
      List<ItemEntity> captured = capturedDrops;
      if (capturedDropsCount > 0)
          capturedDropsCount--;
      if (capturedDropsCount == 0)
          capturedDrops = null;
      return captured;
  }

Hi,

Can you explain how to put this code in minecraft to someone who doesnt understand anything about code? I tried serveral things but i just cant seem to mae it work.

It would help me and my friends is the server a lot!

ST-DDT commented 4 months ago

Can you explain how to put this code in minecraft to someone who doesnt understand anything about code?

If you don't understand anything about code, please use one of the community provided jars with the fix:

If you don't trust jars from strangers (which is a good attitude in general), then:

stefan09103 commented 4 months ago

Can you explain how to put this code in minecraft to someone who doesnt understand anything about code?

If you don't understand anything about code, please use one of the community provided jars with the fix:

If you don't trust jars from strangers (which is a good attitude in general), then:

Hi thanks for willing to help!

But i still dont understand....

The file you made doesnt work on our server. We have a similair file but it is named. Create-SODIUM-fix and not fabric fix.

But i donwloaded all the things you commented but i dont know what to do now. the introductions are not cleare for me on that comment you sent me to. Maby just maby can you make it even easyer? Im sorry if this is annoying but i want it to work soo bad. If you dont want to its fine!.

Thanks a lot in advance!

ST-DDT commented 4 months ago

The file you made doesnt work on our server.

Did you extract the jar from the zip? What exactly did not work.

We have a similair file but it is named...

My jar has just the patch suffix appended to the original filename. Where did you download your version of create?

(Any compile instructions would result in the same issue, so I'm not expanding on those for now)

stefan09103 commented 4 months ago

The file you made doesnt work on our server.

Did you extract the jar from the zip? What exactly did not work.

We have a similair file but it is named...

My jar has just the patch suffix appended to the original filename. Where did you download your version of create?

(Any compile instructions would result in the same issue, so I'm not expanding on those for now)

Hi thanks again for the fast response

I myself did not make the modpack but we use this version of create:

https://modrinth.com/mod/create-fabric-sodium-fix

And i did extract the file from the zip it just did nothing. the game still crashes. I looked at it with a friend who understands mods more then i do and he said that i added it the right way. but i think it is because we dont have the normal create.

thanks again for helping!

ST-DDT commented 4 months ago

Then you should probably ask that mod author to include the fix (Please link to this issue for better communication).

Alternatively, try replacing the create-sodium-fix.jar/META-INF/jars/entity-2.1.1127+1.20.jar with the one in my jar. If that doesn't work, try (with a fresh copy) replacing only create-sodium-fix.jar/META-INF/jars/entity-2.1.1127+1.20.jar/io/github/fabricators_of_create/porting_lib/entity/mixin/EntityMixin.class (fix for this issue) + .../porting_lib/transfer/item/ItemStackHandlerSlot.class (fix for another issue) with the one from my jar.

Or wait and hope that the following PR fixes the issue as well:

DefomCode commented 4 months ago

Are they going to fix it? people write about some temporary solutions and I don't understand, do I need to get into the game code myself and change my mod to fix this or what? help

drwoops commented 4 months ago

its a known bug which will be fixed in the next patch

ST-DDT commented 4 months ago

Are they going to fix it? people write about some temporary solutions and I don't understand, do I need to get into the game code myself and change my mod to fix this or what? help

Download the version that is attached there, it already contains the required fix and its working perfectly fine on my server/for my friends and me:

Akaincaps commented 4 months ago

@paulwsully feel free to use the version we've compiled for use on our server: https://dl.x64.icu/mc_packs/DrakeServ2/mods/create-fabric-0.5.1-d-localmc1.20.1.jar This also contains fixes for issues #1134 and #1080 I tried your fixed version and it did fix the crash when the robot killed a mob. But it is still not compatible with sodium, can you integrate it for repair?

ST-DDT commented 4 months ago

@Akaincaps AFAICT you are using an unofficial fork that uses the updated sodium version, please report any issues with the fork there and maybe include a link to this issue so it is easier for them to lookup the fix.

Sandrro24 commented 3 months ago

@ST-DDT hey i was just reading the comments on the issue and i downloaded https://github.com/Fabricators-of-Create/Create/files/13728069/create-fabric-0.5.1-d-build.1161%2Bmc1.20.1-patched2.jar.zip , but I still don't know where to put it; do i just change the create jar for that one?

ST-DDT commented 3 months ago

I updated the instructions.

Yes,

drwoops commented 3 months ago

do you realize a jar file is already a zip file?

ST-DDT commented 3 months ago

do you realize a jar file is already a zip file?

I would have uploaded just that if github would have let me.

AnnoyedUser420 commented 3 months ago

do you realize a jar file is already a zip file?

I would have uploaded just that if github would have let me.

Just open the zip as a text file, then save it as a txt and send it here :trollface:

jwidess commented 3 months ago

Btw for anybody using the "Create Fabric Sodium Fix" by Treetrain1, I've compiled that .jar with the swapped out entity-2.1.1127+1.20.jar to fix the problem. Below is my .jar file which you can simply extract and swap out with your "create-sodium-fix-0.5.1-d-build.5+mc1.20.1.jar" and it should fix the problem!

create-dkf-sodium-fix-0.5.1-d-build.5+mc1.20.1.jar.zip

IThundxr commented 3 months ago

Fixed in: https://github.com/Fabricators-of-Create/Create/pull/1289