Files
FalsePatternLib/src/main/java/com/falsepattern/lib/toasts/IToast.java
T

72 lines
2.2 KiB
Java
Raw Normal View History

/*
2024-04-17 17:23:43 +02:00
* This file is part of FalsePatternLib.
*
* Copyright (C) 2022-2024 FalsePattern
2022-07-30 23:26:25 +02:00
* All Rights Reserved
*
2024-04-17 17:23:43 +02:00
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
2024-04-17 17:23:43 +02:00
* FalsePatternLib is free software: you can redistribute it and/or modify
2022-07-30 23:26:25 +02:00
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
2024-04-17 17:23:43 +02:00
* FalsePatternLib is distributed in the hope that it will be useful,
2022-07-30 23:26:25 +02:00
* but WITHOUT ANY WARRANTY; without even the implied warranty of
2024-04-17 17:23:43 +02:00
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
2022-07-30 23:26:25 +02:00
* You should have received a copy of the GNU Lesser General Public License
2024-04-17 17:23:43 +02:00
* along with FalsePatternLib. If not, see <https://www.gnu.org/licenses/>.
2022-07-30 23:26:25 +02:00
*/
package com.falsepattern.lib.toasts;
import com.falsepattern.lib.StableAPI;
import com.falsepattern.lib.internal.Tags;
import com.falsepattern.lib.internal.impl.toast.GuiToastImpl;
import net.minecraft.client.audio.PositionedSoundRecord;
import net.minecraft.client.audio.SoundHandler;
import net.minecraft.util.ResourceLocation;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
@StableAPI(since = "0.10.0")
public interface IToast {
2022-08-06 13:12:55 +02:00
@StableAPI.Expose
2022-07-30 23:26:25 +02:00
Object NO_TOKEN = new Object();
2022-08-06 13:12:55 +02:00
@StableAPI.Expose
2022-07-30 23:26:25 +02:00
Visibility draw(GuiToastImpl toastGui, long delta);
2022-08-06 13:12:55 +02:00
@StableAPI.Expose
2022-07-30 23:26:25 +02:00
int width();
2022-08-06 13:12:55 +02:00
@StableAPI.Expose
2022-07-30 23:26:25 +02:00
int height();
2022-08-06 13:12:55 +02:00
@StableAPI.Expose
2022-07-30 23:26:25 +02:00
default Object getType() {
return NO_TOKEN;
}
@SideOnly(Side.CLIENT)
2022-08-06 13:12:55 +02:00
@StableAPI(since = "0.10.0")
2022-07-30 23:26:25 +02:00
enum Visibility {
SHOW(new ResourceLocation(Tags.MODID, "ui.toast.in")),
HIDE(new ResourceLocation(Tags.MODID, "ui.toast.out"));
private final ResourceLocation sound;
Visibility(ResourceLocation soundIn) {
this.sound = soundIn;
}
2022-08-06 13:12:55 +02:00
@StableAPI.Expose
2022-07-30 23:26:25 +02:00
public void playSound(SoundHandler handler) {
handler.playSound(PositionedSoundRecord.func_147674_a(this.sound, 1.0F));
}
}
}