generated from FabricMC/fabric-example-mod
-
Notifications
You must be signed in to change notification settings - Fork 0
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
Showing
10 changed files
with
133 additions
and
51 deletions.
There are no files selected for viewing
39 changes: 39 additions & 0 deletions
39
src/main/java/me/av306/xenon/event/EntityRendererEvents.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,39 @@ | ||
package me.av306.xenon.event; | ||
|
||
import net.fabricmc.fabric.api.event.Event; | ||
import net.fabricmc.fabric.api.event.EventFactory; | ||
import net.minecraft.client.render.entity.model.EntityModel; | ||
import net.minecraft.entity.Entity; | ||
import net.minecraft.entity.mob.MobEntity; | ||
import net.minecraft.text.Text; | ||
import net.minecraft.util.ActionResult; | ||
|
||
public interface EntityRendererEvents | ||
{ | ||
Event<GetLabelText> RENDER_LABEL_TEXT = EventFactory.createArrayBacked( | ||
GetLabelText.class, | ||
(listeners) -> (entity, text) -> | ||
{ | ||
for ( GetLabelText listener : listeners ) | ||
{ | ||
ActionResult result = listener.onGetLabelText( entity, text ); | ||
|
||
if ( result != ActionResult.PASS ) return result; | ||
} | ||
|
||
return ActionResult.PASS; | ||
} | ||
); | ||
|
||
@FunctionalInterface | ||
interface GetLabelText<T extends Entity> | ||
{ | ||
ActionResult onGetLabelText( T entity, Text text ); | ||
} | ||
|
||
class EventData | ||
{ | ||
public static Text LABEL_TEXT_OVERRIDE; | ||
public static boolean SHOULD_OVERRIDE_LABEL_TEXT = false; | ||
} | ||
} |
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
31 changes: 31 additions & 0 deletions
31
src/main/java/me/av306/xenon/event/MobEntityRendererEvents.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,31 @@ | ||
package me.av306.xenon.event; | ||
|
||
import net.fabricmc.fabric.api.event.Event; | ||
import net.fabricmc.fabric.api.event.EventFactory; | ||
import net.minecraft.client.render.entity.model.EntityModel; | ||
import net.minecraft.entity.mob.MobEntity; | ||
import net.minecraft.util.ActionResult; | ||
|
||
public interface MobEntityRendererEvents | ||
{ | ||
Event<RenderLabelTextEvent> RENDER_LABEL_TEXT = EventFactory.createArrayBacked( | ||
RenderLabelTextEvent.class, | ||
(listeners) -> (entity) -> | ||
{ | ||
for ( RenderLabelTextEvent listener : listeners ) | ||
{ | ||
ActionResult result = listener.onGetHasLabel( entity ); | ||
|
||
if ( result != ActionResult.PASS ) return result; | ||
} | ||
|
||
return ActionResult.PASS; | ||
} | ||
); | ||
|
||
@FunctionalInterface | ||
interface RenderLabelTextEvent<T extends MobEntity> | ||
{ | ||
ActionResult onGetHasLabel( T entity ); | ||
} | ||
} |
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
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