MCPcopy Create free account
hub / github.com/DGVPSH/SlackOpen / isValid

Method isValid

src/main/java/net/optifine/RandomEntityRule.java:131–251  ·  view source on GitHub ↗
(String path)

Source from the content-addressed store, hash-verified

129 }
130
131 public boolean isValid(String path)
132 {
133 if (this.textures != null && this.textures.length != 0)
134 {
135 if (this.resourceLocations != null)
136 {
137 return true;
138 }
139 else
140 {
141 this.resourceLocations = new ResourceLocation[this.textures.length];
142 boolean flag = this.pathProps.startsWith("mcpatcher/mob/");
143 ResourceLocation resourcelocation = RandomEntities.getLocationRandom(this.baseResLoc, flag);
144
145 if (resourcelocation == null)
146 {
147 Config.warn("Invalid path: " + this.baseResLoc.getResourcePath());
148 return false;
149 }
150 else
151 {
152 for (int i = 0; i < this.resourceLocations.length; ++i)
153 {
154 int j = this.textures[i];
155
156 if (j <= 1)
157 {
158 this.resourceLocations[i] = this.baseResLoc;
159 }
160 else
161 {
162 ResourceLocation resourcelocation1 = RandomEntities.getLocationIndexed(resourcelocation, j);
163
164 if (resourcelocation1 == null)
165 {
166 Config.warn("Invalid path: " + this.baseResLoc.getResourcePath());
167 return false;
168 }
169
170 if (!Config.hasResource(resourcelocation1))
171 {
172 Config.warn("Texture not found: " + resourcelocation1.getResourcePath());
173 return false;
174 }
175
176 this.resourceLocations[i] = resourcelocation1;
177 }
178 }
179
180 if (this.weights != null)
181 {
182 if (this.weights.length > this.resourceLocations.length)
183 {
184 Config.warn("More weights defined than skins, trimming weights: " + path);
185 int[] aint = new int[this.resourceLocations.length];
186 System.arraycopy(this.weights, 0, aint, 0, aint.length);
187 this.weights = aint;
188 }

Callers 2

parseRulesMethod · 0.95
isValidMethod · 0.95

Calls 7

getLocationRandomMethod · 0.95
warnMethod · 0.95
getResourcePathMethod · 0.95
getLocationIndexedMethod · 0.95
hasResourceMethod · 0.95
getAverageMethod · 0.95
startsWithMethod · 0.80

Tested by

no test coverage detected