Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

removed redundant chest type assertion #887

Merged
merged 1 commit into from
Aug 15, 2024

Conversation

RestartFU
Copy link
Contributor

No description provided.

@RestartFU
Copy link
Contributor Author

bumping this rq because I kinda need this atm, I want to implement hoppers externally.
I could still do it with very hacky stuff, but I'd rather just get this merged instead

@RestartFU
Copy link
Contributor Author

it would also allow me to remove this hacky feature from my inv menu library

@Flonja
Copy link
Contributor

Flonja commented Jul 18, 2024

instead of removing the whole check, maybe replace it with this?

		return s.armour.Inventory(), true
	case protocol.ContainerLevelEntity:
		if s.containerOpened.Load() {
			b := s.c.World().Block(s.openedPos.Load())
-			if _, chest := b.(block.Chest); chest {
+			if _, container := b.(block.Container); container {
				return s.openedWindow.Load(), true
			} else if _, enderChest := b.(block.EnderChest); enderChest {
				return s.openedWindow.Load(), true
			}
		}
	case protocol.ContainerBarrel:
		if s.containerOpened.Load() {

@Sandertv
Copy link
Member

Do hoppers not have a different ID entirely like barrels?

@RestartFU
Copy link
Contributor Author

RestartFU commented Jul 18, 2024

Do hoppers not have a different ID entirely like barrels?

yeah but I can change that quite easily with just a simple block check with a packet handler

@RestartFU
Copy link
Contributor Author

Do hoppers not have a different ID entirely like barrels?

Screenshot_20240724_112405_GitHub.jpg

nope, as you can see here, this is what I did for my hopper PR, and it works just fine

@RestartFU
Copy link
Contributor Author

Do hoppers not have a different ID entirely like barrels?

Screenshot_20240724_112405_GitHub.jpg

nope, as you can see here, this is what I did for my hopper PR, and it works just fine

it is true that the containertype is different, but I could fix this myself on my side, anyway, this is about the redundant assert checks, I don't think it matters if hoppers have a different ID or not

@TwistedAsylumMC TwistedAsylumMC merged commit a792bfd into df-mc:master Aug 15, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants