-
Notifications
You must be signed in to change notification settings - Fork 68
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
6 changed files
with
76 additions
and
1 deletion.
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
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
49 changes: 49 additions & 0 deletions
49
...thub/tartaricacid/touhoulittlemaid/client/animation/gecko/condition/ConditionalChair.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,49 @@ | ||
package com.github.tartaricacid.touhoulittlemaid.client.animation.gecko.condition; | ||
|
||
import com.github.tartaricacid.touhoulittlemaid.entity.item.EntityChair; | ||
import com.google.common.collect.Lists; | ||
import net.minecraft.resources.ResourceLocation; | ||
import net.minecraft.world.entity.Entity; | ||
import net.minecraft.world.entity.Mob; | ||
|
||
import java.util.List; | ||
|
||
public class ConditionalChair { | ||
private static final String EMPTY = ""; | ||
private final List<String> idTest = Lists.newArrayList(); | ||
private final String idPre; | ||
|
||
public ConditionalChair() { | ||
this.idPre = "chair$"; | ||
} | ||
|
||
public void addTest(String name) { | ||
int preSize = this.idPre.length(); | ||
if (name.length() <= preSize) { | ||
return; | ||
} | ||
String substring = name.substring(preSize); | ||
if (name.startsWith(idPre) && ResourceLocation.isValidResourceLocation(substring)) { | ||
idTest.add(substring); | ||
} | ||
} | ||
|
||
public String doTest(Mob maid) { | ||
Entity vehicle = maid.getVehicle(); | ||
if (!(vehicle instanceof EntityChair chair)) { | ||
return EMPTY; | ||
} | ||
return doIdTest(chair); | ||
} | ||
|
||
private String doIdTest(EntityChair chair) { | ||
if (idTest.isEmpty()) { | ||
return EMPTY; | ||
} | ||
String modelId = chair.getModelId(); | ||
if (idTest.contains(modelId)) { | ||
return idPre + modelId; | ||
} | ||
return EMPTY; | ||
} | ||
} |
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
Binary file modified
BIN
+8 Bytes
(100%)
src/main/resources/assets/touhou_little_maid/textures/gui/maid_gui_side.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.