DBot — Сегодня, в 8:52

Напомнил
Что ящик должен агрить пиглинов
Ибо они агрятся даже на ендер сундук
И это by design
This commit is contained in:
YuRaNnNzZZ 2023-10-26 09:10:48 +03:00
parent 1f72cd865c
commit cf45fe69c5
Signed by: YuRaNnNzZZ
GPG Key ID: 5F71738C85A6006D
4 changed files with 13 additions and 5 deletions

View File

@ -253,6 +253,10 @@ fun addTags(tagsProvider: TagsProvider) {
MBlocks.BLACK_HOLE,
)
tagsProvider.guardedByPiglins.add(
MBlockTags.CARGO_CRATES,
)
tagsProvider.androidImmuneEffects.add(
MobEffects.CONDUIT_POWER,
MobEffects.HEAL,

View File

@ -182,6 +182,7 @@ class TagsProvider(private val event: GatherDataEvent) {
val witherImmune = blocks.Appender(BlockTags.WITHER_IMMUNE)
val dragonImmune = blocks.Appender(BlockTags.DRAGON_IMMUNE)
val guardedByPiglins = blocks.Appender(BlockTags.GUARDED_BY_PIGLINS)
fun stoneOre(key: String, block: Block): TagsProvider {
ore(key, block)

View File

@ -6,7 +6,9 @@ import net.minecraft.network.syncher.EntityDataSerializers
import net.minecraft.network.syncher.SynchedEntityData
import net.minecraft.sounds.SoundSource
import net.minecraft.world.entity.EntityType
import net.minecraft.world.entity.monster.piglin.PiglinAi
import net.minecraft.world.entity.player.Inventory
import net.minecraft.world.entity.player.Player
import net.minecraft.world.entity.vehicle.AbstractMinecartContainer
import net.minecraft.world.inventory.AbstractContainerMenu
import net.minecraft.world.item.DyeColor
@ -81,19 +83,20 @@ class MinecartCargoCrate(
var interactingPlayers by entityData.delegate(INTERACTING_PLAYERS)
fun onPlayerOpen() {
fun onPlayerOpen(player: Player) {
if (isRemoved)
return
if (interactingPlayers++ == 0) {
if (!isRemoved) {
level().playSound(null, this, MSoundEvents.CARGO_CRATE_OPEN, SoundSource.BLOCKS, 1f, 0.8f + level().random.nextFloat() * 0.2f)
level().gameEvent(GameEvent.CONTAINER_OPEN, position, GameEvent.Context.of(this))
this.gameEvent(GameEvent.CONTAINER_OPEN, player)
PiglinAi.angerNearbyPiglins(player, true)
}
}
}
fun onPlayerClose() {
fun onPlayerClose(player: Player) {
if (interactingPlayers <= 0)
return

View File

@ -27,7 +27,7 @@ class MinecartCargoCrateMenu(
init {
if (trackedPlayerOpen) {
cart?.onPlayerOpen()
cart?.onPlayerOpen(inventory.player)
}
addStorageSlot(storageSlots)
@ -38,7 +38,7 @@ class MinecartCargoCrateMenu(
super.removed(p_38940_)
if (trackedPlayerOpen) {
cart?.onPlayerClose()
cart?.onPlayerClose(inventory.player)
}
}