Tutorial.java

net.minecraft.client.tutorial.Tutorial

信息

  • 全限定名:net.minecraft.client.tutorial.Tutorial
  • 类型:public class
  • 包:net.minecraft.client.tutorial
  • 源码路径:src/main/java/net/minecraft/client/tutorial/Tutorial.java
  • 起始行号:L20
  • 职责:

    TODO

字段/常量

  • minecraft

    • 类型: Minecraft
    • 修饰符: private final
    • 源码定位: L21
    • 说明:

      TODO

  • instance

    • 类型: TutorialStepInstance
    • 修饰符: private
    • 源码定位: L22
    • 说明:

      TODO

内部类/嵌套类型

构造器

public Tutorial(Minecraft minecraft, Options options) @ L24

  • 构造器名:Tutorial
  • 源码定位:L24
  • 修饰符:public

参数:

  • minecraft: Minecraft
  • options: Options

说明:

TODO

方法

下面的方法块按源码顺序生成。

public void onInput(ClientInput input) @ L28

  • 方法名:onInput
  • 源码定位:L28
  • 返回类型:void
  • 修饰符:public

参数:

  • input: ClientInput

说明:

TODO

public void onMouse(double xd, double yd) @ L34

  • 方法名:onMouse
  • 源码定位:L34
  • 返回类型:void
  • 修饰符:public

参数:

  • xd: double
  • yd: double

说明:

TODO

public void onLookAt(ClientLevel level, HitResult hit) @ L40

  • 方法名:onLookAt
  • 源码定位:L40
  • 返回类型:void
  • 修饰符:public

参数:

  • level: ClientLevel
  • hit: HitResult

说明:

TODO

public void onDestroyBlock(ClientLevel level, BlockPos pos, BlockState state, float percent) @ L46

  • 方法名:onDestroyBlock
  • 源码定位:L46
  • 返回类型:void
  • 修饰符:public

参数:

  • level: ClientLevel
  • pos: BlockPos
  • state: BlockState
  • percent: float

说明:

TODO

public void onOpenInventory() @ L52

  • 方法名:onOpenInventory
  • 源码定位:L52
  • 返回类型:void
  • 修饰符:public

参数:

说明:

TODO

public void onGetItem(ItemStack itemStack) @ L58

  • 方法名:onGetItem
  • 源码定位:L58
  • 返回类型:void
  • 修饰符:public

参数:

  • itemStack: ItemStack

说明:

TODO

public void stop() @ L64

  • 方法名:stop
  • 源码定位:L64
  • 返回类型:void
  • 修饰符:public

参数:

说明:

TODO

public void start() @ L71

  • 方法名:start
  • 源码定位:L71
  • 返回类型:void
  • 修饰符:public

参数:

说明:

TODO

public void tick() @ L79

  • 方法名:tick
  • 源码定位:L79
  • 返回类型:void
  • 修饰符:public

参数:

说明:

TODO

public void setStep(TutorialSteps step) @ L91

  • 方法名:setStep
  • 源码定位:L91
  • 返回类型:void
  • 修饰符:public

参数:

  • step: TutorialSteps

说明:

TODO

public Minecraft getMinecraft() @ L100

  • 方法名:getMinecraft
  • 源码定位:L100
  • 返回类型:Minecraft
  • 修饰符:public

参数:

说明:

TODO

public boolean isSurvival() @ L104

  • 方法名:isSurvival
  • 源码定位:L104
  • 返回类型:boolean
  • 修饰符:public

参数:

说明:

TODO

public static Component key(String name) @ L108

  • 方法名:key
  • 源码定位:L108
  • 返回类型:Component
  • 修饰符:public static

参数:

  • name: String

说明:

TODO

public void onInventoryAction(ItemStack itemCarried, ItemStack itemInSlot, ClickAction clickAction) @ L112

  • 方法名:onInventoryAction
  • 源码定位:L112
  • 返回类型:void
  • 修饰符:public

参数:

  • itemCarried: ItemStack
  • itemInSlot: ItemStack
  • clickAction: ClickAction

说明:

TODO

代码

@OnlyIn(Dist.CLIENT)
public class Tutorial {
    private final Minecraft minecraft;
    private @Nullable TutorialStepInstance instance;
 
    public Tutorial(Minecraft minecraft, Options options) {
        this.minecraft = minecraft;
    }
 
    public void onInput(ClientInput input) {
        if (this.instance != null) {
            this.instance.onInput(input);
        }
    }
 
    public void onMouse(double xd, double yd) {
        if (this.instance != null) {
            this.instance.onMouse(xd, yd);
        }
    }
 
    public void onLookAt(@Nullable ClientLevel level, @Nullable HitResult hit) {
        if (this.instance != null && hit != null && level != null) {
            this.instance.onLookAt(level, hit);
        }
    }
 
    public void onDestroyBlock(ClientLevel level, BlockPos pos, BlockState state, float percent) {
        if (this.instance != null) {
            this.instance.onDestroyBlock(level, pos, state, percent);
        }
    }
 
    public void onOpenInventory() {
        if (this.instance != null) {
            this.instance.onOpenInventory();
        }
    }
 
    public void onGetItem(ItemStack itemStack) {
        if (this.instance != null) {
            this.instance.onGetItem(itemStack);
        }
    }
 
    public void stop() {
        if (this.instance != null) {
            this.instance.clear();
            this.instance = null;
        }
    }
 
    public void start() {
        if (this.instance != null) {
            this.stop();
        }
 
        this.instance = this.minecraft.options.tutorialStep.create(this);
    }
 
    public void tick() {
        if (this.instance != null) {
            if (this.minecraft.level != null) {
                this.instance.tick();
            } else {
                this.stop();
            }
        } else if (this.minecraft.level != null) {
            this.start();
        }
    }
 
    public void setStep(TutorialSteps step) {
        this.minecraft.options.tutorialStep = step;
        this.minecraft.options.save();
        if (this.instance != null) {
            this.instance.clear();
            this.instance = step.create(this);
        }
    }
 
    public Minecraft getMinecraft() {
        return this.minecraft;
    }
 
    public boolean isSurvival() {
        return this.minecraft.gameMode == null ? false : this.minecraft.gameMode.getPlayerMode() == GameType.SURVIVAL;
    }
 
    public static Component key(String name) {
        return Component.keybind("key." + name).withStyle(ChatFormatting.BOLD);
    }
 
    public void onInventoryAction(ItemStack itemCarried, ItemStack itemInSlot, ClickAction clickAction) {
    }
}

引用的其他类