Compare commits

...
Author SHA1 Message Date
Hiroku d6c543e965 Fixed Porygon evolution 2023-05-28 01:04:26 +00:00
Hiroku 505eb06406 Merge branch '1.3.2-dupe-fix' into '1.3.2-dupe-fix'
Fix a crash introduced by issue !482

See merge request cable-mc/cobblemon!483
2023-05-28 00:59:56 +00:00
Neovitalism 83963d038d Clean my unused imports 2023-05-23 20:01:37 -04:00
Neovitalism cedcf1aacf Only force recall when the player teleports
Sadly teleporting the mon caused too many issues and crashes
2023-05-23 16:41:54 -04:00
Neovitalism 5613726acd Merge branch '1.3.2-dupe-fix' of https://gitlab.com/Neovitalism/cobblemon into 1.3.2-dupe-fix 2023-05-23 06:23:43 -04:00
Neovitalism 4be346d96d Make pokemon being manually recalled not trigger onStoppedTrackingBy 2023-05-23 06:23:27 -04:00
Neovitalism 29e6861f88 Merge branch '1.3.2-dupe-fix' into '1.3.2-dupe-fix'
# Conflicts:
#   common/src/main/kotlin/com/cobblemon/mod/common/util/EntityExtensions.kt
2023-05-23 01:42:03 +00:00
Neovitalism 6deb272ec3 Change to teleport since teleport loads the chunk 2023-05-22 21:33:36 -04:00
Neovitalism 18caae05ca Load the chunk the PokemonEntity is being recalled from 2023-05-21 20:35:28 -04:00
Hiroku 1bb4692273 Merge branch '1.3.2-dupe-fix' into '1.3.2-dupe-fix'
Change ticking the GoalSelector to our own teleportToOwner attempt

See merge request cable-mc/cobblemon!482
2023-05-21 12:32:40 +00:00
NeovitalismandHiroku 6a4bd4dfa6 Change ticking the GoalSelector to our own teleportToOwner attempt 2023-05-21 12:32:40 +00:00
Neovitalism 28ff02cc3e Merge branch '1.3.2-dupe-fix' of https://gitlab.com/Neovitalism/cobblemon into 1.3.2-dupe-fix 2023-05-21 08:00:53 -04:00
Neovitalism b8378bf11c Move teleport methods to EntityExtensions.kt
This also moves the larger part of the methods to TameableEntity instead of PokemonEntity, allowing for more vanilla use, as well. (Not that it's a huge change lol)
2023-05-21 08:00:49 -04:00
Neovitalism 8d8cf6d071 Merge branch '1.3.2-dupe-fix' into '1.3.2-dupe-fix'
# Conflicts:
#   common/src/main/kotlin/com/cobblemon/mod/common/entity/pokemon/PokemonEntity.kt
2023-05-20 20:30:37 +00:00
Neovitalism 6b2b9fb064 Change ticking the GoalSelector to our own teleportToOwner attempt
This just moves the methods we need instead of ticking the GoalSelector, this not only saves all goals from ticking but allows us to do custom logic when the teleport fails (recall)
2023-05-20 16:16:27 -04:00
Hiroku 2c151ddcec Merge branch '1.3.1' into '1.3.2-dupe-fix'
Fix owned PokemonEntity from not returning to the player when left in unloaded chunks

See merge request cable-mc/cobblemon!481
2023-05-20 12:03:43 +00:00
NeovitalismandHiroku 1b4584557d Fix owned PokemonEntity from not returning to the player when left in unloaded chunks 2023-05-20 12:03:42 +00:00
Neovitalism 6773084212 Fix owned PokemonEntity from not returning to the player when left in unloaded chunks
This just ticks the pokemon's goal once when the owning player stops loading the mon, so this works in unloaded chunks and does nothing different in loaded chunks
2023-05-19 14:00:50 -04:00
3 changed files with 34 additions and 4 deletions
@@ -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
}
}