This repository has been archived by the owner on Jan 26, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 184
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Testing for 'always replace these blocks with air'
- Loading branch information
Showing
3 changed files
with
67 additions
and
3 deletions.
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
49 changes: 49 additions & 0 deletions
49
src/main/java/net/minecraftforge/cauldron/configuration/IntArraySetting.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 net.minecraftforge.cauldron.configuration; | ||
|
||
import java.util.ArrayList; | ||
|
||
public class IntArraySetting extends Setting<Integer[]> { | ||
private Integer[] value; | ||
private ConfigBase config; | ||
|
||
public IntArraySetting(ConfigBase config, String path, Integer[] def, String description) | ||
{ | ||
super(path, def, description); | ||
this.value = def; | ||
this.config = config; | ||
} | ||
|
||
@Override | ||
public Integer[] getValue() | ||
{ | ||
return value; | ||
} | ||
|
||
@Override | ||
public void setValue(String value) | ||
{ | ||
String[] vals = value.split(","); | ||
ArrayList<Integer> minty = new ArrayList<Integer>(vals.length); | ||
for(int i = 0; i < vals.length; i++) | ||
{ | ||
try | ||
{ | ||
minty.add(Integer.parseInt(vals[i])); | ||
} | ||
catch(Exception e) | ||
{ | ||
|
||
} | ||
catch(Error eeek) | ||
{ | ||
|
||
} | ||
} | ||
this.value = new Integer[minty.size()]; | ||
for(int i = 0; i < this.value.length; i++) | ||
{ | ||
this.value[i] = minty.get(i); | ||
} | ||
config.set(path, this.value); | ||
} | ||
} |