use of de.sanandrew.mods.claysoldiers.api.soldier.ITeam in project ClaySoldiersMod by SanAndreasP.
the class TeamRegistry method registerTeam.
@Override
public ITeam registerTeam(UUID id, String name, ResourceLocation itemModel, int itemColor, ResourceLocation[] normalTextures, ResourceLocation[] rareTextures, ResourceLocation[] uniqueTextures) {
if (id == null || name == null || itemModel == null || normalTextures == null || normalTextures.length < 1) {
CsmConstants.LOG.log(Level.WARN, String.format("Team ID, name, item model and normal texture cannot be null nor empty for ID %s with name %s!", id, name));
return null;
}
if (this.teamFromUUID.containsKey(id)) {
CsmConstants.LOG.log(Level.WARN, String.format("Team UUID %s with name %s is already registered!", id, name));
return null;
}
if (this.teamFromUUID.values().stream().anyMatch(team -> team.getName().equals(name))) {
CsmConstants.LOG.log(Level.WARN, String.format("Team name %s with ID %s is already registered!", name, id));
return null;
}
ITeam newTeam = new TeamStandard(id, name, itemModel, itemColor, normalTextures, rareTextures, uniqueTextures);
this.teamFromUUID.put(id, newTeam);
this.teams.add(newTeam);
return newTeam;
}
use of de.sanandrew.mods.claysoldiers.api.soldier.ITeam in project ClaySoldiersMod by SanAndreasP.
the class BrickSoldierConvRecipe method matches.
@Override
public boolean matches(InventoryCrafting inv, World worldIn) {
this.resultItem = ItemStack.EMPTY;
this.itmCount = 0;
this.remaining.clear();
ITeam resultTeam = TeamRegistry.INSTANCE.getTeam(Teams.SOLDIER_CLAY);
boolean hasGhastTear = false;
boolean hasBrickDoll = false;
for (int i = 0, max = inv.getSizeInventory(); i < max; i++) {
ItemStack stack = inv.getStackInSlot(i);
if (!ItemStackUtils.isValid(stack)) {
continue;
}
if (ItemStackUtils.isItem(stack, ItemRegistry.DOLL_BRICK_SOLDIER)) {
if (!hasBrickDoll) {
hasBrickDoll = true;
} else {
return false;
}
} else if (ItemStackUtils.isItem(stack, ItemRegistry.DOLL_SOLDIER)) {
resultTeam = TeamRegistry.INSTANCE.getTeam(stack);
if (resultTeam == TeamRegistry.NULL_TEAM) {
return false;
}
this.remaining.add(i);
} else if (ItemStackUtils.isItem(stack, Items.GHAST_TEAR)) {
if (!hasGhastTear) {
hasGhastTear = true;
this.remaining.add(i);
} else {
return false;
}
}
this.itmCount++;
}
if (hasGhastTear && hasBrickDoll) {
this.resultItem = TeamRegistry.INSTANCE.getNewTeamStack(1, resultTeam);
return true;
} else {
return false;
}
}