-
Notifications
You must be signed in to change notification settings - Fork 72
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6ae07c0
commit 22b40bb
Showing
92 changed files
with
2,108 additions
and
2,794 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
src/main/java/com/github/tartaricacid/touhoulittlemaid/api/client/gui/ITooltipButton.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package com.github.tartaricacid.touhoulittlemaid.api.client.gui; | ||
|
||
import com.mojang.blaze3d.vertex.PoseStack; | ||
import net.minecraft.client.Minecraft; | ||
|
||
/** | ||
* 女仆主界面用,按钮用于渲染文本提示 | ||
*/ | ||
public interface ITooltipButton { | ||
/** | ||
* 鼠标是否悬浮其上 | ||
*/ | ||
boolean isTooltipHovered(); | ||
|
||
/** | ||
* 渲染文本提示 | ||
*/ | ||
void renderTooltip(PoseStack poseStack, Minecraft mc, int mouseX, int mouseY); | ||
} |
46 changes: 46 additions & 0 deletions
46
...om/github/tartaricacid/touhoulittlemaid/capability/GeckoMaidEntityCapabilityProvider.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package com.github.tartaricacid.touhoulittlemaid.capability; | ||
|
||
import com.github.tartaricacid.touhoulittlemaid.api.entity.IMaid; | ||
import com.github.tartaricacid.touhoulittlemaid.client.entity.GeckoMaidEntity; | ||
import net.minecraft.core.Direction; | ||
import net.minecraft.world.entity.Mob; | ||
import net.minecraftforge.api.distmarker.Dist; | ||
import net.minecraftforge.api.distmarker.OnlyIn; | ||
import net.minecraftforge.common.capabilities.Capability; | ||
import net.minecraftforge.common.capabilities.CapabilityManager; | ||
import net.minecraftforge.common.capabilities.CapabilityToken; | ||
import net.minecraftforge.common.capabilities.ICapabilityProvider; | ||
import net.minecraftforge.common.util.LazyOptional; | ||
|
||
import javax.annotation.Nonnull; | ||
import javax.annotation.Nullable; | ||
|
||
@OnlyIn(Dist.CLIENT) | ||
public class GeckoMaidEntityCapabilityProvider<E extends Mob> implements ICapabilityProvider { | ||
public static Capability<GeckoMaidEntity<?>> CAP = CapabilityManager.get(new CapabilityToken<>() { | ||
}); | ||
private GeckoMaidEntity<E> instance = null; | ||
private E entity; | ||
private IMaid maid; | ||
|
||
public GeckoMaidEntityCapabilityProvider(E mob, IMaid maid) { | ||
this.entity = mob; | ||
this.maid = maid; | ||
} | ||
|
||
@Nonnull | ||
@Override | ||
public <T> LazyOptional<T> getCapability(@Nonnull Capability<T> cap, @Nullable Direction side) { | ||
return CAP.orEmpty(cap, LazyOptional.of(this::createCapability).cast()).cast(); | ||
} | ||
|
||
@Nonnull | ||
private GeckoMaidEntity<E> createCapability() { | ||
if (this.instance == null) { | ||
this.instance = new GeckoMaidEntity<>(this.entity, this.maid); | ||
this.entity = null; | ||
this.maid = null; | ||
} | ||
return this.instance; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.