OpenProcessingBenchInteraction class
Пакет: com.hypixel.hytale.builtin.crafting.interaction
Файл: com/hypixel/hytale/builtin/crafting/interaction/OpenProcessingBenchInteraction.java
extends: SimpleBlockInteraction
Поля (23)
| Модификаторы | Тип | Имя |
|---|---|---|
|
|
return |
|
Player |
var10 |
|
BlockType |
var10 |
|
ChunkStore |
var11 |
|
String |
var11 |
|
Ref |
var12 |
|
int |
var12 |
|
Store |
var13 |
|
Ref |
var14 |
|
ProcessingBenchBlock |
var15 |
|
BenchBlock |
var16 |
|
BlockModule.BlockStateInfo |
var17 |
|
BlockSection |
var18 |
|
BlockType |
var19 |
|
UUIDComponent |
var20 |
|
UUID |
var21 |
|
int |
var22 |
|
ProcessingBenchWindow |
var23 |
|
Map |
var24 |
|
int |
var25 |
|
PlayerRef |
var26 |
|
Ref |
var8 |
|
Store |
var9 |
Методы (9)
| Модификаторы | Возврат | Сигнатура |
|---|---|---|
|
|
if if(var10 != null) |
|
|
if if(var14 != null) |
|
|
if if(var15 == null) |
|
|
if if(var16 != null) |
|
|
if if(var18 != null) |
|
|
if if(var20 != null) |
|
|
if if(var10 != null && var10 != BlockType.EMPTY && var10 != BlockType.UNKNOWN) |
|
|
if if(var12 != 0) |
|
|
if if(var25 == 0) |
Исходный код
Показать/скрыть
class="kw">package com.hypixel.hytale.builtin.crafting.interaction;
class="kw">import com.hypixel.hytale.builtin.crafting.component.BenchBlock;
class="kw">import com.hypixel.hytale.builtin.crafting.component.ProcessingBenchBlock;
class="kw">import com.hypixel.hytale.builtin.crafting.window.BenchWindow;
class="kw">import com.hypixel.hytale.builtin.crafting.window.ProcessingBenchWindow;
class="kw">import com.hypixel.hytale.codec.builder.BuilderCodec;
class="kw">import com.hypixel.hytale.component.CommandBuffer;
class="kw">import com.hypixel.hytale.component.Ref;
class="kw">import com.hypixel.hytale.component.Store;
class="kw">import com.hypixel.hytale.protocol.InteractionType;
class="kw">import com.hypixel.hytale.protocol.SoundCategory;
class="kw">import com.hypixel.hytale.protocol.packets.interface_.Page;
class="kw">import com.hypixel.hytale.server.core.Message;
class="kw">import com.hypixel.hytale.server.core.asset.type.blocktype.config.BlockType;
class="kw">import com.hypixel.hytale.server.core.entity.InteractionContext;
class="kw">import com.hypixel.hytale.server.core.entity.UUIDComponent;
class="kw">import com.hypixel.hytale.server.core.entity.entities.Player;
class="kw">import com.hypixel.hytale.server.core.inventory.ItemStack;
class="kw">import com.hypixel.hytale.server.core.modules.block.BlockModule;
class="kw">import com.hypixel.hytale.server.core.modules.interaction.interaction.CooldownHandler;
class="kw">import com.hypixel.hytale.server.core.modules.interaction.interaction.config.client.SimpleBlockInteraction;
class="kw">import com.hypixel.hytale.server.core.universe.PlayerRef;
class="kw">import com.hypixel.hytale.server.core.universe.world.SoundUtil;
class="kw">import com.hypixel.hytale.server.core.universe.world.World;
class="kw">import com.hypixel.hytale.server.core.universe.world.chunk.section.BlockSection;
class="kw">import com.hypixel.hytale.server.core.universe.world.storage.ChunkStore;
class="kw">import com.hypixel.hytale.server.core.universe.world.storage.EntityStore;
class="kw">import java.util.Map;
class="kw">import java.util.UUID;
class="kw">import javax.annotation.Nonnull;
class="kw">import javax.annotation.Nullable;
class="kw">import org.joml.Vector3i;
class="kw">public class OpenProcessingBenchInteraction class="kw">extends SimpleBlockInteraction {
@Nonnull
class="kw">public class="kw">static class="kw">final BuilderCodec<OpenProcessingBenchInteraction> CODEC = BuilderCodec.builder(
OpenProcessingBenchInteraction.class, OpenProcessingBenchInteraction::new, SimpleBlockInteraction.CODEC
)
.documentation("Opens the processing bench page.")
.build();
class="kw">public OpenProcessingBenchInteraction() {
}
@Override
class="kw">protected void interactWithBlock(
@Nonnull World var1,
@Nonnull CommandBuffer<EntityStore> var2,
@Nonnull InteractionType var3,
@Nonnull InteractionContext var4,
@Nullable ItemStack var5,
@Nonnull Vector3i var6,
@Nonnull CooldownHandler var7
) {
Ref var8 = var4.getEntity();
Store var9 = var8.getStore();
Player var10 = var2.getComponent(var8, Player.getComponentType());
if (var10 != null) {
ChunkStore var11 = var1.getChunkStore();
Ref var12 = var11.getChunkSectionReferenceAtBlock(var6.x, var6.y, var6.z);
if (var12 != null && var12.isValid()) {
Store var13 = var11.getStore();
Ref var14 = BlockModule.getBlockEntity(var13, var12, var6.x, var6.y, var6.z);
if (var14 != null) {
ProcessingBenchBlock var15 = var13.getComponent(var14, ProcessingBenchBlock.getComponentType());
if (var15 == null) {
PlayerRef var26 = var2.getComponent(var8, PlayerRef.getComponentType());
assert var26 != null;
var26.sendMessage(
Message.translation("server.interactions.invalidBlockState")
.param("interaction", this.getClass().getSimpleName())
.param("blockState", "null")
);
} else {
BenchBlock var16 = var13.getComponent(var14, BenchBlock.getComponentType());
if (var16 != null) {
BlockModule.BlockStateInfo var17 = var13.getComponent(var14, BlockModule.BlockStateInfo.getComponentType());
BlockSection var18 = var13.getComponent(var12, BlockSection.getComponentType());
if (var18 != null) {
BlockType var19 = BlockType.getAssetMap().getAsset(var18.get(var6.x, var6.y, var6.z));
UUIDComponent var20 = var2.getComponent(var8, UUIDComponent.getComponentType());
if (var20 != null) {
UUID var21 = var20.getUuid();
int var22 = var18.getRotationIndex(var6.x, var6.y, var6.z);
ProcessingBenchWindow var23 = new ProcessingBenchWindow(var15, var16, var17, var6.x, var6.y, var6.z, var22, var19);
Map var24 = var16.getWindows();
if (var24.putIfAbsent(var21, var23) == null) {
var15.updateFuelValues(var16.getWindows());
if (var10.getPageManager().setPageWithWindows(var8, var9, Page.Bench, true, var23)) {
var23.registerCloseEvent(var9x -> {
var24.remove(var21, var23);
BlockType var10 = var1.getBlockType(var6);
if (var10 != null && var10 != BlockType.EMPTY && var10 != BlockType.UNKNOWN) {
String var11 = var10.getCurrentInteractionState();
if (var24.isEmpty() && !"Processing".equals(var11) && !"ProcessCompleted".equals(var11)) {
var1.setBlockInteractionState(var6, BenchBlock.getBaseBlockType(var10), var16.getTierStateName());
}
int var12 = var19.getBench().getLocalCloseSoundEventIndex();
if (var12 != 0) {
SoundUtil.playSoundEvent2d(var8, var12, SoundCategory.UI, var2);
}
}
});
int var25 = var19.getBench().getLocalOpenSoundEventIndex();
if (var25 == 0) {
class="kw">return;
}
SoundUtil.playSoundEvent2d(var8, var25, SoundCategory.UI, var2);
} else {
var24.remove(var21, var23);
}
}
}
}
}
}
}
}
}
}
@Override
class="kw">protected void simulateInteractWithBlock(
@Nonnull InteractionType var1, @Nonnull InteractionContext var2, @Nullable ItemStack var3, @Nonnull World var4, @Nonnull Vector3i var5
) {
}
}