Skip to content

Commit

Permalink
Maded faces more "alive"
Browse files Browse the repository at this point in the history
  • Loading branch information
kerbybit committed Sep 19, 2019
1 parent aeec94f commit 71abdf7
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ plugins {

sourceCompatibility = targetCompatibility = 1.8

version = "1.3"
version = "1.4"
group= "com.kerbybit.minecwaft" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = "MinecwaftOwO"

Expand Down
22 changes: 17 additions & 5 deletions src/main/java/com/kerbybit/minecwaft/MinecwaftOwO.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.gameevent.TickEvent;
import org.apache.commons.lang3.StringUtils;
import org.cache2k.Cache;
import org.cache2k.Cache2kBuilder;
Expand All @@ -26,9 +27,11 @@
@Mod(modid = MinecwaftOwO.MODID, version = MinecwaftOwO.VERSION)
public class MinecwaftOwO {
static final String MODID = "MinecwaftOwO";
static final String VERSION = "1.3";
static final String VERSION = "1.4";
public static boolean toggled = true;

private static float ticks = 0;

private static final String[] faces = new String[]{"(*^w^)", "(*^.^*)", "(OuO)", "(OwO)", "(UwU)", "(>w<)", "(^w^)", "(^u^)", "(/ =w=)/"};
private static final List<Matcher> faceText = Arrays.asList(
Pattern.compile("!( |$)").matcher(""),
Expand Down Expand Up @@ -71,6 +74,12 @@ private void init(FMLInitializationEvent event) {
MinecraftForge.EVENT_BUS.register(this);
}

@SubscribeEvent
public void tick(TickEvent event) {
ticks+=0.0005;
if (ticks > 25) ticks = 0;
}

@SubscribeEvent
public void renderPlayer(RenderPlayerEvent.Post event) {
if (!toggled) return;
Expand All @@ -80,14 +89,17 @@ public void renderPlayer(RenderPlayerEvent.Post event) {
GlStateManager.pushMatrix();

EntityPlayer entity = event.entityPlayer;
String face = "UwU";
String face = "OwO";
Color color = Color.WHITE;

if (entity.hurtResistantTime > 0) {
if (entity.getHealth() == 0) {
face = "xwx";
color = Color.RED;
} else if (entity.hurtResistantTime > 0) {
face = ">w<";
color = Color.RED;
} else if (entity.prevPosX != entity.posX || entity.prevPosY != entity.posY || entity.prevPosZ != entity.posZ) {
face = "OwO";
} else if (ticks % entity.getName().length() < 0.1) {
face = "-w-";
}

Vec3 look = event.entity.getLook(event.partialRenderTick);
Expand Down

0 comments on commit 71abdf7

Please sign in to comment.