mirror of
https://gitlab.com/cable-mc/cobblemon.git
synced 2026-10-21 06:36:25 -04:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d6c543e965 | ||
|
|
505eb06406 | ||
|
|
83963d038d | ||
|
|
cedcf1aacf | ||
|
|
5613726acd | ||
|
|
4be346d96d | ||
|
|
29e6861f88 | ||
|
|
6deb272ec3 | ||
|
|
18caae05ca | ||
|
|
1bb4692273 | ||
|
|
6a4bd4dfa6 | ||
|
|
28ff02cc3e | ||
|
|
b8378bf11c | ||
|
|
8d8cf6d071 | ||
|
|
6b2b9fb064 | ||
|
|
2c151ddcec | ||
|
|
1b4584557d | ||
|
|
6773084212 |
@@ -73,6 +73,7 @@ import net.minecraft.item.Items
|
||||
import net.minecraft.nbt.NbtCompound
|
||||
import net.minecraft.network.PacketByteBuf
|
||||
import net.minecraft.server.network.ServerPlayerEntity
|
||||
import net.minecraft.server.world.ChunkTicketType
|
||||
import net.minecraft.server.world.ServerWorld
|
||||
import net.minecraft.sound.SoundCategory
|
||||
import net.minecraft.sound.SoundEvent
|
||||
@@ -83,6 +84,7 @@ import net.minecraft.util.ActionResult
|
||||
import net.minecraft.util.Hand
|
||||
import net.minecraft.util.Identifier
|
||||
import net.minecraft.util.math.BlockPos
|
||||
import net.minecraft.util.math.ChunkPos
|
||||
import net.minecraft.util.math.Vec3d
|
||||
import net.minecraft.world.World
|
||||
import net.minecraft.world.event.GameEvent
|
||||
@@ -300,8 +302,11 @@ class PokemonEntity(
|
||||
return super.isInvulnerableTo(damageSource)
|
||||
}
|
||||
|
||||
var beingRecalled = false;
|
||||
|
||||
fun recallWithAnimation(): CompletableFuture<Pokemon> {
|
||||
val owner = owner
|
||||
beingRecalled = true
|
||||
val future = CompletableFuture<Pokemon>()
|
||||
if (phasingTargetId.get() == -1 && owner != null) {
|
||||
owner.getWorld().playSoundServer(pos, CobblemonSounds.POKE_BALL_RECALL.get(), volume = 0.2F)
|
||||
@@ -315,7 +320,7 @@ class PokemonEntity(
|
||||
pokemon.recall()
|
||||
future.complete(pokemon)
|
||||
}
|
||||
|
||||
future.whenComplete{ _, _ -> beingRecalled = false }
|
||||
return future
|
||||
}
|
||||
|
||||
@@ -854,4 +859,20 @@ class PokemonEntity(
|
||||
}
|
||||
|
||||
override fun canUsePortals() = false
|
||||
|
||||
override fun onStoppedTrackingBy(player: ServerPlayerEntity?) {
|
||||
if (player != null) {
|
||||
if(this.ownerUuid == player.uuid) {
|
||||
if(!beingRecalled) {
|
||||
// We're loading the chunk because it creates a ghost if we don't.
|
||||
val chunkPos = ChunkPos(BlockPos(x, y, z))
|
||||
(world as ServerWorld).chunkManager.addTicket(
|
||||
ChunkTicketType.POST_TELEPORT, chunkPos, 0,
|
||||
id
|
||||
)
|
||||
pokemon.recall()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8,12 +8,21 @@
|
||||
|
||||
package com.cobblemon.mod.common.util
|
||||
|
||||
import com.cobblemon.mod.common.entity.pokemon.PokemonEntity
|
||||
import net.minecraft.block.LeavesBlock
|
||||
import net.minecraft.entity.Entity
|
||||
import net.minecraft.entity.ai.pathing.LandPathNodeMaker
|
||||
import net.minecraft.entity.ai.pathing.PathNodeType
|
||||
import net.minecraft.entity.passive.TameableEntity
|
||||
import net.minecraft.server.world.ChunkTicketType
|
||||
import net.minecraft.server.world.ServerWorld
|
||||
import net.minecraft.util.function.BooleanBiFunction
|
||||
import net.minecraft.util.math.BlockPos
|
||||
import net.minecraft.util.math.ChunkPos
|
||||
import net.minecraft.util.math.Direction
|
||||
import net.minecraft.util.math.Vec3d
|
||||
import net.minecraft.util.shape.VoxelShapes
|
||||
import kotlin.math.abs
|
||||
|
||||
fun Entity.setPositionSafely(pos: Vec3d): Boolean {
|
||||
var result = pos
|
||||
@@ -117,4 +126,4 @@ fun Entity.closestPosition(positions: Iterable<BlockPos>, filter: (BlockPos) ->
|
||||
}
|
||||
|
||||
return closest
|
||||
}
|
||||
}
|
||||
|
||||
@@ -194,7 +194,7 @@
|
||||
"requirements": [
|
||||
{
|
||||
"variant": "held_item",
|
||||
"itemCondition": "cobblemon:up_grade"
|
||||
"itemCondition": "cobblemon:upgrade"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -218,4 +218,4 @@
|
||||
"weight": 365,
|
||||
"aspects": [],
|
||||
"cannotDynamax": false
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user