-
Notifications
You must be signed in to change notification settings - Fork 2
Spiderman hero #8
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
base: dev/1.21.4
Are you sure you want to change the base?
Conversation
|
| "text.hero.spiderman.description": "Spiderman Beschreibung???", | ||
| "hero.spiderman.ability.swing.description": "Scheiße ein Netz und schwinge.", | ||
| "heroes.property.web_shoot_power": "Schusskraft", | ||
| "heroes.property.web_shoot_power.description": "Die Kraft, mit der zu das Netz schießt.", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo? Should be "du" instead of "zu"?
|
|
||
| fun handleCobwebClimbCheck(player: PlayerEntity, cir: CallbackInfoReturnable<Boolean>) { | ||
| if (player.getHero() == SpidermanManager.Spiderman && !player.isSpectator && player.blockStateAtPos.block == Blocks.COBWEB) { | ||
| cir.returnValue = true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe this if is unnecessary, just do
cir.returnValue = player.getHero() == SpidermanManager.Spiderman && !player.isSpectator && player.blockStateAtPos.block == Blocks.COBWEB| if (player.getHero() == SpidermanManager.Spiderman && !player.isSpectator && player.horizontalCollision) { | ||
| cir.returnValue = true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This as well can be shortened
cir.returnValue = player.getHero() == SpidermanManager.Spiderman && !player.isSpectator && player.horizontalCollision| if (player.world is ServerWorld) { | ||
| repeat(webAmount.getValue(player.uuid).toInt()) { | ||
| val web = FallingCobwebEntity(player) | ||
| web.velocity = player.directionVector.multiply(0.6).addRandom(player.world.random, 0.3f) | ||
| player.world.spawnEntity(web) | ||
| } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use early returns, they help with code readablity and maintainability
if (player.world !is ServerWorld) {
return
}
// Continue with your codeThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please reformat the code, indentations are not consistent and make the code hard to read (CTRL + ALT + L)
| if (!world.isClient && isAlive) { | ||
| if (!isOnGround) { | ||
| Direction.entries.forEach { | ||
| val pos = this.pos.add(0.5, 0.5, 0.5).add(it.doubleVector).toBlockPos() | ||
| if (!world.getBlockState(pos).isAir) { | ||
| if (world.setBlockState(blockPos, blockState, 3)) { | ||
| discard() | ||
| } | ||
| return | ||
| } | ||
| } | ||
| val y = blockPos.y | ||
| if ((timeFalling > 100 && (y <= world.bottomY || y > world.topYInclusive)) || timeFalling > 600) { | ||
| discard() | ||
| } | ||
| } | ||
| velocity = velocity.multiply(0.98) | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use early returns please
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code is fine, just again early returns needed
Fähigkeiten
Swing ✅
Netz schießen, Netz bleibt kleben, schwingen
Throw webs ✅
Netze werfen (werden zu Blöcken, wenn sie auf dem Boden landen)
Wall climb ✅
An wänden klettern (Permanente Fähigkeit)
Cobweb climb ✅
In Spinnennetzen klettern (Permanente Fähigkeit)