repo_name
stringlengths
7
104
file_path
stringlengths
13
198
context
stringlengths
67
7.15k
import_statement
stringlengths
16
4.43k
code
stringlengths
40
6.98k
prompt
stringlengths
227
8.27k
next_line
stringlengths
8
795
reinra/dynaform
src/main/java/org/dynaform/xml/writer/TextXmlWriter.java
// Path: src/main/java/org/dynaform/xml/XmlVisitor.java // public interface XmlVisitor { // // /** // * Handle text. // * // * @param s text. // * @return XML event handler to be used as next. // */ // XmlVisitor text(String s); // // /** // * Handle XML element start. // * // * @param element name of the XML element. // * @return event handler for the XML element. // */ // ElementVisitor visitElement(String element); // // /** // * Handle end of the XML element body. // * // * @return event handler of the XML element to be used as next. // */ // ElementVisitor visitEndBody(); // // /** // * Event handler of XML element. // * // * @author Rein Raudjärv // */ // interface ElementVisitor { // /** // * Handle XML attribute. // * // * @param name name of the XML attribute. // * @param value value of the XML attribute. // * @return event handler for the XML element. // */ // ElementVisitor visitAttribute(String name, String value); // // /** // * Handle start of the XML body. // * // * @return event handler for the XML element body. // */ // XmlVisitor visitBody(); // // /** // * Handle end of the XML element. // * // * @return XML event handler to be used as next. // */ // XmlVisitor visitEndElement(); // } // // }
import org.dynaform.xml.XmlVisitor;
package org.dynaform.xml.writer; /** * @author Rein Raudjärv * * @see XmlWriter * @see TextWriter * @see XmlTextHandler */ public class TextXmlWriter implements XmlWriter { private final TextWriter textWriter; public TextXmlWriter(TextWriter textWriter) { this.textWriter = textWriter; } public TextWriter getWriter() { return textWriter; } public boolean isEmpty() { return textWriter.getText() == null; }
// Path: src/main/java/org/dynaform/xml/XmlVisitor.java // public interface XmlVisitor { // // /** // * Handle text. // * // * @param s text. // * @return XML event handler to be used as next. // */ // XmlVisitor text(String s); // // /** // * Handle XML element start. // * // * @param element name of the XML element. // * @return event handler for the XML element. // */ // ElementVisitor visitElement(String element); // // /** // * Handle end of the XML element body. // * // * @return event handler of the XML element to be used as next. // */ // ElementVisitor visitEndBody(); // // /** // * Event handler of XML element. // * // * @author Rein Raudjärv // */ // interface ElementVisitor { // /** // * Handle XML attribute. // * // * @param name name of the XML attribute. // * @param value value of the XML attribute. // * @return event handler for the XML element. // */ // ElementVisitor visitAttribute(String name, String value); // // /** // * Handle start of the XML body. // * // * @return event handler for the XML element body. // */ // XmlVisitor visitBody(); // // /** // * Handle end of the XML element. // * // * @return XML event handler to be used as next. // */ // XmlVisitor visitEndElement(); // } // // } // Path: src/main/java/org/dynaform/xml/writer/TextXmlWriter.java import org.dynaform.xml.XmlVisitor; package org.dynaform.xml.writer; /** * @author Rein Raudjärv * * @see XmlWriter * @see TextWriter * @see XmlTextHandler */ public class TextXmlWriter implements XmlWriter { private final TextWriter textWriter; public TextXmlWriter(TextWriter textWriter) { this.textWriter = textWriter; } public TextWriter getWriter() { return textWriter; } public boolean isEmpty() { return textWriter.getText() == null; }
public void write(XmlVisitor xv) {
reinra/dynaform
src/main/java/org/dynaform/dynadata/MappingSet.java
// Path: src/main/java/org/dynaform/xml/form/Form.java // public interface Form { // // String HL_CHILD = "/"; // String HL_DESCENDANT_OR_SELF = "//"; // String LL_CHILD = "!"; // String LL_DESCENDANT_OR_SELF = "!!"; // String INDEX_START = "["; // String INDEX_END = "]"; // String OPERATOR_SEQUENCE = "sequence"; // String OPERATOR_CHOICE = "choice"; // String OPERATOR_ALL = "all"; // // // Identity and parent // String getDescendantOrSelfSelector(); // "//element" // String getFullSelector(); // "/aa/bb/cc!selector[0]" // String getHighLevelFullSelectorForChildren(); // "/aa/bb/cc" // // String getHighLevelId(); // cc // String getLowLevelId(); // selector[0] // // Form getParent(); // void _setParent(Form parent); // // // Sequence // String nextCounterValue(); // // // Visitors // void accept(FormVisitor visitor); // <T> T apply(FormFunction<T> function); // // }
import org.dynaform.xml.form.Form; import java.util.ArrayList; import java.util.Collection; import java.util.LinkedHashMap; import java.util.Map;
package org.dynaform.dynadata; public class MappingSet implements MappingCollection { private final Map<String, Mapping> allMappings = new LinkedHashMap<String, Mapping>(); private final Map<String, Mapping> usedMappings = new LinkedHashMap<String, Mapping>(); public void clear() { allMappings.clear(); usedMappings.clear(); } public void add(Mapping mapping) { allMappings.put(mapping.getSelector().getString(), mapping); usedMappings.put(mapping.getSelector().getString(), mapping); } public void addAll(Collection<Mapping> mappings) { for (Mapping mapping : mappings) add(mapping); } public Collection<Mapping> getAll() { return allMappings.values(); } public void removeAll(Collection<Mapping> mappings) { for (Mapping mapping : mappings) { allMappings.remove(mapping.getSelector().getString()); usedMappings.remove(mapping.getSelector().getString()); } }
// Path: src/main/java/org/dynaform/xml/form/Form.java // public interface Form { // // String HL_CHILD = "/"; // String HL_DESCENDANT_OR_SELF = "//"; // String LL_CHILD = "!"; // String LL_DESCENDANT_OR_SELF = "!!"; // String INDEX_START = "["; // String INDEX_END = "]"; // String OPERATOR_SEQUENCE = "sequence"; // String OPERATOR_CHOICE = "choice"; // String OPERATOR_ALL = "all"; // // // Identity and parent // String getDescendantOrSelfSelector(); // "//element" // String getFullSelector(); // "/aa/bb/cc!selector[0]" // String getHighLevelFullSelectorForChildren(); // "/aa/bb/cc" // // String getHighLevelId(); // cc // String getLowLevelId(); // selector[0] // // Form getParent(); // void _setParent(Form parent); // // // Sequence // String nextCounterValue(); // // // Visitors // void accept(FormVisitor visitor); // <T> T apply(FormFunction<T> function); // // } // Path: src/main/java/org/dynaform/dynadata/MappingSet.java import org.dynaform.xml.form.Form; import java.util.ArrayList; import java.util.Collection; import java.util.LinkedHashMap; import java.util.Map; package org.dynaform.dynadata; public class MappingSet implements MappingCollection { private final Map<String, Mapping> allMappings = new LinkedHashMap<String, Mapping>(); private final Map<String, Mapping> usedMappings = new LinkedHashMap<String, Mapping>(); public void clear() { allMappings.clear(); usedMappings.clear(); } public void add(Mapping mapping) { allMappings.put(mapping.getSelector().getString(), mapping); usedMappings.put(mapping.getSelector().getString(), mapping); } public void addAll(Collection<Mapping> mappings) { for (Mapping mapping : mappings) add(mapping); } public Collection<Mapping> getAll() { return allMappings.values(); } public void removeAll(Collection<Mapping> mappings) { for (Mapping mapping : mappings) { allMappings.remove(mapping.getSelector().getString()); usedMappings.remove(mapping.getSelector().getString()); } }
public Collection<Mapping> get(Form form) {
reinra/dynaform
src/main/java/org/dynaform/xml/writer/XmlElementWriter.java
// Path: src/main/java/org/dynaform/xml/XmlVisitor.java // public interface XmlVisitor { // // /** // * Handle text. // * // * @param s text. // * @return XML event handler to be used as next. // */ // XmlVisitor text(String s); // // /** // * Handle XML element start. // * // * @param element name of the XML element. // * @return event handler for the XML element. // */ // ElementVisitor visitElement(String element); // // /** // * Handle end of the XML element body. // * // * @return event handler of the XML element to be used as next. // */ // ElementVisitor visitEndBody(); // // /** // * Event handler of XML element. // * // * @author Rein Raudjärv // */ // interface ElementVisitor { // /** // * Handle XML attribute. // * // * @param name name of the XML attribute. // * @param value value of the XML attribute. // * @return event handler for the XML element. // */ // ElementVisitor visitAttribute(String name, String value); // // /** // * Handle start of the XML body. // * // * @return event handler for the XML element body. // */ // XmlVisitor visitBody(); // // /** // * Handle end of the XML element. // * // * @return XML event handler to be used as next. // */ // XmlVisitor visitEndElement(); // } // // } // // Path: src/main/java/org/dynaform/xml/XmlVisitor.java // interface ElementVisitor { // /** // * Handle XML attribute. // * // * @param name name of the XML attribute. // * @param value value of the XML attribute. // * @return event handler for the XML element. // */ // ElementVisitor visitAttribute(String name, String value); // // /** // * Handle start of the XML body. // * // * @return event handler for the XML element body. // */ // XmlVisitor visitBody(); // // /** // * Handle end of the XML element. // * // * @return XML event handler to be used as next. // */ // XmlVisitor visitEndElement(); // }
import org.dynaform.xml.XmlVisitor; import org.dynaform.xml.XmlVisitor.ElementVisitor; import java.util.Map; import java.util.Map.Entry;
package org.dynaform.xml.writer; public class XmlElementWriter implements XmlWriter { private final String name; private final Map<String, TextWriter> attributes; private final XmlWriter body; public XmlElementWriter(String name, Map<String, TextWriter> attributes, XmlWriter body) { this.name = name; this.attributes = attributes; this.body = body; } public boolean isEmpty() { return false; }
// Path: src/main/java/org/dynaform/xml/XmlVisitor.java // public interface XmlVisitor { // // /** // * Handle text. // * // * @param s text. // * @return XML event handler to be used as next. // */ // XmlVisitor text(String s); // // /** // * Handle XML element start. // * // * @param element name of the XML element. // * @return event handler for the XML element. // */ // ElementVisitor visitElement(String element); // // /** // * Handle end of the XML element body. // * // * @return event handler of the XML element to be used as next. // */ // ElementVisitor visitEndBody(); // // /** // * Event handler of XML element. // * // * @author Rein Raudjärv // */ // interface ElementVisitor { // /** // * Handle XML attribute. // * // * @param name name of the XML attribute. // * @param value value of the XML attribute. // * @return event handler for the XML element. // */ // ElementVisitor visitAttribute(String name, String value); // // /** // * Handle start of the XML body. // * // * @return event handler for the XML element body. // */ // XmlVisitor visitBody(); // // /** // * Handle end of the XML element. // * // * @return XML event handler to be used as next. // */ // XmlVisitor visitEndElement(); // } // // } // // Path: src/main/java/org/dynaform/xml/XmlVisitor.java // interface ElementVisitor { // /** // * Handle XML attribute. // * // * @param name name of the XML attribute. // * @param value value of the XML attribute. // * @return event handler for the XML element. // */ // ElementVisitor visitAttribute(String name, String value); // // /** // * Handle start of the XML body. // * // * @return event handler for the XML element body. // */ // XmlVisitor visitBody(); // // /** // * Handle end of the XML element. // * // * @return XML event handler to be used as next. // */ // XmlVisitor visitEndElement(); // } // Path: src/main/java/org/dynaform/xml/writer/XmlElementWriter.java import org.dynaform.xml.XmlVisitor; import org.dynaform.xml.XmlVisitor.ElementVisitor; import java.util.Map; import java.util.Map.Entry; package org.dynaform.xml.writer; public class XmlElementWriter implements XmlWriter { private final String name; private final Map<String, TextWriter> attributes; private final XmlWriter body; public XmlElementWriter(String name, Map<String, TextWriter> attributes, XmlWriter body) { this.name = name; this.attributes = attributes; this.body = body; } public boolean isEmpty() { return false; }
public void write(XmlVisitor xa) {
reinra/dynaform
src/main/java/org/dynaform/xml/writer/XmlElementWriter.java
// Path: src/main/java/org/dynaform/xml/XmlVisitor.java // public interface XmlVisitor { // // /** // * Handle text. // * // * @param s text. // * @return XML event handler to be used as next. // */ // XmlVisitor text(String s); // // /** // * Handle XML element start. // * // * @param element name of the XML element. // * @return event handler for the XML element. // */ // ElementVisitor visitElement(String element); // // /** // * Handle end of the XML element body. // * // * @return event handler of the XML element to be used as next. // */ // ElementVisitor visitEndBody(); // // /** // * Event handler of XML element. // * // * @author Rein Raudjärv // */ // interface ElementVisitor { // /** // * Handle XML attribute. // * // * @param name name of the XML attribute. // * @param value value of the XML attribute. // * @return event handler for the XML element. // */ // ElementVisitor visitAttribute(String name, String value); // // /** // * Handle start of the XML body. // * // * @return event handler for the XML element body. // */ // XmlVisitor visitBody(); // // /** // * Handle end of the XML element. // * // * @return XML event handler to be used as next. // */ // XmlVisitor visitEndElement(); // } // // } // // Path: src/main/java/org/dynaform/xml/XmlVisitor.java // interface ElementVisitor { // /** // * Handle XML attribute. // * // * @param name name of the XML attribute. // * @param value value of the XML attribute. // * @return event handler for the XML element. // */ // ElementVisitor visitAttribute(String name, String value); // // /** // * Handle start of the XML body. // * // * @return event handler for the XML element body. // */ // XmlVisitor visitBody(); // // /** // * Handle end of the XML element. // * // * @return XML event handler to be used as next. // */ // XmlVisitor visitEndElement(); // }
import org.dynaform.xml.XmlVisitor; import org.dynaform.xml.XmlVisitor.ElementVisitor; import java.util.Map; import java.util.Map.Entry;
package org.dynaform.xml.writer; public class XmlElementWriter implements XmlWriter { private final String name; private final Map<String, TextWriter> attributes; private final XmlWriter body; public XmlElementWriter(String name, Map<String, TextWriter> attributes, XmlWriter body) { this.name = name; this.attributes = attributes; this.body = body; } public boolean isEmpty() { return false; } public void write(XmlVisitor xa) {
// Path: src/main/java/org/dynaform/xml/XmlVisitor.java // public interface XmlVisitor { // // /** // * Handle text. // * // * @param s text. // * @return XML event handler to be used as next. // */ // XmlVisitor text(String s); // // /** // * Handle XML element start. // * // * @param element name of the XML element. // * @return event handler for the XML element. // */ // ElementVisitor visitElement(String element); // // /** // * Handle end of the XML element body. // * // * @return event handler of the XML element to be used as next. // */ // ElementVisitor visitEndBody(); // // /** // * Event handler of XML element. // * // * @author Rein Raudjärv // */ // interface ElementVisitor { // /** // * Handle XML attribute. // * // * @param name name of the XML attribute. // * @param value value of the XML attribute. // * @return event handler for the XML element. // */ // ElementVisitor visitAttribute(String name, String value); // // /** // * Handle start of the XML body. // * // * @return event handler for the XML element body. // */ // XmlVisitor visitBody(); // // /** // * Handle end of the XML element. // * // * @return XML event handler to be used as next. // */ // XmlVisitor visitEndElement(); // } // // } // // Path: src/main/java/org/dynaform/xml/XmlVisitor.java // interface ElementVisitor { // /** // * Handle XML attribute. // * // * @param name name of the XML attribute. // * @param value value of the XML attribute. // * @return event handler for the XML element. // */ // ElementVisitor visitAttribute(String name, String value); // // /** // * Handle start of the XML body. // * // * @return event handler for the XML element body. // */ // XmlVisitor visitBody(); // // /** // * Handle end of the XML element. // * // * @return XML event handler to be used as next. // */ // XmlVisitor visitEndElement(); // } // Path: src/main/java/org/dynaform/xml/writer/XmlElementWriter.java import org.dynaform.xml.XmlVisitor; import org.dynaform.xml.XmlVisitor.ElementVisitor; import java.util.Map; import java.util.Map.Entry; package org.dynaform.xml.writer; public class XmlElementWriter implements XmlWriter { private final String name; private final Map<String, TextWriter> attributes; private final XmlWriter body; public XmlElementWriter(String name, Map<String, TextWriter> attributes, XmlWriter body) { this.name = name; this.attributes = attributes; this.body = body; } public boolean isEmpty() { return false; } public void write(XmlVisitor xa) {
ElementVisitor elementVisitor = xa.visitElement(name);
reinra/dynaform
src/main/java/org/dynaform/xml/reader/AfterReader.java
// Path: src/main/java/org/dynaform/xml/XmlVisitor.java // public interface XmlVisitor { // // /** // * Handle text. // * // * @param s text. // * @return XML event handler to be used as next. // */ // XmlVisitor text(String s); // // /** // * Handle XML element start. // * // * @param element name of the XML element. // * @return event handler for the XML element. // */ // ElementVisitor visitElement(String element); // // /** // * Handle end of the XML element body. // * // * @return event handler of the XML element to be used as next. // */ // ElementVisitor visitEndBody(); // // /** // * Event handler of XML element. // * // * @author Rein Raudjärv // */ // interface ElementVisitor { // /** // * Handle XML attribute. // * // * @param name name of the XML attribute. // * @param value value of the XML attribute. // * @return event handler for the XML element. // */ // ElementVisitor visitAttribute(String name, String value); // // /** // * Handle start of the XML body. // * // * @return event handler for the XML element body. // */ // XmlVisitor visitBody(); // // /** // * Handle end of the XML element. // * // * @return XML event handler to be used as next. // */ // XmlVisitor visitEndElement(); // } // // }
import org.dynaform.xml.XmlVisitor; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory;
package org.dynaform.xml.reader; public class AfterReader implements XmlReader { private static final Log log = LogFactory.getLog(AfterReader.class); private final XmlReader reader; private final Runnable handler; public AfterReader(XmlReader reader, Runnable handler) { this.reader = reader; this.handler = handler; }
// Path: src/main/java/org/dynaform/xml/XmlVisitor.java // public interface XmlVisitor { // // /** // * Handle text. // * // * @param s text. // * @return XML event handler to be used as next. // */ // XmlVisitor text(String s); // // /** // * Handle XML element start. // * // * @param element name of the XML element. // * @return event handler for the XML element. // */ // ElementVisitor visitElement(String element); // // /** // * Handle end of the XML element body. // * // * @return event handler of the XML element to be used as next. // */ // ElementVisitor visitEndBody(); // // /** // * Event handler of XML element. // * // * @author Rein Raudjärv // */ // interface ElementVisitor { // /** // * Handle XML attribute. // * // * @param name name of the XML attribute. // * @param value value of the XML attribute. // * @return event handler for the XML element. // */ // ElementVisitor visitAttribute(String name, String value); // // /** // * Handle start of the XML body. // * // * @return event handler for the XML element body. // */ // XmlVisitor visitBody(); // // /** // * Handle end of the XML element. // * // * @return XML event handler to be used as next. // */ // XmlVisitor visitEndElement(); // } // // } // Path: src/main/java/org/dynaform/xml/reader/AfterReader.java import org.dynaform.xml.XmlVisitor; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; package org.dynaform.xml.reader; public class AfterReader implements XmlReader { private static final Log log = LogFactory.getLog(AfterReader.class); private final XmlReader reader; private final Runnable handler; public AfterReader(XmlReader reader, Runnable handler) { this.reader = reader; this.handler = handler; }
public XmlVisitor create(XmlReader next) {
reinra/dynaform
src/main/java/org/dynaform/xml/writer/RepeatWriter.java
// Path: src/main/java/org/dynaform/xml/XmlVisitor.java // public interface XmlVisitor { // // /** // * Handle text. // * // * @param s text. // * @return XML event handler to be used as next. // */ // XmlVisitor text(String s); // // /** // * Handle XML element start. // * // * @param element name of the XML element. // * @return event handler for the XML element. // */ // ElementVisitor visitElement(String element); // // /** // * Handle end of the XML element body. // * // * @return event handler of the XML element to be used as next. // */ // ElementVisitor visitEndBody(); // // /** // * Event handler of XML element. // * // * @author Rein Raudjärv // */ // interface ElementVisitor { // /** // * Handle XML attribute. // * // * @param name name of the XML attribute. // * @param value value of the XML attribute. // * @return event handler for the XML element. // */ // ElementVisitor visitAttribute(String name, String value); // // /** // * Handle start of the XML body. // * // * @return event handler for the XML element body. // */ // XmlVisitor visitBody(); // // /** // * Handle end of the XML element. // * // * @return XML event handler to be used as next. // */ // XmlVisitor visitEndElement(); // } // // }
import org.dynaform.xml.RepeatAdapter; import org.dynaform.xml.XmlForm; import org.dynaform.xml.XmlVisitor; import org.dynaform.xml.form.FormRepeat;
package org.dynaform.xml.writer; /** * @author Rein Raudjärv * * @see FormRepeat * @see RepeatAdapter * @see XmlWriter */ public class RepeatWriter implements XmlWriter { private final RepeatAdapter<?> adapter; public RepeatWriter(RepeatAdapter<?> adapter) { this.adapter = adapter; } public boolean isEmpty() { return adapter.getChildren().isEmpty(); }
// Path: src/main/java/org/dynaform/xml/XmlVisitor.java // public interface XmlVisitor { // // /** // * Handle text. // * // * @param s text. // * @return XML event handler to be used as next. // */ // XmlVisitor text(String s); // // /** // * Handle XML element start. // * // * @param element name of the XML element. // * @return event handler for the XML element. // */ // ElementVisitor visitElement(String element); // // /** // * Handle end of the XML element body. // * // * @return event handler of the XML element to be used as next. // */ // ElementVisitor visitEndBody(); // // /** // * Event handler of XML element. // * // * @author Rein Raudjärv // */ // interface ElementVisitor { // /** // * Handle XML attribute. // * // * @param name name of the XML attribute. // * @param value value of the XML attribute. // * @return event handler for the XML element. // */ // ElementVisitor visitAttribute(String name, String value); // // /** // * Handle start of the XML body. // * // * @return event handler for the XML element body. // */ // XmlVisitor visitBody(); // // /** // * Handle end of the XML element. // * // * @return XML event handler to be used as next. // */ // XmlVisitor visitEndElement(); // } // // } // Path: src/main/java/org/dynaform/xml/writer/RepeatWriter.java import org.dynaform.xml.RepeatAdapter; import org.dynaform.xml.XmlForm; import org.dynaform.xml.XmlVisitor; import org.dynaform.xml.form.FormRepeat; package org.dynaform.xml.writer; /** * @author Rein Raudjärv * * @see FormRepeat * @see RepeatAdapter * @see XmlWriter */ public class RepeatWriter implements XmlWriter { private final RepeatAdapter<?> adapter; public RepeatWriter(RepeatAdapter<?> adapter) { this.adapter = adapter; } public boolean isEmpty() { return adapter.getChildren().isEmpty(); }
public void write(XmlVisitor xa) {
reinra/dynaform
src/main/java/org/dynaform/xml/reader/RepeatReader.java
// Path: src/main/java/org/dynaform/xml/XmlVisitor.java // public interface XmlVisitor { // // /** // * Handle text. // * // * @param s text. // * @return XML event handler to be used as next. // */ // XmlVisitor text(String s); // // /** // * Handle XML element start. // * // * @param element name of the XML element. // * @return event handler for the XML element. // */ // ElementVisitor visitElement(String element); // // /** // * Handle end of the XML element body. // * // * @return event handler of the XML element to be used as next. // */ // ElementVisitor visitEndBody(); // // /** // * Event handler of XML element. // * // * @author Rein Raudjärv // */ // interface ElementVisitor { // /** // * Handle XML attribute. // * // * @param name name of the XML attribute. // * @param value value of the XML attribute. // * @return event handler for the XML element. // */ // ElementVisitor visitAttribute(String name, String value); // // /** // * Handle start of the XML body. // * // * @return event handler for the XML element body. // */ // XmlVisitor visitBody(); // // /** // * Handle end of the XML element. // * // * @return XML event handler to be used as next. // */ // XmlVisitor visitEndElement(); // } // // } // // Path: src/main/java/org/dynaform/xml/form/Form.java // public interface Form { // // String HL_CHILD = "/"; // String HL_DESCENDANT_OR_SELF = "//"; // String LL_CHILD = "!"; // String LL_DESCENDANT_OR_SELF = "!!"; // String INDEX_START = "["; // String INDEX_END = "]"; // String OPERATOR_SEQUENCE = "sequence"; // String OPERATOR_CHOICE = "choice"; // String OPERATOR_ALL = "all"; // // // Identity and parent // String getDescendantOrSelfSelector(); // "//element" // String getFullSelector(); // "/aa/bb/cc!selector[0]" // String getHighLevelFullSelectorForChildren(); // "/aa/bb/cc" // // String getHighLevelId(); // cc // String getLowLevelId(); // selector[0] // // Form getParent(); // void _setParent(Form parent); // // // Sequence // String nextCounterValue(); // // // Visitors // void accept(FormVisitor visitor); // <T> T apply(FormFunction<T> function); // // }
import org.dynaform.xml.RepeatAdapter; import org.dynaform.xml.XmlVisitor; import org.dynaform.xml.form.Form; import org.dynaform.xml.form.FormRepeat; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory;
package org.dynaform.xml.reader; /** * @author Rein Raudjärv * * @see FormRepeat * @see RepeatAdapter * @see XmlReader */ public class RepeatReader<F extends Form> implements XmlReader { private static final Log log = LogFactory.getLog(RepeatReader.class); private final FormRepeat<F> form; private final RepeatAdapter<F> adapter; public RepeatReader(FormRepeat<F> form, RepeatAdapter<F> adapter) { this.form = form; this.adapter = adapter; }
// Path: src/main/java/org/dynaform/xml/XmlVisitor.java // public interface XmlVisitor { // // /** // * Handle text. // * // * @param s text. // * @return XML event handler to be used as next. // */ // XmlVisitor text(String s); // // /** // * Handle XML element start. // * // * @param element name of the XML element. // * @return event handler for the XML element. // */ // ElementVisitor visitElement(String element); // // /** // * Handle end of the XML element body. // * // * @return event handler of the XML element to be used as next. // */ // ElementVisitor visitEndBody(); // // /** // * Event handler of XML element. // * // * @author Rein Raudjärv // */ // interface ElementVisitor { // /** // * Handle XML attribute. // * // * @param name name of the XML attribute. // * @param value value of the XML attribute. // * @return event handler for the XML element. // */ // ElementVisitor visitAttribute(String name, String value); // // /** // * Handle start of the XML body. // * // * @return event handler for the XML element body. // */ // XmlVisitor visitBody(); // // /** // * Handle end of the XML element. // * // * @return XML event handler to be used as next. // */ // XmlVisitor visitEndElement(); // } // // } // // Path: src/main/java/org/dynaform/xml/form/Form.java // public interface Form { // // String HL_CHILD = "/"; // String HL_DESCENDANT_OR_SELF = "//"; // String LL_CHILD = "!"; // String LL_DESCENDANT_OR_SELF = "!!"; // String INDEX_START = "["; // String INDEX_END = "]"; // String OPERATOR_SEQUENCE = "sequence"; // String OPERATOR_CHOICE = "choice"; // String OPERATOR_ALL = "all"; // // // Identity and parent // String getDescendantOrSelfSelector(); // "//element" // String getFullSelector(); // "/aa/bb/cc!selector[0]" // String getHighLevelFullSelectorForChildren(); // "/aa/bb/cc" // // String getHighLevelId(); // cc // String getLowLevelId(); // selector[0] // // Form getParent(); // void _setParent(Form parent); // // // Sequence // String nextCounterValue(); // // // Visitors // void accept(FormVisitor visitor); // <T> T apply(FormFunction<T> function); // // } // Path: src/main/java/org/dynaform/xml/reader/RepeatReader.java import org.dynaform.xml.RepeatAdapter; import org.dynaform.xml.XmlVisitor; import org.dynaform.xml.form.Form; import org.dynaform.xml.form.FormRepeat; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; package org.dynaform.xml.reader; /** * @author Rein Raudjärv * * @see FormRepeat * @see RepeatAdapter * @see XmlReader */ public class RepeatReader<F extends Form> implements XmlReader { private static final Log log = LogFactory.getLog(RepeatReader.class); private final FormRepeat<F> form; private final RepeatAdapter<F> adapter; public RepeatReader(FormRepeat<F> form, RepeatAdapter<F> adapter) { this.form = form; this.adapter = adapter; }
public XmlVisitor create(XmlReader next) {
reinra/dynaform
src/main/java/org/dynaform/xml/reader/WhitespaceReader.java
// Path: src/main/java/org/dynaform/xml/XmlVisitor.java // public interface XmlVisitor { // // /** // * Handle text. // * // * @param s text. // * @return XML event handler to be used as next. // */ // XmlVisitor text(String s); // // /** // * Handle XML element start. // * // * @param element name of the XML element. // * @return event handler for the XML element. // */ // ElementVisitor visitElement(String element); // // /** // * Handle end of the XML element body. // * // * @return event handler of the XML element to be used as next. // */ // ElementVisitor visitEndBody(); // // /** // * Event handler of XML element. // * // * @author Rein Raudjärv // */ // interface ElementVisitor { // /** // * Handle XML attribute. // * // * @param name name of the XML attribute. // * @param value value of the XML attribute. // * @return event handler for the XML element. // */ // ElementVisitor visitAttribute(String name, String value); // // /** // * Handle start of the XML body. // * // * @return event handler for the XML element body. // */ // XmlVisitor visitBody(); // // /** // * Handle end of the XML element. // * // * @return XML event handler to be used as next. // */ // XmlVisitor visitEndElement(); // } // // }
import org.dynaform.xml.XmlVisitor; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory;
package org.dynaform.xml.reader; /** * @author Rein Raudjärv */ public class WhitespaceReader implements XmlReader { private static final Log log = LogFactory.getLog(WhitespaceReader.class); private static final XmlReader INSTANCE = new WhitespaceReader(); public static XmlReader getIInstance() { return INSTANCE; } public static XmlReader prependTo(XmlReader reader) { return SequenceReader.newInstance(INSTANCE, reader); } public static XmlReader appendTo(XmlReader reader) { return SequenceReader.newInstance(reader, INSTANCE); } private WhitespaceReader() { }
// Path: src/main/java/org/dynaform/xml/XmlVisitor.java // public interface XmlVisitor { // // /** // * Handle text. // * // * @param s text. // * @return XML event handler to be used as next. // */ // XmlVisitor text(String s); // // /** // * Handle XML element start. // * // * @param element name of the XML element. // * @return event handler for the XML element. // */ // ElementVisitor visitElement(String element); // // /** // * Handle end of the XML element body. // * // * @return event handler of the XML element to be used as next. // */ // ElementVisitor visitEndBody(); // // /** // * Event handler of XML element. // * // * @author Rein Raudjärv // */ // interface ElementVisitor { // /** // * Handle XML attribute. // * // * @param name name of the XML attribute. // * @param value value of the XML attribute. // * @return event handler for the XML element. // */ // ElementVisitor visitAttribute(String name, String value); // // /** // * Handle start of the XML body. // * // * @return event handler for the XML element body. // */ // XmlVisitor visitBody(); // // /** // * Handle end of the XML element. // * // * @return XML event handler to be used as next. // */ // XmlVisitor visitEndElement(); // } // // } // Path: src/main/java/org/dynaform/xml/reader/WhitespaceReader.java import org.dynaform.xml.XmlVisitor; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; package org.dynaform.xml.reader; /** * @author Rein Raudjärv */ public class WhitespaceReader implements XmlReader { private static final Log log = LogFactory.getLog(WhitespaceReader.class); private static final XmlReader INSTANCE = new WhitespaceReader(); public static XmlReader getIInstance() { return INSTANCE; } public static XmlReader prependTo(XmlReader reader) { return SequenceReader.newInstance(INSTANCE, reader); } public static XmlReader appendTo(XmlReader reader) { return SequenceReader.newInstance(reader, INSTANCE); } private WhitespaceReader() { }
public XmlVisitor create(XmlReader next) {
reinra/dynaform
src/main/java/org/dynaform/xml/form/impl/FormSequenceImpl.java
// Path: src/main/java/org/dynaform/xml/form/Form.java // public interface Form { // // String HL_CHILD = "/"; // String HL_DESCENDANT_OR_SELF = "//"; // String LL_CHILD = "!"; // String LL_DESCENDANT_OR_SELF = "!!"; // String INDEX_START = "["; // String INDEX_END = "]"; // String OPERATOR_SEQUENCE = "sequence"; // String OPERATOR_CHOICE = "choice"; // String OPERATOR_ALL = "all"; // // // Identity and parent // String getDescendantOrSelfSelector(); // "//element" // String getFullSelector(); // "/aa/bb/cc!selector[0]" // String getHighLevelFullSelectorForChildren(); // "/aa/bb/cc" // // String getHighLevelId(); // cc // String getLowLevelId(); // selector[0] // // Form getParent(); // void _setParent(Form parent); // // // Sequence // String nextCounterValue(); // // // Visitors // void accept(FormVisitor visitor); // <T> T apply(FormFunction<T> function); // // } // // Path: src/main/java/org/dynaform/xml/form/FormFunction.java // public interface FormFunction<T> { // // <E> T element(FormElement<E> element); // // <F extends Form> T section(FormSection<F> section); // // <F extends Form> T repeat(FormRepeat<F> sequence); // // T sequence(FormSequence composite); // // T choice(FormChoice choice); // // T all(FormAll all); // // } // // Path: src/main/java/org/dynaform/xml/form/FormVisitor.java // public interface FormVisitor { // // <E> void element(FormElement<E> element); // // <F extends Form> void section(FormSection<F> section); // // <F extends Form> void repeat(FormRepeat<F> sequence); // // void sequence(FormSequence composite); // // void choice(FormChoice choice); // // void all(FormAll all); // // }
import org.dynaform.xml.form.Form; import org.dynaform.xml.form.FormFunction; import org.dynaform.xml.form.FormSequence; import org.dynaform.xml.form.FormVisitor; import java.util.Collections; import java.util.List;
child._setParent(this); this.children = Collections.unmodifiableList(children); this.explicit = explicit; } public void _setParent(Form parent) { super._setParent(parent); if (explicit) id = OPERATOR_SEQUENCE + INDEX_START + parent.nextCounterValue() + INDEX_END; } public String getHighLevelId() { return null; } public String getLowLevelId() { return id; } public void add(Form child) { child._setParent(this); children.add(child); } public List<Form> getChildren() { return children; }
// Path: src/main/java/org/dynaform/xml/form/Form.java // public interface Form { // // String HL_CHILD = "/"; // String HL_DESCENDANT_OR_SELF = "//"; // String LL_CHILD = "!"; // String LL_DESCENDANT_OR_SELF = "!!"; // String INDEX_START = "["; // String INDEX_END = "]"; // String OPERATOR_SEQUENCE = "sequence"; // String OPERATOR_CHOICE = "choice"; // String OPERATOR_ALL = "all"; // // // Identity and parent // String getDescendantOrSelfSelector(); // "//element" // String getFullSelector(); // "/aa/bb/cc!selector[0]" // String getHighLevelFullSelectorForChildren(); // "/aa/bb/cc" // // String getHighLevelId(); // cc // String getLowLevelId(); // selector[0] // // Form getParent(); // void _setParent(Form parent); // // // Sequence // String nextCounterValue(); // // // Visitors // void accept(FormVisitor visitor); // <T> T apply(FormFunction<T> function); // // } // // Path: src/main/java/org/dynaform/xml/form/FormFunction.java // public interface FormFunction<T> { // // <E> T element(FormElement<E> element); // // <F extends Form> T section(FormSection<F> section); // // <F extends Form> T repeat(FormRepeat<F> sequence); // // T sequence(FormSequence composite); // // T choice(FormChoice choice); // // T all(FormAll all); // // } // // Path: src/main/java/org/dynaform/xml/form/FormVisitor.java // public interface FormVisitor { // // <E> void element(FormElement<E> element); // // <F extends Form> void section(FormSection<F> section); // // <F extends Form> void repeat(FormRepeat<F> sequence); // // void sequence(FormSequence composite); // // void choice(FormChoice choice); // // void all(FormAll all); // // } // Path: src/main/java/org/dynaform/xml/form/impl/FormSequenceImpl.java import org.dynaform.xml.form.Form; import org.dynaform.xml.form.FormFunction; import org.dynaform.xml.form.FormSequence; import org.dynaform.xml.form.FormVisitor; import java.util.Collections; import java.util.List; child._setParent(this); this.children = Collections.unmodifiableList(children); this.explicit = explicit; } public void _setParent(Form parent) { super._setParent(parent); if (explicit) id = OPERATOR_SEQUENCE + INDEX_START + parent.nextCounterValue() + INDEX_END; } public String getHighLevelId() { return null; } public String getLowLevelId() { return id; } public void add(Form child) { child._setParent(this); children.add(child); } public List<Form> getChildren() { return children; }
public void accept(FormVisitor visitor) {
reinra/dynaform
src/main/java/org/dynaform/xml/form/impl/FormSequenceImpl.java
// Path: src/main/java/org/dynaform/xml/form/Form.java // public interface Form { // // String HL_CHILD = "/"; // String HL_DESCENDANT_OR_SELF = "//"; // String LL_CHILD = "!"; // String LL_DESCENDANT_OR_SELF = "!!"; // String INDEX_START = "["; // String INDEX_END = "]"; // String OPERATOR_SEQUENCE = "sequence"; // String OPERATOR_CHOICE = "choice"; // String OPERATOR_ALL = "all"; // // // Identity and parent // String getDescendantOrSelfSelector(); // "//element" // String getFullSelector(); // "/aa/bb/cc!selector[0]" // String getHighLevelFullSelectorForChildren(); // "/aa/bb/cc" // // String getHighLevelId(); // cc // String getLowLevelId(); // selector[0] // // Form getParent(); // void _setParent(Form parent); // // // Sequence // String nextCounterValue(); // // // Visitors // void accept(FormVisitor visitor); // <T> T apply(FormFunction<T> function); // // } // // Path: src/main/java/org/dynaform/xml/form/FormFunction.java // public interface FormFunction<T> { // // <E> T element(FormElement<E> element); // // <F extends Form> T section(FormSection<F> section); // // <F extends Form> T repeat(FormRepeat<F> sequence); // // T sequence(FormSequence composite); // // T choice(FormChoice choice); // // T all(FormAll all); // // } // // Path: src/main/java/org/dynaform/xml/form/FormVisitor.java // public interface FormVisitor { // // <E> void element(FormElement<E> element); // // <F extends Form> void section(FormSection<F> section); // // <F extends Form> void repeat(FormRepeat<F> sequence); // // void sequence(FormSequence composite); // // void choice(FormChoice choice); // // void all(FormAll all); // // }
import org.dynaform.xml.form.Form; import org.dynaform.xml.form.FormFunction; import org.dynaform.xml.form.FormSequence; import org.dynaform.xml.form.FormVisitor; import java.util.Collections; import java.util.List;
} public void _setParent(Form parent) { super._setParent(parent); if (explicit) id = OPERATOR_SEQUENCE + INDEX_START + parent.nextCounterValue() + INDEX_END; } public String getHighLevelId() { return null; } public String getLowLevelId() { return id; } public void add(Form child) { child._setParent(this); children.add(child); } public List<Form> getChildren() { return children; } public void accept(FormVisitor visitor) { visitor.sequence(this); }
// Path: src/main/java/org/dynaform/xml/form/Form.java // public interface Form { // // String HL_CHILD = "/"; // String HL_DESCENDANT_OR_SELF = "//"; // String LL_CHILD = "!"; // String LL_DESCENDANT_OR_SELF = "!!"; // String INDEX_START = "["; // String INDEX_END = "]"; // String OPERATOR_SEQUENCE = "sequence"; // String OPERATOR_CHOICE = "choice"; // String OPERATOR_ALL = "all"; // // // Identity and parent // String getDescendantOrSelfSelector(); // "//element" // String getFullSelector(); // "/aa/bb/cc!selector[0]" // String getHighLevelFullSelectorForChildren(); // "/aa/bb/cc" // // String getHighLevelId(); // cc // String getLowLevelId(); // selector[0] // // Form getParent(); // void _setParent(Form parent); // // // Sequence // String nextCounterValue(); // // // Visitors // void accept(FormVisitor visitor); // <T> T apply(FormFunction<T> function); // // } // // Path: src/main/java/org/dynaform/xml/form/FormFunction.java // public interface FormFunction<T> { // // <E> T element(FormElement<E> element); // // <F extends Form> T section(FormSection<F> section); // // <F extends Form> T repeat(FormRepeat<F> sequence); // // T sequence(FormSequence composite); // // T choice(FormChoice choice); // // T all(FormAll all); // // } // // Path: src/main/java/org/dynaform/xml/form/FormVisitor.java // public interface FormVisitor { // // <E> void element(FormElement<E> element); // // <F extends Form> void section(FormSection<F> section); // // <F extends Form> void repeat(FormRepeat<F> sequence); // // void sequence(FormSequence composite); // // void choice(FormChoice choice); // // void all(FormAll all); // // } // Path: src/main/java/org/dynaform/xml/form/impl/FormSequenceImpl.java import org.dynaform.xml.form.Form; import org.dynaform.xml.form.FormFunction; import org.dynaform.xml.form.FormSequence; import org.dynaform.xml.form.FormVisitor; import java.util.Collections; import java.util.List; } public void _setParent(Form parent) { super._setParent(parent); if (explicit) id = OPERATOR_SEQUENCE + INDEX_START + parent.nextCounterValue() + INDEX_END; } public String getHighLevelId() { return null; } public String getLowLevelId() { return id; } public void add(Form child) { child._setParent(this); children.add(child); } public List<Form> getChildren() { return children; } public void accept(FormVisitor visitor) { visitor.sequence(this); }
public <T> T apply(FormFunction<T> function) {
reinra/dynaform
src/main/java/org/dynaform/web/form/builder/ControlBuilder.java
// Path: src/main/java/org/dynaform/xml/form/FormElement.java // public interface FormElement<E> extends Form, Data<E>, Labeled { // // Data<E> getData(); // // Restrictions<E> getRestrictions(); // // String getLabel(); // void setLabel(String label); // // Control getControl(); // void setControl(Control control); // // boolean isReadOnly(); // void setReadOnly(boolean readOnly); // // boolean isRequired(); // void setRequired(boolean required); // // boolean isDisabled(); // void setDisabled(boolean disabled); // // // Listeners // // void addListener(ElementChangeListener<E> listener); // void removeListener(ElementChangeListener<E> listener); // // public interface ElementChangeListener<E> { // void onSetValue(FormElement<E> element); // void onSetLabel(FormElement<E> element); // void onSetControl(FormElement<E> element); // void onSetReadOnly(FormElement<E> element); // void onSetRequired(FormElement<E> element); // void onSetDisabled(FormElement<E> element); // } // // } // // Path: src/main/java/org/dynaform/xml/form/restriction/Choice.java // public interface Choice<E> { // // String getLabel(); // void setLabel(String label); // // E getValue(); // void setValue(E value); // // }
import org.dynaform.xml.form.FormElement; import org.dynaform.xml.form.control.Control; import org.dynaform.xml.form.data.Data; import org.dynaform.xml.form.data.DateData; import org.dynaform.xml.form.restriction.Choice; import org.dynaform.xml.form.restriction.Restrictions; import java.math.BigDecimal; import java.math.BigInteger; import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; import org.araneaframework.uilib.form.control.CheckboxControl; import org.araneaframework.uilib.form.control.DateControl; import org.araneaframework.uilib.form.control.DateTimeControl; import org.araneaframework.uilib.form.control.DisplayControl; import org.araneaframework.uilib.form.control.FloatControl; import org.araneaframework.uilib.form.control.NumberControl; import org.araneaframework.uilib.form.control.SelectControl; import org.araneaframework.uilib.form.control.TextControl; import org.araneaframework.uilib.form.control.TextareaControl; import org.araneaframework.uilib.form.control.TimeControl; import org.araneaframework.uilib.support.DisplayItem;
package org.dynaform.web.form.builder; /** * Converts an abstract form into Aranea Widget. * * @author Rein Raudjärv * * @see FormElement * @see AraneaControlEntry * @see AraneaFormBuilder */ public class ControlBuilder { private static final int MAX_LENGTH_LONG = String.valueOf(Long.MIN_VALUE).length(); private static final int MAX_LENGTH_INT = String.valueOf(Integer.MIN_VALUE).length(); private static final int MAX_LENGTH_SHORT = String.valueOf(Short.MIN_VALUE).length(); private static final int MAX_LENGTH_BYTE = String.valueOf(Byte.MIN_VALUE).length(); private static final int SELECT_BOX_MAX_SIZE = 8; private static final String SELECT_BOX_NULL_VALUE = null; private static final String SELECT_BOX_NULL_LABEL = ""; private static final String RADIO_SELECT_BOX_NULL_VALUE = "__null__"; private static final String RADIO_SELECT_BOX_NULL_LABEL = "-";
// Path: src/main/java/org/dynaform/xml/form/FormElement.java // public interface FormElement<E> extends Form, Data<E>, Labeled { // // Data<E> getData(); // // Restrictions<E> getRestrictions(); // // String getLabel(); // void setLabel(String label); // // Control getControl(); // void setControl(Control control); // // boolean isReadOnly(); // void setReadOnly(boolean readOnly); // // boolean isRequired(); // void setRequired(boolean required); // // boolean isDisabled(); // void setDisabled(boolean disabled); // // // Listeners // // void addListener(ElementChangeListener<E> listener); // void removeListener(ElementChangeListener<E> listener); // // public interface ElementChangeListener<E> { // void onSetValue(FormElement<E> element); // void onSetLabel(FormElement<E> element); // void onSetControl(FormElement<E> element); // void onSetReadOnly(FormElement<E> element); // void onSetRequired(FormElement<E> element); // void onSetDisabled(FormElement<E> element); // } // // } // // Path: src/main/java/org/dynaform/xml/form/restriction/Choice.java // public interface Choice<E> { // // String getLabel(); // void setLabel(String label); // // E getValue(); // void setValue(E value); // // } // Path: src/main/java/org/dynaform/web/form/builder/ControlBuilder.java import org.dynaform.xml.form.FormElement; import org.dynaform.xml.form.control.Control; import org.dynaform.xml.form.data.Data; import org.dynaform.xml.form.data.DateData; import org.dynaform.xml.form.restriction.Choice; import org.dynaform.xml.form.restriction.Restrictions; import java.math.BigDecimal; import java.math.BigInteger; import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; import org.araneaframework.uilib.form.control.CheckboxControl; import org.araneaframework.uilib.form.control.DateControl; import org.araneaframework.uilib.form.control.DateTimeControl; import org.araneaframework.uilib.form.control.DisplayControl; import org.araneaframework.uilib.form.control.FloatControl; import org.araneaframework.uilib.form.control.NumberControl; import org.araneaframework.uilib.form.control.SelectControl; import org.araneaframework.uilib.form.control.TextControl; import org.araneaframework.uilib.form.control.TextareaControl; import org.araneaframework.uilib.form.control.TimeControl; import org.araneaframework.uilib.support.DisplayItem; package org.dynaform.web.form.builder; /** * Converts an abstract form into Aranea Widget. * * @author Rein Raudjärv * * @see FormElement * @see AraneaControlEntry * @see AraneaFormBuilder */ public class ControlBuilder { private static final int MAX_LENGTH_LONG = String.valueOf(Long.MIN_VALUE).length(); private static final int MAX_LENGTH_INT = String.valueOf(Integer.MIN_VALUE).length(); private static final int MAX_LENGTH_SHORT = String.valueOf(Short.MIN_VALUE).length(); private static final int MAX_LENGTH_BYTE = String.valueOf(Byte.MIN_VALUE).length(); private static final int SELECT_BOX_MAX_SIZE = 8; private static final String SELECT_BOX_NULL_VALUE = null; private static final String SELECT_BOX_NULL_LABEL = ""; private static final String RADIO_SELECT_BOX_NULL_VALUE = "__null__"; private static final String RADIO_SELECT_BOX_NULL_LABEL = "-";
static <E> AraneaControlEntry getFormControl(FormElement<E> element) {
reinra/dynaform
src/main/java/org/dynaform/web/form/builder/ControlBuilder.java
// Path: src/main/java/org/dynaform/xml/form/FormElement.java // public interface FormElement<E> extends Form, Data<E>, Labeled { // // Data<E> getData(); // // Restrictions<E> getRestrictions(); // // String getLabel(); // void setLabel(String label); // // Control getControl(); // void setControl(Control control); // // boolean isReadOnly(); // void setReadOnly(boolean readOnly); // // boolean isRequired(); // void setRequired(boolean required); // // boolean isDisabled(); // void setDisabled(boolean disabled); // // // Listeners // // void addListener(ElementChangeListener<E> listener); // void removeListener(ElementChangeListener<E> listener); // // public interface ElementChangeListener<E> { // void onSetValue(FormElement<E> element); // void onSetLabel(FormElement<E> element); // void onSetControl(FormElement<E> element); // void onSetReadOnly(FormElement<E> element); // void onSetRequired(FormElement<E> element); // void onSetDisabled(FormElement<E> element); // } // // } // // Path: src/main/java/org/dynaform/xml/form/restriction/Choice.java // public interface Choice<E> { // // String getLabel(); // void setLabel(String label); // // E getValue(); // void setValue(E value); // // }
import org.dynaform.xml.form.FormElement; import org.dynaform.xml.form.control.Control; import org.dynaform.xml.form.data.Data; import org.dynaform.xml.form.data.DateData; import org.dynaform.xml.form.restriction.Choice; import org.dynaform.xml.form.restriction.Restrictions; import java.math.BigDecimal; import java.math.BigInteger; import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; import org.araneaframework.uilib.form.control.CheckboxControl; import org.araneaframework.uilib.form.control.DateControl; import org.araneaframework.uilib.form.control.DateTimeControl; import org.araneaframework.uilib.form.control.DisplayControl; import org.araneaframework.uilib.form.control.FloatControl; import org.araneaframework.uilib.form.control.NumberControl; import org.araneaframework.uilib.form.control.SelectControl; import org.araneaframework.uilib.form.control.TextControl; import org.araneaframework.uilib.form.control.TextareaControl; import org.araneaframework.uilib.form.control.TimeControl; import org.araneaframework.uilib.support.DisplayItem;
final Map<String, String> tagAttributes = new HashMap<String, String>(); final String tag; final Class<?> arType = type; Converter converter = Converters.NOP; if (control instanceof Control.RadioSelectBox) { tag = "radioSelect"; tagAttributes.put("type", "vertical"); arControl.addItem(new DisplayItem(RADIO_SELECT_BOX_NULL_VALUE, RADIO_SELECT_BOX_NULL_LABEL)); converter = new Converter() { public Object convert(Object value) { return value == null ? RADIO_SELECT_BOX_NULL_VALUE : value; } public Object deconvert(Object value) { return RADIO_SELECT_BOX_NULL_VALUE.equals(value) ? null : value; } }; } else { tag = "select"; arControl.addItem(new DisplayItem(SELECT_BOX_NULL_VALUE, SELECT_BOX_NULL_LABEL)); if (control instanceof Control.SelectBox) { Control.SelectBox selectbox = (Control.SelectBox) control; Integer size = selectbox.getSize(); if (size == null) size = Math.min(arControl.getDisplayItems().size(), SELECT_BOX_MAX_SIZE); tagAttributes.put("size", "" + size); } }
// Path: src/main/java/org/dynaform/xml/form/FormElement.java // public interface FormElement<E> extends Form, Data<E>, Labeled { // // Data<E> getData(); // // Restrictions<E> getRestrictions(); // // String getLabel(); // void setLabel(String label); // // Control getControl(); // void setControl(Control control); // // boolean isReadOnly(); // void setReadOnly(boolean readOnly); // // boolean isRequired(); // void setRequired(boolean required); // // boolean isDisabled(); // void setDisabled(boolean disabled); // // // Listeners // // void addListener(ElementChangeListener<E> listener); // void removeListener(ElementChangeListener<E> listener); // // public interface ElementChangeListener<E> { // void onSetValue(FormElement<E> element); // void onSetLabel(FormElement<E> element); // void onSetControl(FormElement<E> element); // void onSetReadOnly(FormElement<E> element); // void onSetRequired(FormElement<E> element); // void onSetDisabled(FormElement<E> element); // } // // } // // Path: src/main/java/org/dynaform/xml/form/restriction/Choice.java // public interface Choice<E> { // // String getLabel(); // void setLabel(String label); // // E getValue(); // void setValue(E value); // // } // Path: src/main/java/org/dynaform/web/form/builder/ControlBuilder.java import org.dynaform.xml.form.FormElement; import org.dynaform.xml.form.control.Control; import org.dynaform.xml.form.data.Data; import org.dynaform.xml.form.data.DateData; import org.dynaform.xml.form.restriction.Choice; import org.dynaform.xml.form.restriction.Restrictions; import java.math.BigDecimal; import java.math.BigInteger; import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; import org.araneaframework.uilib.form.control.CheckboxControl; import org.araneaframework.uilib.form.control.DateControl; import org.araneaframework.uilib.form.control.DateTimeControl; import org.araneaframework.uilib.form.control.DisplayControl; import org.araneaframework.uilib.form.control.FloatControl; import org.araneaframework.uilib.form.control.NumberControl; import org.araneaframework.uilib.form.control.SelectControl; import org.araneaframework.uilib.form.control.TextControl; import org.araneaframework.uilib.form.control.TextareaControl; import org.araneaframework.uilib.form.control.TimeControl; import org.araneaframework.uilib.support.DisplayItem; final Map<String, String> tagAttributes = new HashMap<String, String>(); final String tag; final Class<?> arType = type; Converter converter = Converters.NOP; if (control instanceof Control.RadioSelectBox) { tag = "radioSelect"; tagAttributes.put("type", "vertical"); arControl.addItem(new DisplayItem(RADIO_SELECT_BOX_NULL_VALUE, RADIO_SELECT_BOX_NULL_LABEL)); converter = new Converter() { public Object convert(Object value) { return value == null ? RADIO_SELECT_BOX_NULL_VALUE : value; } public Object deconvert(Object value) { return RADIO_SELECT_BOX_NULL_VALUE.equals(value) ? null : value; } }; } else { tag = "select"; arControl.addItem(new DisplayItem(SELECT_BOX_NULL_VALUE, SELECT_BOX_NULL_LABEL)); if (control instanceof Control.SelectBox) { Control.SelectBox selectbox = (Control.SelectBox) control; Integer size = selectbox.getSize(); if (size == null) size = Math.min(arControl.getDisplayItems().size(), SELECT_BOX_MAX_SIZE); tagAttributes.put("size", "" + size); } }
List<Choice<E>> choices = restrictions.getChoices();
reinra/dynaform
src/main/java/org/dynaform/xml/form/impl/FormChoiceImpl.java
// Path: src/main/java/org/dynaform/xml/form/Form.java // public interface Form { // // String HL_CHILD = "/"; // String HL_DESCENDANT_OR_SELF = "//"; // String LL_CHILD = "!"; // String LL_DESCENDANT_OR_SELF = "!!"; // String INDEX_START = "["; // String INDEX_END = "]"; // String OPERATOR_SEQUENCE = "sequence"; // String OPERATOR_CHOICE = "choice"; // String OPERATOR_ALL = "all"; // // // Identity and parent // String getDescendantOrSelfSelector(); // "//element" // String getFullSelector(); // "/aa/bb/cc!selector[0]" // String getHighLevelFullSelectorForChildren(); // "/aa/bb/cc" // // String getHighLevelId(); // cc // String getLowLevelId(); // selector[0] // // Form getParent(); // void _setParent(Form parent); // // // Sequence // String nextCounterValue(); // // // Visitors // void accept(FormVisitor visitor); // <T> T apply(FormFunction<T> function); // // } // // Path: src/main/java/org/dynaform/xml/form/FormFunction.java // public interface FormFunction<T> { // // <E> T element(FormElement<E> element); // // <F extends Form> T section(FormSection<F> section); // // <F extends Form> T repeat(FormRepeat<F> sequence); // // T sequence(FormSequence composite); // // T choice(FormChoice choice); // // T all(FormAll all); // // } // // Path: src/main/java/org/dynaform/xml/form/FormVisitor.java // public interface FormVisitor { // // <E> void element(FormElement<E> element); // // <F extends Form> void section(FormSection<F> section); // // <F extends Form> void repeat(FormRepeat<F> sequence); // // void sequence(FormSequence composite); // // void choice(FormChoice choice); // // void all(FormAll all); // // }
import org.dynaform.xml.form.Form; import org.dynaform.xml.form.FormChoice; import org.dynaform.xml.form.FormFunction; import org.dynaform.xml.form.FormVisitor; import org.dynaform.xml.form.ToggleFormVisitor; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.List;
package org.dynaform.xml.form.impl; /** * @author Rein Raudjärv * * @see FormChoice */ public class FormChoiceImpl extends BaseForm implements FormChoice, FormChoice.ChoiceChangeListener { private String id;
// Path: src/main/java/org/dynaform/xml/form/Form.java // public interface Form { // // String HL_CHILD = "/"; // String HL_DESCENDANT_OR_SELF = "//"; // String LL_CHILD = "!"; // String LL_DESCENDANT_OR_SELF = "!!"; // String INDEX_START = "["; // String INDEX_END = "]"; // String OPERATOR_SEQUENCE = "sequence"; // String OPERATOR_CHOICE = "choice"; // String OPERATOR_ALL = "all"; // // // Identity and parent // String getDescendantOrSelfSelector(); // "//element" // String getFullSelector(); // "/aa/bb/cc!selector[0]" // String getHighLevelFullSelectorForChildren(); // "/aa/bb/cc" // // String getHighLevelId(); // cc // String getLowLevelId(); // selector[0] // // Form getParent(); // void _setParent(Form parent); // // // Sequence // String nextCounterValue(); // // // Visitors // void accept(FormVisitor visitor); // <T> T apply(FormFunction<T> function); // // } // // Path: src/main/java/org/dynaform/xml/form/FormFunction.java // public interface FormFunction<T> { // // <E> T element(FormElement<E> element); // // <F extends Form> T section(FormSection<F> section); // // <F extends Form> T repeat(FormRepeat<F> sequence); // // T sequence(FormSequence composite); // // T choice(FormChoice choice); // // T all(FormAll all); // // } // // Path: src/main/java/org/dynaform/xml/form/FormVisitor.java // public interface FormVisitor { // // <E> void element(FormElement<E> element); // // <F extends Form> void section(FormSection<F> section); // // <F extends Form> void repeat(FormRepeat<F> sequence); // // void sequence(FormSequence composite); // // void choice(FormChoice choice); // // void all(FormAll all); // // } // Path: src/main/java/org/dynaform/xml/form/impl/FormChoiceImpl.java import org.dynaform.xml.form.Form; import org.dynaform.xml.form.FormChoice; import org.dynaform.xml.form.FormFunction; import org.dynaform.xml.form.FormVisitor; import org.dynaform.xml.form.ToggleFormVisitor; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.List; package org.dynaform.xml.form.impl; /** * @author Rein Raudjärv * * @see FormChoice */ public class FormChoiceImpl extends BaseForm implements FormChoice, FormChoice.ChoiceChangeListener { private String id;
private final List<Form> children;
reinra/dynaform
src/main/java/org/dynaform/xml/form/impl/FormChoiceImpl.java
// Path: src/main/java/org/dynaform/xml/form/Form.java // public interface Form { // // String HL_CHILD = "/"; // String HL_DESCENDANT_OR_SELF = "//"; // String LL_CHILD = "!"; // String LL_DESCENDANT_OR_SELF = "!!"; // String INDEX_START = "["; // String INDEX_END = "]"; // String OPERATOR_SEQUENCE = "sequence"; // String OPERATOR_CHOICE = "choice"; // String OPERATOR_ALL = "all"; // // // Identity and parent // String getDescendantOrSelfSelector(); // "//element" // String getFullSelector(); // "/aa/bb/cc!selector[0]" // String getHighLevelFullSelectorForChildren(); // "/aa/bb/cc" // // String getHighLevelId(); // cc // String getLowLevelId(); // selector[0] // // Form getParent(); // void _setParent(Form parent); // // // Sequence // String nextCounterValue(); // // // Visitors // void accept(FormVisitor visitor); // <T> T apply(FormFunction<T> function); // // } // // Path: src/main/java/org/dynaform/xml/form/FormFunction.java // public interface FormFunction<T> { // // <E> T element(FormElement<E> element); // // <F extends Form> T section(FormSection<F> section); // // <F extends Form> T repeat(FormRepeat<F> sequence); // // T sequence(FormSequence composite); // // T choice(FormChoice choice); // // T all(FormAll all); // // } // // Path: src/main/java/org/dynaform/xml/form/FormVisitor.java // public interface FormVisitor { // // <E> void element(FormElement<E> element); // // <F extends Form> void section(FormSection<F> section); // // <F extends Form> void repeat(FormRepeat<F> sequence); // // void sequence(FormSequence composite); // // void choice(FormChoice choice); // // void all(FormAll all); // // }
import org.dynaform.xml.form.Form; import org.dynaform.xml.form.FormChoice; import org.dynaform.xml.form.FormFunction; import org.dynaform.xml.form.FormVisitor; import org.dynaform.xml.form.ToggleFormVisitor; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.List;
return children; } public Form getSelectedChild() { return children.get(selectedIndex); } public int getSelectedIndex() { return selectedIndex; } public void setSelectedIndex(int index) { if (index < 0 || index >= children.size()) throw new IndexOutOfBoundsException(); if (index == selectedIndex) return; // no change // Disable last selected child element getSelectedChild().accept(ToggleFormVisitor.DISABLER); selectedIndex = index; // Enable new selected child element getSelectedChild().accept(ToggleFormVisitor.ENABLER); // Invoke listeners onSetSelectedIndex(index); }
// Path: src/main/java/org/dynaform/xml/form/Form.java // public interface Form { // // String HL_CHILD = "/"; // String HL_DESCENDANT_OR_SELF = "//"; // String LL_CHILD = "!"; // String LL_DESCENDANT_OR_SELF = "!!"; // String INDEX_START = "["; // String INDEX_END = "]"; // String OPERATOR_SEQUENCE = "sequence"; // String OPERATOR_CHOICE = "choice"; // String OPERATOR_ALL = "all"; // // // Identity and parent // String getDescendantOrSelfSelector(); // "//element" // String getFullSelector(); // "/aa/bb/cc!selector[0]" // String getHighLevelFullSelectorForChildren(); // "/aa/bb/cc" // // String getHighLevelId(); // cc // String getLowLevelId(); // selector[0] // // Form getParent(); // void _setParent(Form parent); // // // Sequence // String nextCounterValue(); // // // Visitors // void accept(FormVisitor visitor); // <T> T apply(FormFunction<T> function); // // } // // Path: src/main/java/org/dynaform/xml/form/FormFunction.java // public interface FormFunction<T> { // // <E> T element(FormElement<E> element); // // <F extends Form> T section(FormSection<F> section); // // <F extends Form> T repeat(FormRepeat<F> sequence); // // T sequence(FormSequence composite); // // T choice(FormChoice choice); // // T all(FormAll all); // // } // // Path: src/main/java/org/dynaform/xml/form/FormVisitor.java // public interface FormVisitor { // // <E> void element(FormElement<E> element); // // <F extends Form> void section(FormSection<F> section); // // <F extends Form> void repeat(FormRepeat<F> sequence); // // void sequence(FormSequence composite); // // void choice(FormChoice choice); // // void all(FormAll all); // // } // Path: src/main/java/org/dynaform/xml/form/impl/FormChoiceImpl.java import org.dynaform.xml.form.Form; import org.dynaform.xml.form.FormChoice; import org.dynaform.xml.form.FormFunction; import org.dynaform.xml.form.FormVisitor; import org.dynaform.xml.form.ToggleFormVisitor; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.List; return children; } public Form getSelectedChild() { return children.get(selectedIndex); } public int getSelectedIndex() { return selectedIndex; } public void setSelectedIndex(int index) { if (index < 0 || index >= children.size()) throw new IndexOutOfBoundsException(); if (index == selectedIndex) return; // no change // Disable last selected child element getSelectedChild().accept(ToggleFormVisitor.DISABLER); selectedIndex = index; // Enable new selected child element getSelectedChild().accept(ToggleFormVisitor.ENABLER); // Invoke listeners onSetSelectedIndex(index); }
public void accept(FormVisitor visitor) {
reinra/dynaform
src/main/java/org/dynaform/xml/form/impl/FormChoiceImpl.java
// Path: src/main/java/org/dynaform/xml/form/Form.java // public interface Form { // // String HL_CHILD = "/"; // String HL_DESCENDANT_OR_SELF = "//"; // String LL_CHILD = "!"; // String LL_DESCENDANT_OR_SELF = "!!"; // String INDEX_START = "["; // String INDEX_END = "]"; // String OPERATOR_SEQUENCE = "sequence"; // String OPERATOR_CHOICE = "choice"; // String OPERATOR_ALL = "all"; // // // Identity and parent // String getDescendantOrSelfSelector(); // "//element" // String getFullSelector(); // "/aa/bb/cc!selector[0]" // String getHighLevelFullSelectorForChildren(); // "/aa/bb/cc" // // String getHighLevelId(); // cc // String getLowLevelId(); // selector[0] // // Form getParent(); // void _setParent(Form parent); // // // Sequence // String nextCounterValue(); // // // Visitors // void accept(FormVisitor visitor); // <T> T apply(FormFunction<T> function); // // } // // Path: src/main/java/org/dynaform/xml/form/FormFunction.java // public interface FormFunction<T> { // // <E> T element(FormElement<E> element); // // <F extends Form> T section(FormSection<F> section); // // <F extends Form> T repeat(FormRepeat<F> sequence); // // T sequence(FormSequence composite); // // T choice(FormChoice choice); // // T all(FormAll all); // // } // // Path: src/main/java/org/dynaform/xml/form/FormVisitor.java // public interface FormVisitor { // // <E> void element(FormElement<E> element); // // <F extends Form> void section(FormSection<F> section); // // <F extends Form> void repeat(FormRepeat<F> sequence); // // void sequence(FormSequence composite); // // void choice(FormChoice choice); // // void all(FormAll all); // // }
import org.dynaform.xml.form.Form; import org.dynaform.xml.form.FormChoice; import org.dynaform.xml.form.FormFunction; import org.dynaform.xml.form.FormVisitor; import org.dynaform.xml.form.ToggleFormVisitor; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.List;
return children.get(selectedIndex); } public int getSelectedIndex() { return selectedIndex; } public void setSelectedIndex(int index) { if (index < 0 || index >= children.size()) throw new IndexOutOfBoundsException(); if (index == selectedIndex) return; // no change // Disable last selected child element getSelectedChild().accept(ToggleFormVisitor.DISABLER); selectedIndex = index; // Enable new selected child element getSelectedChild().accept(ToggleFormVisitor.ENABLER); // Invoke listeners onSetSelectedIndex(index); } public void accept(FormVisitor visitor) { visitor.choice(this); }
// Path: src/main/java/org/dynaform/xml/form/Form.java // public interface Form { // // String HL_CHILD = "/"; // String HL_DESCENDANT_OR_SELF = "//"; // String LL_CHILD = "!"; // String LL_DESCENDANT_OR_SELF = "!!"; // String INDEX_START = "["; // String INDEX_END = "]"; // String OPERATOR_SEQUENCE = "sequence"; // String OPERATOR_CHOICE = "choice"; // String OPERATOR_ALL = "all"; // // // Identity and parent // String getDescendantOrSelfSelector(); // "//element" // String getFullSelector(); // "/aa/bb/cc!selector[0]" // String getHighLevelFullSelectorForChildren(); // "/aa/bb/cc" // // String getHighLevelId(); // cc // String getLowLevelId(); // selector[0] // // Form getParent(); // void _setParent(Form parent); // // // Sequence // String nextCounterValue(); // // // Visitors // void accept(FormVisitor visitor); // <T> T apply(FormFunction<T> function); // // } // // Path: src/main/java/org/dynaform/xml/form/FormFunction.java // public interface FormFunction<T> { // // <E> T element(FormElement<E> element); // // <F extends Form> T section(FormSection<F> section); // // <F extends Form> T repeat(FormRepeat<F> sequence); // // T sequence(FormSequence composite); // // T choice(FormChoice choice); // // T all(FormAll all); // // } // // Path: src/main/java/org/dynaform/xml/form/FormVisitor.java // public interface FormVisitor { // // <E> void element(FormElement<E> element); // // <F extends Form> void section(FormSection<F> section); // // <F extends Form> void repeat(FormRepeat<F> sequence); // // void sequence(FormSequence composite); // // void choice(FormChoice choice); // // void all(FormAll all); // // } // Path: src/main/java/org/dynaform/xml/form/impl/FormChoiceImpl.java import org.dynaform.xml.form.Form; import org.dynaform.xml.form.FormChoice; import org.dynaform.xml.form.FormFunction; import org.dynaform.xml.form.FormVisitor; import org.dynaform.xml.form.ToggleFormVisitor; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.List; return children.get(selectedIndex); } public int getSelectedIndex() { return selectedIndex; } public void setSelectedIndex(int index) { if (index < 0 || index >= children.size()) throw new IndexOutOfBoundsException(); if (index == selectedIndex) return; // no change // Disable last selected child element getSelectedChild().accept(ToggleFormVisitor.DISABLER); selectedIndex = index; // Enable new selected child element getSelectedChild().accept(ToggleFormVisitor.ENABLER); // Invoke listeners onSetSelectedIndex(index); } public void accept(FormVisitor visitor) { visitor.choice(this); }
public <T> T apply(FormFunction<T> function) {
reinra/dynaform
src/main/java/org/dynaform/web/demo/XmlEditWidget.java
// Path: src/main/java/org/dynaform/xml/XmlUtil.java // public class XmlUtil { // // /** // * Uses an XmlWriter to produce a pretty XML String. // * // * @param form an abstract form // * @return an XML String. // */ // public static String writeXml(XmlWriter writer) { // try { // XmlVisitor xa = PrettyXmlAppender.newInstance(); // writer.write(xa); // return xa.toString(); // } catch (Exception e) { // throw new RuntimeException("Failed to produce XML String from XML writer '" + writer + "'", e); // } // } // // /** // * Uses an XmlWriter to produce an XML String without additional whitespace. // * // * @param form an abstract form // * @return an XML String. // */ // public static String writeCompactXml(XmlWriter writer) { // try { // XmlVisitor xa = XmlAppender.newInstance(); // writer.write(xa); // return xa.toString(); // } catch (Exception e) { // throw new RuntimeException("Failed to produce XML String from XML writer '" + writer + "'", e); // } // } // // /** // * Parses XML String using the given {@link XmlReader}. // * // * @param xml XML String. // * @param xv an XML reader. // */ // public static void readXml(String xml, XmlReader xr) { // try { // readXml(xml, xr.create(null)); // } catch (InvalidXmlException e) { // throw e; // } catch (Exception e) { // throw new RuntimeException("Failed to read XML String '" + xml + "' using XML reader '" + xr + "'", e); // } // } // // /** // * Parses XML String using the given {@link XmlVisitor}. // * // * @param xml XML String. // * @param xv an XML visitor. // */ // private static void readXml(String xml, XmlVisitor xv) { // parse(xml, new XmlParser(xv)); // } // // /** // * Parses XML String using the given SAX event handler. // * // * @param xml XML String. // * @param handler SAX event handler. // */ // private static void parse(String xml, DefaultHandler handler) { // if (xml == null || "".equals(xml)) // return; // // try { // InputStream in = new ByteArrayInputStream(xml.getBytes("UTF-8")); // SAXParserFactory factory = SAXParserFactory.newInstance(); // SAXParser saxParser; // saxParser = factory.newSAXParser(); // saxParser.parse(in, handler); // } catch (Exception e) { // if (e instanceof RuntimeException) // throw (RuntimeException) e; // throw new RuntimeException("Failed to parse XML String '" + xml + "'", e); // } // } // // /** // * Uses {@link XmlParser} and {@link XmlAppender} // * to read and write an XML String. // * // * @param xml XML String to be read. // * @return XML String written. // */ // public static String readAndWrite(String xml) { // XmlVisitor xv = XmlAppender.newInstance(); // readXml(xml, xv); // return xv.toString(); // } // // }
import org.dynaform.xml.XmlUtil; import org.dynaform.xml.writer.XmlWriter; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.araneaframework.uilib.core.BaseUIWidget; import org.araneaframework.uilib.form.FormWidget; import org.araneaframework.uilib.form.control.TextareaControl; import org.araneaframework.uilib.form.data.StringData;
package org.dynaform.web.demo; public class XmlEditWidget extends BaseUIWidget { private static final Log log = LogFactory.getLog(XmlEditWidget.class); private static final long serialVersionUID = 1L; private final FormWidget form = new FormWidget(); protected void init() throws Exception { setViewSelector("xmlEdit"); form.addElement("xml", "#XML", new TextareaControl(), new StringData(), getXml(), true); addWidget("f", form); } private String getXml() { XmlWriter writer = getContext().getXmlForm().getWriter();
// Path: src/main/java/org/dynaform/xml/XmlUtil.java // public class XmlUtil { // // /** // * Uses an XmlWriter to produce a pretty XML String. // * // * @param form an abstract form // * @return an XML String. // */ // public static String writeXml(XmlWriter writer) { // try { // XmlVisitor xa = PrettyXmlAppender.newInstance(); // writer.write(xa); // return xa.toString(); // } catch (Exception e) { // throw new RuntimeException("Failed to produce XML String from XML writer '" + writer + "'", e); // } // } // // /** // * Uses an XmlWriter to produce an XML String without additional whitespace. // * // * @param form an abstract form // * @return an XML String. // */ // public static String writeCompactXml(XmlWriter writer) { // try { // XmlVisitor xa = XmlAppender.newInstance(); // writer.write(xa); // return xa.toString(); // } catch (Exception e) { // throw new RuntimeException("Failed to produce XML String from XML writer '" + writer + "'", e); // } // } // // /** // * Parses XML String using the given {@link XmlReader}. // * // * @param xml XML String. // * @param xv an XML reader. // */ // public static void readXml(String xml, XmlReader xr) { // try { // readXml(xml, xr.create(null)); // } catch (InvalidXmlException e) { // throw e; // } catch (Exception e) { // throw new RuntimeException("Failed to read XML String '" + xml + "' using XML reader '" + xr + "'", e); // } // } // // /** // * Parses XML String using the given {@link XmlVisitor}. // * // * @param xml XML String. // * @param xv an XML visitor. // */ // private static void readXml(String xml, XmlVisitor xv) { // parse(xml, new XmlParser(xv)); // } // // /** // * Parses XML String using the given SAX event handler. // * // * @param xml XML String. // * @param handler SAX event handler. // */ // private static void parse(String xml, DefaultHandler handler) { // if (xml == null || "".equals(xml)) // return; // // try { // InputStream in = new ByteArrayInputStream(xml.getBytes("UTF-8")); // SAXParserFactory factory = SAXParserFactory.newInstance(); // SAXParser saxParser; // saxParser = factory.newSAXParser(); // saxParser.parse(in, handler); // } catch (Exception e) { // if (e instanceof RuntimeException) // throw (RuntimeException) e; // throw new RuntimeException("Failed to parse XML String '" + xml + "'", e); // } // } // // /** // * Uses {@link XmlParser} and {@link XmlAppender} // * to read and write an XML String. // * // * @param xml XML String to be read. // * @return XML String written. // */ // public static String readAndWrite(String xml) { // XmlVisitor xv = XmlAppender.newInstance(); // readXml(xml, xv); // return xv.toString(); // } // // } // Path: src/main/java/org/dynaform/web/demo/XmlEditWidget.java import org.dynaform.xml.XmlUtil; import org.dynaform.xml.writer.XmlWriter; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.araneaframework.uilib.core.BaseUIWidget; import org.araneaframework.uilib.form.FormWidget; import org.araneaframework.uilib.form.control.TextareaControl; import org.araneaframework.uilib.form.data.StringData; package org.dynaform.web.demo; public class XmlEditWidget extends BaseUIWidget { private static final Log log = LogFactory.getLog(XmlEditWidget.class); private static final long serialVersionUID = 1L; private final FormWidget form = new FormWidget(); protected void init() throws Exception { setViewSelector("xmlEdit"); form.addElement("xml", "#XML", new TextareaControl(), new StringData(), getXml(), true); addWidget("f", form); } private String getXml() { XmlWriter writer = getContext().getXmlForm().getWriter();
return XmlUtil.writeXml(writer);
reinra/dynaform
src/main/java/org/dynaform/xml/reader/MaybeReader.java
// Path: src/main/java/org/dynaform/xml/XmlVisitor.java // public interface XmlVisitor { // // /** // * Handle text. // * // * @param s text. // * @return XML event handler to be used as next. // */ // XmlVisitor text(String s); // // /** // * Handle XML element start. // * // * @param element name of the XML element. // * @return event handler for the XML element. // */ // ElementVisitor visitElement(String element); // // /** // * Handle end of the XML element body. // * // * @return event handler of the XML element to be used as next. // */ // ElementVisitor visitEndBody(); // // /** // * Event handler of XML element. // * // * @author Rein Raudjärv // */ // interface ElementVisitor { // /** // * Handle XML attribute. // * // * @param name name of the XML attribute. // * @param value value of the XML attribute. // * @return event handler for the XML element. // */ // ElementVisitor visitAttribute(String name, String value); // // /** // * Handle start of the XML body. // * // * @return event handler for the XML element body. // */ // XmlVisitor visitBody(); // // /** // * Handle end of the XML element. // * // * @return XML event handler to be used as next. // */ // XmlVisitor visitEndElement(); // } // // }
import org.dynaform.xml.XmlVisitor; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory;
package org.dynaform.xml.reader; public class MaybeReader implements XmlReader { private static final Log log = LogFactory.getLog(MaybeReader.class); private final XmlReader reader; private final XmlReader fallback; public MaybeReader(XmlReader reader, XmlReader fallback) { this.reader = reader; this.fallback = fallback; }
// Path: src/main/java/org/dynaform/xml/XmlVisitor.java // public interface XmlVisitor { // // /** // * Handle text. // * // * @param s text. // * @return XML event handler to be used as next. // */ // XmlVisitor text(String s); // // /** // * Handle XML element start. // * // * @param element name of the XML element. // * @return event handler for the XML element. // */ // ElementVisitor visitElement(String element); // // /** // * Handle end of the XML element body. // * // * @return event handler of the XML element to be used as next. // */ // ElementVisitor visitEndBody(); // // /** // * Event handler of XML element. // * // * @author Rein Raudjärv // */ // interface ElementVisitor { // /** // * Handle XML attribute. // * // * @param name name of the XML attribute. // * @param value value of the XML attribute. // * @return event handler for the XML element. // */ // ElementVisitor visitAttribute(String name, String value); // // /** // * Handle start of the XML body. // * // * @return event handler for the XML element body. // */ // XmlVisitor visitBody(); // // /** // * Handle end of the XML element. // * // * @return XML event handler to be used as next. // */ // XmlVisitor visitEndElement(); // } // // } // Path: src/main/java/org/dynaform/xml/reader/MaybeReader.java import org.dynaform.xml.XmlVisitor; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; package org.dynaform.xml.reader; public class MaybeReader implements XmlReader { private static final Log log = LogFactory.getLog(MaybeReader.class); private final XmlReader reader; private final XmlReader fallback; public MaybeReader(XmlReader reader, XmlReader fallback) { this.reader = reader; this.fallback = fallback; }
public XmlVisitor create(XmlReader next) {
reinra/dynaform
src/main/java/org/dynaform/xml/writer/SequenceWriter.java
// Path: src/main/java/org/dynaform/xml/XmlVisitor.java // public interface XmlVisitor { // // /** // * Handle text. // * // * @param s text. // * @return XML event handler to be used as next. // */ // XmlVisitor text(String s); // // /** // * Handle XML element start. // * // * @param element name of the XML element. // * @return event handler for the XML element. // */ // ElementVisitor visitElement(String element); // // /** // * Handle end of the XML element body. // * // * @return event handler of the XML element to be used as next. // */ // ElementVisitor visitEndBody(); // // /** // * Event handler of XML element. // * // * @author Rein Raudjärv // */ // interface ElementVisitor { // /** // * Handle XML attribute. // * // * @param name name of the XML attribute. // * @param value value of the XML attribute. // * @return event handler for the XML element. // */ // ElementVisitor visitAttribute(String name, String value); // // /** // * Handle start of the XML body. // * // * @return event handler for the XML element body. // */ // XmlVisitor visitBody(); // // /** // * Handle end of the XML element. // * // * @return XML event handler to be used as next. // */ // XmlVisitor visitEndElement(); // } // // }
import org.dynaform.xml.XmlVisitor; import java.util.ArrayList; import java.util.Collection; import java.util.Iterator; import java.util.List;
package org.dynaform.xml.writer; /** * @author Rein Raudjärv * * @see XmlWriter */ public class SequenceWriter implements XmlWriter { private final Collection<XmlWriter> children; public static XmlWriter newInstance(Collection<XmlWriter> writers) { if (writers == null || writers.isEmpty()) return null; if (writers.size() == 1) return writers.iterator().next(); List<XmlWriter> items = new ArrayList<XmlWriter>(); for (Iterator<XmlWriter> it = writers.iterator(); it.hasNext();) { XmlWriter writer = it.next(); if (writer instanceof SequenceWriter) items.addAll(((SequenceWriter) writer).children); else items.add(writer); } return new SequenceWriter(items); } private SequenceWriter(Collection<XmlWriter> children) { this.children = children; } public boolean isEmpty() { return false; }
// Path: src/main/java/org/dynaform/xml/XmlVisitor.java // public interface XmlVisitor { // // /** // * Handle text. // * // * @param s text. // * @return XML event handler to be used as next. // */ // XmlVisitor text(String s); // // /** // * Handle XML element start. // * // * @param element name of the XML element. // * @return event handler for the XML element. // */ // ElementVisitor visitElement(String element); // // /** // * Handle end of the XML element body. // * // * @return event handler of the XML element to be used as next. // */ // ElementVisitor visitEndBody(); // // /** // * Event handler of XML element. // * // * @author Rein Raudjärv // */ // interface ElementVisitor { // /** // * Handle XML attribute. // * // * @param name name of the XML attribute. // * @param value value of the XML attribute. // * @return event handler for the XML element. // */ // ElementVisitor visitAttribute(String name, String value); // // /** // * Handle start of the XML body. // * // * @return event handler for the XML element body. // */ // XmlVisitor visitBody(); // // /** // * Handle end of the XML element. // * // * @return XML event handler to be used as next. // */ // XmlVisitor visitEndElement(); // } // // } // Path: src/main/java/org/dynaform/xml/writer/SequenceWriter.java import org.dynaform.xml.XmlVisitor; import java.util.ArrayList; import java.util.Collection; import java.util.Iterator; import java.util.List; package org.dynaform.xml.writer; /** * @author Rein Raudjärv * * @see XmlWriter */ public class SequenceWriter implements XmlWriter { private final Collection<XmlWriter> children; public static XmlWriter newInstance(Collection<XmlWriter> writers) { if (writers == null || writers.isEmpty()) return null; if (writers.size() == 1) return writers.iterator().next(); List<XmlWriter> items = new ArrayList<XmlWriter>(); for (Iterator<XmlWriter> it = writers.iterator(); it.hasNext();) { XmlWriter writer = it.next(); if (writer instanceof SequenceWriter) items.addAll(((SequenceWriter) writer).children); else items.add(writer); } return new SequenceWriter(items); } private SequenceWriter(Collection<XmlWriter> children) { this.children = children; } public boolean isEmpty() { return false; }
public void write(XmlVisitor xa) {
reinra/dynaform
src/main/java/org/dynaform/xml/form/impl/FormElementImpl.java
// Path: src/main/java/org/dynaform/xml/form/FormElement.java // public interface FormElement<E> extends Form, Data<E>, Labeled { // // Data<E> getData(); // // Restrictions<E> getRestrictions(); // // String getLabel(); // void setLabel(String label); // // Control getControl(); // void setControl(Control control); // // boolean isReadOnly(); // void setReadOnly(boolean readOnly); // // boolean isRequired(); // void setRequired(boolean required); // // boolean isDisabled(); // void setDisabled(boolean disabled); // // // Listeners // // void addListener(ElementChangeListener<E> listener); // void removeListener(ElementChangeListener<E> listener); // // public interface ElementChangeListener<E> { // void onSetValue(FormElement<E> element); // void onSetLabel(FormElement<E> element); // void onSetControl(FormElement<E> element); // void onSetReadOnly(FormElement<E> element); // void onSetRequired(FormElement<E> element); // void onSetDisabled(FormElement<E> element); // } // // } // // Path: src/main/java/org/dynaform/xml/form/FormFunction.java // public interface FormFunction<T> { // // <E> T element(FormElement<E> element); // // <F extends Form> T section(FormSection<F> section); // // <F extends Form> T repeat(FormRepeat<F> sequence); // // T sequence(FormSequence composite); // // T choice(FormChoice choice); // // T all(FormAll all); // // } // // Path: src/main/java/org/dynaform/xml/form/FormVisitor.java // public interface FormVisitor { // // <E> void element(FormElement<E> element); // // <F extends Form> void section(FormSection<F> section); // // <F extends Form> void repeat(FormRepeat<F> sequence); // // void sequence(FormSequence composite); // // void choice(FormChoice choice); // // void all(FormAll all); // // } // // Path: src/main/java/org/dynaform/xml/form/impl/restriction/RestrictionsImpl.java // public class RestrictionsImpl<E> implements Restrictions<E> { // // private final List<Choice<E>> choices = new ArrayList<Choice<E>>(); // // private Integer length; // private Integer minLength; // private Integer maxLength; // // private E minInclusive; // private E minExclusive; // private E maxInclusive; // private E maxExclusive; // // public List<Choice<E>> getChoices() { // return choices; // } // // public Integer getLength() { // return length; // } // // public void setLength(Integer length) { // this.length = length; // } // // public Integer getMinLength() { // return minLength; // } // // public void setMinLength(Integer minLength) { // this.minLength = minLength; // } // // public Integer getMaxLength() { // return maxLength; // } // // public void setMaxLength(Integer maxLength) { // this.maxLength = maxLength; // } // // public E getMinInclusive() { // return minInclusive; // } // // public void setMinInclusive(E minInclusive) { // this.minInclusive = minInclusive; // } // // public E getMinExclusive() { // return minExclusive; // } // // public void setMinExclusive(E minExclusive) { // this.minExclusive = minExclusive; // } // // public E getMaxInclusive() { // return maxInclusive; // } // // public void setMaxInclusive(E maxInclusive) { // this.maxInclusive = maxInclusive; // } // // public E getMaxExclusive() { // return maxExclusive; // } // // public void setMaxExclusive(E maxExclusive) { // this.maxExclusive = maxExclusive; // } // // }
import org.dynaform.xml.form.FormElement; import org.dynaform.xml.form.FormFunction; import org.dynaform.xml.form.FormVisitor; import org.dynaform.xml.form.control.Control; import org.dynaform.xml.form.data.Data; import org.dynaform.xml.form.impl.restriction.RestrictionsImpl; import org.dynaform.xml.form.restriction.Restrictions; import java.util.ArrayList; import java.util.Collection;
package org.dynaform.xml.form.impl; /** * Form element. * * @author Rein Raudjärv * @param <F> data type. */ public class FormElementImpl<F> extends BaseForm implements FormElement<F> { private static final long serialVersionUID = 1L; private final String id; private final Data<F> data;
// Path: src/main/java/org/dynaform/xml/form/FormElement.java // public interface FormElement<E> extends Form, Data<E>, Labeled { // // Data<E> getData(); // // Restrictions<E> getRestrictions(); // // String getLabel(); // void setLabel(String label); // // Control getControl(); // void setControl(Control control); // // boolean isReadOnly(); // void setReadOnly(boolean readOnly); // // boolean isRequired(); // void setRequired(boolean required); // // boolean isDisabled(); // void setDisabled(boolean disabled); // // // Listeners // // void addListener(ElementChangeListener<E> listener); // void removeListener(ElementChangeListener<E> listener); // // public interface ElementChangeListener<E> { // void onSetValue(FormElement<E> element); // void onSetLabel(FormElement<E> element); // void onSetControl(FormElement<E> element); // void onSetReadOnly(FormElement<E> element); // void onSetRequired(FormElement<E> element); // void onSetDisabled(FormElement<E> element); // } // // } // // Path: src/main/java/org/dynaform/xml/form/FormFunction.java // public interface FormFunction<T> { // // <E> T element(FormElement<E> element); // // <F extends Form> T section(FormSection<F> section); // // <F extends Form> T repeat(FormRepeat<F> sequence); // // T sequence(FormSequence composite); // // T choice(FormChoice choice); // // T all(FormAll all); // // } // // Path: src/main/java/org/dynaform/xml/form/FormVisitor.java // public interface FormVisitor { // // <E> void element(FormElement<E> element); // // <F extends Form> void section(FormSection<F> section); // // <F extends Form> void repeat(FormRepeat<F> sequence); // // void sequence(FormSequence composite); // // void choice(FormChoice choice); // // void all(FormAll all); // // } // // Path: src/main/java/org/dynaform/xml/form/impl/restriction/RestrictionsImpl.java // public class RestrictionsImpl<E> implements Restrictions<E> { // // private final List<Choice<E>> choices = new ArrayList<Choice<E>>(); // // private Integer length; // private Integer minLength; // private Integer maxLength; // // private E minInclusive; // private E minExclusive; // private E maxInclusive; // private E maxExclusive; // // public List<Choice<E>> getChoices() { // return choices; // } // // public Integer getLength() { // return length; // } // // public void setLength(Integer length) { // this.length = length; // } // // public Integer getMinLength() { // return minLength; // } // // public void setMinLength(Integer minLength) { // this.minLength = minLength; // } // // public Integer getMaxLength() { // return maxLength; // } // // public void setMaxLength(Integer maxLength) { // this.maxLength = maxLength; // } // // public E getMinInclusive() { // return minInclusive; // } // // public void setMinInclusive(E minInclusive) { // this.minInclusive = minInclusive; // } // // public E getMinExclusive() { // return minExclusive; // } // // public void setMinExclusive(E minExclusive) { // this.minExclusive = minExclusive; // } // // public E getMaxInclusive() { // return maxInclusive; // } // // public void setMaxInclusive(E maxInclusive) { // this.maxInclusive = maxInclusive; // } // // public E getMaxExclusive() { // return maxExclusive; // } // // public void setMaxExclusive(E maxExclusive) { // this.maxExclusive = maxExclusive; // } // // } // Path: src/main/java/org/dynaform/xml/form/impl/FormElementImpl.java import org.dynaform.xml.form.FormElement; import org.dynaform.xml.form.FormFunction; import org.dynaform.xml.form.FormVisitor; import org.dynaform.xml.form.control.Control; import org.dynaform.xml.form.data.Data; import org.dynaform.xml.form.impl.restriction.RestrictionsImpl; import org.dynaform.xml.form.restriction.Restrictions; import java.util.ArrayList; import java.util.Collection; package org.dynaform.xml.form.impl; /** * Form element. * * @author Rein Raudjärv * @param <F> data type. */ public class FormElementImpl<F> extends BaseForm implements FormElement<F> { private static final long serialVersionUID = 1L; private final String id; private final Data<F> data;
private final Restrictions<F> restrictions = new RestrictionsImpl<F>();
reinra/dynaform
src/main/java/org/dynaform/xml/form/impl/FormElementImpl.java
// Path: src/main/java/org/dynaform/xml/form/FormElement.java // public interface FormElement<E> extends Form, Data<E>, Labeled { // // Data<E> getData(); // // Restrictions<E> getRestrictions(); // // String getLabel(); // void setLabel(String label); // // Control getControl(); // void setControl(Control control); // // boolean isReadOnly(); // void setReadOnly(boolean readOnly); // // boolean isRequired(); // void setRequired(boolean required); // // boolean isDisabled(); // void setDisabled(boolean disabled); // // // Listeners // // void addListener(ElementChangeListener<E> listener); // void removeListener(ElementChangeListener<E> listener); // // public interface ElementChangeListener<E> { // void onSetValue(FormElement<E> element); // void onSetLabel(FormElement<E> element); // void onSetControl(FormElement<E> element); // void onSetReadOnly(FormElement<E> element); // void onSetRequired(FormElement<E> element); // void onSetDisabled(FormElement<E> element); // } // // } // // Path: src/main/java/org/dynaform/xml/form/FormFunction.java // public interface FormFunction<T> { // // <E> T element(FormElement<E> element); // // <F extends Form> T section(FormSection<F> section); // // <F extends Form> T repeat(FormRepeat<F> sequence); // // T sequence(FormSequence composite); // // T choice(FormChoice choice); // // T all(FormAll all); // // } // // Path: src/main/java/org/dynaform/xml/form/FormVisitor.java // public interface FormVisitor { // // <E> void element(FormElement<E> element); // // <F extends Form> void section(FormSection<F> section); // // <F extends Form> void repeat(FormRepeat<F> sequence); // // void sequence(FormSequence composite); // // void choice(FormChoice choice); // // void all(FormAll all); // // } // // Path: src/main/java/org/dynaform/xml/form/impl/restriction/RestrictionsImpl.java // public class RestrictionsImpl<E> implements Restrictions<E> { // // private final List<Choice<E>> choices = new ArrayList<Choice<E>>(); // // private Integer length; // private Integer minLength; // private Integer maxLength; // // private E minInclusive; // private E minExclusive; // private E maxInclusive; // private E maxExclusive; // // public List<Choice<E>> getChoices() { // return choices; // } // // public Integer getLength() { // return length; // } // // public void setLength(Integer length) { // this.length = length; // } // // public Integer getMinLength() { // return minLength; // } // // public void setMinLength(Integer minLength) { // this.minLength = minLength; // } // // public Integer getMaxLength() { // return maxLength; // } // // public void setMaxLength(Integer maxLength) { // this.maxLength = maxLength; // } // // public E getMinInclusive() { // return minInclusive; // } // // public void setMinInclusive(E minInclusive) { // this.minInclusive = minInclusive; // } // // public E getMinExclusive() { // return minExclusive; // } // // public void setMinExclusive(E minExclusive) { // this.minExclusive = minExclusive; // } // // public E getMaxInclusive() { // return maxInclusive; // } // // public void setMaxInclusive(E maxInclusive) { // this.maxInclusive = maxInclusive; // } // // public E getMaxExclusive() { // return maxExclusive; // } // // public void setMaxExclusive(E maxExclusive) { // this.maxExclusive = maxExclusive; // } // // }
import org.dynaform.xml.form.FormElement; import org.dynaform.xml.form.FormFunction; import org.dynaform.xml.form.FormVisitor; import org.dynaform.xml.form.control.Control; import org.dynaform.xml.form.data.Data; import org.dynaform.xml.form.impl.restriction.RestrictionsImpl; import org.dynaform.xml.form.restriction.Restrictions; import java.util.ArrayList; import java.util.Collection;
public void setDisabled(boolean disabled) { this.disabled = disabled; onSetDisabled(); } public Class<F> getType() { return data.getType(); } public F getValue() { return data.getValue(); } public String getXmlValue() { return data.getXmlValue(); } public void setValue(F value) { if (readOnly) throw new UnsupportedOperationException("read only"); data.setValue(value); onSetValue(); } public void setXmlValue(String value) { data.setXmlValue(value); onSetValue(); }
// Path: src/main/java/org/dynaform/xml/form/FormElement.java // public interface FormElement<E> extends Form, Data<E>, Labeled { // // Data<E> getData(); // // Restrictions<E> getRestrictions(); // // String getLabel(); // void setLabel(String label); // // Control getControl(); // void setControl(Control control); // // boolean isReadOnly(); // void setReadOnly(boolean readOnly); // // boolean isRequired(); // void setRequired(boolean required); // // boolean isDisabled(); // void setDisabled(boolean disabled); // // // Listeners // // void addListener(ElementChangeListener<E> listener); // void removeListener(ElementChangeListener<E> listener); // // public interface ElementChangeListener<E> { // void onSetValue(FormElement<E> element); // void onSetLabel(FormElement<E> element); // void onSetControl(FormElement<E> element); // void onSetReadOnly(FormElement<E> element); // void onSetRequired(FormElement<E> element); // void onSetDisabled(FormElement<E> element); // } // // } // // Path: src/main/java/org/dynaform/xml/form/FormFunction.java // public interface FormFunction<T> { // // <E> T element(FormElement<E> element); // // <F extends Form> T section(FormSection<F> section); // // <F extends Form> T repeat(FormRepeat<F> sequence); // // T sequence(FormSequence composite); // // T choice(FormChoice choice); // // T all(FormAll all); // // } // // Path: src/main/java/org/dynaform/xml/form/FormVisitor.java // public interface FormVisitor { // // <E> void element(FormElement<E> element); // // <F extends Form> void section(FormSection<F> section); // // <F extends Form> void repeat(FormRepeat<F> sequence); // // void sequence(FormSequence composite); // // void choice(FormChoice choice); // // void all(FormAll all); // // } // // Path: src/main/java/org/dynaform/xml/form/impl/restriction/RestrictionsImpl.java // public class RestrictionsImpl<E> implements Restrictions<E> { // // private final List<Choice<E>> choices = new ArrayList<Choice<E>>(); // // private Integer length; // private Integer minLength; // private Integer maxLength; // // private E minInclusive; // private E minExclusive; // private E maxInclusive; // private E maxExclusive; // // public List<Choice<E>> getChoices() { // return choices; // } // // public Integer getLength() { // return length; // } // // public void setLength(Integer length) { // this.length = length; // } // // public Integer getMinLength() { // return minLength; // } // // public void setMinLength(Integer minLength) { // this.minLength = minLength; // } // // public Integer getMaxLength() { // return maxLength; // } // // public void setMaxLength(Integer maxLength) { // this.maxLength = maxLength; // } // // public E getMinInclusive() { // return minInclusive; // } // // public void setMinInclusive(E minInclusive) { // this.minInclusive = minInclusive; // } // // public E getMinExclusive() { // return minExclusive; // } // // public void setMinExclusive(E minExclusive) { // this.minExclusive = minExclusive; // } // // public E getMaxInclusive() { // return maxInclusive; // } // // public void setMaxInclusive(E maxInclusive) { // this.maxInclusive = maxInclusive; // } // // public E getMaxExclusive() { // return maxExclusive; // } // // public void setMaxExclusive(E maxExclusive) { // this.maxExclusive = maxExclusive; // } // // } // Path: src/main/java/org/dynaform/xml/form/impl/FormElementImpl.java import org.dynaform.xml.form.FormElement; import org.dynaform.xml.form.FormFunction; import org.dynaform.xml.form.FormVisitor; import org.dynaform.xml.form.control.Control; import org.dynaform.xml.form.data.Data; import org.dynaform.xml.form.impl.restriction.RestrictionsImpl; import org.dynaform.xml.form.restriction.Restrictions; import java.util.ArrayList; import java.util.Collection; public void setDisabled(boolean disabled) { this.disabled = disabled; onSetDisabled(); } public Class<F> getType() { return data.getType(); } public F getValue() { return data.getValue(); } public String getXmlValue() { return data.getXmlValue(); } public void setValue(F value) { if (readOnly) throw new UnsupportedOperationException("read only"); data.setValue(value); onSetValue(); } public void setXmlValue(String value) { data.setXmlValue(value); onSetValue(); }
public void accept(FormVisitor visitor) {
reinra/dynaform
src/main/java/org/dynaform/xml/form/impl/FormElementImpl.java
// Path: src/main/java/org/dynaform/xml/form/FormElement.java // public interface FormElement<E> extends Form, Data<E>, Labeled { // // Data<E> getData(); // // Restrictions<E> getRestrictions(); // // String getLabel(); // void setLabel(String label); // // Control getControl(); // void setControl(Control control); // // boolean isReadOnly(); // void setReadOnly(boolean readOnly); // // boolean isRequired(); // void setRequired(boolean required); // // boolean isDisabled(); // void setDisabled(boolean disabled); // // // Listeners // // void addListener(ElementChangeListener<E> listener); // void removeListener(ElementChangeListener<E> listener); // // public interface ElementChangeListener<E> { // void onSetValue(FormElement<E> element); // void onSetLabel(FormElement<E> element); // void onSetControl(FormElement<E> element); // void onSetReadOnly(FormElement<E> element); // void onSetRequired(FormElement<E> element); // void onSetDisabled(FormElement<E> element); // } // // } // // Path: src/main/java/org/dynaform/xml/form/FormFunction.java // public interface FormFunction<T> { // // <E> T element(FormElement<E> element); // // <F extends Form> T section(FormSection<F> section); // // <F extends Form> T repeat(FormRepeat<F> sequence); // // T sequence(FormSequence composite); // // T choice(FormChoice choice); // // T all(FormAll all); // // } // // Path: src/main/java/org/dynaform/xml/form/FormVisitor.java // public interface FormVisitor { // // <E> void element(FormElement<E> element); // // <F extends Form> void section(FormSection<F> section); // // <F extends Form> void repeat(FormRepeat<F> sequence); // // void sequence(FormSequence composite); // // void choice(FormChoice choice); // // void all(FormAll all); // // } // // Path: src/main/java/org/dynaform/xml/form/impl/restriction/RestrictionsImpl.java // public class RestrictionsImpl<E> implements Restrictions<E> { // // private final List<Choice<E>> choices = new ArrayList<Choice<E>>(); // // private Integer length; // private Integer minLength; // private Integer maxLength; // // private E minInclusive; // private E minExclusive; // private E maxInclusive; // private E maxExclusive; // // public List<Choice<E>> getChoices() { // return choices; // } // // public Integer getLength() { // return length; // } // // public void setLength(Integer length) { // this.length = length; // } // // public Integer getMinLength() { // return minLength; // } // // public void setMinLength(Integer minLength) { // this.minLength = minLength; // } // // public Integer getMaxLength() { // return maxLength; // } // // public void setMaxLength(Integer maxLength) { // this.maxLength = maxLength; // } // // public E getMinInclusive() { // return minInclusive; // } // // public void setMinInclusive(E minInclusive) { // this.minInclusive = minInclusive; // } // // public E getMinExclusive() { // return minExclusive; // } // // public void setMinExclusive(E minExclusive) { // this.minExclusive = minExclusive; // } // // public E getMaxInclusive() { // return maxInclusive; // } // // public void setMaxInclusive(E maxInclusive) { // this.maxInclusive = maxInclusive; // } // // public E getMaxExclusive() { // return maxExclusive; // } // // public void setMaxExclusive(E maxExclusive) { // this.maxExclusive = maxExclusive; // } // // }
import org.dynaform.xml.form.FormElement; import org.dynaform.xml.form.FormFunction; import org.dynaform.xml.form.FormVisitor; import org.dynaform.xml.form.control.Control; import org.dynaform.xml.form.data.Data; import org.dynaform.xml.form.impl.restriction.RestrictionsImpl; import org.dynaform.xml.form.restriction.Restrictions; import java.util.ArrayList; import java.util.Collection;
public Class<F> getType() { return data.getType(); } public F getValue() { return data.getValue(); } public String getXmlValue() { return data.getXmlValue(); } public void setValue(F value) { if (readOnly) throw new UnsupportedOperationException("read only"); data.setValue(value); onSetValue(); } public void setXmlValue(String value) { data.setXmlValue(value); onSetValue(); } public void accept(FormVisitor visitor) { visitor.element(this); }
// Path: src/main/java/org/dynaform/xml/form/FormElement.java // public interface FormElement<E> extends Form, Data<E>, Labeled { // // Data<E> getData(); // // Restrictions<E> getRestrictions(); // // String getLabel(); // void setLabel(String label); // // Control getControl(); // void setControl(Control control); // // boolean isReadOnly(); // void setReadOnly(boolean readOnly); // // boolean isRequired(); // void setRequired(boolean required); // // boolean isDisabled(); // void setDisabled(boolean disabled); // // // Listeners // // void addListener(ElementChangeListener<E> listener); // void removeListener(ElementChangeListener<E> listener); // // public interface ElementChangeListener<E> { // void onSetValue(FormElement<E> element); // void onSetLabel(FormElement<E> element); // void onSetControl(FormElement<E> element); // void onSetReadOnly(FormElement<E> element); // void onSetRequired(FormElement<E> element); // void onSetDisabled(FormElement<E> element); // } // // } // // Path: src/main/java/org/dynaform/xml/form/FormFunction.java // public interface FormFunction<T> { // // <E> T element(FormElement<E> element); // // <F extends Form> T section(FormSection<F> section); // // <F extends Form> T repeat(FormRepeat<F> sequence); // // T sequence(FormSequence composite); // // T choice(FormChoice choice); // // T all(FormAll all); // // } // // Path: src/main/java/org/dynaform/xml/form/FormVisitor.java // public interface FormVisitor { // // <E> void element(FormElement<E> element); // // <F extends Form> void section(FormSection<F> section); // // <F extends Form> void repeat(FormRepeat<F> sequence); // // void sequence(FormSequence composite); // // void choice(FormChoice choice); // // void all(FormAll all); // // } // // Path: src/main/java/org/dynaform/xml/form/impl/restriction/RestrictionsImpl.java // public class RestrictionsImpl<E> implements Restrictions<E> { // // private final List<Choice<E>> choices = new ArrayList<Choice<E>>(); // // private Integer length; // private Integer minLength; // private Integer maxLength; // // private E minInclusive; // private E minExclusive; // private E maxInclusive; // private E maxExclusive; // // public List<Choice<E>> getChoices() { // return choices; // } // // public Integer getLength() { // return length; // } // // public void setLength(Integer length) { // this.length = length; // } // // public Integer getMinLength() { // return minLength; // } // // public void setMinLength(Integer minLength) { // this.minLength = minLength; // } // // public Integer getMaxLength() { // return maxLength; // } // // public void setMaxLength(Integer maxLength) { // this.maxLength = maxLength; // } // // public E getMinInclusive() { // return minInclusive; // } // // public void setMinInclusive(E minInclusive) { // this.minInclusive = minInclusive; // } // // public E getMinExclusive() { // return minExclusive; // } // // public void setMinExclusive(E minExclusive) { // this.minExclusive = minExclusive; // } // // public E getMaxInclusive() { // return maxInclusive; // } // // public void setMaxInclusive(E maxInclusive) { // this.maxInclusive = maxInclusive; // } // // public E getMaxExclusive() { // return maxExclusive; // } // // public void setMaxExclusive(E maxExclusive) { // this.maxExclusive = maxExclusive; // } // // } // Path: src/main/java/org/dynaform/xml/form/impl/FormElementImpl.java import org.dynaform.xml.form.FormElement; import org.dynaform.xml.form.FormFunction; import org.dynaform.xml.form.FormVisitor; import org.dynaform.xml.form.control.Control; import org.dynaform.xml.form.data.Data; import org.dynaform.xml.form.impl.restriction.RestrictionsImpl; import org.dynaform.xml.form.restriction.Restrictions; import java.util.ArrayList; import java.util.Collection; public Class<F> getType() { return data.getType(); } public F getValue() { return data.getValue(); } public String getXmlValue() { return data.getXmlValue(); } public void setValue(F value) { if (readOnly) throw new UnsupportedOperationException("read only"); data.setValue(value); onSetValue(); } public void setXmlValue(String value) { data.setXmlValue(value); onSetValue(); } public void accept(FormVisitor visitor) { visitor.element(this); }
public <T> T apply(FormFunction<T> function) {
reinra/dynaform
src/main/java/org/dynaform/xml/form/label/SequenceHeaderFactory.java
// Path: src/main/java/org/dynaform/xml/form/Form.java // public interface Form { // // String HL_CHILD = "/"; // String HL_DESCENDANT_OR_SELF = "//"; // String LL_CHILD = "!"; // String LL_DESCENDANT_OR_SELF = "!!"; // String INDEX_START = "["; // String INDEX_END = "]"; // String OPERATOR_SEQUENCE = "sequence"; // String OPERATOR_CHOICE = "choice"; // String OPERATOR_ALL = "all"; // // // Identity and parent // String getDescendantOrSelfSelector(); // "//element" // String getFullSelector(); // "/aa/bb/cc!selector[0]" // String getHighLevelFullSelectorForChildren(); // "/aa/bb/cc" // // String getHighLevelId(); // cc // String getLowLevelId(); // selector[0] // // Form getParent(); // void _setParent(Form parent); // // // Sequence // String nextCounterValue(); // // // Visitors // void accept(FormVisitor visitor); // <T> T apply(FormFunction<T> function); // // } // // Path: src/main/java/org/dynaform/xml/form/FormSection.java // public interface FormSection<F extends Form> extends Form, Labeled { // // String getLabel(); // void setLabel(String label); // // SectionStyle getSectionStyle(); // void setSectionStyle(SectionStyle orientation); // // F getContent(); // // // Listeners // // void addListener(SectionChangeListener<F> listener); // void removeListener(SectionChangeListener<F> listener); // // public interface SectionChangeListener<F extends Form> { // void onSetLabel(FormSection<F> section); // void onSetSectionStyle(FormSection<F> section); // } // // }
import org.dynaform.xml.form.Form; import org.dynaform.xml.form.FormRepeat; import org.dynaform.xml.form.FormSection; import org.dynaform.xml.form.FormSequence; import org.dynaform.xml.form.Labeled; import java.util.List; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory;
package org.dynaform.xml.form.label; public class SequenceHeaderFactory implements HeaderFactory { private static final Log log = LogFactory.getLog(SequenceHeaderFactory.class);
// Path: src/main/java/org/dynaform/xml/form/Form.java // public interface Form { // // String HL_CHILD = "/"; // String HL_DESCENDANT_OR_SELF = "//"; // String LL_CHILD = "!"; // String LL_DESCENDANT_OR_SELF = "!!"; // String INDEX_START = "["; // String INDEX_END = "]"; // String OPERATOR_SEQUENCE = "sequence"; // String OPERATOR_CHOICE = "choice"; // String OPERATOR_ALL = "all"; // // // Identity and parent // String getDescendantOrSelfSelector(); // "//element" // String getFullSelector(); // "/aa/bb/cc!selector[0]" // String getHighLevelFullSelectorForChildren(); // "/aa/bb/cc" // // String getHighLevelId(); // cc // String getLowLevelId(); // selector[0] // // Form getParent(); // void _setParent(Form parent); // // // Sequence // String nextCounterValue(); // // // Visitors // void accept(FormVisitor visitor); // <T> T apply(FormFunction<T> function); // // } // // Path: src/main/java/org/dynaform/xml/form/FormSection.java // public interface FormSection<F extends Form> extends Form, Labeled { // // String getLabel(); // void setLabel(String label); // // SectionStyle getSectionStyle(); // void setSectionStyle(SectionStyle orientation); // // F getContent(); // // // Listeners // // void addListener(SectionChangeListener<F> listener); // void removeListener(SectionChangeListener<F> listener); // // public interface SectionChangeListener<F extends Form> { // void onSetLabel(FormSection<F> section); // void onSetSectionStyle(FormSection<F> section); // } // // } // Path: src/main/java/org/dynaform/xml/form/label/SequenceHeaderFactory.java import org.dynaform.xml.form.Form; import org.dynaform.xml.form.FormRepeat; import org.dynaform.xml.form.FormSection; import org.dynaform.xml.form.FormSequence; import org.dynaform.xml.form.Labeled; import java.util.List; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; package org.dynaform.xml.form.label; public class SequenceHeaderFactory implements HeaderFactory { private static final Log log = LogFactory.getLog(SequenceHeaderFactory.class);
private final FormRepeat<Form> formRepeat;
reinra/dynaform
src/main/java/org/dynaform/xml/form/label/SequenceHeaderFactory.java
// Path: src/main/java/org/dynaform/xml/form/Form.java // public interface Form { // // String HL_CHILD = "/"; // String HL_DESCENDANT_OR_SELF = "//"; // String LL_CHILD = "!"; // String LL_DESCENDANT_OR_SELF = "!!"; // String INDEX_START = "["; // String INDEX_END = "]"; // String OPERATOR_SEQUENCE = "sequence"; // String OPERATOR_CHOICE = "choice"; // String OPERATOR_ALL = "all"; // // // Identity and parent // String getDescendantOrSelfSelector(); // "//element" // String getFullSelector(); // "/aa/bb/cc!selector[0]" // String getHighLevelFullSelectorForChildren(); // "/aa/bb/cc" // // String getHighLevelId(); // cc // String getLowLevelId(); // selector[0] // // Form getParent(); // void _setParent(Form parent); // // // Sequence // String nextCounterValue(); // // // Visitors // void accept(FormVisitor visitor); // <T> T apply(FormFunction<T> function); // // } // // Path: src/main/java/org/dynaform/xml/form/FormSection.java // public interface FormSection<F extends Form> extends Form, Labeled { // // String getLabel(); // void setLabel(String label); // // SectionStyle getSectionStyle(); // void setSectionStyle(SectionStyle orientation); // // F getContent(); // // // Listeners // // void addListener(SectionChangeListener<F> listener); // void removeListener(SectionChangeListener<F> listener); // // public interface SectionChangeListener<F extends Form> { // void onSetLabel(FormSection<F> section); // void onSetSectionStyle(FormSection<F> section); // } // // }
import org.dynaform.xml.form.Form; import org.dynaform.xml.form.FormRepeat; import org.dynaform.xml.form.FormSection; import org.dynaform.xml.form.FormSequence; import org.dynaform.xml.form.Labeled; import java.util.List; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory;
} finally { formRepeat.remove(child); } } public List<String> getSubHeaders() { List<Form> children = formRepeat.getChildren(); if (!children.isEmpty()) { Form child = children.get(0); return getSubHeaders(child); } Form child = formRepeat.add(); try { return getSubHeaders(child); } finally { formRepeat.remove(child); } } private String getHeader(Form child) { if (child instanceof Labeled) return ((Labeled) child).getLabel(); return null; } private List<String> getSubHeaders(Form child) {
// Path: src/main/java/org/dynaform/xml/form/Form.java // public interface Form { // // String HL_CHILD = "/"; // String HL_DESCENDANT_OR_SELF = "//"; // String LL_CHILD = "!"; // String LL_DESCENDANT_OR_SELF = "!!"; // String INDEX_START = "["; // String INDEX_END = "]"; // String OPERATOR_SEQUENCE = "sequence"; // String OPERATOR_CHOICE = "choice"; // String OPERATOR_ALL = "all"; // // // Identity and parent // String getDescendantOrSelfSelector(); // "//element" // String getFullSelector(); // "/aa/bb/cc!selector[0]" // String getHighLevelFullSelectorForChildren(); // "/aa/bb/cc" // // String getHighLevelId(); // cc // String getLowLevelId(); // selector[0] // // Form getParent(); // void _setParent(Form parent); // // // Sequence // String nextCounterValue(); // // // Visitors // void accept(FormVisitor visitor); // <T> T apply(FormFunction<T> function); // // } // // Path: src/main/java/org/dynaform/xml/form/FormSection.java // public interface FormSection<F extends Form> extends Form, Labeled { // // String getLabel(); // void setLabel(String label); // // SectionStyle getSectionStyle(); // void setSectionStyle(SectionStyle orientation); // // F getContent(); // // // Listeners // // void addListener(SectionChangeListener<F> listener); // void removeListener(SectionChangeListener<F> listener); // // public interface SectionChangeListener<F extends Form> { // void onSetLabel(FormSection<F> section); // void onSetSectionStyle(FormSection<F> section); // } // // } // Path: src/main/java/org/dynaform/xml/form/label/SequenceHeaderFactory.java import org.dynaform.xml.form.Form; import org.dynaform.xml.form.FormRepeat; import org.dynaform.xml.form.FormSection; import org.dynaform.xml.form.FormSequence; import org.dynaform.xml.form.Labeled; import java.util.List; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; } finally { formRepeat.remove(child); } } public List<String> getSubHeaders() { List<Form> children = formRepeat.getChildren(); if (!children.isEmpty()) { Form child = children.get(0); return getSubHeaders(child); } Form child = formRepeat.add(); try { return getSubHeaders(child); } finally { formRepeat.remove(child); } } private String getHeader(Form child) { if (child instanceof Labeled) return ((Labeled) child).getLabel(); return null; } private List<String> getSubHeaders(Form child) {
if (child instanceof FormSection) {
reinra/dynaform
src/main/java/org/dynaform/xml/XmlUtil.java
// Path: src/main/java/org/dynaform/xml/reader/InvalidXmlException.java // public class InvalidXmlException extends RuntimeException { // // private static final long serialVersionUID = 1L; // // public InvalidXmlException() { // super(); // } // // public InvalidXmlException(String message) { // super(message); // } // // } // // Path: src/main/java/org/dynaform/xml/reader/XmlReader.java // public interface XmlReader { // // /** // * Creates XML event handler for consuming the XML. // * // * @param next next XML reader. // * @return XML event handler. // */ // XmlVisitor create(XmlReader next); // // }
import org.dynaform.xml.reader.InvalidXmlException; import org.dynaform.xml.reader.XmlParser; import org.dynaform.xml.reader.XmlReader; import org.dynaform.xml.writer.PrettyXmlAppender; import org.dynaform.xml.writer.XmlAppender; import org.dynaform.xml.writer.XmlWriter; import java.io.ByteArrayInputStream; import java.io.InputStream; import javax.xml.parsers.SAXParser; import javax.xml.parsers.SAXParserFactory; import org.xml.sax.helpers.DefaultHandler;
package org.dynaform.xml; /** * @author Rein Raudjärv * * @see XmlVisitor * @see XmlParser * @see DefaultHandler */ public class XmlUtil { /** * Uses an XmlWriter to produce a pretty XML String. * * @param form an abstract form * @return an XML String. */ public static String writeXml(XmlWriter writer) { try { XmlVisitor xa = PrettyXmlAppender.newInstance(); writer.write(xa); return xa.toString(); } catch (Exception e) { throw new RuntimeException("Failed to produce XML String from XML writer '" + writer + "'", e); } } /** * Uses an XmlWriter to produce an XML String without additional whitespace. * * @param form an abstract form * @return an XML String. */ public static String writeCompactXml(XmlWriter writer) { try { XmlVisitor xa = XmlAppender.newInstance(); writer.write(xa); return xa.toString(); } catch (Exception e) { throw new RuntimeException("Failed to produce XML String from XML writer '" + writer + "'", e); } } /** * Parses XML String using the given {@link XmlReader}. * * @param xml XML String. * @param xv an XML reader. */
// Path: src/main/java/org/dynaform/xml/reader/InvalidXmlException.java // public class InvalidXmlException extends RuntimeException { // // private static final long serialVersionUID = 1L; // // public InvalidXmlException() { // super(); // } // // public InvalidXmlException(String message) { // super(message); // } // // } // // Path: src/main/java/org/dynaform/xml/reader/XmlReader.java // public interface XmlReader { // // /** // * Creates XML event handler for consuming the XML. // * // * @param next next XML reader. // * @return XML event handler. // */ // XmlVisitor create(XmlReader next); // // } // Path: src/main/java/org/dynaform/xml/XmlUtil.java import org.dynaform.xml.reader.InvalidXmlException; import org.dynaform.xml.reader.XmlParser; import org.dynaform.xml.reader.XmlReader; import org.dynaform.xml.writer.PrettyXmlAppender; import org.dynaform.xml.writer.XmlAppender; import org.dynaform.xml.writer.XmlWriter; import java.io.ByteArrayInputStream; import java.io.InputStream; import javax.xml.parsers.SAXParser; import javax.xml.parsers.SAXParserFactory; import org.xml.sax.helpers.DefaultHandler; package org.dynaform.xml; /** * @author Rein Raudjärv * * @see XmlVisitor * @see XmlParser * @see DefaultHandler */ public class XmlUtil { /** * Uses an XmlWriter to produce a pretty XML String. * * @param form an abstract form * @return an XML String. */ public static String writeXml(XmlWriter writer) { try { XmlVisitor xa = PrettyXmlAppender.newInstance(); writer.write(xa); return xa.toString(); } catch (Exception e) { throw new RuntimeException("Failed to produce XML String from XML writer '" + writer + "'", e); } } /** * Uses an XmlWriter to produce an XML String without additional whitespace. * * @param form an abstract form * @return an XML String. */ public static String writeCompactXml(XmlWriter writer) { try { XmlVisitor xa = XmlAppender.newInstance(); writer.write(xa); return xa.toString(); } catch (Exception e) { throw new RuntimeException("Failed to produce XML String from XML writer '" + writer + "'", e); } } /** * Parses XML String using the given {@link XmlReader}. * * @param xml XML String. * @param xv an XML reader. */
public static void readXml(String xml, XmlReader xr) {
reinra/dynaform
src/main/java/org/dynaform/xml/XmlUtil.java
// Path: src/main/java/org/dynaform/xml/reader/InvalidXmlException.java // public class InvalidXmlException extends RuntimeException { // // private static final long serialVersionUID = 1L; // // public InvalidXmlException() { // super(); // } // // public InvalidXmlException(String message) { // super(message); // } // // } // // Path: src/main/java/org/dynaform/xml/reader/XmlReader.java // public interface XmlReader { // // /** // * Creates XML event handler for consuming the XML. // * // * @param next next XML reader. // * @return XML event handler. // */ // XmlVisitor create(XmlReader next); // // }
import org.dynaform.xml.reader.InvalidXmlException; import org.dynaform.xml.reader.XmlParser; import org.dynaform.xml.reader.XmlReader; import org.dynaform.xml.writer.PrettyXmlAppender; import org.dynaform.xml.writer.XmlAppender; import org.dynaform.xml.writer.XmlWriter; import java.io.ByteArrayInputStream; import java.io.InputStream; import javax.xml.parsers.SAXParser; import javax.xml.parsers.SAXParserFactory; import org.xml.sax.helpers.DefaultHandler;
package org.dynaform.xml; /** * @author Rein Raudjärv * * @see XmlVisitor * @see XmlParser * @see DefaultHandler */ public class XmlUtil { /** * Uses an XmlWriter to produce a pretty XML String. * * @param form an abstract form * @return an XML String. */ public static String writeXml(XmlWriter writer) { try { XmlVisitor xa = PrettyXmlAppender.newInstance(); writer.write(xa); return xa.toString(); } catch (Exception e) { throw new RuntimeException("Failed to produce XML String from XML writer '" + writer + "'", e); } } /** * Uses an XmlWriter to produce an XML String without additional whitespace. * * @param form an abstract form * @return an XML String. */ public static String writeCompactXml(XmlWriter writer) { try { XmlVisitor xa = XmlAppender.newInstance(); writer.write(xa); return xa.toString(); } catch (Exception e) { throw new RuntimeException("Failed to produce XML String from XML writer '" + writer + "'", e); } } /** * Parses XML String using the given {@link XmlReader}. * * @param xml XML String. * @param xv an XML reader. */ public static void readXml(String xml, XmlReader xr) { try { readXml(xml, xr.create(null));
// Path: src/main/java/org/dynaform/xml/reader/InvalidXmlException.java // public class InvalidXmlException extends RuntimeException { // // private static final long serialVersionUID = 1L; // // public InvalidXmlException() { // super(); // } // // public InvalidXmlException(String message) { // super(message); // } // // } // // Path: src/main/java/org/dynaform/xml/reader/XmlReader.java // public interface XmlReader { // // /** // * Creates XML event handler for consuming the XML. // * // * @param next next XML reader. // * @return XML event handler. // */ // XmlVisitor create(XmlReader next); // // } // Path: src/main/java/org/dynaform/xml/XmlUtil.java import org.dynaform.xml.reader.InvalidXmlException; import org.dynaform.xml.reader.XmlParser; import org.dynaform.xml.reader.XmlReader; import org.dynaform.xml.writer.PrettyXmlAppender; import org.dynaform.xml.writer.XmlAppender; import org.dynaform.xml.writer.XmlWriter; import java.io.ByteArrayInputStream; import java.io.InputStream; import javax.xml.parsers.SAXParser; import javax.xml.parsers.SAXParserFactory; import org.xml.sax.helpers.DefaultHandler; package org.dynaform.xml; /** * @author Rein Raudjärv * * @see XmlVisitor * @see XmlParser * @see DefaultHandler */ public class XmlUtil { /** * Uses an XmlWriter to produce a pretty XML String. * * @param form an abstract form * @return an XML String. */ public static String writeXml(XmlWriter writer) { try { XmlVisitor xa = PrettyXmlAppender.newInstance(); writer.write(xa); return xa.toString(); } catch (Exception e) { throw new RuntimeException("Failed to produce XML String from XML writer '" + writer + "'", e); } } /** * Uses an XmlWriter to produce an XML String without additional whitespace. * * @param form an abstract form * @return an XML String. */ public static String writeCompactXml(XmlWriter writer) { try { XmlVisitor xa = XmlAppender.newInstance(); writer.write(xa); return xa.toString(); } catch (Exception e) { throw new RuntimeException("Failed to produce XML String from XML writer '" + writer + "'", e); } } /** * Parses XML String using the given {@link XmlReader}. * * @param xml XML String. * @param xv an XML reader. */ public static void readXml(String xml, XmlReader xr) { try { readXml(xml, xr.create(null));
} catch (InvalidXmlException e) {
reinra/dynaform
src/main/java/org/dynaform/xml/XmlFormImpl.java
// Path: src/main/java/org/dynaform/xml/form/Form.java // public interface Form { // // String HL_CHILD = "/"; // String HL_DESCENDANT_OR_SELF = "//"; // String LL_CHILD = "!"; // String LL_DESCENDANT_OR_SELF = "!!"; // String INDEX_START = "["; // String INDEX_END = "]"; // String OPERATOR_SEQUENCE = "sequence"; // String OPERATOR_CHOICE = "choice"; // String OPERATOR_ALL = "all"; // // // Identity and parent // String getDescendantOrSelfSelector(); // "//element" // String getFullSelector(); // "/aa/bb/cc!selector[0]" // String getHighLevelFullSelectorForChildren(); // "/aa/bb/cc" // // String getHighLevelId(); // cc // String getLowLevelId(); // selector[0] // // Form getParent(); // void _setParent(Form parent); // // // Sequence // String nextCounterValue(); // // // Visitors // void accept(FormVisitor visitor); // <T> T apply(FormFunction<T> function); // // } // // Path: src/main/java/org/dynaform/xml/reader/XmlReader.java // public interface XmlReader { // // /** // * Creates XML event handler for consuming the XML. // * // * @param next next XML reader. // * @return XML event handler. // */ // XmlVisitor create(XmlReader next); // // }
import org.dynaform.xml.form.Form; import org.dynaform.xml.reader.XmlReader; import org.dynaform.xml.writer.XmlWriter;
package org.dynaform.xml; public class XmlFormImpl implements XmlForm { private final Form form; private final XmlWriter writer;
// Path: src/main/java/org/dynaform/xml/form/Form.java // public interface Form { // // String HL_CHILD = "/"; // String HL_DESCENDANT_OR_SELF = "//"; // String LL_CHILD = "!"; // String LL_DESCENDANT_OR_SELF = "!!"; // String INDEX_START = "["; // String INDEX_END = "]"; // String OPERATOR_SEQUENCE = "sequence"; // String OPERATOR_CHOICE = "choice"; // String OPERATOR_ALL = "all"; // // // Identity and parent // String getDescendantOrSelfSelector(); // "//element" // String getFullSelector(); // "/aa/bb/cc!selector[0]" // String getHighLevelFullSelectorForChildren(); // "/aa/bb/cc" // // String getHighLevelId(); // cc // String getLowLevelId(); // selector[0] // // Form getParent(); // void _setParent(Form parent); // // // Sequence // String nextCounterValue(); // // // Visitors // void accept(FormVisitor visitor); // <T> T apply(FormFunction<T> function); // // } // // Path: src/main/java/org/dynaform/xml/reader/XmlReader.java // public interface XmlReader { // // /** // * Creates XML event handler for consuming the XML. // * // * @param next next XML reader. // * @return XML event handler. // */ // XmlVisitor create(XmlReader next); // // } // Path: src/main/java/org/dynaform/xml/XmlFormImpl.java import org.dynaform.xml.form.Form; import org.dynaform.xml.reader.XmlReader; import org.dynaform.xml.writer.XmlWriter; package org.dynaform.xml; public class XmlFormImpl implements XmlForm { private final Form form; private final XmlWriter writer;
private final XmlReader reader;
bazaarvoice/ostrich
core/src/main/java/com/bazaarvoice/ostrich/pool/AsyncServicePool.java
// Path: core/src/main/java/com/bazaarvoice/ostrich/PartitionContext.java // public interface PartitionContext { // /** // * Gets the default piece of context. In many cases, there is only a single piece of relevant context, which this // * method should provide. // * // * @return The default context data. // */ // Object get(); // // /** // * Gets the context for the specified key. // * @param key The key for the desired context data. // * @return The context data. // */ // Object get(String key); // // /** // * Gets a {@code Map} version of the context. The Map should be immutable. // * @return A {@code Map} with the same key/value pairs as this context. // */ // Map<String, Object> asMap(); // } // // Path: core/src/main/java/com/bazaarvoice/ostrich/exceptions/NoAvailableHostsException.java // public class NoAvailableHostsException extends DiscoveryException { // private static final long serialVersionUID = 0; // // public NoAvailableHostsException() { // super(); // } // // public NoAvailableHostsException(String message) { // super(message); // } // // public NoAvailableHostsException(String message, Throwable cause) { // super(message, cause); // } // // public NoAvailableHostsException(Throwable cause) { // super(cause); // } // }
import com.bazaarvoice.ostrich.PartitionContext; import com.bazaarvoice.ostrich.RetryPolicy; import com.bazaarvoice.ostrich.ServiceCallback; import com.bazaarvoice.ostrich.ServiceEndPoint; import com.bazaarvoice.ostrich.ServiceEndPointPredicate; import com.bazaarvoice.ostrich.exceptions.MaxRetriesException; import com.bazaarvoice.ostrich.exceptions.NoAvailableHostsException; import com.bazaarvoice.ostrich.metrics.Metrics; import com.codahale.metrics.Histogram; import com.codahale.metrics.Meter; import com.codahale.metrics.MetricRegistry; import com.codahale.metrics.Timer; import com.google.common.base.Ticker; import com.google.common.collect.Iterables; import com.google.common.collect.Lists; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.io.IOException; import java.util.Collection; import java.util.concurrent.Callable; import java.util.concurrent.ExecutorService; import java.util.concurrent.Future; import java.util.concurrent.TimeUnit; import static com.google.common.base.Preconditions.checkNotNull;
_executionTime = _metrics.timer("execution-time"); _numExecuteSuccesses = _metrics.meter("num-execute-successes"); _numExecuteFailures = _metrics.meter("num-execute-failures"); _executeBatchSize = _metrics.histogram("execute-batch-size"); } @Override public void close() throws IOException { if (_shutdownExecutorOnClose) { _executor.shutdown(); } if (_shutdownPoolOnClose) { _pool.close(); } _metrics.close(); } @Override public <R> Future<R> execute(final RetryPolicy retryPolicy, final ServiceCallback<S, R> callback) { return _executor.submit(new Callable<R>() { @Override public R call() throws Exception { return _pool.execute(retryPolicy, callback); } }); } @Override
// Path: core/src/main/java/com/bazaarvoice/ostrich/PartitionContext.java // public interface PartitionContext { // /** // * Gets the default piece of context. In many cases, there is only a single piece of relevant context, which this // * method should provide. // * // * @return The default context data. // */ // Object get(); // // /** // * Gets the context for the specified key. // * @param key The key for the desired context data. // * @return The context data. // */ // Object get(String key); // // /** // * Gets a {@code Map} version of the context. The Map should be immutable. // * @return A {@code Map} with the same key/value pairs as this context. // */ // Map<String, Object> asMap(); // } // // Path: core/src/main/java/com/bazaarvoice/ostrich/exceptions/NoAvailableHostsException.java // public class NoAvailableHostsException extends DiscoveryException { // private static final long serialVersionUID = 0; // // public NoAvailableHostsException() { // super(); // } // // public NoAvailableHostsException(String message) { // super(message); // } // // public NoAvailableHostsException(String message, Throwable cause) { // super(message, cause); // } // // public NoAvailableHostsException(Throwable cause) { // super(cause); // } // } // Path: core/src/main/java/com/bazaarvoice/ostrich/pool/AsyncServicePool.java import com.bazaarvoice.ostrich.PartitionContext; import com.bazaarvoice.ostrich.RetryPolicy; import com.bazaarvoice.ostrich.ServiceCallback; import com.bazaarvoice.ostrich.ServiceEndPoint; import com.bazaarvoice.ostrich.ServiceEndPointPredicate; import com.bazaarvoice.ostrich.exceptions.MaxRetriesException; import com.bazaarvoice.ostrich.exceptions.NoAvailableHostsException; import com.bazaarvoice.ostrich.metrics.Metrics; import com.codahale.metrics.Histogram; import com.codahale.metrics.Meter; import com.codahale.metrics.MetricRegistry; import com.codahale.metrics.Timer; import com.google.common.base.Ticker; import com.google.common.collect.Iterables; import com.google.common.collect.Lists; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.io.IOException; import java.util.Collection; import java.util.concurrent.Callable; import java.util.concurrent.ExecutorService; import java.util.concurrent.Future; import java.util.concurrent.TimeUnit; import static com.google.common.base.Preconditions.checkNotNull; _executionTime = _metrics.timer("execution-time"); _numExecuteSuccesses = _metrics.meter("num-execute-successes"); _numExecuteFailures = _metrics.meter("num-execute-failures"); _executeBatchSize = _metrics.histogram("execute-batch-size"); } @Override public void close() throws IOException { if (_shutdownExecutorOnClose) { _executor.shutdown(); } if (_shutdownPoolOnClose) { _pool.close(); } _metrics.close(); } @Override public <R> Future<R> execute(final RetryPolicy retryPolicy, final ServiceCallback<S, R> callback) { return _executor.submit(new Callable<R>() { @Override public R call() throws Exception { return _pool.execute(retryPolicy, callback); } }); } @Override
public <R> Future<R> execute(final PartitionContext partitionContext, final RetryPolicy retryPolicy,
bazaarvoice/ostrich
core/src/main/java/com/bazaarvoice/ostrich/pool/AsyncServicePool.java
// Path: core/src/main/java/com/bazaarvoice/ostrich/PartitionContext.java // public interface PartitionContext { // /** // * Gets the default piece of context. In many cases, there is only a single piece of relevant context, which this // * method should provide. // * // * @return The default context data. // */ // Object get(); // // /** // * Gets the context for the specified key. // * @param key The key for the desired context data. // * @return The context data. // */ // Object get(String key); // // /** // * Gets a {@code Map} version of the context. The Map should be immutable. // * @return A {@code Map} with the same key/value pairs as this context. // */ // Map<String, Object> asMap(); // } // // Path: core/src/main/java/com/bazaarvoice/ostrich/exceptions/NoAvailableHostsException.java // public class NoAvailableHostsException extends DiscoveryException { // private static final long serialVersionUID = 0; // // public NoAvailableHostsException() { // super(); // } // // public NoAvailableHostsException(String message) { // super(message); // } // // public NoAvailableHostsException(String message, Throwable cause) { // super(message, cause); // } // // public NoAvailableHostsException(Throwable cause) { // super(cause); // } // }
import com.bazaarvoice.ostrich.PartitionContext; import com.bazaarvoice.ostrich.RetryPolicy; import com.bazaarvoice.ostrich.ServiceCallback; import com.bazaarvoice.ostrich.ServiceEndPoint; import com.bazaarvoice.ostrich.ServiceEndPointPredicate; import com.bazaarvoice.ostrich.exceptions.MaxRetriesException; import com.bazaarvoice.ostrich.exceptions.NoAvailableHostsException; import com.bazaarvoice.ostrich.metrics.Metrics; import com.codahale.metrics.Histogram; import com.codahale.metrics.Meter; import com.codahale.metrics.MetricRegistry; import com.codahale.metrics.Timer; import com.google.common.base.Ticker; import com.google.common.collect.Iterables; import com.google.common.collect.Lists; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.io.IOException; import java.util.Collection; import java.util.concurrent.Callable; import java.util.concurrent.ExecutorService; import java.util.concurrent.Future; import java.util.concurrent.TimeUnit; import static com.google.common.base.Preconditions.checkNotNull;
@Override public R call() throws Exception { return _pool.execute(retryPolicy, callback); } }); } @Override public <R> Future<R> execute(final PartitionContext partitionContext, final RetryPolicy retryPolicy, final ServiceCallback<S, R> callback) { return _executor.submit(new Callable<R>() { @Override public R call() throws Exception { return _pool.execute(partitionContext, retryPolicy, callback); } }); } @Override public <R> Collection<Future<R>> executeOnAll(RetryPolicy retry, ServiceCallback<S, R> callback) { return executeOn(ALL_END_POINTS, retry, callback); } @Override public <R> Collection<Future<R>> executeOn(ServiceEndPointPredicate predicate, final RetryPolicy retry, final ServiceCallback<S, R> callback) { Collection<Future<R>> futures = Lists.newArrayList(); Iterable<ServiceEndPoint> endPoints = _pool.getAllEndPoints(); if (Iterables.isEmpty(endPoints)) {
// Path: core/src/main/java/com/bazaarvoice/ostrich/PartitionContext.java // public interface PartitionContext { // /** // * Gets the default piece of context. In many cases, there is only a single piece of relevant context, which this // * method should provide. // * // * @return The default context data. // */ // Object get(); // // /** // * Gets the context for the specified key. // * @param key The key for the desired context data. // * @return The context data. // */ // Object get(String key); // // /** // * Gets a {@code Map} version of the context. The Map should be immutable. // * @return A {@code Map} with the same key/value pairs as this context. // */ // Map<String, Object> asMap(); // } // // Path: core/src/main/java/com/bazaarvoice/ostrich/exceptions/NoAvailableHostsException.java // public class NoAvailableHostsException extends DiscoveryException { // private static final long serialVersionUID = 0; // // public NoAvailableHostsException() { // super(); // } // // public NoAvailableHostsException(String message) { // super(message); // } // // public NoAvailableHostsException(String message, Throwable cause) { // super(message, cause); // } // // public NoAvailableHostsException(Throwable cause) { // super(cause); // } // } // Path: core/src/main/java/com/bazaarvoice/ostrich/pool/AsyncServicePool.java import com.bazaarvoice.ostrich.PartitionContext; import com.bazaarvoice.ostrich.RetryPolicy; import com.bazaarvoice.ostrich.ServiceCallback; import com.bazaarvoice.ostrich.ServiceEndPoint; import com.bazaarvoice.ostrich.ServiceEndPointPredicate; import com.bazaarvoice.ostrich.exceptions.MaxRetriesException; import com.bazaarvoice.ostrich.exceptions.NoAvailableHostsException; import com.bazaarvoice.ostrich.metrics.Metrics; import com.codahale.metrics.Histogram; import com.codahale.metrics.Meter; import com.codahale.metrics.MetricRegistry; import com.codahale.metrics.Timer; import com.google.common.base.Ticker; import com.google.common.collect.Iterables; import com.google.common.collect.Lists; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.io.IOException; import java.util.Collection; import java.util.concurrent.Callable; import java.util.concurrent.ExecutorService; import java.util.concurrent.Future; import java.util.concurrent.TimeUnit; import static com.google.common.base.Preconditions.checkNotNull; @Override public R call() throws Exception { return _pool.execute(retryPolicy, callback); } }); } @Override public <R> Future<R> execute(final PartitionContext partitionContext, final RetryPolicy retryPolicy, final ServiceCallback<S, R> callback) { return _executor.submit(new Callable<R>() { @Override public R call() throws Exception { return _pool.execute(partitionContext, retryPolicy, callback); } }); } @Override public <R> Collection<Future<R>> executeOnAll(RetryPolicy retry, ServiceCallback<S, R> callback) { return executeOn(ALL_END_POINTS, retry, callback); } @Override public <R> Collection<Future<R>> executeOn(ServiceEndPointPredicate predicate, final RetryPolicy retry, final ServiceCallback<S, R> callback) { Collection<Future<R>> futures = Lists.newArrayList(); Iterable<ServiceEndPoint> endPoints = _pool.getAllEndPoints(); if (Iterables.isEmpty(endPoints)) {
throw new NoAvailableHostsException(String.format("No hosts discovered for service %s", _pool.getServiceName()));
bazaarvoice/ostrich
core/src/main/java/com/bazaarvoice/ostrich/pool/AnnotationPartitionContextSupplier.java
// Path: core/src/main/java/com/bazaarvoice/ostrich/PartitionContext.java // public interface PartitionContext { // /** // * Gets the default piece of context. In many cases, there is only a single piece of relevant context, which this // * method should provide. // * // * @return The default context data. // */ // Object get(); // // /** // * Gets the context for the specified key. // * @param key The key for the desired context data. // * @return The context data. // */ // Object get(String key); // // /** // * Gets a {@code Map} version of the context. The Map should be immutable. // * @return A {@code Map} with the same key/value pairs as this context. // */ // Map<String, Object> asMap(); // } // // Path: core/src/main/java/com/bazaarvoice/ostrich/PartitionContextBuilder.java // public final class PartitionContextBuilder { // private static final PartitionContext EMPTY = new Context(ImmutableMap.<String, Object>of()); // // private final ImmutableMap.Builder<String, Object> _map = ImmutableMap.builder(); // // public static PartitionContext empty() { // return EMPTY; // } // // public static PartitionContext of(Object obj) { // return new Context(ImmutableMap.of("", obj)); // } // // public static PartitionContext of(String key, Object value) { // return new Context(ImmutableMap.of(key, value)); // } // // public static PartitionContext of(String key1, Object value1, String key2, Object value2) { // return new Context(ImmutableMap.of(key1, value1, key2, value2)); // } // // /** // * Adds the specified key and value to the partition context. Null keys or values and duplicate keys are not // * allowed. // * // * @return this // */ // public PartitionContextBuilder put(String key, Object value) { // _map.put(key, value); // return this; // } // // /** // * Adds the specified keys and values to the partition context. Null keys or values and duplicate keys are not // * allowed. // * // * @return this // */ // public PartitionContextBuilder putAll(Map<String, ?> map) { // _map.putAll(map); // return this; // } // // /** // * Returns a newly-create immutable {@code PartitionContext}. // */ // public PartitionContext build() { // return new Context(_map.build()); // } // // private static class Context implements PartitionContext { // private final ImmutableMap<String, Object> _map; // // private Context(ImmutableMap<String, Object> map) { // _map = checkNotNull(map); // } // // @Override // public Object get() { // return _map.get(""); // } // // @Override // public Object get(String key) { // return _map.get(key); // } // // @Override // public Map<String, Object> asMap() { // return _map; // } // // @Override // public boolean equals(Object o) { // return this == o || (o instanceof Context && _map.equals(((Context) o)._map)); // } // // @Override // public int hashCode() { // return 95261 + _map.hashCode(); // } // } // }
import com.bazaarvoice.ostrich.PartitionContext; import com.bazaarvoice.ostrich.PartitionContextBuilder; import com.bazaarvoice.ostrich.partition.PartitionKey; import com.google.common.collect.ImmutableMap; import com.google.common.collect.Maps; import java.lang.annotation.Annotation; import java.lang.reflect.Method; import java.lang.reflect.Modifier; import java.util.Map; import static com.google.common.base.Preconditions.checkArgument; import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Preconditions.checkState;
package com.bazaarvoice.ostrich.pool; /** * Builds {@link PartitionContext} objects for service pool calls based on {@link PartitionKey} annotations. This is * designed for use by the {@link ServicePoolProxy} if/when the proxy invocation handler can determine the partition * context from method arguments. */ class AnnotationPartitionContextSupplier implements PartitionContextSupplier { private final Map<Method, String[]> _keyMappings; /** * Introspects the specified service interface and client implementation class, looking for {@link PartitionKey} * annotations on the implementation class. * <p> * At runtime the {@code Method} passed to the {@link #forCall(java.lang.reflect.Method, Object[])} method is * expected to belong to the interface class. But the interface shouldn't have {@link PartitionKey} annotations * since that's an implementation concern. As a result, this constructor expects the annotations to be found on the * implementation class. */ <S> AnnotationPartitionContextSupplier(Class<S> ifc, Class<? extends S> impl) { checkArgument(ifc.isAssignableFrom(impl)); ImmutableMap.Builder<Method, String[]> builder = ImmutableMap.builder(); for (Method ifcMethod : ifc.getMethods()) { if (Modifier.isStatic(ifcMethod.getModifiers())) { continue; // Static methods of ifc aren't members of impl. } Method implMethod; try { implMethod = impl.getMethod(ifcMethod.getName(), ifcMethod.getParameterTypes()); } catch (NoSuchMethodException e) { throw new RuntimeException(e); // Should never happen if impl implements ifc. } String[] keyMappings = collectPartitionKeyAnnotations(implMethod); if (keyMappings == null) { continue; // Not annotated } // Index by the ifcMethod because that's the method provided when a dynamic proxy method is invoked. builder.put(ifcMethod, keyMappings); } _keyMappings = builder.build(); } @Override
// Path: core/src/main/java/com/bazaarvoice/ostrich/PartitionContext.java // public interface PartitionContext { // /** // * Gets the default piece of context. In many cases, there is only a single piece of relevant context, which this // * method should provide. // * // * @return The default context data. // */ // Object get(); // // /** // * Gets the context for the specified key. // * @param key The key for the desired context data. // * @return The context data. // */ // Object get(String key); // // /** // * Gets a {@code Map} version of the context. The Map should be immutable. // * @return A {@code Map} with the same key/value pairs as this context. // */ // Map<String, Object> asMap(); // } // // Path: core/src/main/java/com/bazaarvoice/ostrich/PartitionContextBuilder.java // public final class PartitionContextBuilder { // private static final PartitionContext EMPTY = new Context(ImmutableMap.<String, Object>of()); // // private final ImmutableMap.Builder<String, Object> _map = ImmutableMap.builder(); // // public static PartitionContext empty() { // return EMPTY; // } // // public static PartitionContext of(Object obj) { // return new Context(ImmutableMap.of("", obj)); // } // // public static PartitionContext of(String key, Object value) { // return new Context(ImmutableMap.of(key, value)); // } // // public static PartitionContext of(String key1, Object value1, String key2, Object value2) { // return new Context(ImmutableMap.of(key1, value1, key2, value2)); // } // // /** // * Adds the specified key and value to the partition context. Null keys or values and duplicate keys are not // * allowed. // * // * @return this // */ // public PartitionContextBuilder put(String key, Object value) { // _map.put(key, value); // return this; // } // // /** // * Adds the specified keys and values to the partition context. Null keys or values and duplicate keys are not // * allowed. // * // * @return this // */ // public PartitionContextBuilder putAll(Map<String, ?> map) { // _map.putAll(map); // return this; // } // // /** // * Returns a newly-create immutable {@code PartitionContext}. // */ // public PartitionContext build() { // return new Context(_map.build()); // } // // private static class Context implements PartitionContext { // private final ImmutableMap<String, Object> _map; // // private Context(ImmutableMap<String, Object> map) { // _map = checkNotNull(map); // } // // @Override // public Object get() { // return _map.get(""); // } // // @Override // public Object get(String key) { // return _map.get(key); // } // // @Override // public Map<String, Object> asMap() { // return _map; // } // // @Override // public boolean equals(Object o) { // return this == o || (o instanceof Context && _map.equals(((Context) o)._map)); // } // // @Override // public int hashCode() { // return 95261 + _map.hashCode(); // } // } // } // Path: core/src/main/java/com/bazaarvoice/ostrich/pool/AnnotationPartitionContextSupplier.java import com.bazaarvoice.ostrich.PartitionContext; import com.bazaarvoice.ostrich.PartitionContextBuilder; import com.bazaarvoice.ostrich.partition.PartitionKey; import com.google.common.collect.ImmutableMap; import com.google.common.collect.Maps; import java.lang.annotation.Annotation; import java.lang.reflect.Method; import java.lang.reflect.Modifier; import java.util.Map; import static com.google.common.base.Preconditions.checkArgument; import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Preconditions.checkState; package com.bazaarvoice.ostrich.pool; /** * Builds {@link PartitionContext} objects for service pool calls based on {@link PartitionKey} annotations. This is * designed for use by the {@link ServicePoolProxy} if/when the proxy invocation handler can determine the partition * context from method arguments. */ class AnnotationPartitionContextSupplier implements PartitionContextSupplier { private final Map<Method, String[]> _keyMappings; /** * Introspects the specified service interface and client implementation class, looking for {@link PartitionKey} * annotations on the implementation class. * <p> * At runtime the {@code Method} passed to the {@link #forCall(java.lang.reflect.Method, Object[])} method is * expected to belong to the interface class. But the interface shouldn't have {@link PartitionKey} annotations * since that's an implementation concern. As a result, this constructor expects the annotations to be found on the * implementation class. */ <S> AnnotationPartitionContextSupplier(Class<S> ifc, Class<? extends S> impl) { checkArgument(ifc.isAssignableFrom(impl)); ImmutableMap.Builder<Method, String[]> builder = ImmutableMap.builder(); for (Method ifcMethod : ifc.getMethods()) { if (Modifier.isStatic(ifcMethod.getModifiers())) { continue; // Static methods of ifc aren't members of impl. } Method implMethod; try { implMethod = impl.getMethod(ifcMethod.getName(), ifcMethod.getParameterTypes()); } catch (NoSuchMethodException e) { throw new RuntimeException(e); // Should never happen if impl implements ifc. } String[] keyMappings = collectPartitionKeyAnnotations(implMethod); if (keyMappings == null) { continue; // Not annotated } // Index by the ifcMethod because that's the method provided when a dynamic proxy method is invoked. builder.put(ifcMethod, keyMappings); } _keyMappings = builder.build(); } @Override
public PartitionContext forCall(Method method, Object... args) {
bazaarvoice/ostrich
core/src/main/java/com/bazaarvoice/ostrich/pool/AnnotationPartitionContextSupplier.java
// Path: core/src/main/java/com/bazaarvoice/ostrich/PartitionContext.java // public interface PartitionContext { // /** // * Gets the default piece of context. In many cases, there is only a single piece of relevant context, which this // * method should provide. // * // * @return The default context data. // */ // Object get(); // // /** // * Gets the context for the specified key. // * @param key The key for the desired context data. // * @return The context data. // */ // Object get(String key); // // /** // * Gets a {@code Map} version of the context. The Map should be immutable. // * @return A {@code Map} with the same key/value pairs as this context. // */ // Map<String, Object> asMap(); // } // // Path: core/src/main/java/com/bazaarvoice/ostrich/PartitionContextBuilder.java // public final class PartitionContextBuilder { // private static final PartitionContext EMPTY = new Context(ImmutableMap.<String, Object>of()); // // private final ImmutableMap.Builder<String, Object> _map = ImmutableMap.builder(); // // public static PartitionContext empty() { // return EMPTY; // } // // public static PartitionContext of(Object obj) { // return new Context(ImmutableMap.of("", obj)); // } // // public static PartitionContext of(String key, Object value) { // return new Context(ImmutableMap.of(key, value)); // } // // public static PartitionContext of(String key1, Object value1, String key2, Object value2) { // return new Context(ImmutableMap.of(key1, value1, key2, value2)); // } // // /** // * Adds the specified key and value to the partition context. Null keys or values and duplicate keys are not // * allowed. // * // * @return this // */ // public PartitionContextBuilder put(String key, Object value) { // _map.put(key, value); // return this; // } // // /** // * Adds the specified keys and values to the partition context. Null keys or values and duplicate keys are not // * allowed. // * // * @return this // */ // public PartitionContextBuilder putAll(Map<String, ?> map) { // _map.putAll(map); // return this; // } // // /** // * Returns a newly-create immutable {@code PartitionContext}. // */ // public PartitionContext build() { // return new Context(_map.build()); // } // // private static class Context implements PartitionContext { // private final ImmutableMap<String, Object> _map; // // private Context(ImmutableMap<String, Object> map) { // _map = checkNotNull(map); // } // // @Override // public Object get() { // return _map.get(""); // } // // @Override // public Object get(String key) { // return _map.get(key); // } // // @Override // public Map<String, Object> asMap() { // return _map; // } // // @Override // public boolean equals(Object o) { // return this == o || (o instanceof Context && _map.equals(((Context) o)._map)); // } // // @Override // public int hashCode() { // return 95261 + _map.hashCode(); // } // } // }
import com.bazaarvoice.ostrich.PartitionContext; import com.bazaarvoice.ostrich.PartitionContextBuilder; import com.bazaarvoice.ostrich.partition.PartitionKey; import com.google.common.collect.ImmutableMap; import com.google.common.collect.Maps; import java.lang.annotation.Annotation; import java.lang.reflect.Method; import java.lang.reflect.Modifier; import java.util.Map; import static com.google.common.base.Preconditions.checkArgument; import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Preconditions.checkState;
package com.bazaarvoice.ostrich.pool; /** * Builds {@link PartitionContext} objects for service pool calls based on {@link PartitionKey} annotations. This is * designed for use by the {@link ServicePoolProxy} if/when the proxy invocation handler can determine the partition * context from method arguments. */ class AnnotationPartitionContextSupplier implements PartitionContextSupplier { private final Map<Method, String[]> _keyMappings; /** * Introspects the specified service interface and client implementation class, looking for {@link PartitionKey} * annotations on the implementation class. * <p> * At runtime the {@code Method} passed to the {@link #forCall(java.lang.reflect.Method, Object[])} method is * expected to belong to the interface class. But the interface shouldn't have {@link PartitionKey} annotations * since that's an implementation concern. As a result, this constructor expects the annotations to be found on the * implementation class. */ <S> AnnotationPartitionContextSupplier(Class<S> ifc, Class<? extends S> impl) { checkArgument(ifc.isAssignableFrom(impl)); ImmutableMap.Builder<Method, String[]> builder = ImmutableMap.builder(); for (Method ifcMethod : ifc.getMethods()) { if (Modifier.isStatic(ifcMethod.getModifiers())) { continue; // Static methods of ifc aren't members of impl. } Method implMethod; try { implMethod = impl.getMethod(ifcMethod.getName(), ifcMethod.getParameterTypes()); } catch (NoSuchMethodException e) { throw new RuntimeException(e); // Should never happen if impl implements ifc. } String[] keyMappings = collectPartitionKeyAnnotations(implMethod); if (keyMappings == null) { continue; // Not annotated } // Index by the ifcMethod because that's the method provided when a dynamic proxy method is invoked. builder.put(ifcMethod, keyMappings); } _keyMappings = builder.build(); } @Override public PartitionContext forCall(Method method, Object... args) { String[] mappings = _keyMappings.get(method); if (mappings == null) {
// Path: core/src/main/java/com/bazaarvoice/ostrich/PartitionContext.java // public interface PartitionContext { // /** // * Gets the default piece of context. In many cases, there is only a single piece of relevant context, which this // * method should provide. // * // * @return The default context data. // */ // Object get(); // // /** // * Gets the context for the specified key. // * @param key The key for the desired context data. // * @return The context data. // */ // Object get(String key); // // /** // * Gets a {@code Map} version of the context. The Map should be immutable. // * @return A {@code Map} with the same key/value pairs as this context. // */ // Map<String, Object> asMap(); // } // // Path: core/src/main/java/com/bazaarvoice/ostrich/PartitionContextBuilder.java // public final class PartitionContextBuilder { // private static final PartitionContext EMPTY = new Context(ImmutableMap.<String, Object>of()); // // private final ImmutableMap.Builder<String, Object> _map = ImmutableMap.builder(); // // public static PartitionContext empty() { // return EMPTY; // } // // public static PartitionContext of(Object obj) { // return new Context(ImmutableMap.of("", obj)); // } // // public static PartitionContext of(String key, Object value) { // return new Context(ImmutableMap.of(key, value)); // } // // public static PartitionContext of(String key1, Object value1, String key2, Object value2) { // return new Context(ImmutableMap.of(key1, value1, key2, value2)); // } // // /** // * Adds the specified key and value to the partition context. Null keys or values and duplicate keys are not // * allowed. // * // * @return this // */ // public PartitionContextBuilder put(String key, Object value) { // _map.put(key, value); // return this; // } // // /** // * Adds the specified keys and values to the partition context. Null keys or values and duplicate keys are not // * allowed. // * // * @return this // */ // public PartitionContextBuilder putAll(Map<String, ?> map) { // _map.putAll(map); // return this; // } // // /** // * Returns a newly-create immutable {@code PartitionContext}. // */ // public PartitionContext build() { // return new Context(_map.build()); // } // // private static class Context implements PartitionContext { // private final ImmutableMap<String, Object> _map; // // private Context(ImmutableMap<String, Object> map) { // _map = checkNotNull(map); // } // // @Override // public Object get() { // return _map.get(""); // } // // @Override // public Object get(String key) { // return _map.get(key); // } // // @Override // public Map<String, Object> asMap() { // return _map; // } // // @Override // public boolean equals(Object o) { // return this == o || (o instanceof Context && _map.equals(((Context) o)._map)); // } // // @Override // public int hashCode() { // return 95261 + _map.hashCode(); // } // } // } // Path: core/src/main/java/com/bazaarvoice/ostrich/pool/AnnotationPartitionContextSupplier.java import com.bazaarvoice.ostrich.PartitionContext; import com.bazaarvoice.ostrich.PartitionContextBuilder; import com.bazaarvoice.ostrich.partition.PartitionKey; import com.google.common.collect.ImmutableMap; import com.google.common.collect.Maps; import java.lang.annotation.Annotation; import java.lang.reflect.Method; import java.lang.reflect.Modifier; import java.util.Map; import static com.google.common.base.Preconditions.checkArgument; import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Preconditions.checkState; package com.bazaarvoice.ostrich.pool; /** * Builds {@link PartitionContext} objects for service pool calls based on {@link PartitionKey} annotations. This is * designed for use by the {@link ServicePoolProxy} if/when the proxy invocation handler can determine the partition * context from method arguments. */ class AnnotationPartitionContextSupplier implements PartitionContextSupplier { private final Map<Method, String[]> _keyMappings; /** * Introspects the specified service interface and client implementation class, looking for {@link PartitionKey} * annotations on the implementation class. * <p> * At runtime the {@code Method} passed to the {@link #forCall(java.lang.reflect.Method, Object[])} method is * expected to belong to the interface class. But the interface shouldn't have {@link PartitionKey} annotations * since that's an implementation concern. As a result, this constructor expects the annotations to be found on the * implementation class. */ <S> AnnotationPartitionContextSupplier(Class<S> ifc, Class<? extends S> impl) { checkArgument(ifc.isAssignableFrom(impl)); ImmutableMap.Builder<Method, String[]> builder = ImmutableMap.builder(); for (Method ifcMethod : ifc.getMethods()) { if (Modifier.isStatic(ifcMethod.getModifiers())) { continue; // Static methods of ifc aren't members of impl. } Method implMethod; try { implMethod = impl.getMethod(ifcMethod.getName(), ifcMethod.getParameterTypes()); } catch (NoSuchMethodException e) { throw new RuntimeException(e); // Should never happen if impl implements ifc. } String[] keyMappings = collectPartitionKeyAnnotations(implMethod); if (keyMappings == null) { continue; // Not annotated } // Index by the ifcMethod because that's the method provided when a dynamic proxy method is invoked. builder.put(ifcMethod, keyMappings); } _keyMappings = builder.build(); } @Override public PartitionContext forCall(Method method, Object... args) { String[] mappings = _keyMappings.get(method); if (mappings == null) {
return PartitionContextBuilder.empty();
bazaarvoice/ostrich
core/src/test/java/com/bazaarvoice/ostrich/pool/AsyncServicePoolTest.java
// Path: core/src/main/java/com/bazaarvoice/ostrich/PartitionContext.java // public interface PartitionContext { // /** // * Gets the default piece of context. In many cases, there is only a single piece of relevant context, which this // * method should provide. // * // * @return The default context data. // */ // Object get(); // // /** // * Gets the context for the specified key. // * @param key The key for the desired context data. // * @return The context data. // */ // Object get(String key); // // /** // * Gets a {@code Map} version of the context. The Map should be immutable. // * @return A {@code Map} with the same key/value pairs as this context. // */ // Map<String, Object> asMap(); // }
import com.bazaarvoice.ostrich.PartitionContext; import com.bazaarvoice.ostrich.RetryPolicy; import com.bazaarvoice.ostrich.ServiceCallback; import com.bazaarvoice.ostrich.ServiceEndPoint; import com.bazaarvoice.ostrich.ServiceEndPointPredicate; import com.bazaarvoice.ostrich.exceptions.MaxRetriesException; import com.codahale.metrics.MetricRegistry; import com.google.common.base.Ticker; import com.google.common.collect.Lists; import com.google.common.collect.Sets; import com.google.common.io.Closeables; import com.google.common.util.concurrent.MoreExecutors; import org.junit.After; import org.junit.Before; import org.junit.Test; import java.io.IOException; import java.util.Collection; import java.util.List; import java.util.Random; import java.util.Set; import java.util.concurrent.Callable; import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutorService; import java.util.concurrent.Future; import java.util.concurrent.TimeUnit; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertSame; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; import static org.mockito.Matchers.any; import static org.mockito.Matchers.anyInt; import static org.mockito.Matchers.anyLong; import static org.mockito.Matchers.same; import static org.mockito.Mockito.RETURNS_MOCKS; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.never; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when;
new AsyncServicePool<>(_mockTicker, _mockPool, true, null, true, _metricRegistry); } @SuppressWarnings("unchecked") @Test public void testSubmitsCallableToExecutor() { AsyncServicePool<Service> pool = newAsyncPool(); pool.execute(NEVER_RETRY, mock(ServiceCallback.class)); verify(_mockExecutor).submit(any(Callable.class)); } @SuppressWarnings("unchecked") @Test public void testExecutesCallbackInPool() { // Use a real executor so that it can actually call into the callback AsyncServicePool<Service> pool = newAsyncPool(MoreExecutors.newDirectExecutorService()); ServiceCallback<Service, Void> callback = (ServiceCallback<Service, Void>) mock(ServiceCallback.class); pool.execute(NEVER_RETRY, callback); verify(_mockPool).execute(same(NEVER_RETRY), same(callback)); } @SuppressWarnings("unchecked") @Test public void testExecutesPartitionContextInPool() { AsyncServicePool<Service> pool = newAsyncPool(MoreExecutors.newDirectExecutorService()); ServiceCallback<Service, Void> callback = (ServiceCallback<Service, Void>) mock(ServiceCallback.class);
// Path: core/src/main/java/com/bazaarvoice/ostrich/PartitionContext.java // public interface PartitionContext { // /** // * Gets the default piece of context. In many cases, there is only a single piece of relevant context, which this // * method should provide. // * // * @return The default context data. // */ // Object get(); // // /** // * Gets the context for the specified key. // * @param key The key for the desired context data. // * @return The context data. // */ // Object get(String key); // // /** // * Gets a {@code Map} version of the context. The Map should be immutable. // * @return A {@code Map} with the same key/value pairs as this context. // */ // Map<String, Object> asMap(); // } // Path: core/src/test/java/com/bazaarvoice/ostrich/pool/AsyncServicePoolTest.java import com.bazaarvoice.ostrich.PartitionContext; import com.bazaarvoice.ostrich.RetryPolicy; import com.bazaarvoice.ostrich.ServiceCallback; import com.bazaarvoice.ostrich.ServiceEndPoint; import com.bazaarvoice.ostrich.ServiceEndPointPredicate; import com.bazaarvoice.ostrich.exceptions.MaxRetriesException; import com.codahale.metrics.MetricRegistry; import com.google.common.base.Ticker; import com.google.common.collect.Lists; import com.google.common.collect.Sets; import com.google.common.io.Closeables; import com.google.common.util.concurrent.MoreExecutors; import org.junit.After; import org.junit.Before; import org.junit.Test; import java.io.IOException; import java.util.Collection; import java.util.List; import java.util.Random; import java.util.Set; import java.util.concurrent.Callable; import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutorService; import java.util.concurrent.Future; import java.util.concurrent.TimeUnit; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertSame; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; import static org.mockito.Matchers.any; import static org.mockito.Matchers.anyInt; import static org.mockito.Matchers.anyLong; import static org.mockito.Matchers.same; import static org.mockito.Mockito.RETURNS_MOCKS; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.never; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; new AsyncServicePool<>(_mockTicker, _mockPool, true, null, true, _metricRegistry); } @SuppressWarnings("unchecked") @Test public void testSubmitsCallableToExecutor() { AsyncServicePool<Service> pool = newAsyncPool(); pool.execute(NEVER_RETRY, mock(ServiceCallback.class)); verify(_mockExecutor).submit(any(Callable.class)); } @SuppressWarnings("unchecked") @Test public void testExecutesCallbackInPool() { // Use a real executor so that it can actually call into the callback AsyncServicePool<Service> pool = newAsyncPool(MoreExecutors.newDirectExecutorService()); ServiceCallback<Service, Void> callback = (ServiceCallback<Service, Void>) mock(ServiceCallback.class); pool.execute(NEVER_RETRY, callback); verify(_mockPool).execute(same(NEVER_RETRY), same(callback)); } @SuppressWarnings("unchecked") @Test public void testExecutesPartitionContextInPool() { AsyncServicePool<Service> pool = newAsyncPool(MoreExecutors.newDirectExecutorService()); ServiceCallback<Service, Void> callback = (ServiceCallback<Service, Void>) mock(ServiceCallback.class);
PartitionContext context = mock(PartitionContext.class);
bazaarvoice/ostrich
core/src/main/java/com/bazaarvoice/ostrich/pool/MultiThreadedClientServiceCache.java
// Path: core/src/main/java/com/bazaarvoice/ostrich/pool/ServiceCacheBuilder.java // public static ScheduledExecutorService buildDefaultExecutor() { // return Executors.newScheduledThreadPool(1, // new ThreadFactoryBuilder().setNameFormat("ServiceCache-CleanupThread-%d").setDaemon(true).build()); // }
import com.bazaarvoice.ostrich.MultiThreadedServiceFactory; import com.bazaarvoice.ostrich.ServiceEndPoint; import com.bazaarvoice.ostrich.ServiceFactory; import com.bazaarvoice.ostrich.metrics.Metrics; import com.codahale.metrics.Counter; import com.codahale.metrics.MetricRegistry; import com.codahale.metrics.Timer; import com.google.common.annotations.VisibleForTesting; import com.google.common.collect.Maps; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.concurrent.Future; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeUnit; import static com.bazaarvoice.ostrich.pool.ServiceCacheBuilder.buildDefaultExecutor; import static com.google.common.base.Preconditions.checkArgument; import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Preconditions.checkState; import static java.util.concurrent.TimeUnit.MINUTES; import static java.util.concurrent.TimeUnit.SECONDS;
} public boolean isOld() { return System.currentTimeMillis() > _sellByDate; } public boolean hasBeenFlaggedForEviction() { return _expireAfterDate != Long.MAX_VALUE; } public boolean timeToEvict() { return _expireAfterDate != Long.MAX_VALUE && System.currentTimeMillis() > _expireAfterDate; } public void flagAsEvicted() { if (_expireAfterDate == Long.MAX_VALUE) { // Not synchronized - evictionDelay is long enough that thread contention here shouldn't matter _expireAfterDate = System.currentTimeMillis() + _evictionDelayInMilliSeconds; } } } /** * Builds a {@code MultiThreadedClientServiceCache} with a default executor and cleanup delay. * Used by the builder. * * @param serviceFactory The service factory for creating service handles * @param metricRegistry The metric registry for reporting metrics */ MultiThreadedClientServiceCache(MultiThreadedServiceFactory<S> serviceFactory, MetricRegistry metricRegistry) {
// Path: core/src/main/java/com/bazaarvoice/ostrich/pool/ServiceCacheBuilder.java // public static ScheduledExecutorService buildDefaultExecutor() { // return Executors.newScheduledThreadPool(1, // new ThreadFactoryBuilder().setNameFormat("ServiceCache-CleanupThread-%d").setDaemon(true).build()); // } // Path: core/src/main/java/com/bazaarvoice/ostrich/pool/MultiThreadedClientServiceCache.java import com.bazaarvoice.ostrich.MultiThreadedServiceFactory; import com.bazaarvoice.ostrich.ServiceEndPoint; import com.bazaarvoice.ostrich.ServiceFactory; import com.bazaarvoice.ostrich.metrics.Metrics; import com.codahale.metrics.Counter; import com.codahale.metrics.MetricRegistry; import com.codahale.metrics.Timer; import com.google.common.annotations.VisibleForTesting; import com.google.common.collect.Maps; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.concurrent.Future; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeUnit; import static com.bazaarvoice.ostrich.pool.ServiceCacheBuilder.buildDefaultExecutor; import static com.google.common.base.Preconditions.checkArgument; import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Preconditions.checkState; import static java.util.concurrent.TimeUnit.MINUTES; import static java.util.concurrent.TimeUnit.SECONDS; } public boolean isOld() { return System.currentTimeMillis() > _sellByDate; } public boolean hasBeenFlaggedForEviction() { return _expireAfterDate != Long.MAX_VALUE; } public boolean timeToEvict() { return _expireAfterDate != Long.MAX_VALUE && System.currentTimeMillis() > _expireAfterDate; } public void flagAsEvicted() { if (_expireAfterDate == Long.MAX_VALUE) { // Not synchronized - evictionDelay is long enough that thread contention here shouldn't matter _expireAfterDate = System.currentTimeMillis() + _evictionDelayInMilliSeconds; } } } /** * Builds a {@code MultiThreadedClientServiceCache} with a default executor and cleanup delay. * Used by the builder. * * @param serviceFactory The service factory for creating service handles * @param metricRegistry The metric registry for reporting metrics */ MultiThreadedClientServiceCache(MultiThreadedServiceFactory<S> serviceFactory, MetricRegistry metricRegistry) {
this(serviceFactory, buildDefaultExecutor(), DEFAULT_EVICTION_DELAY_SECONDS, DEFAULT_CLEANUP_DELAY_SECONDS, metricRegistry);
bazaarvoice/ostrich
core/src/main/java/com/bazaarvoice/ostrich/pool/ServicePoolProxy.java
// Path: core/src/main/java/com/bazaarvoice/ostrich/PartitionContext.java // public interface PartitionContext { // /** // * Gets the default piece of context. In many cases, there is only a single piece of relevant context, which this // * method should provide. // * // * @return The default context data. // */ // Object get(); // // /** // * Gets the context for the specified key. // * @param key The key for the desired context data. // * @return The context data. // */ // Object get(String key); // // /** // * Gets a {@code Map} version of the context. The Map should be immutable. // * @return A {@code Map} with the same key/value pairs as this context. // */ // Map<String, Object> asMap(); // }
import com.bazaarvoice.ostrich.PartitionContext; import com.bazaarvoice.ostrich.RetryPolicy; import com.bazaarvoice.ostrich.ServiceCallback; import com.bazaarvoice.ostrich.ServicePool; import com.bazaarvoice.ostrich.exceptions.ServiceException; import com.google.common.base.Throwables; import com.google.common.reflect.AbstractInvocationHandler; import java.io.Closeable; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.lang.reflect.Proxy; import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Preconditions.checkState;
serviceType, retryPolicy, pool, partitionContextSupplier, shutdownPoolOnClose); return serviceType.cast(Proxy.newProxyInstance(loader, interfaces, proxy)); } ServicePoolProxy(Class<S> serviceType, RetryPolicy retryPolicy, ServicePool<S> servicePool, PartitionContextSupplier partitionContextSupplier, boolean shutdownPoolOnClose) { checkState(serviceType.isInterface(), "Proxy functionality is only available for interface service types."); _serviceType = checkNotNull(serviceType); _retryPolicy = checkNotNull(retryPolicy); _servicePool = checkNotNull(servicePool); _partitionContextSupplier = checkNotNull(partitionContextSupplier); _shutdownPoolOnClose = shutdownPoolOnClose; } /** * @return The service pool used by this proxy to execute service methods. */ com.bazaarvoice.ostrich.ServicePool<S> getServicePool() { return _servicePool; } @Override protected Object handleInvocation(Object proxy, final Method method, final Object[] args) throws Throwable { // Special case for close() allows closing the entire pool by calling close() on the proxy. if (_shutdownPoolOnClose && args.length == 0 && method.getName().equals("close")) { _servicePool.close(); return null; }
// Path: core/src/main/java/com/bazaarvoice/ostrich/PartitionContext.java // public interface PartitionContext { // /** // * Gets the default piece of context. In many cases, there is only a single piece of relevant context, which this // * method should provide. // * // * @return The default context data. // */ // Object get(); // // /** // * Gets the context for the specified key. // * @param key The key for the desired context data. // * @return The context data. // */ // Object get(String key); // // /** // * Gets a {@code Map} version of the context. The Map should be immutable. // * @return A {@code Map} with the same key/value pairs as this context. // */ // Map<String, Object> asMap(); // } // Path: core/src/main/java/com/bazaarvoice/ostrich/pool/ServicePoolProxy.java import com.bazaarvoice.ostrich.PartitionContext; import com.bazaarvoice.ostrich.RetryPolicy; import com.bazaarvoice.ostrich.ServiceCallback; import com.bazaarvoice.ostrich.ServicePool; import com.bazaarvoice.ostrich.exceptions.ServiceException; import com.google.common.base.Throwables; import com.google.common.reflect.AbstractInvocationHandler; import java.io.Closeable; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.lang.reflect.Proxy; import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Preconditions.checkState; serviceType, retryPolicy, pool, partitionContextSupplier, shutdownPoolOnClose); return serviceType.cast(Proxy.newProxyInstance(loader, interfaces, proxy)); } ServicePoolProxy(Class<S> serviceType, RetryPolicy retryPolicy, ServicePool<S> servicePool, PartitionContextSupplier partitionContextSupplier, boolean shutdownPoolOnClose) { checkState(serviceType.isInterface(), "Proxy functionality is only available for interface service types."); _serviceType = checkNotNull(serviceType); _retryPolicy = checkNotNull(retryPolicy); _servicePool = checkNotNull(servicePool); _partitionContextSupplier = checkNotNull(partitionContextSupplier); _shutdownPoolOnClose = shutdownPoolOnClose; } /** * @return The service pool used by this proxy to execute service methods. */ com.bazaarvoice.ostrich.ServicePool<S> getServicePool() { return _servicePool; } @Override protected Object handleInvocation(Object proxy, final Method method, final Object[] args) throws Throwable { // Special case for close() allows closing the entire pool by calling close() on the proxy. if (_shutdownPoolOnClose && args.length == 0 && method.getName().equals("close")) { _servicePool.close(); return null; }
PartitionContext partitionContext = _partitionContextSupplier.forCall(method, args);
bazaarvoice/ostrich
core/src/test/java/com/bazaarvoice/ostrich/pool/AnnotationPartitionContextSupplierTest.java
// Path: core/src/main/java/com/bazaarvoice/ostrich/PartitionContext.java // public interface PartitionContext { // /** // * Gets the default piece of context. In many cases, there is only a single piece of relevant context, which this // * method should provide. // * // * @return The default context data. // */ // Object get(); // // /** // * Gets the context for the specified key. // * @param key The key for the desired context data. // * @return The context data. // */ // Object get(String key); // // /** // * Gets a {@code Map} version of the context. The Map should be immutable. // * @return A {@code Map} with the same key/value pairs as this context. // */ // Map<String, Object> asMap(); // }
import com.bazaarvoice.ostrich.PartitionContext; import com.bazaarvoice.ostrich.partition.PartitionKey; import com.google.common.collect.ImmutableMap; import org.junit.Test; import java.util.ArrayList; import java.util.List; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue;
package com.bazaarvoice.ostrich.pool; public class AnnotationPartitionContextSupplierTest { @Test public void testImplExtendsIfc() { new AnnotationPartitionContextSupplier(List.class, ArrayList.class); } @SuppressWarnings("unchecked") @Test(expected = IllegalArgumentException.class) public void testImplDoesntExtendsIfc() { new AnnotationPartitionContextSupplier((Class) ArrayList.class, List.class); } @Test(expected = IllegalStateException.class) public void testDuplicateKey() { new AnnotationPartitionContextSupplier(MyService.class, MyServiceDup.class); } @Test public void testNoArgs() throws Exception { PartitionContextSupplier contextSupplier = new AnnotationPartitionContextSupplier(MyService.class, MyServiceImpl.class);
// Path: core/src/main/java/com/bazaarvoice/ostrich/PartitionContext.java // public interface PartitionContext { // /** // * Gets the default piece of context. In many cases, there is only a single piece of relevant context, which this // * method should provide. // * // * @return The default context data. // */ // Object get(); // // /** // * Gets the context for the specified key. // * @param key The key for the desired context data. // * @return The context data. // */ // Object get(String key); // // /** // * Gets a {@code Map} version of the context. The Map should be immutable. // * @return A {@code Map} with the same key/value pairs as this context. // */ // Map<String, Object> asMap(); // } // Path: core/src/test/java/com/bazaarvoice/ostrich/pool/AnnotationPartitionContextSupplierTest.java import com.bazaarvoice.ostrich.PartitionContext; import com.bazaarvoice.ostrich.partition.PartitionKey; import com.google.common.collect.ImmutableMap; import org.junit.Test; import java.util.ArrayList; import java.util.List; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; package com.bazaarvoice.ostrich.pool; public class AnnotationPartitionContextSupplierTest { @Test public void testImplExtendsIfc() { new AnnotationPartitionContextSupplier(List.class, ArrayList.class); } @SuppressWarnings("unchecked") @Test(expected = IllegalArgumentException.class) public void testImplDoesntExtendsIfc() { new AnnotationPartitionContextSupplier((Class) ArrayList.class, List.class); } @Test(expected = IllegalStateException.class) public void testDuplicateKey() { new AnnotationPartitionContextSupplier(MyService.class, MyServiceDup.class); } @Test public void testNoArgs() throws Exception { PartitionContextSupplier contextSupplier = new AnnotationPartitionContextSupplier(MyService.class, MyServiceImpl.class);
PartitionContext partitionContext = contextSupplier.forCall(MyService.class.getMethod("noArgs"));
bazaarvoice/ostrich
core/src/main/java/com/bazaarvoice/ostrich/pool/EmptyPartitionContextSupplier.java
// Path: core/src/main/java/com/bazaarvoice/ostrich/PartitionContext.java // public interface PartitionContext { // /** // * Gets the default piece of context. In many cases, there is only a single piece of relevant context, which this // * method should provide. // * // * @return The default context data. // */ // Object get(); // // /** // * Gets the context for the specified key. // * @param key The key for the desired context data. // * @return The context data. // */ // Object get(String key); // // /** // * Gets a {@code Map} version of the context. The Map should be immutable. // * @return A {@code Map} with the same key/value pairs as this context. // */ // Map<String, Object> asMap(); // } // // Path: core/src/main/java/com/bazaarvoice/ostrich/PartitionContextBuilder.java // public final class PartitionContextBuilder { // private static final PartitionContext EMPTY = new Context(ImmutableMap.<String, Object>of()); // // private final ImmutableMap.Builder<String, Object> _map = ImmutableMap.builder(); // // public static PartitionContext empty() { // return EMPTY; // } // // public static PartitionContext of(Object obj) { // return new Context(ImmutableMap.of("", obj)); // } // // public static PartitionContext of(String key, Object value) { // return new Context(ImmutableMap.of(key, value)); // } // // public static PartitionContext of(String key1, Object value1, String key2, Object value2) { // return new Context(ImmutableMap.of(key1, value1, key2, value2)); // } // // /** // * Adds the specified key and value to the partition context. Null keys or values and duplicate keys are not // * allowed. // * // * @return this // */ // public PartitionContextBuilder put(String key, Object value) { // _map.put(key, value); // return this; // } // // /** // * Adds the specified keys and values to the partition context. Null keys or values and duplicate keys are not // * allowed. // * // * @return this // */ // public PartitionContextBuilder putAll(Map<String, ?> map) { // _map.putAll(map); // return this; // } // // /** // * Returns a newly-create immutable {@code PartitionContext}. // */ // public PartitionContext build() { // return new Context(_map.build()); // } // // private static class Context implements PartitionContext { // private final ImmutableMap<String, Object> _map; // // private Context(ImmutableMap<String, Object> map) { // _map = checkNotNull(map); // } // // @Override // public Object get() { // return _map.get(""); // } // // @Override // public Object get(String key) { // return _map.get(key); // } // // @Override // public Map<String, Object> asMap() { // return _map; // } // // @Override // public boolean equals(Object o) { // return this == o || (o instanceof Context && _map.equals(((Context) o)._map)); // } // // @Override // public int hashCode() { // return 95261 + _map.hashCode(); // } // } // }
import com.bazaarvoice.ostrich.PartitionContext; import com.bazaarvoice.ostrich.PartitionContextBuilder; import java.lang.reflect.Method;
package com.bazaarvoice.ostrich.pool; /** * A supplier with a {@link #forCall} method that always returns {@link PartitionContextBuilder#empty()}. */ public class EmptyPartitionContextSupplier implements PartitionContextSupplier { @Override
// Path: core/src/main/java/com/bazaarvoice/ostrich/PartitionContext.java // public interface PartitionContext { // /** // * Gets the default piece of context. In many cases, there is only a single piece of relevant context, which this // * method should provide. // * // * @return The default context data. // */ // Object get(); // // /** // * Gets the context for the specified key. // * @param key The key for the desired context data. // * @return The context data. // */ // Object get(String key); // // /** // * Gets a {@code Map} version of the context. The Map should be immutable. // * @return A {@code Map} with the same key/value pairs as this context. // */ // Map<String, Object> asMap(); // } // // Path: core/src/main/java/com/bazaarvoice/ostrich/PartitionContextBuilder.java // public final class PartitionContextBuilder { // private static final PartitionContext EMPTY = new Context(ImmutableMap.<String, Object>of()); // // private final ImmutableMap.Builder<String, Object> _map = ImmutableMap.builder(); // // public static PartitionContext empty() { // return EMPTY; // } // // public static PartitionContext of(Object obj) { // return new Context(ImmutableMap.of("", obj)); // } // // public static PartitionContext of(String key, Object value) { // return new Context(ImmutableMap.of(key, value)); // } // // public static PartitionContext of(String key1, Object value1, String key2, Object value2) { // return new Context(ImmutableMap.of(key1, value1, key2, value2)); // } // // /** // * Adds the specified key and value to the partition context. Null keys or values and duplicate keys are not // * allowed. // * // * @return this // */ // public PartitionContextBuilder put(String key, Object value) { // _map.put(key, value); // return this; // } // // /** // * Adds the specified keys and values to the partition context. Null keys or values and duplicate keys are not // * allowed. // * // * @return this // */ // public PartitionContextBuilder putAll(Map<String, ?> map) { // _map.putAll(map); // return this; // } // // /** // * Returns a newly-create immutable {@code PartitionContext}. // */ // public PartitionContext build() { // return new Context(_map.build()); // } // // private static class Context implements PartitionContext { // private final ImmutableMap<String, Object> _map; // // private Context(ImmutableMap<String, Object> map) { // _map = checkNotNull(map); // } // // @Override // public Object get() { // return _map.get(""); // } // // @Override // public Object get(String key) { // return _map.get(key); // } // // @Override // public Map<String, Object> asMap() { // return _map; // } // // @Override // public boolean equals(Object o) { // return this == o || (o instanceof Context && _map.equals(((Context) o)._map)); // } // // @Override // public int hashCode() { // return 95261 + _map.hashCode(); // } // } // } // Path: core/src/main/java/com/bazaarvoice/ostrich/pool/EmptyPartitionContextSupplier.java import com.bazaarvoice.ostrich.PartitionContext; import com.bazaarvoice.ostrich.PartitionContextBuilder; import java.lang.reflect.Method; package com.bazaarvoice.ostrich.pool; /** * A supplier with a {@link #forCall} method that always returns {@link PartitionContextBuilder#empty()}. */ public class EmptyPartitionContextSupplier implements PartitionContextSupplier { @Override
public PartitionContext forCall(Method method, Object... args) {
bazaarvoice/ostrich
core/src/main/java/com/bazaarvoice/ostrich/pool/EmptyPartitionContextSupplier.java
// Path: core/src/main/java/com/bazaarvoice/ostrich/PartitionContext.java // public interface PartitionContext { // /** // * Gets the default piece of context. In many cases, there is only a single piece of relevant context, which this // * method should provide. // * // * @return The default context data. // */ // Object get(); // // /** // * Gets the context for the specified key. // * @param key The key for the desired context data. // * @return The context data. // */ // Object get(String key); // // /** // * Gets a {@code Map} version of the context. The Map should be immutable. // * @return A {@code Map} with the same key/value pairs as this context. // */ // Map<String, Object> asMap(); // } // // Path: core/src/main/java/com/bazaarvoice/ostrich/PartitionContextBuilder.java // public final class PartitionContextBuilder { // private static final PartitionContext EMPTY = new Context(ImmutableMap.<String, Object>of()); // // private final ImmutableMap.Builder<String, Object> _map = ImmutableMap.builder(); // // public static PartitionContext empty() { // return EMPTY; // } // // public static PartitionContext of(Object obj) { // return new Context(ImmutableMap.of("", obj)); // } // // public static PartitionContext of(String key, Object value) { // return new Context(ImmutableMap.of(key, value)); // } // // public static PartitionContext of(String key1, Object value1, String key2, Object value2) { // return new Context(ImmutableMap.of(key1, value1, key2, value2)); // } // // /** // * Adds the specified key and value to the partition context. Null keys or values and duplicate keys are not // * allowed. // * // * @return this // */ // public PartitionContextBuilder put(String key, Object value) { // _map.put(key, value); // return this; // } // // /** // * Adds the specified keys and values to the partition context. Null keys or values and duplicate keys are not // * allowed. // * // * @return this // */ // public PartitionContextBuilder putAll(Map<String, ?> map) { // _map.putAll(map); // return this; // } // // /** // * Returns a newly-create immutable {@code PartitionContext}. // */ // public PartitionContext build() { // return new Context(_map.build()); // } // // private static class Context implements PartitionContext { // private final ImmutableMap<String, Object> _map; // // private Context(ImmutableMap<String, Object> map) { // _map = checkNotNull(map); // } // // @Override // public Object get() { // return _map.get(""); // } // // @Override // public Object get(String key) { // return _map.get(key); // } // // @Override // public Map<String, Object> asMap() { // return _map; // } // // @Override // public boolean equals(Object o) { // return this == o || (o instanceof Context && _map.equals(((Context) o)._map)); // } // // @Override // public int hashCode() { // return 95261 + _map.hashCode(); // } // } // }
import com.bazaarvoice.ostrich.PartitionContext; import com.bazaarvoice.ostrich.PartitionContextBuilder; import java.lang.reflect.Method;
package com.bazaarvoice.ostrich.pool; /** * A supplier with a {@link #forCall} method that always returns {@link PartitionContextBuilder#empty()}. */ public class EmptyPartitionContextSupplier implements PartitionContextSupplier { @Override public PartitionContext forCall(Method method, Object... args) {
// Path: core/src/main/java/com/bazaarvoice/ostrich/PartitionContext.java // public interface PartitionContext { // /** // * Gets the default piece of context. In many cases, there is only a single piece of relevant context, which this // * method should provide. // * // * @return The default context data. // */ // Object get(); // // /** // * Gets the context for the specified key. // * @param key The key for the desired context data. // * @return The context data. // */ // Object get(String key); // // /** // * Gets a {@code Map} version of the context. The Map should be immutable. // * @return A {@code Map} with the same key/value pairs as this context. // */ // Map<String, Object> asMap(); // } // // Path: core/src/main/java/com/bazaarvoice/ostrich/PartitionContextBuilder.java // public final class PartitionContextBuilder { // private static final PartitionContext EMPTY = new Context(ImmutableMap.<String, Object>of()); // // private final ImmutableMap.Builder<String, Object> _map = ImmutableMap.builder(); // // public static PartitionContext empty() { // return EMPTY; // } // // public static PartitionContext of(Object obj) { // return new Context(ImmutableMap.of("", obj)); // } // // public static PartitionContext of(String key, Object value) { // return new Context(ImmutableMap.of(key, value)); // } // // public static PartitionContext of(String key1, Object value1, String key2, Object value2) { // return new Context(ImmutableMap.of(key1, value1, key2, value2)); // } // // /** // * Adds the specified key and value to the partition context. Null keys or values and duplicate keys are not // * allowed. // * // * @return this // */ // public PartitionContextBuilder put(String key, Object value) { // _map.put(key, value); // return this; // } // // /** // * Adds the specified keys and values to the partition context. Null keys or values and duplicate keys are not // * allowed. // * // * @return this // */ // public PartitionContextBuilder putAll(Map<String, ?> map) { // _map.putAll(map); // return this; // } // // /** // * Returns a newly-create immutable {@code PartitionContext}. // */ // public PartitionContext build() { // return new Context(_map.build()); // } // // private static class Context implements PartitionContext { // private final ImmutableMap<String, Object> _map; // // private Context(ImmutableMap<String, Object> map) { // _map = checkNotNull(map); // } // // @Override // public Object get() { // return _map.get(""); // } // // @Override // public Object get(String key) { // return _map.get(key); // } // // @Override // public Map<String, Object> asMap() { // return _map; // } // // @Override // public boolean equals(Object o) { // return this == o || (o instanceof Context && _map.equals(((Context) o)._map)); // } // // @Override // public int hashCode() { // return 95261 + _map.hashCode(); // } // } // } // Path: core/src/main/java/com/bazaarvoice/ostrich/pool/EmptyPartitionContextSupplier.java import com.bazaarvoice.ostrich.PartitionContext; import com.bazaarvoice.ostrich.PartitionContextBuilder; import java.lang.reflect.Method; package com.bazaarvoice.ostrich.pool; /** * A supplier with a {@link #forCall} method that always returns {@link PartitionContextBuilder#empty()}. */ public class EmptyPartitionContextSupplier implements PartitionContextSupplier { @Override public PartitionContext forCall(Method method, Object... args) {
return PartitionContextBuilder.empty();
bazaarvoice/ostrich
core/src/main/java/com/bazaarvoice/ostrich/pool/ServicePoolBuilder.java
// Path: core/src/main/java/com/bazaarvoice/ostrich/LoadBalanceAlgorithm.java // public interface LoadBalanceAlgorithm { // /** // * Selects an end point to use based on a load balancing algorithm. If no end point can be chosen, then // * <code>null</code> is returned. // * // * @param endPoints The end points to choose from. // * @param statistics Usage statistics about the end points in case the load balancing algorithm needs some // * knowledge of the service pool's state. // * @return Which end point to use or <code>null</code> if one couldn't be chosen. // */ // ServiceEndPoint choose(Iterable<ServiceEndPoint> endPoints, ServicePoolStatistics statistics); // } // // Path: core/src/main/java/com/bazaarvoice/ostrich/loadbalance/RandomAlgorithm.java // public class RandomAlgorithm implements LoadBalanceAlgorithm { // private final Random _rnd = new Random(); // // @Override // public ServiceEndPoint choose(Iterable<ServiceEndPoint> endPoints, ServicePoolStatistics statistics) { // Preconditions.checkNotNull(endPoints); // // Iterator<ServiceEndPoint> iter = endPoints.iterator(); // if (!iter.hasNext()) { // return null; // } // // List<ServiceEndPoint> list = Lists.newArrayList(iter); // if (list.size() == 1) { // return list.get(0); // } // return list.get(_rnd.nextInt(list.size())); // } // }
import com.bazaarvoice.ostrich.HostDiscovery; import com.bazaarvoice.ostrich.HostDiscoverySource; import com.bazaarvoice.ostrich.LoadBalanceAlgorithm; import com.bazaarvoice.ostrich.RetryPolicy; import com.bazaarvoice.ostrich.ServiceFactory; import com.bazaarvoice.ostrich.healthcheck.ExponentialBackoffHealthCheckRetryDelay; import com.bazaarvoice.ostrich.healthcheck.HealthCheckRetryDelay; import com.bazaarvoice.ostrich.loadbalance.RandomAlgorithm; import com.bazaarvoice.ostrich.partition.IdentityPartitionFilter; import com.bazaarvoice.ostrich.partition.PartitionFilter; import com.bazaarvoice.ostrich.partition.PartitionKey; import com.codahale.metrics.MetricRegistry; import com.google.common.annotations.VisibleForTesting; import com.google.common.base.Strings; import com.google.common.base.Throwables; import com.google.common.base.Ticker; import com.google.common.collect.Lists; import com.google.common.util.concurrent.ThreadFactoryBuilder; import java.io.IOException; import java.util.List; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.ThreadFactory; import java.util.concurrent.TimeUnit; import static com.google.common.base.Preconditions.checkArgument; import static com.google.common.base.Preconditions.checkNotNull; import static java.lang.String.format;
package com.bazaarvoice.ostrich.pool; public class ServicePoolBuilder<S> { private static final int DEFAULT_NUM_HEALTH_CHECK_THREADS = 1; private static final HealthCheckRetryDelay DEFAULT_HEALTH_CHECK_RETRY_POLICY = new ExponentialBackoffHealthCheckRetryDelay(100, 10_000, TimeUnit.MILLISECONDS); private final Class<S> _serviceType; private final List<HostDiscoverySource> _hostDiscoverySources = Lists.newArrayList(); private boolean _closeHostDiscovery; private ServiceFactory<S> _serviceFactory; private String _serviceName; private ScheduledExecutorService _healthCheckExecutor; private ServiceCachingPolicy _cachingPolicy; private PartitionFilter _partitionFilter = new IdentityPartitionFilter(); private PartitionContextSupplier _partitionContextSupplier = new EmptyPartitionContextSupplier();
// Path: core/src/main/java/com/bazaarvoice/ostrich/LoadBalanceAlgorithm.java // public interface LoadBalanceAlgorithm { // /** // * Selects an end point to use based on a load balancing algorithm. If no end point can be chosen, then // * <code>null</code> is returned. // * // * @param endPoints The end points to choose from. // * @param statistics Usage statistics about the end points in case the load balancing algorithm needs some // * knowledge of the service pool's state. // * @return Which end point to use or <code>null</code> if one couldn't be chosen. // */ // ServiceEndPoint choose(Iterable<ServiceEndPoint> endPoints, ServicePoolStatistics statistics); // } // // Path: core/src/main/java/com/bazaarvoice/ostrich/loadbalance/RandomAlgorithm.java // public class RandomAlgorithm implements LoadBalanceAlgorithm { // private final Random _rnd = new Random(); // // @Override // public ServiceEndPoint choose(Iterable<ServiceEndPoint> endPoints, ServicePoolStatistics statistics) { // Preconditions.checkNotNull(endPoints); // // Iterator<ServiceEndPoint> iter = endPoints.iterator(); // if (!iter.hasNext()) { // return null; // } // // List<ServiceEndPoint> list = Lists.newArrayList(iter); // if (list.size() == 1) { // return list.get(0); // } // return list.get(_rnd.nextInt(list.size())); // } // } // Path: core/src/main/java/com/bazaarvoice/ostrich/pool/ServicePoolBuilder.java import com.bazaarvoice.ostrich.HostDiscovery; import com.bazaarvoice.ostrich.HostDiscoverySource; import com.bazaarvoice.ostrich.LoadBalanceAlgorithm; import com.bazaarvoice.ostrich.RetryPolicy; import com.bazaarvoice.ostrich.ServiceFactory; import com.bazaarvoice.ostrich.healthcheck.ExponentialBackoffHealthCheckRetryDelay; import com.bazaarvoice.ostrich.healthcheck.HealthCheckRetryDelay; import com.bazaarvoice.ostrich.loadbalance.RandomAlgorithm; import com.bazaarvoice.ostrich.partition.IdentityPartitionFilter; import com.bazaarvoice.ostrich.partition.PartitionFilter; import com.bazaarvoice.ostrich.partition.PartitionKey; import com.codahale.metrics.MetricRegistry; import com.google.common.annotations.VisibleForTesting; import com.google.common.base.Strings; import com.google.common.base.Throwables; import com.google.common.base.Ticker; import com.google.common.collect.Lists; import com.google.common.util.concurrent.ThreadFactoryBuilder; import java.io.IOException; import java.util.List; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.ThreadFactory; import java.util.concurrent.TimeUnit; import static com.google.common.base.Preconditions.checkArgument; import static com.google.common.base.Preconditions.checkNotNull; import static java.lang.String.format; package com.bazaarvoice.ostrich.pool; public class ServicePoolBuilder<S> { private static final int DEFAULT_NUM_HEALTH_CHECK_THREADS = 1; private static final HealthCheckRetryDelay DEFAULT_HEALTH_CHECK_RETRY_POLICY = new ExponentialBackoffHealthCheckRetryDelay(100, 10_000, TimeUnit.MILLISECONDS); private final Class<S> _serviceType; private final List<HostDiscoverySource> _hostDiscoverySources = Lists.newArrayList(); private boolean _closeHostDiscovery; private ServiceFactory<S> _serviceFactory; private String _serviceName; private ScheduledExecutorService _healthCheckExecutor; private ServiceCachingPolicy _cachingPolicy; private PartitionFilter _partitionFilter = new IdentityPartitionFilter(); private PartitionContextSupplier _partitionContextSupplier = new EmptyPartitionContextSupplier();
private LoadBalanceAlgorithm _loadBalanceAlgorithm = new RandomAlgorithm();
bazaarvoice/ostrich
core/src/main/java/com/bazaarvoice/ostrich/pool/ServicePoolBuilder.java
// Path: core/src/main/java/com/bazaarvoice/ostrich/LoadBalanceAlgorithm.java // public interface LoadBalanceAlgorithm { // /** // * Selects an end point to use based on a load balancing algorithm. If no end point can be chosen, then // * <code>null</code> is returned. // * // * @param endPoints The end points to choose from. // * @param statistics Usage statistics about the end points in case the load balancing algorithm needs some // * knowledge of the service pool's state. // * @return Which end point to use or <code>null</code> if one couldn't be chosen. // */ // ServiceEndPoint choose(Iterable<ServiceEndPoint> endPoints, ServicePoolStatistics statistics); // } // // Path: core/src/main/java/com/bazaarvoice/ostrich/loadbalance/RandomAlgorithm.java // public class RandomAlgorithm implements LoadBalanceAlgorithm { // private final Random _rnd = new Random(); // // @Override // public ServiceEndPoint choose(Iterable<ServiceEndPoint> endPoints, ServicePoolStatistics statistics) { // Preconditions.checkNotNull(endPoints); // // Iterator<ServiceEndPoint> iter = endPoints.iterator(); // if (!iter.hasNext()) { // return null; // } // // List<ServiceEndPoint> list = Lists.newArrayList(iter); // if (list.size() == 1) { // return list.get(0); // } // return list.get(_rnd.nextInt(list.size())); // } // }
import com.bazaarvoice.ostrich.HostDiscovery; import com.bazaarvoice.ostrich.HostDiscoverySource; import com.bazaarvoice.ostrich.LoadBalanceAlgorithm; import com.bazaarvoice.ostrich.RetryPolicy; import com.bazaarvoice.ostrich.ServiceFactory; import com.bazaarvoice.ostrich.healthcheck.ExponentialBackoffHealthCheckRetryDelay; import com.bazaarvoice.ostrich.healthcheck.HealthCheckRetryDelay; import com.bazaarvoice.ostrich.loadbalance.RandomAlgorithm; import com.bazaarvoice.ostrich.partition.IdentityPartitionFilter; import com.bazaarvoice.ostrich.partition.PartitionFilter; import com.bazaarvoice.ostrich.partition.PartitionKey; import com.codahale.metrics.MetricRegistry; import com.google.common.annotations.VisibleForTesting; import com.google.common.base.Strings; import com.google.common.base.Throwables; import com.google.common.base.Ticker; import com.google.common.collect.Lists; import com.google.common.util.concurrent.ThreadFactoryBuilder; import java.io.IOException; import java.util.List; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.ThreadFactory; import java.util.concurrent.TimeUnit; import static com.google.common.base.Preconditions.checkArgument; import static com.google.common.base.Preconditions.checkNotNull; import static java.lang.String.format;
package com.bazaarvoice.ostrich.pool; public class ServicePoolBuilder<S> { private static final int DEFAULT_NUM_HEALTH_CHECK_THREADS = 1; private static final HealthCheckRetryDelay DEFAULT_HEALTH_CHECK_RETRY_POLICY = new ExponentialBackoffHealthCheckRetryDelay(100, 10_000, TimeUnit.MILLISECONDS); private final Class<S> _serviceType; private final List<HostDiscoverySource> _hostDiscoverySources = Lists.newArrayList(); private boolean _closeHostDiscovery; private ServiceFactory<S> _serviceFactory; private String _serviceName; private ScheduledExecutorService _healthCheckExecutor; private ServiceCachingPolicy _cachingPolicy; private PartitionFilter _partitionFilter = new IdentityPartitionFilter(); private PartitionContextSupplier _partitionContextSupplier = new EmptyPartitionContextSupplier();
// Path: core/src/main/java/com/bazaarvoice/ostrich/LoadBalanceAlgorithm.java // public interface LoadBalanceAlgorithm { // /** // * Selects an end point to use based on a load balancing algorithm. If no end point can be chosen, then // * <code>null</code> is returned. // * // * @param endPoints The end points to choose from. // * @param statistics Usage statistics about the end points in case the load balancing algorithm needs some // * knowledge of the service pool's state. // * @return Which end point to use or <code>null</code> if one couldn't be chosen. // */ // ServiceEndPoint choose(Iterable<ServiceEndPoint> endPoints, ServicePoolStatistics statistics); // } // // Path: core/src/main/java/com/bazaarvoice/ostrich/loadbalance/RandomAlgorithm.java // public class RandomAlgorithm implements LoadBalanceAlgorithm { // private final Random _rnd = new Random(); // // @Override // public ServiceEndPoint choose(Iterable<ServiceEndPoint> endPoints, ServicePoolStatistics statistics) { // Preconditions.checkNotNull(endPoints); // // Iterator<ServiceEndPoint> iter = endPoints.iterator(); // if (!iter.hasNext()) { // return null; // } // // List<ServiceEndPoint> list = Lists.newArrayList(iter); // if (list.size() == 1) { // return list.get(0); // } // return list.get(_rnd.nextInt(list.size())); // } // } // Path: core/src/main/java/com/bazaarvoice/ostrich/pool/ServicePoolBuilder.java import com.bazaarvoice.ostrich.HostDiscovery; import com.bazaarvoice.ostrich.HostDiscoverySource; import com.bazaarvoice.ostrich.LoadBalanceAlgorithm; import com.bazaarvoice.ostrich.RetryPolicy; import com.bazaarvoice.ostrich.ServiceFactory; import com.bazaarvoice.ostrich.healthcheck.ExponentialBackoffHealthCheckRetryDelay; import com.bazaarvoice.ostrich.healthcheck.HealthCheckRetryDelay; import com.bazaarvoice.ostrich.loadbalance.RandomAlgorithm; import com.bazaarvoice.ostrich.partition.IdentityPartitionFilter; import com.bazaarvoice.ostrich.partition.PartitionFilter; import com.bazaarvoice.ostrich.partition.PartitionKey; import com.codahale.metrics.MetricRegistry; import com.google.common.annotations.VisibleForTesting; import com.google.common.base.Strings; import com.google.common.base.Throwables; import com.google.common.base.Ticker; import com.google.common.collect.Lists; import com.google.common.util.concurrent.ThreadFactoryBuilder; import java.io.IOException; import java.util.List; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.ThreadFactory; import java.util.concurrent.TimeUnit; import static com.google.common.base.Preconditions.checkArgument; import static com.google.common.base.Preconditions.checkNotNull; import static java.lang.String.format; package com.bazaarvoice.ostrich.pool; public class ServicePoolBuilder<S> { private static final int DEFAULT_NUM_HEALTH_CHECK_THREADS = 1; private static final HealthCheckRetryDelay DEFAULT_HEALTH_CHECK_RETRY_POLICY = new ExponentialBackoffHealthCheckRetryDelay(100, 10_000, TimeUnit.MILLISECONDS); private final Class<S> _serviceType; private final List<HostDiscoverySource> _hostDiscoverySources = Lists.newArrayList(); private boolean _closeHostDiscovery; private ServiceFactory<S> _serviceFactory; private String _serviceName; private ScheduledExecutorService _healthCheckExecutor; private ServiceCachingPolicy _cachingPolicy; private PartitionFilter _partitionFilter = new IdentityPartitionFilter(); private PartitionContextSupplier _partitionContextSupplier = new EmptyPartitionContextSupplier();
private LoadBalanceAlgorithm _loadBalanceAlgorithm = new RandomAlgorithm();
bazaarvoice/ostrich
examples/dictionary/service/src/main/java/com/bazaarvoice/ostrich/examples/dictionary/service/DictionaryResource.java
// Path: examples/dictionary/client/src/main/java/com/bazaarvoice/ostrich/examples/dictionary/client/WordRange.java // public class WordRange implements Predicate<String> { // private static final Pattern RANGE_PATTERN = Pattern.compile("(\\w*)-(\\w*)", Pattern.CASE_INSENSITIVE); // // private final String rangeString; // private final NavigableMap<String, String> ranges; // // public WordRange(String rangeString) { // this.rangeString = rangeString; // // // Parse the range string into a TreeMap of "start -> end". // NavigableMap<String, String> ranges = Maps.newTreeMap(); // for (String range : Splitter.on(',').omitEmptyStrings().trimResults().split(rangeString)) { // Matcher matcher = RANGE_PATTERN.matcher(range); // if (!matcher.matches()) { // throw new IllegalArgumentException(format("Invalid word range: %s", range)); // } // String from = matcher.group(1).toLowerCase(); // String to = matcher.group(2).toLowerCase() + Character.MAX_VALUE; // // // Make sure the low end of the range is less than the high end, unless the high end is open. // checkArgument(from.compareTo(to) <= 0 || to.isEmpty(), "Low end of range must be first: %s", range); // // // Check that the range don't overlap with each other (the apply fn below assumes ranges are disjoint) // Map.Entry<String, String> existingRange = ranges.floorEntry(to); // if (existingRange != null && existingRange.getValue().compareTo(from) >= 0) { // String conflictFrom = existingRange.getKey(); // String conflictTo = existingRange.getValue(); // throw new IllegalArgumentException(format("Individual ranges may not overlap: %s-%s vs. %s", // conflictFrom, conflictTo.substring(0, conflictTo.length() - 1), range)); // } // // ranges.put(from, to); // } // checkArgument(!ranges.isEmpty(), "Empty word range: %s", rangeString); // // this.ranges = ranges; // } // // @Override // public boolean apply(String string) { // String lower = string.toLowerCase(); // Map.Entry<String, String> entry = ranges.floorEntry(lower); // return entry != null && lower.compareTo(entry.getValue()) <= 0; // } // // @Override // @JsonValue // public String toString() { // return rangeString; // } // }
import com.bazaarvoice.ostrich.examples.dictionary.client.WordRange; import com.codahale.metrics.annotation.Timed; import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.Produces; import javax.ws.rs.WebApplicationException; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import static com.google.common.base.Preconditions.checkArgument;
package com.bazaarvoice.ostrich.examples.dictionary.service; /** * A Dropwizard+Jersey-based RESTful implementation of a simple dictionary service. * <p> * Note: the url contains the service name "dictionary" to allow multiple services to be hosted on the same server. * It contains the version number "1" to allow multiple versions of the same service to be hosted on the same server. * Future backward-incompatible versions of the dictionary API can be hosted at "/dictionary/2", .... * <p> * Contains a backdoor for simulating server outages. */ @Path("/dictionary/1") @Produces(MediaType.APPLICATION_JSON) public class DictionaryResource { private final WordList _words;
// Path: examples/dictionary/client/src/main/java/com/bazaarvoice/ostrich/examples/dictionary/client/WordRange.java // public class WordRange implements Predicate<String> { // private static final Pattern RANGE_PATTERN = Pattern.compile("(\\w*)-(\\w*)", Pattern.CASE_INSENSITIVE); // // private final String rangeString; // private final NavigableMap<String, String> ranges; // // public WordRange(String rangeString) { // this.rangeString = rangeString; // // // Parse the range string into a TreeMap of "start -> end". // NavigableMap<String, String> ranges = Maps.newTreeMap(); // for (String range : Splitter.on(',').omitEmptyStrings().trimResults().split(rangeString)) { // Matcher matcher = RANGE_PATTERN.matcher(range); // if (!matcher.matches()) { // throw new IllegalArgumentException(format("Invalid word range: %s", range)); // } // String from = matcher.group(1).toLowerCase(); // String to = matcher.group(2).toLowerCase() + Character.MAX_VALUE; // // // Make sure the low end of the range is less than the high end, unless the high end is open. // checkArgument(from.compareTo(to) <= 0 || to.isEmpty(), "Low end of range must be first: %s", range); // // // Check that the range don't overlap with each other (the apply fn below assumes ranges are disjoint) // Map.Entry<String, String> existingRange = ranges.floorEntry(to); // if (existingRange != null && existingRange.getValue().compareTo(from) >= 0) { // String conflictFrom = existingRange.getKey(); // String conflictTo = existingRange.getValue(); // throw new IllegalArgumentException(format("Individual ranges may not overlap: %s-%s vs. %s", // conflictFrom, conflictTo.substring(0, conflictTo.length() - 1), range)); // } // // ranges.put(from, to); // } // checkArgument(!ranges.isEmpty(), "Empty word range: %s", rangeString); // // this.ranges = ranges; // } // // @Override // public boolean apply(String string) { // String lower = string.toLowerCase(); // Map.Entry<String, String> entry = ranges.floorEntry(lower); // return entry != null && lower.compareTo(entry.getValue()) <= 0; // } // // @Override // @JsonValue // public String toString() { // return rangeString; // } // } // Path: examples/dictionary/service/src/main/java/com/bazaarvoice/ostrich/examples/dictionary/service/DictionaryResource.java import com.bazaarvoice.ostrich.examples.dictionary.client.WordRange; import com.codahale.metrics.annotation.Timed; import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.Produces; import javax.ws.rs.WebApplicationException; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import static com.google.common.base.Preconditions.checkArgument; package com.bazaarvoice.ostrich.examples.dictionary.service; /** * A Dropwizard+Jersey-based RESTful implementation of a simple dictionary service. * <p> * Note: the url contains the service name "dictionary" to allow multiple services to be hosted on the same server. * It contains the version number "1" to allow multiple versions of the same service to be hosted on the same server. * Future backward-incompatible versions of the dictionary API can be hosted at "/dictionary/2", .... * <p> * Contains a backdoor for simulating server outages. */ @Path("/dictionary/1") @Produces(MediaType.APPLICATION_JSON) public class DictionaryResource { private final WordList _words;
private final WordRange _range;
bazaarvoice/ostrich
core/src/test/java/com/bazaarvoice/ostrich/pool/ServicePoolCachingTest.java
// Path: core/src/main/java/com/bazaarvoice/ostrich/LoadBalanceAlgorithm.java // public interface LoadBalanceAlgorithm { // /** // * Selects an end point to use based on a load balancing algorithm. If no end point can be chosen, then // * <code>null</code> is returned. // * // * @param endPoints The end points to choose from. // * @param statistics Usage statistics about the end points in case the load balancing algorithm needs some // * knowledge of the service pool's state. // * @return Which end point to use or <code>null</code> if one couldn't be chosen. // */ // ServiceEndPoint choose(Iterable<ServiceEndPoint> endPoints, ServicePoolStatistics statistics); // } // // Path: core/src/main/java/com/bazaarvoice/ostrich/PartitionContext.java // public interface PartitionContext { // /** // * Gets the default piece of context. In many cases, there is only a single piece of relevant context, which this // * method should provide. // * // * @return The default context data. // */ // Object get(); // // /** // * Gets the context for the specified key. // * @param key The key for the desired context data. // * @return The context data. // */ // Object get(String key); // // /** // * Gets a {@code Map} version of the context. The Map should be immutable. // * @return A {@code Map} with the same key/value pairs as this context. // */ // Map<String, Object> asMap(); // } // // Path: core/src/main/java/com/bazaarvoice/ostrich/healthcheck/FixedHealthCheckRetryDelay.java // public class FixedHealthCheckRetryDelay implements HealthCheckRetryDelay { // public static final FixedHealthCheckRetryDelay ZERO = new FixedHealthCheckRetryDelay(0, TimeUnit.MILLISECONDS); // // private final long _retryMillis; // // public FixedHealthCheckRetryDelay(long duration, TimeUnit unit) { // checkArgument(duration >= 0); // checkNotNull(unit); // // _retryMillis = unit.toMillis(duration); // } // // @Override // public long getDelay(int numAttempts, HealthCheckResult result) { // return _retryMillis; // } // }
import com.bazaarvoice.ostrich.HostDiscovery; import com.bazaarvoice.ostrich.LoadBalanceAlgorithm; import com.bazaarvoice.ostrich.PartitionContext; import com.bazaarvoice.ostrich.RetryPolicy; import com.bazaarvoice.ostrich.ServiceCallback; import com.bazaarvoice.ostrich.ServiceEndPoint; import com.bazaarvoice.ostrich.ServiceFactory; import com.bazaarvoice.ostrich.ServicePoolStatistics; import com.bazaarvoice.ostrich.exceptions.MaxRetriesException; import com.bazaarvoice.ostrich.exceptions.ServiceException; import com.bazaarvoice.ostrich.healthcheck.FixedHealthCheckRetryDelay; import com.bazaarvoice.ostrich.partition.PartitionFilter; import com.codahale.metrics.MetricRegistry; import com.google.common.base.Ticker; import com.google.common.collect.ImmutableList; import org.junit.After; import org.junit.Before; import org.junit.Test; import org.mockito.ArgumentCaptor; import org.mockito.invocation.InvocationOnMock; import org.mockito.stubbing.Answer; import java.io.IOException; import java.util.List; import java.util.concurrent.Callable; import java.util.concurrent.CountDownLatch; import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.Future; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeUnit; import static com.google.common.collect.Lists.newArrayList; import static org.junit.Assert.assertNotSame; import static org.junit.Assert.assertSame; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; import static org.mockito.Matchers.any; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when;
package com.bazaarvoice.ostrich.pool; public class ServicePoolCachingTest { private static final ServiceEndPoint FOO_ENDPOINT = mock(ServiceEndPoint.class); private static final RetryPolicy NEVER_RETRY = mock(RetryPolicy.class); private static final ServiceCachingPolicy CACHE_ONE_INSTANCE_PER_ENDPOINT = new ServiceCachingPolicyBuilder() .withMaxNumServiceInstancesPerEndPoint(1) .build(); private static final ServiceCallback<Service, Service> IDENTITY_CALLBACK = new ServiceCallback<Service, Service>() { @Override public Service call(Service service) throws ServiceException { return service; } }; private Ticker _ticker; private HostDiscovery _hostDiscovery; private ServiceFactory<Service> _serviceFactory;
// Path: core/src/main/java/com/bazaarvoice/ostrich/LoadBalanceAlgorithm.java // public interface LoadBalanceAlgorithm { // /** // * Selects an end point to use based on a load balancing algorithm. If no end point can be chosen, then // * <code>null</code> is returned. // * // * @param endPoints The end points to choose from. // * @param statistics Usage statistics about the end points in case the load balancing algorithm needs some // * knowledge of the service pool's state. // * @return Which end point to use or <code>null</code> if one couldn't be chosen. // */ // ServiceEndPoint choose(Iterable<ServiceEndPoint> endPoints, ServicePoolStatistics statistics); // } // // Path: core/src/main/java/com/bazaarvoice/ostrich/PartitionContext.java // public interface PartitionContext { // /** // * Gets the default piece of context. In many cases, there is only a single piece of relevant context, which this // * method should provide. // * // * @return The default context data. // */ // Object get(); // // /** // * Gets the context for the specified key. // * @param key The key for the desired context data. // * @return The context data. // */ // Object get(String key); // // /** // * Gets a {@code Map} version of the context. The Map should be immutable. // * @return A {@code Map} with the same key/value pairs as this context. // */ // Map<String, Object> asMap(); // } // // Path: core/src/main/java/com/bazaarvoice/ostrich/healthcheck/FixedHealthCheckRetryDelay.java // public class FixedHealthCheckRetryDelay implements HealthCheckRetryDelay { // public static final FixedHealthCheckRetryDelay ZERO = new FixedHealthCheckRetryDelay(0, TimeUnit.MILLISECONDS); // // private final long _retryMillis; // // public FixedHealthCheckRetryDelay(long duration, TimeUnit unit) { // checkArgument(duration >= 0); // checkNotNull(unit); // // _retryMillis = unit.toMillis(duration); // } // // @Override // public long getDelay(int numAttempts, HealthCheckResult result) { // return _retryMillis; // } // } // Path: core/src/test/java/com/bazaarvoice/ostrich/pool/ServicePoolCachingTest.java import com.bazaarvoice.ostrich.HostDiscovery; import com.bazaarvoice.ostrich.LoadBalanceAlgorithm; import com.bazaarvoice.ostrich.PartitionContext; import com.bazaarvoice.ostrich.RetryPolicy; import com.bazaarvoice.ostrich.ServiceCallback; import com.bazaarvoice.ostrich.ServiceEndPoint; import com.bazaarvoice.ostrich.ServiceFactory; import com.bazaarvoice.ostrich.ServicePoolStatistics; import com.bazaarvoice.ostrich.exceptions.MaxRetriesException; import com.bazaarvoice.ostrich.exceptions.ServiceException; import com.bazaarvoice.ostrich.healthcheck.FixedHealthCheckRetryDelay; import com.bazaarvoice.ostrich.partition.PartitionFilter; import com.codahale.metrics.MetricRegistry; import com.google.common.base.Ticker; import com.google.common.collect.ImmutableList; import org.junit.After; import org.junit.Before; import org.junit.Test; import org.mockito.ArgumentCaptor; import org.mockito.invocation.InvocationOnMock; import org.mockito.stubbing.Answer; import java.io.IOException; import java.util.List; import java.util.concurrent.Callable; import java.util.concurrent.CountDownLatch; import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.Future; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeUnit; import static com.google.common.collect.Lists.newArrayList; import static org.junit.Assert.assertNotSame; import static org.junit.Assert.assertSame; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; import static org.mockito.Matchers.any; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; package com.bazaarvoice.ostrich.pool; public class ServicePoolCachingTest { private static final ServiceEndPoint FOO_ENDPOINT = mock(ServiceEndPoint.class); private static final RetryPolicy NEVER_RETRY = mock(RetryPolicy.class); private static final ServiceCachingPolicy CACHE_ONE_INSTANCE_PER_ENDPOINT = new ServiceCachingPolicyBuilder() .withMaxNumServiceInstancesPerEndPoint(1) .build(); private static final ServiceCallback<Service, Service> IDENTITY_CALLBACK = new ServiceCallback<Service, Service>() { @Override public Service call(Service service) throws ServiceException { return service; } }; private Ticker _ticker; private HostDiscovery _hostDiscovery; private ServiceFactory<Service> _serviceFactory;
private LoadBalanceAlgorithm _loadBalanceAlgorithm;
bazaarvoice/ostrich
core/src/test/java/com/bazaarvoice/ostrich/pool/ServicePoolCachingTest.java
// Path: core/src/main/java/com/bazaarvoice/ostrich/LoadBalanceAlgorithm.java // public interface LoadBalanceAlgorithm { // /** // * Selects an end point to use based on a load balancing algorithm. If no end point can be chosen, then // * <code>null</code> is returned. // * // * @param endPoints The end points to choose from. // * @param statistics Usage statistics about the end points in case the load balancing algorithm needs some // * knowledge of the service pool's state. // * @return Which end point to use or <code>null</code> if one couldn't be chosen. // */ // ServiceEndPoint choose(Iterable<ServiceEndPoint> endPoints, ServicePoolStatistics statistics); // } // // Path: core/src/main/java/com/bazaarvoice/ostrich/PartitionContext.java // public interface PartitionContext { // /** // * Gets the default piece of context. In many cases, there is only a single piece of relevant context, which this // * method should provide. // * // * @return The default context data. // */ // Object get(); // // /** // * Gets the context for the specified key. // * @param key The key for the desired context data. // * @return The context data. // */ // Object get(String key); // // /** // * Gets a {@code Map} version of the context. The Map should be immutable. // * @return A {@code Map} with the same key/value pairs as this context. // */ // Map<String, Object> asMap(); // } // // Path: core/src/main/java/com/bazaarvoice/ostrich/healthcheck/FixedHealthCheckRetryDelay.java // public class FixedHealthCheckRetryDelay implements HealthCheckRetryDelay { // public static final FixedHealthCheckRetryDelay ZERO = new FixedHealthCheckRetryDelay(0, TimeUnit.MILLISECONDS); // // private final long _retryMillis; // // public FixedHealthCheckRetryDelay(long duration, TimeUnit unit) { // checkArgument(duration >= 0); // checkNotNull(unit); // // _retryMillis = unit.toMillis(duration); // } // // @Override // public long getDelay(int numAttempts, HealthCheckResult result) { // return _retryMillis; // } // }
import com.bazaarvoice.ostrich.HostDiscovery; import com.bazaarvoice.ostrich.LoadBalanceAlgorithm; import com.bazaarvoice.ostrich.PartitionContext; import com.bazaarvoice.ostrich.RetryPolicy; import com.bazaarvoice.ostrich.ServiceCallback; import com.bazaarvoice.ostrich.ServiceEndPoint; import com.bazaarvoice.ostrich.ServiceFactory; import com.bazaarvoice.ostrich.ServicePoolStatistics; import com.bazaarvoice.ostrich.exceptions.MaxRetriesException; import com.bazaarvoice.ostrich.exceptions.ServiceException; import com.bazaarvoice.ostrich.healthcheck.FixedHealthCheckRetryDelay; import com.bazaarvoice.ostrich.partition.PartitionFilter; import com.codahale.metrics.MetricRegistry; import com.google.common.base.Ticker; import com.google.common.collect.ImmutableList; import org.junit.After; import org.junit.Before; import org.junit.Test; import org.mockito.ArgumentCaptor; import org.mockito.invocation.InvocationOnMock; import org.mockito.stubbing.Answer; import java.io.IOException; import java.util.List; import java.util.concurrent.Callable; import java.util.concurrent.CountDownLatch; import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.Future; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeUnit; import static com.google.common.collect.Lists.newArrayList; import static org.junit.Assert.assertNotSame; import static org.junit.Assert.assertSame; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; import static org.mockito.Matchers.any; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when;
@SuppressWarnings("unchecked") @Before public void setup() { // // This setup method takes the approach of building a reasonably useful ServicePool using mocks that can then be // customized by individual test methods to add whatever functionality they need to (or ignored completely). // _ticker = mock(Ticker.class); _hostDiscovery = mock(HostDiscovery.class); when(_hostDiscovery.getHosts()).thenReturn(ImmutableList.of(FOO_ENDPOINT)); _loadBalanceAlgorithm = mock(LoadBalanceAlgorithm.class); when(_loadBalanceAlgorithm.choose(any(Iterable.class), any(ServicePoolStatistics.class))) .thenReturn(FOO_ENDPOINT); _serviceFactory = (ServiceFactory<Service>) mock(ServiceFactory.class); when(_serviceFactory.getServiceName()).thenReturn(Service.class.getSimpleName()); when(_serviceFactory.create(any(ServiceEndPoint.class))).then(new Answer<Service>() { @Override public Service answer(InvocationOnMock invocation) throws Throwable { return mock(Service.class); } }); when(_serviceFactory.isRetriableException(any(Exception.class))).thenReturn(true); _healthCheckExecutor = mock(ScheduledExecutorService.class); _partitionFilter = mock(PartitionFilter.class);
// Path: core/src/main/java/com/bazaarvoice/ostrich/LoadBalanceAlgorithm.java // public interface LoadBalanceAlgorithm { // /** // * Selects an end point to use based on a load balancing algorithm. If no end point can be chosen, then // * <code>null</code> is returned. // * // * @param endPoints The end points to choose from. // * @param statistics Usage statistics about the end points in case the load balancing algorithm needs some // * knowledge of the service pool's state. // * @return Which end point to use or <code>null</code> if one couldn't be chosen. // */ // ServiceEndPoint choose(Iterable<ServiceEndPoint> endPoints, ServicePoolStatistics statistics); // } // // Path: core/src/main/java/com/bazaarvoice/ostrich/PartitionContext.java // public interface PartitionContext { // /** // * Gets the default piece of context. In many cases, there is only a single piece of relevant context, which this // * method should provide. // * // * @return The default context data. // */ // Object get(); // // /** // * Gets the context for the specified key. // * @param key The key for the desired context data. // * @return The context data. // */ // Object get(String key); // // /** // * Gets a {@code Map} version of the context. The Map should be immutable. // * @return A {@code Map} with the same key/value pairs as this context. // */ // Map<String, Object> asMap(); // } // // Path: core/src/main/java/com/bazaarvoice/ostrich/healthcheck/FixedHealthCheckRetryDelay.java // public class FixedHealthCheckRetryDelay implements HealthCheckRetryDelay { // public static final FixedHealthCheckRetryDelay ZERO = new FixedHealthCheckRetryDelay(0, TimeUnit.MILLISECONDS); // // private final long _retryMillis; // // public FixedHealthCheckRetryDelay(long duration, TimeUnit unit) { // checkArgument(duration >= 0); // checkNotNull(unit); // // _retryMillis = unit.toMillis(duration); // } // // @Override // public long getDelay(int numAttempts, HealthCheckResult result) { // return _retryMillis; // } // } // Path: core/src/test/java/com/bazaarvoice/ostrich/pool/ServicePoolCachingTest.java import com.bazaarvoice.ostrich.HostDiscovery; import com.bazaarvoice.ostrich.LoadBalanceAlgorithm; import com.bazaarvoice.ostrich.PartitionContext; import com.bazaarvoice.ostrich.RetryPolicy; import com.bazaarvoice.ostrich.ServiceCallback; import com.bazaarvoice.ostrich.ServiceEndPoint; import com.bazaarvoice.ostrich.ServiceFactory; import com.bazaarvoice.ostrich.ServicePoolStatistics; import com.bazaarvoice.ostrich.exceptions.MaxRetriesException; import com.bazaarvoice.ostrich.exceptions.ServiceException; import com.bazaarvoice.ostrich.healthcheck.FixedHealthCheckRetryDelay; import com.bazaarvoice.ostrich.partition.PartitionFilter; import com.codahale.metrics.MetricRegistry; import com.google.common.base.Ticker; import com.google.common.collect.ImmutableList; import org.junit.After; import org.junit.Before; import org.junit.Test; import org.mockito.ArgumentCaptor; import org.mockito.invocation.InvocationOnMock; import org.mockito.stubbing.Answer; import java.io.IOException; import java.util.List; import java.util.concurrent.Callable; import java.util.concurrent.CountDownLatch; import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.Future; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeUnit; import static com.google.common.collect.Lists.newArrayList; import static org.junit.Assert.assertNotSame; import static org.junit.Assert.assertSame; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; import static org.mockito.Matchers.any; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; @SuppressWarnings("unchecked") @Before public void setup() { // // This setup method takes the approach of building a reasonably useful ServicePool using mocks that can then be // customized by individual test methods to add whatever functionality they need to (or ignored completely). // _ticker = mock(Ticker.class); _hostDiscovery = mock(HostDiscovery.class); when(_hostDiscovery.getHosts()).thenReturn(ImmutableList.of(FOO_ENDPOINT)); _loadBalanceAlgorithm = mock(LoadBalanceAlgorithm.class); when(_loadBalanceAlgorithm.choose(any(Iterable.class), any(ServicePoolStatistics.class))) .thenReturn(FOO_ENDPOINT); _serviceFactory = (ServiceFactory<Service>) mock(ServiceFactory.class); when(_serviceFactory.getServiceName()).thenReturn(Service.class.getSimpleName()); when(_serviceFactory.create(any(ServiceEndPoint.class))).then(new Answer<Service>() { @Override public Service answer(InvocationOnMock invocation) throws Throwable { return mock(Service.class); } }); when(_serviceFactory.isRetriableException(any(Exception.class))).thenReturn(true); _healthCheckExecutor = mock(ScheduledExecutorService.class); _partitionFilter = mock(PartitionFilter.class);
when(_partitionFilter.filter(any(Iterable.class), any(PartitionContext.class)))
bazaarvoice/ostrich
core/src/test/java/com/bazaarvoice/ostrich/pool/ServicePoolCachingTest.java
// Path: core/src/main/java/com/bazaarvoice/ostrich/LoadBalanceAlgorithm.java // public interface LoadBalanceAlgorithm { // /** // * Selects an end point to use based on a load balancing algorithm. If no end point can be chosen, then // * <code>null</code> is returned. // * // * @param endPoints The end points to choose from. // * @param statistics Usage statistics about the end points in case the load balancing algorithm needs some // * knowledge of the service pool's state. // * @return Which end point to use or <code>null</code> if one couldn't be chosen. // */ // ServiceEndPoint choose(Iterable<ServiceEndPoint> endPoints, ServicePoolStatistics statistics); // } // // Path: core/src/main/java/com/bazaarvoice/ostrich/PartitionContext.java // public interface PartitionContext { // /** // * Gets the default piece of context. In many cases, there is only a single piece of relevant context, which this // * method should provide. // * // * @return The default context data. // */ // Object get(); // // /** // * Gets the context for the specified key. // * @param key The key for the desired context data. // * @return The context data. // */ // Object get(String key); // // /** // * Gets a {@code Map} version of the context. The Map should be immutable. // * @return A {@code Map} with the same key/value pairs as this context. // */ // Map<String, Object> asMap(); // } // // Path: core/src/main/java/com/bazaarvoice/ostrich/healthcheck/FixedHealthCheckRetryDelay.java // public class FixedHealthCheckRetryDelay implements HealthCheckRetryDelay { // public static final FixedHealthCheckRetryDelay ZERO = new FixedHealthCheckRetryDelay(0, TimeUnit.MILLISECONDS); // // private final long _retryMillis; // // public FixedHealthCheckRetryDelay(long duration, TimeUnit unit) { // checkArgument(duration >= 0); // checkNotNull(unit); // // _retryMillis = unit.toMillis(duration); // } // // @Override // public long getDelay(int numAttempts, HealthCheckResult result) { // return _retryMillis; // } // }
import com.bazaarvoice.ostrich.HostDiscovery; import com.bazaarvoice.ostrich.LoadBalanceAlgorithm; import com.bazaarvoice.ostrich.PartitionContext; import com.bazaarvoice.ostrich.RetryPolicy; import com.bazaarvoice.ostrich.ServiceCallback; import com.bazaarvoice.ostrich.ServiceEndPoint; import com.bazaarvoice.ostrich.ServiceFactory; import com.bazaarvoice.ostrich.ServicePoolStatistics; import com.bazaarvoice.ostrich.exceptions.MaxRetriesException; import com.bazaarvoice.ostrich.exceptions.ServiceException; import com.bazaarvoice.ostrich.healthcheck.FixedHealthCheckRetryDelay; import com.bazaarvoice.ostrich.partition.PartitionFilter; import com.codahale.metrics.MetricRegistry; import com.google.common.base.Ticker; import com.google.common.collect.ImmutableList; import org.junit.After; import org.junit.Before; import org.junit.Test; import org.mockito.ArgumentCaptor; import org.mockito.invocation.InvocationOnMock; import org.mockito.stubbing.Answer; import java.io.IOException; import java.util.List; import java.util.concurrent.Callable; import java.util.concurrent.CountDownLatch; import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.Future; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeUnit; import static com.google.common.collect.Lists.newArrayList; import static org.junit.Assert.assertNotSame; import static org.junit.Assert.assertSame; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; import static org.mockito.Matchers.any; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when;
}); } }); // Wait until the callable has definitely started and allocated a service instance... assertTrue(callableStarted.await(10, TimeUnit.SECONDS)); // Capture the end point listener that was registered with HostDiscovery ArgumentCaptor<HostDiscovery.EndPointListener> listener = ArgumentCaptor.forClass( HostDiscovery.EndPointListener.class); verify(_hostDiscovery).addListener(listener.capture()); // Remove the end point from host discovery then add it back listener.getValue().onEndPointRemoved(FOO_ENDPOINT); listener.getValue().onEndPointAdded(FOO_ENDPOINT); // Let the initial callback terminate... canReturn.countDown(); pool.forceHealthChecks(); assertNotSame(serviceFuture.get(), pool.execute(NEVER_RETRY, IDENTITY_CALLBACK)); } finally { executor.shutdown(); } } private ServicePool<Service> newPool(ServiceCachingPolicy cachingPolicy) { ServicePool<Service> pool = new ServicePool<>(_ticker, _hostDiscovery, false, _serviceFactory, cachingPolicy,
// Path: core/src/main/java/com/bazaarvoice/ostrich/LoadBalanceAlgorithm.java // public interface LoadBalanceAlgorithm { // /** // * Selects an end point to use based on a load balancing algorithm. If no end point can be chosen, then // * <code>null</code> is returned. // * // * @param endPoints The end points to choose from. // * @param statistics Usage statistics about the end points in case the load balancing algorithm needs some // * knowledge of the service pool's state. // * @return Which end point to use or <code>null</code> if one couldn't be chosen. // */ // ServiceEndPoint choose(Iterable<ServiceEndPoint> endPoints, ServicePoolStatistics statistics); // } // // Path: core/src/main/java/com/bazaarvoice/ostrich/PartitionContext.java // public interface PartitionContext { // /** // * Gets the default piece of context. In many cases, there is only a single piece of relevant context, which this // * method should provide. // * // * @return The default context data. // */ // Object get(); // // /** // * Gets the context for the specified key. // * @param key The key for the desired context data. // * @return The context data. // */ // Object get(String key); // // /** // * Gets a {@code Map} version of the context. The Map should be immutable. // * @return A {@code Map} with the same key/value pairs as this context. // */ // Map<String, Object> asMap(); // } // // Path: core/src/main/java/com/bazaarvoice/ostrich/healthcheck/FixedHealthCheckRetryDelay.java // public class FixedHealthCheckRetryDelay implements HealthCheckRetryDelay { // public static final FixedHealthCheckRetryDelay ZERO = new FixedHealthCheckRetryDelay(0, TimeUnit.MILLISECONDS); // // private final long _retryMillis; // // public FixedHealthCheckRetryDelay(long duration, TimeUnit unit) { // checkArgument(duration >= 0); // checkNotNull(unit); // // _retryMillis = unit.toMillis(duration); // } // // @Override // public long getDelay(int numAttempts, HealthCheckResult result) { // return _retryMillis; // } // } // Path: core/src/test/java/com/bazaarvoice/ostrich/pool/ServicePoolCachingTest.java import com.bazaarvoice.ostrich.HostDiscovery; import com.bazaarvoice.ostrich.LoadBalanceAlgorithm; import com.bazaarvoice.ostrich.PartitionContext; import com.bazaarvoice.ostrich.RetryPolicy; import com.bazaarvoice.ostrich.ServiceCallback; import com.bazaarvoice.ostrich.ServiceEndPoint; import com.bazaarvoice.ostrich.ServiceFactory; import com.bazaarvoice.ostrich.ServicePoolStatistics; import com.bazaarvoice.ostrich.exceptions.MaxRetriesException; import com.bazaarvoice.ostrich.exceptions.ServiceException; import com.bazaarvoice.ostrich.healthcheck.FixedHealthCheckRetryDelay; import com.bazaarvoice.ostrich.partition.PartitionFilter; import com.codahale.metrics.MetricRegistry; import com.google.common.base.Ticker; import com.google.common.collect.ImmutableList; import org.junit.After; import org.junit.Before; import org.junit.Test; import org.mockito.ArgumentCaptor; import org.mockito.invocation.InvocationOnMock; import org.mockito.stubbing.Answer; import java.io.IOException; import java.util.List; import java.util.concurrent.Callable; import java.util.concurrent.CountDownLatch; import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.Future; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeUnit; import static com.google.common.collect.Lists.newArrayList; import static org.junit.Assert.assertNotSame; import static org.junit.Assert.assertSame; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; import static org.mockito.Matchers.any; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; }); } }); // Wait until the callable has definitely started and allocated a service instance... assertTrue(callableStarted.await(10, TimeUnit.SECONDS)); // Capture the end point listener that was registered with HostDiscovery ArgumentCaptor<HostDiscovery.EndPointListener> listener = ArgumentCaptor.forClass( HostDiscovery.EndPointListener.class); verify(_hostDiscovery).addListener(listener.capture()); // Remove the end point from host discovery then add it back listener.getValue().onEndPointRemoved(FOO_ENDPOINT); listener.getValue().onEndPointAdded(FOO_ENDPOINT); // Let the initial callback terminate... canReturn.countDown(); pool.forceHealthChecks(); assertNotSame(serviceFuture.get(), pool.execute(NEVER_RETRY, IDENTITY_CALLBACK)); } finally { executor.shutdown(); } } private ServicePool<Service> newPool(ServiceCachingPolicy cachingPolicy) { ServicePool<Service> pool = new ServicePool<>(_ticker, _hostDiscovery, false, _serviceFactory, cachingPolicy,
_partitionFilter, _loadBalanceAlgorithm, _healthCheckExecutor, true, FixedHealthCheckRetryDelay.ZERO, _registry);
bazaarvoice/ostrich
core/src/test/java/com/bazaarvoice/ostrich/pool/ServicePoolProxiesTest.java
// Path: core/src/main/java/com/bazaarvoice/ostrich/HealthCheckResults.java // public interface HealthCheckResults { // /** // * @return {@code true} if there is a healthy result, {@code false} otherwise. // */ // boolean hasHealthyResult(); // // /** // * @return All results in the aggregate, regardless of health. // */ // Iterable<HealthCheckResult> getAllResults(); // // /** // * Returns a healthy result if {@link #hasHealthyResult} is {@code true}. Returns {@code null} when // * {@code hasHealthyResult} is false. If there are multiple healthy results, there is no guarantee as to which gets // * returned. // * @return A result in the aggregate whose {@link HealthCheckResult#isHealthy} method returns {@code true}, or // * {@code null} if there are none. // */ // HealthCheckResult getHealthyResult(); // // /** // * @return Results in the aggregate whose {@link HealthCheckResult#isHealthy} method returns {@code false}. // */ // Iterable<HealthCheckResult> getUnhealthyResults(); // }
import com.bazaarvoice.ostrich.HealthCheckResults; import com.bazaarvoice.ostrich.RetryPolicy; import com.bazaarvoice.ostrich.ServicePool; import com.google.common.reflect.Reflection; import org.junit.Test; import java.io.IOException; import java.lang.reflect.InvocationHandler; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertSame; import static org.junit.Assert.assertTrue; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when;
Service service = Reflection.newProxy(Service.class, mock(InvocationHandler.class)); assertFalse(ServicePoolProxies.isProxy(service)); } @Test public void testIsProxy() throws IOException { @SuppressWarnings("unchecked") Service service = ServicePoolProxy.create(Service.class, mock(RetryPolicy.class), mock(ServicePool.class), mock(PartitionContextSupplier.class), true); assertTrue(ServicePoolProxies.isProxy(service)); } @Test public void testClose() throws IOException { @SuppressWarnings("unchecked") ServicePool<Service> pool = mock(ServicePool.class); Service service = ServicePoolProxy.create(Service.class, mock(RetryPolicy.class), pool, mock(PartitionContextSupplier.class), true); ServicePoolProxies.close(service); verify(pool).close(); } @SuppressWarnings("unchecked") @Test public void testCheckForHealthyEndPoint() { ServicePool<Service> pool = mock(ServicePool.class);
// Path: core/src/main/java/com/bazaarvoice/ostrich/HealthCheckResults.java // public interface HealthCheckResults { // /** // * @return {@code true} if there is a healthy result, {@code false} otherwise. // */ // boolean hasHealthyResult(); // // /** // * @return All results in the aggregate, regardless of health. // */ // Iterable<HealthCheckResult> getAllResults(); // // /** // * Returns a healthy result if {@link #hasHealthyResult} is {@code true}. Returns {@code null} when // * {@code hasHealthyResult} is false. If there are multiple healthy results, there is no guarantee as to which gets // * returned. // * @return A result in the aggregate whose {@link HealthCheckResult#isHealthy} method returns {@code true}, or // * {@code null} if there are none. // */ // HealthCheckResult getHealthyResult(); // // /** // * @return Results in the aggregate whose {@link HealthCheckResult#isHealthy} method returns {@code false}. // */ // Iterable<HealthCheckResult> getUnhealthyResults(); // } // Path: core/src/test/java/com/bazaarvoice/ostrich/pool/ServicePoolProxiesTest.java import com.bazaarvoice.ostrich.HealthCheckResults; import com.bazaarvoice.ostrich.RetryPolicy; import com.bazaarvoice.ostrich.ServicePool; import com.google.common.reflect.Reflection; import org.junit.Test; import java.io.IOException; import java.lang.reflect.InvocationHandler; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertSame; import static org.junit.Assert.assertTrue; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; Service service = Reflection.newProxy(Service.class, mock(InvocationHandler.class)); assertFalse(ServicePoolProxies.isProxy(service)); } @Test public void testIsProxy() throws IOException { @SuppressWarnings("unchecked") Service service = ServicePoolProxy.create(Service.class, mock(RetryPolicy.class), mock(ServicePool.class), mock(PartitionContextSupplier.class), true); assertTrue(ServicePoolProxies.isProxy(service)); } @Test public void testClose() throws IOException { @SuppressWarnings("unchecked") ServicePool<Service> pool = mock(ServicePool.class); Service service = ServicePoolProxy.create(Service.class, mock(RetryPolicy.class), pool, mock(PartitionContextSupplier.class), true); ServicePoolProxies.close(service); verify(pool).close(); } @SuppressWarnings("unchecked") @Test public void testCheckForHealthyEndPoint() { ServicePool<Service> pool = mock(ServicePool.class);
HealthCheckResults results = mock(HealthCheckResults.class);
winterstein/elasticsearch-java-client
src/com/winterwell/es/client/MultiGetRequestBuilder.java
// Path: src/com/winterwell/es/ESPath.java // public final class ESPath<T> { // // @Override // public int hashCode() { // final int prime = 31; // int result = 1; // result = prime * result + ((id == null) ? 0 : id.hashCode()); // result = prime * result + Arrays.hashCode(indices); // // result = prime * result + ((type == null) ? 0 : type.hashCode()); // return result; // } // // @Override // public boolean equals(Object obj) { // if (this == obj) // return true; // if (obj == null) // return false; // if (getClass() != obj.getClass()) // return false; // ESPath other = (ESPath) obj; // if (id == null) { // if (other.id != null) // return false; // } else if ( ! id.equals(other.id)) // return false; // if ( ! Arrays.equals(indices, other.indices)) // return false; // return true; // } // // public final String id; // // /** // * @deprecated types are gone in ESv7 // */ // public final String type; // // public final String[] indices; // // public ESPath(String index, CharSequence id) { // this(new String[]{index},null,id); // } // public ESPath(String[] indices, CharSequence id) { // this(indices, null, id); // } // // /** // * @deprecated go typeless // * @param indices // * @param type // * @param id // */ // public ESPath(String[] indices, String type, CharSequence id) { // this.id = id==null? null : id.toString(); // this.type = type; // this.indices = indices; // } // // /** // * @deprecated go typeless // * @param indices // * @param type // * @param id // */ // public ESPath(Collection<String> indices, String type, CharSequence id) { // this(indices.toArray(StrUtils.ARRAY), type, id); // } // // /** // * @deprecated go typeless // * @param index // * @param type // * @param id // */ // public ESPath(String index, String type, CharSequence id) { // this(new String[] {index}, type, id); // } // // @Override // public String toString() { // return "ESPath[" +Arrays.toString(indices)+" / id: " +id+ "]"; // } // // public String index() { // assert indices.length == 1 : this; // return indices[0]; // } // // // }
import java.util.ArrayList; import java.util.List; import java.util.Map; import com.winterwell.es.ESPath; import com.winterwell.utils.StrUtils; import com.winterwell.utils.containers.ArrayMap; import com.winterwell.utils.containers.Containers;
package com.winterwell.es.client; /** * * See https://www.elastic.co/guide/en/elasticsearch/guide/current/_retrieving_multiple_documents.html * * result: * docs: [{found: Boolean, _index, _type, _id, _version, _source}] * * @author daniel * */ public class MultiGetRequestBuilder extends ESHttpRequest<MultiGetRequestBuilder, IESResponse> { boolean sourceOnly;
// Path: src/com/winterwell/es/ESPath.java // public final class ESPath<T> { // // @Override // public int hashCode() { // final int prime = 31; // int result = 1; // result = prime * result + ((id == null) ? 0 : id.hashCode()); // result = prime * result + Arrays.hashCode(indices); // // result = prime * result + ((type == null) ? 0 : type.hashCode()); // return result; // } // // @Override // public boolean equals(Object obj) { // if (this == obj) // return true; // if (obj == null) // return false; // if (getClass() != obj.getClass()) // return false; // ESPath other = (ESPath) obj; // if (id == null) { // if (other.id != null) // return false; // } else if ( ! id.equals(other.id)) // return false; // if ( ! Arrays.equals(indices, other.indices)) // return false; // return true; // } // // public final String id; // // /** // * @deprecated types are gone in ESv7 // */ // public final String type; // // public final String[] indices; // // public ESPath(String index, CharSequence id) { // this(new String[]{index},null,id); // } // public ESPath(String[] indices, CharSequence id) { // this(indices, null, id); // } // // /** // * @deprecated go typeless // * @param indices // * @param type // * @param id // */ // public ESPath(String[] indices, String type, CharSequence id) { // this.id = id==null? null : id.toString(); // this.type = type; // this.indices = indices; // } // // /** // * @deprecated go typeless // * @param indices // * @param type // * @param id // */ // public ESPath(Collection<String> indices, String type, CharSequence id) { // this(indices.toArray(StrUtils.ARRAY), type, id); // } // // /** // * @deprecated go typeless // * @param index // * @param type // * @param id // */ // public ESPath(String index, String type, CharSequence id) { // this(new String[] {index}, type, id); // } // // @Override // public String toString() { // return "ESPath[" +Arrays.toString(indices)+" / id: " +id+ "]"; // } // // public String index() { // assert indices.length == 1 : this; // return indices[0]; // } // // // } // Path: src/com/winterwell/es/client/MultiGetRequestBuilder.java import java.util.ArrayList; import java.util.List; import java.util.Map; import com.winterwell.es.ESPath; import com.winterwell.utils.StrUtils; import com.winterwell.utils.containers.ArrayMap; import com.winterwell.utils.containers.Containers; package com.winterwell.es.client; /** * * See https://www.elastic.co/guide/en/elasticsearch/guide/current/_retrieving_multiple_documents.html * * result: * docs: [{found: Boolean, _index, _type, _id, _version, _source}] * * @author daniel * */ public class MultiGetRequestBuilder extends ESHttpRequest<MultiGetRequestBuilder, IESResponse> { boolean sourceOnly;
private List<ESPath> docs = new ArrayList();
winterstein/elasticsearch-java-client
src/com/winterwell/es/client/SearchResponse.java
// Path: src/com/winterwell/es/client/agg/AggregationResults.java // public class AggregationResults { // // private String name; // private Map results; // // public AggregationResults(String aggName, Map rs) { // this.name = aggName; // this.results = rs; // } // // @Override // public String toString() { // return "AggregationResults[ "+name+": "+results+"]"; // } // }
import java.util.List; import java.util.Map; import com.winterwell.es.client.agg.AggregationResults; import com.winterwell.web.WebEx;
package com.winterwell.es.client; public interface SearchResponse extends IESResponse { /** * @return List of hits, which are wrapper objects around a _source document. * @throws WebEx if the search failed. */ List<Map> getHits(); Map getFacets(); /** * The initial search request and each subsequent scroll request returns a new scroll_id. * <b>Only the most recent scroll_id should be used.</b> * @return the new scroll_id for the next request */ String getScrollId(); /** * @return the total possible number results which could be returned for query, * not necessarily the amount which WILL be returned (See ResultsPerPage) * */ long getTotal(); Map getAggregations(); /** * Like {@link #getHits()} then get _source, but without any gson to-POJO conversion. * @return list of documents * @see #getSearchResults(Class) */ List<Map<String,Object>> getSearchResults(); <X> List<X> getSearchResults(Class<? extends X> klass);
// Path: src/com/winterwell/es/client/agg/AggregationResults.java // public class AggregationResults { // // private String name; // private Map results; // // public AggregationResults(String aggName, Map rs) { // this.name = aggName; // this.results = rs; // } // // @Override // public String toString() { // return "AggregationResults[ "+name+": "+results+"]"; // } // } // Path: src/com/winterwell/es/client/SearchResponse.java import java.util.List; import java.util.Map; import com.winterwell.es.client.agg.AggregationResults; import com.winterwell.web.WebEx; package com.winterwell.es.client; public interface SearchResponse extends IESResponse { /** * @return List of hits, which are wrapper objects around a _source document. * @throws WebEx if the search failed. */ List<Map> getHits(); Map getFacets(); /** * The initial search request and each subsequent scroll request returns a new scroll_id. * <b>Only the most recent scroll_id should be used.</b> * @return the new scroll_id for the next request */ String getScrollId(); /** * @return the total possible number results which could be returned for query, * not necessarily the amount which WILL be returned (See ResultsPerPage) * */ long getTotal(); Map getAggregations(); /** * Like {@link #getHits()} then get _source, but without any gson to-POJO conversion. * @return list of documents * @see #getSearchResults(Class) */ List<Map<String,Object>> getSearchResults(); <X> List<X> getSearchResults(Class<? extends X> klass);
AggregationResults getAggregationResults(String name);
winterstein/elasticsearch-java-client
src/com/winterwell/es/ESUtils.java
// Path: src/shadoworg/elasticsearch/common/xcontent/ToXContent.java // @Deprecated // public interface ToXContent { // // }
import java.util.HashMap; import java.util.List; import java.util.Map; import shadoworg.elasticsearch.common.xcontent.ToXContent; import com.winterwell.gson.FlexiGson; import com.winterwell.utils.StrUtils; import com.winterwell.utils.containers.ArrayMap; import com.winterwell.utils.containers.Containers;
/** * */ package com.winterwell.es; /** * Elastic Search utils * * @author daniel * */ public class ESUtils { /** * See http://www.elasticsearch.org/guide/en/elasticsearch/reference/1.x/ * mapping-core-types.html * * @return an ElasticSearch type builder, which (being a Map) can be * submitted to PutMapping. This is just a convenience for <code>new ESType()</code>. */ public static ESType type() { return new ESType(); } /** See http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl-query-string-query.html#_reserved_characters */ public static String escapeWord(String s) { if (s==null) return null; String chars = "+-&|!(){}[]^\"~*?:\\/"; String s2 = StrUtils.escape(s, chars, '\\'); // Note "&" will also have to be url-encoded! return s2; } /** * HACK convert an ES class into a json object. * TODO replace these ES classes with something nicer. * Preferably auto-generated from the ES source * @param qb * @return */
// Path: src/shadoworg/elasticsearch/common/xcontent/ToXContent.java // @Deprecated // public interface ToXContent { // // } // Path: src/com/winterwell/es/ESUtils.java import java.util.HashMap; import java.util.List; import java.util.Map; import shadoworg.elasticsearch.common.xcontent.ToXContent; import com.winterwell.gson.FlexiGson; import com.winterwell.utils.StrUtils; import com.winterwell.utils.containers.ArrayMap; import com.winterwell.utils.containers.Containers; /** * */ package com.winterwell.es; /** * Elastic Search utils * * @author daniel * */ public class ESUtils { /** * See http://www.elasticsearch.org/guide/en/elasticsearch/reference/1.x/ * mapping-core-types.html * * @return an ElasticSearch type builder, which (being a Map) can be * submitted to PutMapping. This is just a convenience for <code>new ESType()</code>. */ public static ESType type() { return new ESType(); } /** See http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl-query-string-query.html#_reserved_characters */ public static String escapeWord(String s) { if (s==null) return null; String chars = "+-&|!(){}[]^\"~*?:\\/"; String s2 = StrUtils.escape(s, chars, '\\'); // Note "&" will also have to be url-encoded! return s2; } /** * HACK convert an ES class into a json object. * TODO replace these ES classes with something nicer. * Preferably auto-generated from the ES source * @param qb * @return */
public static Map jobj(ToXContent qb) {
winterstein/elasticsearch-java-client
src/com/winterwell/es/client/query/ESQueryBuilder.java
// Path: src/com/winterwell/es/ESUtils.java // public class ESUtils { // // // /** // * See http://www.elasticsearch.org/guide/en/elasticsearch/reference/1.x/ // * mapping-core-types.html // * // * @return an ElasticSearch type builder, which (being a Map) can be // * submitted to PutMapping. This is just a convenience for <code>new ESType()</code>. // */ // public static ESType type() { // return new ESType(); // } // // /** // See http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl-query-string-query.html#_reserved_characters // */ // public static String escapeWord(String s) { // if (s==null) return null; // String chars = "+-&|!(){}[]^\"~*?:\\/"; // String s2 = StrUtils.escape(s, chars, '\\'); // // Note "&" will also have to be url-encoded! // return s2; // } // // /** // * HACK convert an ES class into a json object. // * TODO replace these ES classes with something nicer. // * Preferably auto-generated from the ES source // * @param qb // * @return // */ // public static Map jobj(ToXContent qb) { // String s = qb.toString(); // return FlexiGson.fromJSON(s); // } // // /** // * ElasticSearch gets upset by many keys (they explode the schema) // * so we can't store maps the obvious way. // * @param map // * @param k What to call the key-key in the output mini-maps, e.g. "key" or "k" // * @param v What to call the value-key in the output mini-maps, e.g. "value" or "v" // * @return a sort of association list, where each key:value mapping // * is turned into a {k:key, v:value} map in a list // */ // public static List<Map<String,Object>> assocListFromMap(Map<String, ?> map, String k, String v) { // List<Map<String, Object>> list = Containers.apply(map.entrySet(), // e -> new ArrayMap(k, e.getKey(), v, e.getValue()) // ); // return list; // } // // public static <V> Map<String, V> mapFromAssocList(List<Map<String,Object>> topmapList, // String k, String v) // { // Map<String, V> map = new HashMap(); // for (Map<String, Object> kv : topmapList) { // map.put((String)kv.get(k), (V) kv.get(v)); // } // return map; // } // // } // // Path: src/shadoworg/elasticsearch/index/query/QueryBuilder/QueryBuilder.java // @Deprecated // public class QueryBuilder implements ToXContent { // // }
import java.util.Map; import com.winterwell.es.ESUtils; import com.winterwell.utils.containers.ArrayMap; import com.winterwell.utils.containers.Containers; import com.winterwell.utils.web.IHasJson; import shadoworg.elasticsearch.index.query.QueryBuilder.QueryBuilder;
package com.winterwell.es.client.query; /** * Base class for query-builders. For common cases use the convenience methods in {@link ESQueryBuilders} * @author daniel * */ public class ESQueryBuilder implements IHasJson, Cloneable { @Override public ESQueryBuilder clone() { ESQueryBuilder clone = new ESQueryBuilder(new ArrayMap(jobj)); return clone; } @Override public String toString() { boolean prelock = lock; // HACK - don't accidentally lock by calling toJson2 // NB: this prelock/lock code is not thread safe, but since its only sanity-checking code, that's OK. String s = "ESQueryBuilder"+toJSONString(); lock = prelock; return s; } Map jobj; protected transient boolean lock; /** * Many queries have one top level key, and the sub-object is where the settings go */ protected Map props; /** * Direct access to the jobject map. * @throws IllegalStateException see {@link #lockCheck()} */ public Map getUnderlyingMap() { lockCheck(); return jobj; } /** * * @param query Used directly! beware of side effects */ public ESQueryBuilder(Map query) { this.jobj = query; // Convenience hack if (query.size()==1) { this.props = (Map) Containers.first(jobj.values()); } }
// Path: src/com/winterwell/es/ESUtils.java // public class ESUtils { // // // /** // * See http://www.elasticsearch.org/guide/en/elasticsearch/reference/1.x/ // * mapping-core-types.html // * // * @return an ElasticSearch type builder, which (being a Map) can be // * submitted to PutMapping. This is just a convenience for <code>new ESType()</code>. // */ // public static ESType type() { // return new ESType(); // } // // /** // See http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl-query-string-query.html#_reserved_characters // */ // public static String escapeWord(String s) { // if (s==null) return null; // String chars = "+-&|!(){}[]^\"~*?:\\/"; // String s2 = StrUtils.escape(s, chars, '\\'); // // Note "&" will also have to be url-encoded! // return s2; // } // // /** // * HACK convert an ES class into a json object. // * TODO replace these ES classes with something nicer. // * Preferably auto-generated from the ES source // * @param qb // * @return // */ // public static Map jobj(ToXContent qb) { // String s = qb.toString(); // return FlexiGson.fromJSON(s); // } // // /** // * ElasticSearch gets upset by many keys (they explode the schema) // * so we can't store maps the obvious way. // * @param map // * @param k What to call the key-key in the output mini-maps, e.g. "key" or "k" // * @param v What to call the value-key in the output mini-maps, e.g. "value" or "v" // * @return a sort of association list, where each key:value mapping // * is turned into a {k:key, v:value} map in a list // */ // public static List<Map<String,Object>> assocListFromMap(Map<String, ?> map, String k, String v) { // List<Map<String, Object>> list = Containers.apply(map.entrySet(), // e -> new ArrayMap(k, e.getKey(), v, e.getValue()) // ); // return list; // } // // public static <V> Map<String, V> mapFromAssocList(List<Map<String,Object>> topmapList, // String k, String v) // { // Map<String, V> map = new HashMap(); // for (Map<String, Object> kv : topmapList) { // map.put((String)kv.get(k), (V) kv.get(v)); // } // return map; // } // // } // // Path: src/shadoworg/elasticsearch/index/query/QueryBuilder/QueryBuilder.java // @Deprecated // public class QueryBuilder implements ToXContent { // // } // Path: src/com/winterwell/es/client/query/ESQueryBuilder.java import java.util.Map; import com.winterwell.es.ESUtils; import com.winterwell.utils.containers.ArrayMap; import com.winterwell.utils.containers.Containers; import com.winterwell.utils.web.IHasJson; import shadoworg.elasticsearch.index.query.QueryBuilder.QueryBuilder; package com.winterwell.es.client.query; /** * Base class for query-builders. For common cases use the convenience methods in {@link ESQueryBuilders} * @author daniel * */ public class ESQueryBuilder implements IHasJson, Cloneable { @Override public ESQueryBuilder clone() { ESQueryBuilder clone = new ESQueryBuilder(new ArrayMap(jobj)); return clone; } @Override public String toString() { boolean prelock = lock; // HACK - don't accidentally lock by calling toJson2 // NB: this prelock/lock code is not thread safe, but since its only sanity-checking code, that's OK. String s = "ESQueryBuilder"+toJSONString(); lock = prelock; return s; } Map jobj; protected transient boolean lock; /** * Many queries have one top level key, and the sub-object is where the settings go */ protected Map props; /** * Direct access to the jobject map. * @throws IllegalStateException see {@link #lockCheck()} */ public Map getUnderlyingMap() { lockCheck(); return jobj; } /** * * @param query Used directly! beware of side effects */ public ESQueryBuilder(Map query) { this.jobj = query; // Convenience hack if (query.size()==1) { this.props = (Map) Containers.first(jobj.values()); } }
public ESQueryBuilder(QueryBuilder query) {
winterstein/elasticsearch-java-client
src/com/winterwell/es/client/query/ESQueryBuilder.java
// Path: src/com/winterwell/es/ESUtils.java // public class ESUtils { // // // /** // * See http://www.elasticsearch.org/guide/en/elasticsearch/reference/1.x/ // * mapping-core-types.html // * // * @return an ElasticSearch type builder, which (being a Map) can be // * submitted to PutMapping. This is just a convenience for <code>new ESType()</code>. // */ // public static ESType type() { // return new ESType(); // } // // /** // See http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl-query-string-query.html#_reserved_characters // */ // public static String escapeWord(String s) { // if (s==null) return null; // String chars = "+-&|!(){}[]^\"~*?:\\/"; // String s2 = StrUtils.escape(s, chars, '\\'); // // Note "&" will also have to be url-encoded! // return s2; // } // // /** // * HACK convert an ES class into a json object. // * TODO replace these ES classes with something nicer. // * Preferably auto-generated from the ES source // * @param qb // * @return // */ // public static Map jobj(ToXContent qb) { // String s = qb.toString(); // return FlexiGson.fromJSON(s); // } // // /** // * ElasticSearch gets upset by many keys (they explode the schema) // * so we can't store maps the obvious way. // * @param map // * @param k What to call the key-key in the output mini-maps, e.g. "key" or "k" // * @param v What to call the value-key in the output mini-maps, e.g. "value" or "v" // * @return a sort of association list, where each key:value mapping // * is turned into a {k:key, v:value} map in a list // */ // public static List<Map<String,Object>> assocListFromMap(Map<String, ?> map, String k, String v) { // List<Map<String, Object>> list = Containers.apply(map.entrySet(), // e -> new ArrayMap(k, e.getKey(), v, e.getValue()) // ); // return list; // } // // public static <V> Map<String, V> mapFromAssocList(List<Map<String,Object>> topmapList, // String k, String v) // { // Map<String, V> map = new HashMap(); // for (Map<String, Object> kv : topmapList) { // map.put((String)kv.get(k), (V) kv.get(v)); // } // return map; // } // // } // // Path: src/shadoworg/elasticsearch/index/query/QueryBuilder/QueryBuilder.java // @Deprecated // public class QueryBuilder implements ToXContent { // // }
import java.util.Map; import com.winterwell.es.ESUtils; import com.winterwell.utils.containers.ArrayMap; import com.winterwell.utils.containers.Containers; import com.winterwell.utils.web.IHasJson; import shadoworg.elasticsearch.index.query.QueryBuilder.QueryBuilder;
package com.winterwell.es.client.query; /** * Base class for query-builders. For common cases use the convenience methods in {@link ESQueryBuilders} * @author daniel * */ public class ESQueryBuilder implements IHasJson, Cloneable { @Override public ESQueryBuilder clone() { ESQueryBuilder clone = new ESQueryBuilder(new ArrayMap(jobj)); return clone; } @Override public String toString() { boolean prelock = lock; // HACK - don't accidentally lock by calling toJson2 // NB: this prelock/lock code is not thread safe, but since its only sanity-checking code, that's OK. String s = "ESQueryBuilder"+toJSONString(); lock = prelock; return s; } Map jobj; protected transient boolean lock; /** * Many queries have one top level key, and the sub-object is where the settings go */ protected Map props; /** * Direct access to the jobject map. * @throws IllegalStateException see {@link #lockCheck()} */ public Map getUnderlyingMap() { lockCheck(); return jobj; } /** * * @param query Used directly! beware of side effects */ public ESQueryBuilder(Map query) { this.jobj = query; // Convenience hack if (query.size()==1) { this.props = (Map) Containers.first(jobj.values()); } } public ESQueryBuilder(QueryBuilder query) {
// Path: src/com/winterwell/es/ESUtils.java // public class ESUtils { // // // /** // * See http://www.elasticsearch.org/guide/en/elasticsearch/reference/1.x/ // * mapping-core-types.html // * // * @return an ElasticSearch type builder, which (being a Map) can be // * submitted to PutMapping. This is just a convenience for <code>new ESType()</code>. // */ // public static ESType type() { // return new ESType(); // } // // /** // See http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl-query-string-query.html#_reserved_characters // */ // public static String escapeWord(String s) { // if (s==null) return null; // String chars = "+-&|!(){}[]^\"~*?:\\/"; // String s2 = StrUtils.escape(s, chars, '\\'); // // Note "&" will also have to be url-encoded! // return s2; // } // // /** // * HACK convert an ES class into a json object. // * TODO replace these ES classes with something nicer. // * Preferably auto-generated from the ES source // * @param qb // * @return // */ // public static Map jobj(ToXContent qb) { // String s = qb.toString(); // return FlexiGson.fromJSON(s); // } // // /** // * ElasticSearch gets upset by many keys (they explode the schema) // * so we can't store maps the obvious way. // * @param map // * @param k What to call the key-key in the output mini-maps, e.g. "key" or "k" // * @param v What to call the value-key in the output mini-maps, e.g. "value" or "v" // * @return a sort of association list, where each key:value mapping // * is turned into a {k:key, v:value} map in a list // */ // public static List<Map<String,Object>> assocListFromMap(Map<String, ?> map, String k, String v) { // List<Map<String, Object>> list = Containers.apply(map.entrySet(), // e -> new ArrayMap(k, e.getKey(), v, e.getValue()) // ); // return list; // } // // public static <V> Map<String, V> mapFromAssocList(List<Map<String,Object>> topmapList, // String k, String v) // { // Map<String, V> map = new HashMap(); // for (Map<String, Object> kv : topmapList) { // map.put((String)kv.get(k), (V) kv.get(v)); // } // return map; // } // // } // // Path: src/shadoworg/elasticsearch/index/query/QueryBuilder/QueryBuilder.java // @Deprecated // public class QueryBuilder implements ToXContent { // // } // Path: src/com/winterwell/es/client/query/ESQueryBuilder.java import java.util.Map; import com.winterwell.es.ESUtils; import com.winterwell.utils.containers.ArrayMap; import com.winterwell.utils.containers.Containers; import com.winterwell.utils.web.IHasJson; import shadoworg.elasticsearch.index.query.QueryBuilder.QueryBuilder; package com.winterwell.es.client.query; /** * Base class for query-builders. For common cases use the convenience methods in {@link ESQueryBuilders} * @author daniel * */ public class ESQueryBuilder implements IHasJson, Cloneable { @Override public ESQueryBuilder clone() { ESQueryBuilder clone = new ESQueryBuilder(new ArrayMap(jobj)); return clone; } @Override public String toString() { boolean prelock = lock; // HACK - don't accidentally lock by calling toJson2 // NB: this prelock/lock code is not thread safe, but since its only sanity-checking code, that's OK. String s = "ESQueryBuilder"+toJSONString(); lock = prelock; return s; } Map jobj; protected transient boolean lock; /** * Many queries have one top level key, and the sub-object is where the settings go */ protected Map props; /** * Direct access to the jobject map. * @throws IllegalStateException see {@link #lockCheck()} */ public Map getUnderlyingMap() { lockCheck(); return jobj; } /** * * @param query Used directly! beware of side effects */ public ESQueryBuilder(Map query) { this.jobj = query; // Convenience hack if (query.size()==1) { this.props = (Map) Containers.first(jobj.values()); } } public ESQueryBuilder(QueryBuilder query) {
this(ESUtils.jobj(query));
winterstein/elasticsearch-java-client
src/com/winterwell/es/client/ESHttpResponse.java
// Path: src/com/winterwell/es/client/agg/AggregationResults.java // public class AggregationResults { // // private String name; // private Map results; // // public AggregationResults(String aggName, Map rs) { // this.name = aggName; // this.results = rs; // } // // @Override // public String toString() { // return "AggregationResults[ "+name+": "+results+"]"; // } // } // // Path: src/com/winterwell/es/fail/ESBulkException.java // public class ESBulkException extends ESException { // // private List<Exception> errors; // // public List<Exception> getErrors() { // return errors; // } // // public ESBulkException(List<Exception> exs) { // super(exs.size()+" errors", exs.size() > 1? exs.get(0) : null); // this.errors = exs; // } // // private static final long serialVersionUID = 1L; // // } // // Path: src/com/winterwell/es/fail/ESException.java // public class ESException extends WrappedException implements IElasticException { // // public transient ESHttpRequest request; // // public ESException(String msg, Throwable ex) { // super(msg, ex); // } // // public ESException(String msg) { // super(msg, null); // } // // // private static final long serialVersionUID = 1L; // // }
import java.util.ArrayList; import java.util.List; import java.util.Map; import com.winterwell.es.client.agg.AggregationResults; import com.winterwell.es.fail.ESBulkException; import com.winterwell.es.fail.ESException; import com.winterwell.gson.Gson; import com.winterwell.gson.GsonBuilder; import com.winterwell.utils.Dep; import com.winterwell.utils.Printer; import com.winterwell.utils.StrUtils; import com.winterwell.utils.Utils; import com.winterwell.utils.containers.Containers; import com.winterwell.utils.log.Log; import com.winterwell.utils.web.IHasJson;
/** * error or null * * TODO handle bulk-request errors, which are different * @see #getBulkErrors() */ public RuntimeException getError() { // HACK! unreliable if deserialising cos req is transient if (req instanceof BulkRequestBuilder && error==null) { return getBulkErrors(); } return error; } /** * TODO handle bulk-request errors nicely * @return */ RuntimeException getBulkErrors() { List<Exception> errors = new ArrayList<>(); Map<String, Object> parsedJson = getParsedJson(); List<Map<String, Map<String, Object>>> items = (List) parsedJson.get("items"); if (items == null) return null; for(Map<String, Map<String, Object>> item : items) { for (Map.Entry<String, Map<String, Object>> entry : item.entrySet()) { Map<String, Object> values = entry.getValue(); Map err = (Map) values.get("error"); if (err == null) continue; String errs = err.toString();
// Path: src/com/winterwell/es/client/agg/AggregationResults.java // public class AggregationResults { // // private String name; // private Map results; // // public AggregationResults(String aggName, Map rs) { // this.name = aggName; // this.results = rs; // } // // @Override // public String toString() { // return "AggregationResults[ "+name+": "+results+"]"; // } // } // // Path: src/com/winterwell/es/fail/ESBulkException.java // public class ESBulkException extends ESException { // // private List<Exception> errors; // // public List<Exception> getErrors() { // return errors; // } // // public ESBulkException(List<Exception> exs) { // super(exs.size()+" errors", exs.size() > 1? exs.get(0) : null); // this.errors = exs; // } // // private static final long serialVersionUID = 1L; // // } // // Path: src/com/winterwell/es/fail/ESException.java // public class ESException extends WrappedException implements IElasticException { // // public transient ESHttpRequest request; // // public ESException(String msg, Throwable ex) { // super(msg, ex); // } // // public ESException(String msg) { // super(msg, null); // } // // // private static final long serialVersionUID = 1L; // // } // Path: src/com/winterwell/es/client/ESHttpResponse.java import java.util.ArrayList; import java.util.List; import java.util.Map; import com.winterwell.es.client.agg.AggregationResults; import com.winterwell.es.fail.ESBulkException; import com.winterwell.es.fail.ESException; import com.winterwell.gson.Gson; import com.winterwell.gson.GsonBuilder; import com.winterwell.utils.Dep; import com.winterwell.utils.Printer; import com.winterwell.utils.StrUtils; import com.winterwell.utils.Utils; import com.winterwell.utils.containers.Containers; import com.winterwell.utils.log.Log; import com.winterwell.utils.web.IHasJson; /** * error or null * * TODO handle bulk-request errors, which are different * @see #getBulkErrors() */ public RuntimeException getError() { // HACK! unreliable if deserialising cos req is transient if (req instanceof BulkRequestBuilder && error==null) { return getBulkErrors(); } return error; } /** * TODO handle bulk-request errors nicely * @return */ RuntimeException getBulkErrors() { List<Exception> errors = new ArrayList<>(); Map<String, Object> parsedJson = getParsedJson(); List<Map<String, Map<String, Object>>> items = (List) parsedJson.get("items"); if (items == null) return null; for(Map<String, Map<String, Object>> item : items) { for (Map.Entry<String, Map<String, Object>> entry : item.entrySet()) { Map<String, Object> values = entry.getValue(); Map err = (Map) values.get("error"); if (err == null) continue; String errs = err.toString();
ESException ex = new ESException((String)err.get("reason"));
winterstein/elasticsearch-java-client
src/com/winterwell/es/client/ESHttpResponse.java
// Path: src/com/winterwell/es/client/agg/AggregationResults.java // public class AggregationResults { // // private String name; // private Map results; // // public AggregationResults(String aggName, Map rs) { // this.name = aggName; // this.results = rs; // } // // @Override // public String toString() { // return "AggregationResults[ "+name+": "+results+"]"; // } // } // // Path: src/com/winterwell/es/fail/ESBulkException.java // public class ESBulkException extends ESException { // // private List<Exception> errors; // // public List<Exception> getErrors() { // return errors; // } // // public ESBulkException(List<Exception> exs) { // super(exs.size()+" errors", exs.size() > 1? exs.get(0) : null); // this.errors = exs; // } // // private static final long serialVersionUID = 1L; // // } // // Path: src/com/winterwell/es/fail/ESException.java // public class ESException extends WrappedException implements IElasticException { // // public transient ESHttpRequest request; // // public ESException(String msg, Throwable ex) { // super(msg, ex); // } // // public ESException(String msg) { // super(msg, null); // } // // // private static final long serialVersionUID = 1L; // // }
import java.util.ArrayList; import java.util.List; import java.util.Map; import com.winterwell.es.client.agg.AggregationResults; import com.winterwell.es.fail.ESBulkException; import com.winterwell.es.fail.ESException; import com.winterwell.gson.Gson; import com.winterwell.gson.GsonBuilder; import com.winterwell.utils.Dep; import com.winterwell.utils.Printer; import com.winterwell.utils.StrUtils; import com.winterwell.utils.Utils; import com.winterwell.utils.containers.Containers; import com.winterwell.utils.log.Log; import com.winterwell.utils.web.IHasJson;
* @see #getBulkErrors() */ public RuntimeException getError() { // HACK! unreliable if deserialising cos req is transient if (req instanceof BulkRequestBuilder && error==null) { return getBulkErrors(); } return error; } /** * TODO handle bulk-request errors nicely * @return */ RuntimeException getBulkErrors() { List<Exception> errors = new ArrayList<>(); Map<String, Object> parsedJson = getParsedJson(); List<Map<String, Map<String, Object>>> items = (List) parsedJson.get("items"); if (items == null) return null; for(Map<String, Map<String, Object>> item : items) { for (Map.Entry<String, Map<String, Object>> entry : item.entrySet()) { Map<String, Object> values = entry.getValue(); Map err = (Map) values.get("error"); if (err == null) continue; String errs = err.toString(); ESException ex = new ESException((String)err.get("reason")); errors.add(ex); } } if ( ! errors.isEmpty()) {
// Path: src/com/winterwell/es/client/agg/AggregationResults.java // public class AggregationResults { // // private String name; // private Map results; // // public AggregationResults(String aggName, Map rs) { // this.name = aggName; // this.results = rs; // } // // @Override // public String toString() { // return "AggregationResults[ "+name+": "+results+"]"; // } // } // // Path: src/com/winterwell/es/fail/ESBulkException.java // public class ESBulkException extends ESException { // // private List<Exception> errors; // // public List<Exception> getErrors() { // return errors; // } // // public ESBulkException(List<Exception> exs) { // super(exs.size()+" errors", exs.size() > 1? exs.get(0) : null); // this.errors = exs; // } // // private static final long serialVersionUID = 1L; // // } // // Path: src/com/winterwell/es/fail/ESException.java // public class ESException extends WrappedException implements IElasticException { // // public transient ESHttpRequest request; // // public ESException(String msg, Throwable ex) { // super(msg, ex); // } // // public ESException(String msg) { // super(msg, null); // } // // // private static final long serialVersionUID = 1L; // // } // Path: src/com/winterwell/es/client/ESHttpResponse.java import java.util.ArrayList; import java.util.List; import java.util.Map; import com.winterwell.es.client.agg.AggregationResults; import com.winterwell.es.fail.ESBulkException; import com.winterwell.es.fail.ESException; import com.winterwell.gson.Gson; import com.winterwell.gson.GsonBuilder; import com.winterwell.utils.Dep; import com.winterwell.utils.Printer; import com.winterwell.utils.StrUtils; import com.winterwell.utils.Utils; import com.winterwell.utils.containers.Containers; import com.winterwell.utils.log.Log; import com.winterwell.utils.web.IHasJson; * @see #getBulkErrors() */ public RuntimeException getError() { // HACK! unreliable if deserialising cos req is transient if (req instanceof BulkRequestBuilder && error==null) { return getBulkErrors(); } return error; } /** * TODO handle bulk-request errors nicely * @return */ RuntimeException getBulkErrors() { List<Exception> errors = new ArrayList<>(); Map<String, Object> parsedJson = getParsedJson(); List<Map<String, Map<String, Object>>> items = (List) parsedJson.get("items"); if (items == null) return null; for(Map<String, Map<String, Object>> item : items) { for (Map.Entry<String, Map<String, Object>> entry : item.entrySet()) { Map<String, Object> values = entry.getValue(); Map err = (Map) values.get("error"); if (err == null) continue; String errs = err.toString(); ESException ex = new ESException((String)err.get("reason")); errors.add(ex); } } if ( ! errors.isEmpty()) {
return new ESBulkException(errors);
winterstein/elasticsearch-java-client
src/com/winterwell/es/client/ESHttpResponse.java
// Path: src/com/winterwell/es/client/agg/AggregationResults.java // public class AggregationResults { // // private String name; // private Map results; // // public AggregationResults(String aggName, Map rs) { // this.name = aggName; // this.results = rs; // } // // @Override // public String toString() { // return "AggregationResults[ "+name+": "+results+"]"; // } // } // // Path: src/com/winterwell/es/fail/ESBulkException.java // public class ESBulkException extends ESException { // // private List<Exception> errors; // // public List<Exception> getErrors() { // return errors; // } // // public ESBulkException(List<Exception> exs) { // super(exs.size()+" errors", exs.size() > 1? exs.get(0) : null); // this.errors = exs; // } // // private static final long serialVersionUID = 1L; // // } // // Path: src/com/winterwell/es/fail/ESException.java // public class ESException extends WrappedException implements IElasticException { // // public transient ESHttpRequest request; // // public ESException(String msg, Throwable ex) { // super(msg, ex); // } // // public ESException(String msg) { // super(msg, null); // } // // // private static final long serialVersionUID = 1L; // // }
import java.util.ArrayList; import java.util.List; import java.util.Map; import com.winterwell.es.client.agg.AggregationResults; import com.winterwell.es.fail.ESBulkException; import com.winterwell.es.fail.ESException; import com.winterwell.gson.Gson; import com.winterwell.gson.GsonBuilder; import com.winterwell.utils.Dep; import com.winterwell.utils.Printer; import com.winterwell.utils.StrUtils; import com.winterwell.utils.Utils; import com.winterwell.utils.containers.Containers; import com.winterwell.utils.log.Log; import com.winterwell.utils.web.IHasJson;
Map hits = (Map) map.get("hits"); List<Map<String,Object>> hitsList = (List) hits.get("hits"); List results = Containers.apply(hitsList, hit -> hit.get("_source")); return results; } /** * {@inheritDoc} * * Uses {@link #gson()} for the convertor. */ @Override public <X> List<X> getSearchResults(Class<? extends X> klass) { check(); Map<String, Object> jobj = getJsonMap(); List<Map> hits = (List<Map>) ((Map)jobj.get("hits")).get("hits"); List<X> results = Containers.apply(hits, map -> gson().convert((Map)map.get("_source"), klass)); return results; } @Override public Map getAggregations() { if ( ! isSuccess()) throw error; Map<String, Object> map = getParsedJson(); Map hits = (Map) map.get("aggregations"); return hits; } @Override
// Path: src/com/winterwell/es/client/agg/AggregationResults.java // public class AggregationResults { // // private String name; // private Map results; // // public AggregationResults(String aggName, Map rs) { // this.name = aggName; // this.results = rs; // } // // @Override // public String toString() { // return "AggregationResults[ "+name+": "+results+"]"; // } // } // // Path: src/com/winterwell/es/fail/ESBulkException.java // public class ESBulkException extends ESException { // // private List<Exception> errors; // // public List<Exception> getErrors() { // return errors; // } // // public ESBulkException(List<Exception> exs) { // super(exs.size()+" errors", exs.size() > 1? exs.get(0) : null); // this.errors = exs; // } // // private static final long serialVersionUID = 1L; // // } // // Path: src/com/winterwell/es/fail/ESException.java // public class ESException extends WrappedException implements IElasticException { // // public transient ESHttpRequest request; // // public ESException(String msg, Throwable ex) { // super(msg, ex); // } // // public ESException(String msg) { // super(msg, null); // } // // // private static final long serialVersionUID = 1L; // // } // Path: src/com/winterwell/es/client/ESHttpResponse.java import java.util.ArrayList; import java.util.List; import java.util.Map; import com.winterwell.es.client.agg.AggregationResults; import com.winterwell.es.fail.ESBulkException; import com.winterwell.es.fail.ESException; import com.winterwell.gson.Gson; import com.winterwell.gson.GsonBuilder; import com.winterwell.utils.Dep; import com.winterwell.utils.Printer; import com.winterwell.utils.StrUtils; import com.winterwell.utils.Utils; import com.winterwell.utils.containers.Containers; import com.winterwell.utils.log.Log; import com.winterwell.utils.web.IHasJson; Map hits = (Map) map.get("hits"); List<Map<String,Object>> hitsList = (List) hits.get("hits"); List results = Containers.apply(hitsList, hit -> hit.get("_source")); return results; } /** * {@inheritDoc} * * Uses {@link #gson()} for the convertor. */ @Override public <X> List<X> getSearchResults(Class<? extends X> klass) { check(); Map<String, Object> jobj = getJsonMap(); List<Map> hits = (List<Map>) ((Map)jobj.get("hits")).get("hits"); List<X> results = Containers.apply(hits, map -> gson().convert((Map)map.get("_source"), klass)); return results; } @Override public Map getAggregations() { if ( ! isSuccess()) throw error; Map<String, Object> map = getParsedJson(); Map hits = (Map) map.get("aggregations"); return hits; } @Override
public AggregationResults getAggregationResults(String aggName) {
winterstein/elasticsearch-java-client
src/com/winterwell/es/client/agg/Aggregations.java
// Path: src/com/winterwell/es/client/query/ESQueryBuilder.java // public class ESQueryBuilder implements IHasJson, Cloneable { // // @Override // public ESQueryBuilder clone() { // ESQueryBuilder clone = new ESQueryBuilder(new ArrayMap(jobj)); // return clone; // } // // @Override // public String toString() { // boolean prelock = lock; // HACK - don't accidentally lock by calling toJson2 // // NB: this prelock/lock code is not thread safe, but since its only sanity-checking code, that's OK. // String s = "ESQueryBuilder"+toJSONString(); // lock = prelock; // return s; // } // // Map jobj; // protected transient boolean lock; // /** // * Many queries have one top level key, and the sub-object is where the settings go // */ // protected Map props; // // /** // * Direct access to the jobject map. // * @throws IllegalStateException see {@link #lockCheck()} // */ // public Map getUnderlyingMap() { // lockCheck(); // return jobj; // } // // /** // * // * @param query Used directly! beware of side effects // */ // public ESQueryBuilder(Map query) { // this.jobj = query; // // Convenience hack // if (query.size()==1) { // this.props = (Map) Containers.first(jobj.values()); // } // } // // public ESQueryBuilder(QueryBuilder query) { // this(ESUtils.jobj(query)); // } // protected void lockCheck() throws IllegalStateException { // if (lock) { // throw new IllegalStateException("modified after toJson2() was used -- not allowed ('cos: risk of losing edits)"); // } // } // /** // * Construct an ESQueryBuilder from a QueryBuilder, ESQueryBuilder, or Map. // * // * Note: the input object should not be modified afterwards! // * // * @param query_mapOrQueryBuilder // * @return // */ // public static ESQueryBuilder make(Object query_mapOrQueryBuilder) { // if (query_mapOrQueryBuilder instanceof ESQueryBuilder) { // return (ESQueryBuilder) query_mapOrQueryBuilder; // } // if (query_mapOrQueryBuilder instanceof QueryBuilder) { // return new ESQueryBuilder((QueryBuilder)query_mapOrQueryBuilder); // } // return new ESQueryBuilder((Map)query_mapOrQueryBuilder); // } // // @Override // public Map<String,Object> toJson2() throws UnsupportedOperationException { // lock = true; // return jobj; // } // }
import com.winterwell.utils.time.Dt; import com.winterwell.utils.time.TUnit; import java.util.Map; import com.winterwell.es.client.query.ESQueryBuilder;
/** * */ package com.winterwell.es.client.agg; /** * Builder methods for making {@link Aggregation}s * @author daniel * */ public class Aggregations { /** * Default to one day interval */ public static Aggregation dateHistogram(String name, String field) { return dateHistogram(name, field, TUnit.DAY.dt); }
// Path: src/com/winterwell/es/client/query/ESQueryBuilder.java // public class ESQueryBuilder implements IHasJson, Cloneable { // // @Override // public ESQueryBuilder clone() { // ESQueryBuilder clone = new ESQueryBuilder(new ArrayMap(jobj)); // return clone; // } // // @Override // public String toString() { // boolean prelock = lock; // HACK - don't accidentally lock by calling toJson2 // // NB: this prelock/lock code is not thread safe, but since its only sanity-checking code, that's OK. // String s = "ESQueryBuilder"+toJSONString(); // lock = prelock; // return s; // } // // Map jobj; // protected transient boolean lock; // /** // * Many queries have one top level key, and the sub-object is where the settings go // */ // protected Map props; // // /** // * Direct access to the jobject map. // * @throws IllegalStateException see {@link #lockCheck()} // */ // public Map getUnderlyingMap() { // lockCheck(); // return jobj; // } // // /** // * // * @param query Used directly! beware of side effects // */ // public ESQueryBuilder(Map query) { // this.jobj = query; // // Convenience hack // if (query.size()==1) { // this.props = (Map) Containers.first(jobj.values()); // } // } // // public ESQueryBuilder(QueryBuilder query) { // this(ESUtils.jobj(query)); // } // protected void lockCheck() throws IllegalStateException { // if (lock) { // throw new IllegalStateException("modified after toJson2() was used -- not allowed ('cos: risk of losing edits)"); // } // } // /** // * Construct an ESQueryBuilder from a QueryBuilder, ESQueryBuilder, or Map. // * // * Note: the input object should not be modified afterwards! // * // * @param query_mapOrQueryBuilder // * @return // */ // public static ESQueryBuilder make(Object query_mapOrQueryBuilder) { // if (query_mapOrQueryBuilder instanceof ESQueryBuilder) { // return (ESQueryBuilder) query_mapOrQueryBuilder; // } // if (query_mapOrQueryBuilder instanceof QueryBuilder) { // return new ESQueryBuilder((QueryBuilder)query_mapOrQueryBuilder); // } // return new ESQueryBuilder((Map)query_mapOrQueryBuilder); // } // // @Override // public Map<String,Object> toJson2() throws UnsupportedOperationException { // lock = true; // return jobj; // } // } // Path: src/com/winterwell/es/client/agg/Aggregations.java import com.winterwell.utils.time.Dt; import com.winterwell.utils.time.TUnit; import java.util.Map; import com.winterwell.es.client.query.ESQueryBuilder; /** * */ package com.winterwell.es.client.agg; /** * Builder methods for making {@link Aggregation}s * @author daniel * */ public class Aggregations { /** * Default to one day interval */ public static Aggregation dateHistogram(String name, String field) { return dateHistogram(name, field, TUnit.DAY.dt); }
public static Aggregation filtered(String name, ESQueryBuilder filter, Aggregation agg) {
winterstein/elasticsearch-java-client
test/com/winterwell/es/client/PainlessScriptBuilderTest.java
// Path: src/com/winterwell/es/ESPath.java // public final class ESPath<T> { // // @Override // public int hashCode() { // final int prime = 31; // int result = 1; // result = prime * result + ((id == null) ? 0 : id.hashCode()); // result = prime * result + Arrays.hashCode(indices); // // result = prime * result + ((type == null) ? 0 : type.hashCode()); // return result; // } // // @Override // public boolean equals(Object obj) { // if (this == obj) // return true; // if (obj == null) // return false; // if (getClass() != obj.getClass()) // return false; // ESPath other = (ESPath) obj; // if (id == null) { // if (other.id != null) // return false; // } else if ( ! id.equals(other.id)) // return false; // if ( ! Arrays.equals(indices, other.indices)) // return false; // return true; // } // // public final String id; // // /** // * @deprecated types are gone in ESv7 // */ // public final String type; // // public final String[] indices; // // public ESPath(String index, CharSequence id) { // this(new String[]{index},null,id); // } // public ESPath(String[] indices, CharSequence id) { // this(indices, null, id); // } // // /** // * @deprecated go typeless // * @param indices // * @param type // * @param id // */ // public ESPath(String[] indices, String type, CharSequence id) { // this.id = id==null? null : id.toString(); // this.type = type; // this.indices = indices; // } // // /** // * @deprecated go typeless // * @param indices // * @param type // * @param id // */ // public ESPath(Collection<String> indices, String type, CharSequence id) { // this(indices.toArray(StrUtils.ARRAY), type, id); // } // // /** // * @deprecated go typeless // * @param index // * @param type // * @param id // */ // public ESPath(String index, String type, CharSequence id) { // this(new String[] {index}, type, id); // } // // @Override // public String toString() { // return "ESPath[" +Arrays.toString(indices)+" / id: " +id+ "]"; // } // // public String index() { // assert indices.length == 1 : this; // return indices[0]; // } // // // } // // Path: test/com/winterwell/es/ESTest.java // public class ESTest { // // @BeforeClass // public static void setupES() { // ESConfig config = ConfigFactory.get().getConfig(ESConfig.class); // Printer.out(config); // } // // protected static ESHttpClient getESJC() { // // Dep.setIfAbsent(ESConfig.class, new ESConfig()); done in setupES // // ESConfig esconfig = Dep.get(ESConfig.class); // if ( ! Dep.has(ESHttpClient.class)) { // Dep.setSupplier(ESHttpClient.class, false, ESHttpClient::new); // } // ESHttpClient esc = Dep.get(ESHttpClient.class); // return esc; // } // // }
import java.util.Arrays; import java.util.Map; import org.junit.Test; import com.winterwell.es.ESPath; import com.winterwell.es.ESTest; import com.winterwell.utils.Dep; import com.winterwell.utils.containers.ArrayMap;
@Test public void testMapAndList() { PainlessScriptBuilder psb = new PainlessScriptBuilder(); Map<String, Object> jsonObject = new ArrayMap( "a", new String[] {"Apple"}, "n", Arrays.asList(10, 20)); psb.setJsonObject(jsonObject); String script = psb.getScript(); Map params = psb.getParams(); System.out.println(script); System.out.println(params); } @Test public void testCallES() { BulkRequestBuilderTest brbt = new BulkRequestBuilderTest(); brbt.testBulkIndex1(); PainlessScriptBuilder psb = new PainlessScriptBuilder(); Map<String, Object> jsonObject = new ArrayMap( "a", new String[] {"Apple"}, "n", Arrays.asList(10, 20)); psb.setJsonObject(jsonObject); String script = psb.getScript(); Map params = psb.getParams(); System.out.println(script); System.out.println(params); ESHttpClient esjc = Dep.get(ESHttpClient.class);
// Path: src/com/winterwell/es/ESPath.java // public final class ESPath<T> { // // @Override // public int hashCode() { // final int prime = 31; // int result = 1; // result = prime * result + ((id == null) ? 0 : id.hashCode()); // result = prime * result + Arrays.hashCode(indices); // // result = prime * result + ((type == null) ? 0 : type.hashCode()); // return result; // } // // @Override // public boolean equals(Object obj) { // if (this == obj) // return true; // if (obj == null) // return false; // if (getClass() != obj.getClass()) // return false; // ESPath other = (ESPath) obj; // if (id == null) { // if (other.id != null) // return false; // } else if ( ! id.equals(other.id)) // return false; // if ( ! Arrays.equals(indices, other.indices)) // return false; // return true; // } // // public final String id; // // /** // * @deprecated types are gone in ESv7 // */ // public final String type; // // public final String[] indices; // // public ESPath(String index, CharSequence id) { // this(new String[]{index},null,id); // } // public ESPath(String[] indices, CharSequence id) { // this(indices, null, id); // } // // /** // * @deprecated go typeless // * @param indices // * @param type // * @param id // */ // public ESPath(String[] indices, String type, CharSequence id) { // this.id = id==null? null : id.toString(); // this.type = type; // this.indices = indices; // } // // /** // * @deprecated go typeless // * @param indices // * @param type // * @param id // */ // public ESPath(Collection<String> indices, String type, CharSequence id) { // this(indices.toArray(StrUtils.ARRAY), type, id); // } // // /** // * @deprecated go typeless // * @param index // * @param type // * @param id // */ // public ESPath(String index, String type, CharSequence id) { // this(new String[] {index}, type, id); // } // // @Override // public String toString() { // return "ESPath[" +Arrays.toString(indices)+" / id: " +id+ "]"; // } // // public String index() { // assert indices.length == 1 : this; // return indices[0]; // } // // // } // // Path: test/com/winterwell/es/ESTest.java // public class ESTest { // // @BeforeClass // public static void setupES() { // ESConfig config = ConfigFactory.get().getConfig(ESConfig.class); // Printer.out(config); // } // // protected static ESHttpClient getESJC() { // // Dep.setIfAbsent(ESConfig.class, new ESConfig()); done in setupES // // ESConfig esconfig = Dep.get(ESConfig.class); // if ( ! Dep.has(ESHttpClient.class)) { // Dep.setSupplier(ESHttpClient.class, false, ESHttpClient::new); // } // ESHttpClient esc = Dep.get(ESHttpClient.class); // return esc; // } // // } // Path: test/com/winterwell/es/client/PainlessScriptBuilderTest.java import java.util.Arrays; import java.util.Map; import org.junit.Test; import com.winterwell.es.ESPath; import com.winterwell.es.ESTest; import com.winterwell.utils.Dep; import com.winterwell.utils.containers.ArrayMap; @Test public void testMapAndList() { PainlessScriptBuilder psb = new PainlessScriptBuilder(); Map<String, Object> jsonObject = new ArrayMap( "a", new String[] {"Apple"}, "n", Arrays.asList(10, 20)); psb.setJsonObject(jsonObject); String script = psb.getScript(); Map params = psb.getParams(); System.out.println(script); System.out.println(params); } @Test public void testCallES() { BulkRequestBuilderTest brbt = new BulkRequestBuilderTest(); brbt.testBulkIndex1(); PainlessScriptBuilder psb = new PainlessScriptBuilder(); Map<String, Object> jsonObject = new ArrayMap( "a", new String[] {"Apple"}, "n", Arrays.asList(10, 20)); psb.setJsonObject(jsonObject); String script = psb.getScript(); Map params = psb.getParams(); System.out.println(script); System.out.println(params); ESHttpClient esjc = Dep.get(ESHttpClient.class);
ESPath path = new ESPath("test", "thingy", "testCallES");
winterstein/elasticsearch-java-client
test/com/winterwell/es/client/MultiGetRequestBuilderTest.java
// Path: src/com/winterwell/es/ESPath.java // public final class ESPath<T> { // // @Override // public int hashCode() { // final int prime = 31; // int result = 1; // result = prime * result + ((id == null) ? 0 : id.hashCode()); // result = prime * result + Arrays.hashCode(indices); // // result = prime * result + ((type == null) ? 0 : type.hashCode()); // return result; // } // // @Override // public boolean equals(Object obj) { // if (this == obj) // return true; // if (obj == null) // return false; // if (getClass() != obj.getClass()) // return false; // ESPath other = (ESPath) obj; // if (id == null) { // if (other.id != null) // return false; // } else if ( ! id.equals(other.id)) // return false; // if ( ! Arrays.equals(indices, other.indices)) // return false; // return true; // } // // public final String id; // // /** // * @deprecated types are gone in ESv7 // */ // public final String type; // // public final String[] indices; // // public ESPath(String index, CharSequence id) { // this(new String[]{index},null,id); // } // public ESPath(String[] indices, CharSequence id) { // this(indices, null, id); // } // // /** // * @deprecated go typeless // * @param indices // * @param type // * @param id // */ // public ESPath(String[] indices, String type, CharSequence id) { // this.id = id==null? null : id.toString(); // this.type = type; // this.indices = indices; // } // // /** // * @deprecated go typeless // * @param indices // * @param type // * @param id // */ // public ESPath(Collection<String> indices, String type, CharSequence id) { // this(indices.toArray(StrUtils.ARRAY), type, id); // } // // /** // * @deprecated go typeless // * @param index // * @param type // * @param id // */ // public ESPath(String index, String type, CharSequence id) { // this(new String[] {index}, type, id); // } // // @Override // public String toString() { // return "ESPath[" +Arrays.toString(indices)+" / id: " +id+ "]"; // } // // public String index() { // assert indices.length == 1 : this; // return indices[0]; // } // // // } // // Path: test/com/winterwell/es/ESTest.java // public class ESTest { // // @BeforeClass // public static void setupES() { // ESConfig config = ConfigFactory.get().getConfig(ESConfig.class); // Printer.out(config); // } // // protected static ESHttpClient getESJC() { // // Dep.setIfAbsent(ESConfig.class, new ESConfig()); done in setupES // // ESConfig esconfig = Dep.get(ESConfig.class); // if ( ! Dep.has(ESHttpClient.class)) { // Dep.setSupplier(ESHttpClient.class, false, ESHttpClient::new); // } // ESHttpClient esc = Dep.get(ESHttpClient.class); // return esc; // } // // }
import java.util.List; import java.util.Map; import org.junit.Test; import com.winterwell.es.ESPath; import com.winterwell.es.ESTest; import com.winterwell.utils.Dep;
package com.winterwell.es.client; public class MultiGetRequestBuilderTest extends ESTest { @Test public void testGet() { BulkRequestBuilderTest brbt = new BulkRequestBuilderTest(); List<String> ids = brbt.testBulkIndexMany2(); // now get two ESHttpClient esc = Dep.get(ESHttpClient.class); MultiGetRequestBuilder srb = new MultiGetRequestBuilder(esc).setIndex(brbt.INDEX);
// Path: src/com/winterwell/es/ESPath.java // public final class ESPath<T> { // // @Override // public int hashCode() { // final int prime = 31; // int result = 1; // result = prime * result + ((id == null) ? 0 : id.hashCode()); // result = prime * result + Arrays.hashCode(indices); // // result = prime * result + ((type == null) ? 0 : type.hashCode()); // return result; // } // // @Override // public boolean equals(Object obj) { // if (this == obj) // return true; // if (obj == null) // return false; // if (getClass() != obj.getClass()) // return false; // ESPath other = (ESPath) obj; // if (id == null) { // if (other.id != null) // return false; // } else if ( ! id.equals(other.id)) // return false; // if ( ! Arrays.equals(indices, other.indices)) // return false; // return true; // } // // public final String id; // // /** // * @deprecated types are gone in ESv7 // */ // public final String type; // // public final String[] indices; // // public ESPath(String index, CharSequence id) { // this(new String[]{index},null,id); // } // public ESPath(String[] indices, CharSequence id) { // this(indices, null, id); // } // // /** // * @deprecated go typeless // * @param indices // * @param type // * @param id // */ // public ESPath(String[] indices, String type, CharSequence id) { // this.id = id==null? null : id.toString(); // this.type = type; // this.indices = indices; // } // // /** // * @deprecated go typeless // * @param indices // * @param type // * @param id // */ // public ESPath(Collection<String> indices, String type, CharSequence id) { // this(indices.toArray(StrUtils.ARRAY), type, id); // } // // /** // * @deprecated go typeless // * @param index // * @param type // * @param id // */ // public ESPath(String index, String type, CharSequence id) { // this(new String[] {index}, type, id); // } // // @Override // public String toString() { // return "ESPath[" +Arrays.toString(indices)+" / id: " +id+ "]"; // } // // public String index() { // assert indices.length == 1 : this; // return indices[0]; // } // // // } // // Path: test/com/winterwell/es/ESTest.java // public class ESTest { // // @BeforeClass // public static void setupES() { // ESConfig config = ConfigFactory.get().getConfig(ESConfig.class); // Printer.out(config); // } // // protected static ESHttpClient getESJC() { // // Dep.setIfAbsent(ESConfig.class, new ESConfig()); done in setupES // // ESConfig esconfig = Dep.get(ESConfig.class); // if ( ! Dep.has(ESHttpClient.class)) { // Dep.setSupplier(ESHttpClient.class, false, ESHttpClient::new); // } // ESHttpClient esc = Dep.get(ESHttpClient.class); // return esc; // } // // } // Path: test/com/winterwell/es/client/MultiGetRequestBuilderTest.java import java.util.List; import java.util.Map; import org.junit.Test; import com.winterwell.es.ESPath; import com.winterwell.es.ESTest; import com.winterwell.utils.Dep; package com.winterwell.es.client; public class MultiGetRequestBuilderTest extends ESTest { @Test public void testGet() { BulkRequestBuilderTest brbt = new BulkRequestBuilderTest(); List<String> ids = brbt.testBulkIndexMany2(); // now get two ESHttpClient esc = Dep.get(ESHttpClient.class); MultiGetRequestBuilder srb = new MultiGetRequestBuilder(esc).setIndex(brbt.INDEX);
srb.addDoc(new ESPath(brbt.INDEX, "simple", ids.get(0)));
MasterAbdoTGM50/ThaumicWarden
src/main/java/matgm50/twarden/client/gui/GuiWaslieHammer.java
// Path: src/main/java/matgm50/twarden/lib/ModLib.java // public class ModLib { // // public static final String ID = "TWarden"; // public static final String NAME = "Thaumic Warden"; // public static final String VERSION = "1.1.1"; // public static final String DEPENDENCIES = "required-after:Thaumcraft"; // // public static final String CLIENTPROXY = "matgm50.twarden.proxy.ClientProxy"; // public static final String COMMONPROXY = "matgm50.twarden.proxy.CommonProxy"; // // } // // Path: src/main/java/matgm50/twarden/inventory/ContainerHammer.java // public class ContainerHammer extends Container { // // InventoryPlayer playerInv; // InventoryCrafting hammerInv; // IInventory resultInv; // // public ContainerHammer(EntityPlayer player) { // // playerInv = player.inventory; // hammerInv = new InventoryCrafting(this, 2, 1); // resultInv = new InventoryCraftResult(); // // for(int hotbar = 0; hotbar < 9; hotbar++) { // // addSlotToContainer(new Slot(playerInv, hotbar, 8 + 18 * hotbar, 142)); // // } // // for(int row = 0; row < 3; row++) { // // for(int collumn = 0; collumn < 9; collumn++) { // // addSlotToContainer(new Slot(playerInv, 9 + row * 9 + collumn, 8 + 18 * collumn, 84 + row * 18)); // // } // // } // // addSlotToContainer(new SlotEssentia(hammerInv, 0, 80, 54)); // addSlotToContainer(new Slot(hammerInv, 1, 80, 33)); // addSlotToContainer(new SlotCrafting(player, hammerInv, resultInv, 0, 80, 12)); // // onCraftMatrixChanged(hammerInv); // // } // // @Override // public void onCraftMatrixChanged(IInventory craftingMatrix) { // // ItemStack essentia = craftingMatrix.getStackInSlot(0); // ItemStack item = craftingMatrix.getStackInSlot(1); // // if(item != null) { // // if(!(item.getItem() instanceof ItemWardenArmor || item.getItem() instanceof ItemWardenWeapon)) { // // ItemStack repairedItem = new ItemStack(item.getItem()); // // if(item.getItemDamage() != 0 && item.getItem().isRepairable()) { // // repairedItem.setItemDamage(0); // resultInv.setInventorySlotContents(0, repairedItem); // // } // // } else if(essentia != null) { // // ItemStack infusedArmor = new ItemStack(item.getItem()); // String aspectKey = ((IEssentiaContainerItem)essentia.getItem()).getAspects(essentia).getAspects()[0].getName(); // // if(WardenicChargeHelper.upgrades.containsKey(aspectKey)) { // // WardenicChargeHelper.setUpgradeOnStack(infusedArmor, aspectKey); // // } // // resultInv.setInventorySlotContents(0, infusedArmor); // // } else {resultInv.setInventorySlotContents(0, null);} // // } else {resultInv.setInventorySlotContents(0, null);} // // } // // @Override // public void onContainerClosed(EntityPlayer player) { // // super.onContainerClosed(player); // // ItemStack essentia = this.hammerInv.getStackInSlotOnClosing(0); // if(essentia != null) {player.dropPlayerItemWithRandomChoice(essentia, false);} // // ItemStack item = this.hammerInv.getStackInSlotOnClosing(1); // if(item != null) {player.dropPlayerItemWithRandomChoice(item, false);} // // } // // @Override // public boolean canInteractWith(EntityPlayer player) {return true;} // // @Override // public ItemStack transferStackInSlot(EntityPlayer player, int slot) {return null;} // // @Override // public ItemStack slotClick(int slot, int button, int flag, EntityPlayer player) { // // if (slot >= 0 && getSlot(slot) != null && getSlot(slot).getStack() == player.getHeldItem()) {return null;} // return super.slotClick(slot, button, flag, player); // // } // // }
import matgm50.twarden.lib.ModLib; import matgm50.twarden.inventory.ContainerHammer; import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.ResourceLocation; import org.lwjgl.opengl.GL11;
package matgm50.twarden.client.gui; /** * Created by MasterAbdoTGM50 on 8/27/2014. */ public class GuiWaslieHammer extends GuiContainer { private final int guiWidth = 176; private final int guiHeight = 166; private int startX, startY;
// Path: src/main/java/matgm50/twarden/lib/ModLib.java // public class ModLib { // // public static final String ID = "TWarden"; // public static final String NAME = "Thaumic Warden"; // public static final String VERSION = "1.1.1"; // public static final String DEPENDENCIES = "required-after:Thaumcraft"; // // public static final String CLIENTPROXY = "matgm50.twarden.proxy.ClientProxy"; // public static final String COMMONPROXY = "matgm50.twarden.proxy.CommonProxy"; // // } // // Path: src/main/java/matgm50/twarden/inventory/ContainerHammer.java // public class ContainerHammer extends Container { // // InventoryPlayer playerInv; // InventoryCrafting hammerInv; // IInventory resultInv; // // public ContainerHammer(EntityPlayer player) { // // playerInv = player.inventory; // hammerInv = new InventoryCrafting(this, 2, 1); // resultInv = new InventoryCraftResult(); // // for(int hotbar = 0; hotbar < 9; hotbar++) { // // addSlotToContainer(new Slot(playerInv, hotbar, 8 + 18 * hotbar, 142)); // // } // // for(int row = 0; row < 3; row++) { // // for(int collumn = 0; collumn < 9; collumn++) { // // addSlotToContainer(new Slot(playerInv, 9 + row * 9 + collumn, 8 + 18 * collumn, 84 + row * 18)); // // } // // } // // addSlotToContainer(new SlotEssentia(hammerInv, 0, 80, 54)); // addSlotToContainer(new Slot(hammerInv, 1, 80, 33)); // addSlotToContainer(new SlotCrafting(player, hammerInv, resultInv, 0, 80, 12)); // // onCraftMatrixChanged(hammerInv); // // } // // @Override // public void onCraftMatrixChanged(IInventory craftingMatrix) { // // ItemStack essentia = craftingMatrix.getStackInSlot(0); // ItemStack item = craftingMatrix.getStackInSlot(1); // // if(item != null) { // // if(!(item.getItem() instanceof ItemWardenArmor || item.getItem() instanceof ItemWardenWeapon)) { // // ItemStack repairedItem = new ItemStack(item.getItem()); // // if(item.getItemDamage() != 0 && item.getItem().isRepairable()) { // // repairedItem.setItemDamage(0); // resultInv.setInventorySlotContents(0, repairedItem); // // } // // } else if(essentia != null) { // // ItemStack infusedArmor = new ItemStack(item.getItem()); // String aspectKey = ((IEssentiaContainerItem)essentia.getItem()).getAspects(essentia).getAspects()[0].getName(); // // if(WardenicChargeHelper.upgrades.containsKey(aspectKey)) { // // WardenicChargeHelper.setUpgradeOnStack(infusedArmor, aspectKey); // // } // // resultInv.setInventorySlotContents(0, infusedArmor); // // } else {resultInv.setInventorySlotContents(0, null);} // // } else {resultInv.setInventorySlotContents(0, null);} // // } // // @Override // public void onContainerClosed(EntityPlayer player) { // // super.onContainerClosed(player); // // ItemStack essentia = this.hammerInv.getStackInSlotOnClosing(0); // if(essentia != null) {player.dropPlayerItemWithRandomChoice(essentia, false);} // // ItemStack item = this.hammerInv.getStackInSlotOnClosing(1); // if(item != null) {player.dropPlayerItemWithRandomChoice(item, false);} // // } // // @Override // public boolean canInteractWith(EntityPlayer player) {return true;} // // @Override // public ItemStack transferStackInSlot(EntityPlayer player, int slot) {return null;} // // @Override // public ItemStack slotClick(int slot, int button, int flag, EntityPlayer player) { // // if (slot >= 0 && getSlot(slot) != null && getSlot(slot).getStack() == player.getHeldItem()) {return null;} // return super.slotClick(slot, button, flag, player); // // } // // } // Path: src/main/java/matgm50/twarden/client/gui/GuiWaslieHammer.java import matgm50.twarden.lib.ModLib; import matgm50.twarden.inventory.ContainerHammer; import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.ResourceLocation; import org.lwjgl.opengl.GL11; package matgm50.twarden.client.gui; /** * Created by MasterAbdoTGM50 on 8/27/2014. */ public class GuiWaslieHammer extends GuiContainer { private final int guiWidth = 176; private final int guiHeight = 166; private int startX, startY;
private static final ResourceLocation texture = new ResourceLocation(ModLib.ID.toLowerCase(), "textures/gui/guihammer.png");
MasterAbdoTGM50/ThaumicWarden
src/main/java/matgm50/twarden/client/gui/GuiWaslieHammer.java
// Path: src/main/java/matgm50/twarden/lib/ModLib.java // public class ModLib { // // public static final String ID = "TWarden"; // public static final String NAME = "Thaumic Warden"; // public static final String VERSION = "1.1.1"; // public static final String DEPENDENCIES = "required-after:Thaumcraft"; // // public static final String CLIENTPROXY = "matgm50.twarden.proxy.ClientProxy"; // public static final String COMMONPROXY = "matgm50.twarden.proxy.CommonProxy"; // // } // // Path: src/main/java/matgm50/twarden/inventory/ContainerHammer.java // public class ContainerHammer extends Container { // // InventoryPlayer playerInv; // InventoryCrafting hammerInv; // IInventory resultInv; // // public ContainerHammer(EntityPlayer player) { // // playerInv = player.inventory; // hammerInv = new InventoryCrafting(this, 2, 1); // resultInv = new InventoryCraftResult(); // // for(int hotbar = 0; hotbar < 9; hotbar++) { // // addSlotToContainer(new Slot(playerInv, hotbar, 8 + 18 * hotbar, 142)); // // } // // for(int row = 0; row < 3; row++) { // // for(int collumn = 0; collumn < 9; collumn++) { // // addSlotToContainer(new Slot(playerInv, 9 + row * 9 + collumn, 8 + 18 * collumn, 84 + row * 18)); // // } // // } // // addSlotToContainer(new SlotEssentia(hammerInv, 0, 80, 54)); // addSlotToContainer(new Slot(hammerInv, 1, 80, 33)); // addSlotToContainer(new SlotCrafting(player, hammerInv, resultInv, 0, 80, 12)); // // onCraftMatrixChanged(hammerInv); // // } // // @Override // public void onCraftMatrixChanged(IInventory craftingMatrix) { // // ItemStack essentia = craftingMatrix.getStackInSlot(0); // ItemStack item = craftingMatrix.getStackInSlot(1); // // if(item != null) { // // if(!(item.getItem() instanceof ItemWardenArmor || item.getItem() instanceof ItemWardenWeapon)) { // // ItemStack repairedItem = new ItemStack(item.getItem()); // // if(item.getItemDamage() != 0 && item.getItem().isRepairable()) { // // repairedItem.setItemDamage(0); // resultInv.setInventorySlotContents(0, repairedItem); // // } // // } else if(essentia != null) { // // ItemStack infusedArmor = new ItemStack(item.getItem()); // String aspectKey = ((IEssentiaContainerItem)essentia.getItem()).getAspects(essentia).getAspects()[0].getName(); // // if(WardenicChargeHelper.upgrades.containsKey(aspectKey)) { // // WardenicChargeHelper.setUpgradeOnStack(infusedArmor, aspectKey); // // } // // resultInv.setInventorySlotContents(0, infusedArmor); // // } else {resultInv.setInventorySlotContents(0, null);} // // } else {resultInv.setInventorySlotContents(0, null);} // // } // // @Override // public void onContainerClosed(EntityPlayer player) { // // super.onContainerClosed(player); // // ItemStack essentia = this.hammerInv.getStackInSlotOnClosing(0); // if(essentia != null) {player.dropPlayerItemWithRandomChoice(essentia, false);} // // ItemStack item = this.hammerInv.getStackInSlotOnClosing(1); // if(item != null) {player.dropPlayerItemWithRandomChoice(item, false);} // // } // // @Override // public boolean canInteractWith(EntityPlayer player) {return true;} // // @Override // public ItemStack transferStackInSlot(EntityPlayer player, int slot) {return null;} // // @Override // public ItemStack slotClick(int slot, int button, int flag, EntityPlayer player) { // // if (slot >= 0 && getSlot(slot) != null && getSlot(slot).getStack() == player.getHeldItem()) {return null;} // return super.slotClick(slot, button, flag, player); // // } // // }
import matgm50.twarden.lib.ModLib; import matgm50.twarden.inventory.ContainerHammer; import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.ResourceLocation; import org.lwjgl.opengl.GL11;
package matgm50.twarden.client.gui; /** * Created by MasterAbdoTGM50 on 8/27/2014. */ public class GuiWaslieHammer extends GuiContainer { private final int guiWidth = 176; private final int guiHeight = 166; private int startX, startY; private static final ResourceLocation texture = new ResourceLocation(ModLib.ID.toLowerCase(), "textures/gui/guihammer.png"); public GuiWaslieHammer(EntityPlayer inv) {
// Path: src/main/java/matgm50/twarden/lib/ModLib.java // public class ModLib { // // public static final String ID = "TWarden"; // public static final String NAME = "Thaumic Warden"; // public static final String VERSION = "1.1.1"; // public static final String DEPENDENCIES = "required-after:Thaumcraft"; // // public static final String CLIENTPROXY = "matgm50.twarden.proxy.ClientProxy"; // public static final String COMMONPROXY = "matgm50.twarden.proxy.CommonProxy"; // // } // // Path: src/main/java/matgm50/twarden/inventory/ContainerHammer.java // public class ContainerHammer extends Container { // // InventoryPlayer playerInv; // InventoryCrafting hammerInv; // IInventory resultInv; // // public ContainerHammer(EntityPlayer player) { // // playerInv = player.inventory; // hammerInv = new InventoryCrafting(this, 2, 1); // resultInv = new InventoryCraftResult(); // // for(int hotbar = 0; hotbar < 9; hotbar++) { // // addSlotToContainer(new Slot(playerInv, hotbar, 8 + 18 * hotbar, 142)); // // } // // for(int row = 0; row < 3; row++) { // // for(int collumn = 0; collumn < 9; collumn++) { // // addSlotToContainer(new Slot(playerInv, 9 + row * 9 + collumn, 8 + 18 * collumn, 84 + row * 18)); // // } // // } // // addSlotToContainer(new SlotEssentia(hammerInv, 0, 80, 54)); // addSlotToContainer(new Slot(hammerInv, 1, 80, 33)); // addSlotToContainer(new SlotCrafting(player, hammerInv, resultInv, 0, 80, 12)); // // onCraftMatrixChanged(hammerInv); // // } // // @Override // public void onCraftMatrixChanged(IInventory craftingMatrix) { // // ItemStack essentia = craftingMatrix.getStackInSlot(0); // ItemStack item = craftingMatrix.getStackInSlot(1); // // if(item != null) { // // if(!(item.getItem() instanceof ItemWardenArmor || item.getItem() instanceof ItemWardenWeapon)) { // // ItemStack repairedItem = new ItemStack(item.getItem()); // // if(item.getItemDamage() != 0 && item.getItem().isRepairable()) { // // repairedItem.setItemDamage(0); // resultInv.setInventorySlotContents(0, repairedItem); // // } // // } else if(essentia != null) { // // ItemStack infusedArmor = new ItemStack(item.getItem()); // String aspectKey = ((IEssentiaContainerItem)essentia.getItem()).getAspects(essentia).getAspects()[0].getName(); // // if(WardenicChargeHelper.upgrades.containsKey(aspectKey)) { // // WardenicChargeHelper.setUpgradeOnStack(infusedArmor, aspectKey); // // } // // resultInv.setInventorySlotContents(0, infusedArmor); // // } else {resultInv.setInventorySlotContents(0, null);} // // } else {resultInv.setInventorySlotContents(0, null);} // // } // // @Override // public void onContainerClosed(EntityPlayer player) { // // super.onContainerClosed(player); // // ItemStack essentia = this.hammerInv.getStackInSlotOnClosing(0); // if(essentia != null) {player.dropPlayerItemWithRandomChoice(essentia, false);} // // ItemStack item = this.hammerInv.getStackInSlotOnClosing(1); // if(item != null) {player.dropPlayerItemWithRandomChoice(item, false);} // // } // // @Override // public boolean canInteractWith(EntityPlayer player) {return true;} // // @Override // public ItemStack transferStackInSlot(EntityPlayer player, int slot) {return null;} // // @Override // public ItemStack slotClick(int slot, int button, int flag, EntityPlayer player) { // // if (slot >= 0 && getSlot(slot) != null && getSlot(slot).getStack() == player.getHeldItem()) {return null;} // return super.slotClick(slot, button, flag, player); // // } // // } // Path: src/main/java/matgm50/twarden/client/gui/GuiWaslieHammer.java import matgm50.twarden.lib.ModLib; import matgm50.twarden.inventory.ContainerHammer; import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.ResourceLocation; import org.lwjgl.opengl.GL11; package matgm50.twarden.client.gui; /** * Created by MasterAbdoTGM50 on 8/27/2014. */ public class GuiWaslieHammer extends GuiContainer { private final int guiWidth = 176; private final int guiHeight = 166; private int startX, startY; private static final ResourceLocation texture = new ResourceLocation(ModLib.ID.toLowerCase(), "textures/gui/guihammer.png"); public GuiWaslieHammer(EntityPlayer inv) {
super(new ContainerHammer(inv));
MasterAbdoTGM50/ThaumicWarden
src/main/java/matgm50/twarden/block/ModBlocks.java
// Path: src/main/java/matgm50/twarden/block/tile/TileWitor.java // public class TileWitor extends TileEntity { // // public boolean canUpdate() {return true;} // // public void updateEntity() { // // super.updateEntity(); // // if (this.worldObj.isRemote) { // // if (this.worldObj.rand.nextInt(9 - Thaumcraft.proxy.particleCount(2)) == 0) { // Thaumcraft.proxy.wispFX3(this.worldObj, this.xCoord + 0.5F, this.yCoord + 0.5F, this.zCoord + 0.5F, this.xCoord + 0.3F + this.worldObj.rand.nextFloat() * 0.4F, this.yCoord + 0.5F, this.zCoord + 0.3F + this.worldObj.rand.nextFloat() * 0.4F, 0.5F, 0, true, -0.025F); // } // // if (this.worldObj.rand.nextInt(15 - Thaumcraft.proxy.particleCount(4)) == 0) { // Thaumcraft.proxy.wispFX3(this.worldObj, this.xCoord + 0.5F, this.yCoord + 0.5F, this.zCoord + 0.5F, this.xCoord + 0.4F + this.worldObj.rand.nextFloat() * 0.2F, this.yCoord + 0.5F, this.zCoord + 0.4F + this.worldObj.rand.nextFloat() * 0.2F, 0.25F, 2, true, -0.02F); // } // // } // // } // // } // // Path: src/main/java/matgm50/twarden/lib/BlockLib.java // public class BlockLib { // // public static final String EXUBITURA_NAME = "blockExubitura"; // public static final String QUARTZ_NORMAL_NAME = "blockInfusedQuartzNormal"; // public static final String QUARTZ_SLAB_NAME = "blockInfusedQuartzSlab"; // public static final String QUARTZ_STAIR_NAME = "blockInfusedQuartzStair"; // public static final String QUARTZ_CHISELED_NAME = "blockInfusedQuartzChiseled"; // public static final String QUARTZ_PILLAR_NAME = "blockInfusedQuartzPillar"; // public static final String BLOCK_WITOR_NAME = "blockWitor"; // public static final String TILE_WITOR_NAME = "tileWitor"; // // }
import cpw.mods.fml.common.registry.GameRegistry; import matgm50.twarden.block.tile.TileWitor; import matgm50.twarden.lib.BlockLib; import net.minecraft.block.Block;
package matgm50.twarden.block; /** * Created by MasterAbdoTGM50 on 5/22/2014. */ public class ModBlocks { public static Block blockExubitura = new BlockExubitura(); public static Block blockInfusedQuartzNormal = new BlockQuartzNormal(); public static Block blockInfusedQuartzChiseled = new BlockQuartzChiseled(); public static Block blockInfusedQuartzPillar = new BlockQuartzPillar(); public static Block blockInfusedQuartzSlab = new BlockQuartzSlab(); public static Block blockInfusedQuartzStair = new BlockQuartzStair(); public static Block blockWitor = new BlockWitor(); public static void init() {
// Path: src/main/java/matgm50/twarden/block/tile/TileWitor.java // public class TileWitor extends TileEntity { // // public boolean canUpdate() {return true;} // // public void updateEntity() { // // super.updateEntity(); // // if (this.worldObj.isRemote) { // // if (this.worldObj.rand.nextInt(9 - Thaumcraft.proxy.particleCount(2)) == 0) { // Thaumcraft.proxy.wispFX3(this.worldObj, this.xCoord + 0.5F, this.yCoord + 0.5F, this.zCoord + 0.5F, this.xCoord + 0.3F + this.worldObj.rand.nextFloat() * 0.4F, this.yCoord + 0.5F, this.zCoord + 0.3F + this.worldObj.rand.nextFloat() * 0.4F, 0.5F, 0, true, -0.025F); // } // // if (this.worldObj.rand.nextInt(15 - Thaumcraft.proxy.particleCount(4)) == 0) { // Thaumcraft.proxy.wispFX3(this.worldObj, this.xCoord + 0.5F, this.yCoord + 0.5F, this.zCoord + 0.5F, this.xCoord + 0.4F + this.worldObj.rand.nextFloat() * 0.2F, this.yCoord + 0.5F, this.zCoord + 0.4F + this.worldObj.rand.nextFloat() * 0.2F, 0.25F, 2, true, -0.02F); // } // // } // // } // // } // // Path: src/main/java/matgm50/twarden/lib/BlockLib.java // public class BlockLib { // // public static final String EXUBITURA_NAME = "blockExubitura"; // public static final String QUARTZ_NORMAL_NAME = "blockInfusedQuartzNormal"; // public static final String QUARTZ_SLAB_NAME = "blockInfusedQuartzSlab"; // public static final String QUARTZ_STAIR_NAME = "blockInfusedQuartzStair"; // public static final String QUARTZ_CHISELED_NAME = "blockInfusedQuartzChiseled"; // public static final String QUARTZ_PILLAR_NAME = "blockInfusedQuartzPillar"; // public static final String BLOCK_WITOR_NAME = "blockWitor"; // public static final String TILE_WITOR_NAME = "tileWitor"; // // } // Path: src/main/java/matgm50/twarden/block/ModBlocks.java import cpw.mods.fml.common.registry.GameRegistry; import matgm50.twarden.block.tile.TileWitor; import matgm50.twarden.lib.BlockLib; import net.minecraft.block.Block; package matgm50.twarden.block; /** * Created by MasterAbdoTGM50 on 5/22/2014. */ public class ModBlocks { public static Block blockExubitura = new BlockExubitura(); public static Block blockInfusedQuartzNormal = new BlockQuartzNormal(); public static Block blockInfusedQuartzChiseled = new BlockQuartzChiseled(); public static Block blockInfusedQuartzPillar = new BlockQuartzPillar(); public static Block blockInfusedQuartzSlab = new BlockQuartzSlab(); public static Block blockInfusedQuartzStair = new BlockQuartzStair(); public static Block blockWitor = new BlockWitor(); public static void init() {
GameRegistry.registerBlock(blockExubitura, BlockLib.EXUBITURA_NAME);
MasterAbdoTGM50/ThaumicWarden
src/main/java/matgm50/twarden/block/ModBlocks.java
// Path: src/main/java/matgm50/twarden/block/tile/TileWitor.java // public class TileWitor extends TileEntity { // // public boolean canUpdate() {return true;} // // public void updateEntity() { // // super.updateEntity(); // // if (this.worldObj.isRemote) { // // if (this.worldObj.rand.nextInt(9 - Thaumcraft.proxy.particleCount(2)) == 0) { // Thaumcraft.proxy.wispFX3(this.worldObj, this.xCoord + 0.5F, this.yCoord + 0.5F, this.zCoord + 0.5F, this.xCoord + 0.3F + this.worldObj.rand.nextFloat() * 0.4F, this.yCoord + 0.5F, this.zCoord + 0.3F + this.worldObj.rand.nextFloat() * 0.4F, 0.5F, 0, true, -0.025F); // } // // if (this.worldObj.rand.nextInt(15 - Thaumcraft.proxy.particleCount(4)) == 0) { // Thaumcraft.proxy.wispFX3(this.worldObj, this.xCoord + 0.5F, this.yCoord + 0.5F, this.zCoord + 0.5F, this.xCoord + 0.4F + this.worldObj.rand.nextFloat() * 0.2F, this.yCoord + 0.5F, this.zCoord + 0.4F + this.worldObj.rand.nextFloat() * 0.2F, 0.25F, 2, true, -0.02F); // } // // } // // } // // } // // Path: src/main/java/matgm50/twarden/lib/BlockLib.java // public class BlockLib { // // public static final String EXUBITURA_NAME = "blockExubitura"; // public static final String QUARTZ_NORMAL_NAME = "blockInfusedQuartzNormal"; // public static final String QUARTZ_SLAB_NAME = "blockInfusedQuartzSlab"; // public static final String QUARTZ_STAIR_NAME = "blockInfusedQuartzStair"; // public static final String QUARTZ_CHISELED_NAME = "blockInfusedQuartzChiseled"; // public static final String QUARTZ_PILLAR_NAME = "blockInfusedQuartzPillar"; // public static final String BLOCK_WITOR_NAME = "blockWitor"; // public static final String TILE_WITOR_NAME = "tileWitor"; // // }
import cpw.mods.fml.common.registry.GameRegistry; import matgm50.twarden.block.tile.TileWitor; import matgm50.twarden.lib.BlockLib; import net.minecraft.block.Block;
package matgm50.twarden.block; /** * Created by MasterAbdoTGM50 on 5/22/2014. */ public class ModBlocks { public static Block blockExubitura = new BlockExubitura(); public static Block blockInfusedQuartzNormal = new BlockQuartzNormal(); public static Block blockInfusedQuartzChiseled = new BlockQuartzChiseled(); public static Block blockInfusedQuartzPillar = new BlockQuartzPillar(); public static Block blockInfusedQuartzSlab = new BlockQuartzSlab(); public static Block blockInfusedQuartzStair = new BlockQuartzStair(); public static Block blockWitor = new BlockWitor(); public static void init() { GameRegistry.registerBlock(blockExubitura, BlockLib.EXUBITURA_NAME); GameRegistry.registerBlock(blockInfusedQuartzNormal, BlockLib.QUARTZ_NORMAL_NAME); GameRegistry.registerBlock(blockInfusedQuartzChiseled, BlockLib.QUARTZ_CHISELED_NAME); GameRegistry.registerBlock(blockInfusedQuartzPillar, BlockLib.QUARTZ_PILLAR_NAME); GameRegistry.registerBlock(blockInfusedQuartzSlab, BlockLib.QUARTZ_SLAB_NAME); GameRegistry.registerBlock(blockInfusedQuartzStair, BlockLib.QUARTZ_STAIR_NAME); GameRegistry.registerBlock(blockWitor, BlockLib.BLOCK_WITOR_NAME);
// Path: src/main/java/matgm50/twarden/block/tile/TileWitor.java // public class TileWitor extends TileEntity { // // public boolean canUpdate() {return true;} // // public void updateEntity() { // // super.updateEntity(); // // if (this.worldObj.isRemote) { // // if (this.worldObj.rand.nextInt(9 - Thaumcraft.proxy.particleCount(2)) == 0) { // Thaumcraft.proxy.wispFX3(this.worldObj, this.xCoord + 0.5F, this.yCoord + 0.5F, this.zCoord + 0.5F, this.xCoord + 0.3F + this.worldObj.rand.nextFloat() * 0.4F, this.yCoord + 0.5F, this.zCoord + 0.3F + this.worldObj.rand.nextFloat() * 0.4F, 0.5F, 0, true, -0.025F); // } // // if (this.worldObj.rand.nextInt(15 - Thaumcraft.proxy.particleCount(4)) == 0) { // Thaumcraft.proxy.wispFX3(this.worldObj, this.xCoord + 0.5F, this.yCoord + 0.5F, this.zCoord + 0.5F, this.xCoord + 0.4F + this.worldObj.rand.nextFloat() * 0.2F, this.yCoord + 0.5F, this.zCoord + 0.4F + this.worldObj.rand.nextFloat() * 0.2F, 0.25F, 2, true, -0.02F); // } // // } // // } // // } // // Path: src/main/java/matgm50/twarden/lib/BlockLib.java // public class BlockLib { // // public static final String EXUBITURA_NAME = "blockExubitura"; // public static final String QUARTZ_NORMAL_NAME = "blockInfusedQuartzNormal"; // public static final String QUARTZ_SLAB_NAME = "blockInfusedQuartzSlab"; // public static final String QUARTZ_STAIR_NAME = "blockInfusedQuartzStair"; // public static final String QUARTZ_CHISELED_NAME = "blockInfusedQuartzChiseled"; // public static final String QUARTZ_PILLAR_NAME = "blockInfusedQuartzPillar"; // public static final String BLOCK_WITOR_NAME = "blockWitor"; // public static final String TILE_WITOR_NAME = "tileWitor"; // // } // Path: src/main/java/matgm50/twarden/block/ModBlocks.java import cpw.mods.fml.common.registry.GameRegistry; import matgm50.twarden.block.tile.TileWitor; import matgm50.twarden.lib.BlockLib; import net.minecraft.block.Block; package matgm50.twarden.block; /** * Created by MasterAbdoTGM50 on 5/22/2014. */ public class ModBlocks { public static Block blockExubitura = new BlockExubitura(); public static Block blockInfusedQuartzNormal = new BlockQuartzNormal(); public static Block blockInfusedQuartzChiseled = new BlockQuartzChiseled(); public static Block blockInfusedQuartzPillar = new BlockQuartzPillar(); public static Block blockInfusedQuartzSlab = new BlockQuartzSlab(); public static Block blockInfusedQuartzStair = new BlockQuartzStair(); public static Block blockWitor = new BlockWitor(); public static void init() { GameRegistry.registerBlock(blockExubitura, BlockLib.EXUBITURA_NAME); GameRegistry.registerBlock(blockInfusedQuartzNormal, BlockLib.QUARTZ_NORMAL_NAME); GameRegistry.registerBlock(blockInfusedQuartzChiseled, BlockLib.QUARTZ_CHISELED_NAME); GameRegistry.registerBlock(blockInfusedQuartzPillar, BlockLib.QUARTZ_PILLAR_NAME); GameRegistry.registerBlock(blockInfusedQuartzSlab, BlockLib.QUARTZ_SLAB_NAME); GameRegistry.registerBlock(blockInfusedQuartzStair, BlockLib.QUARTZ_STAIR_NAME); GameRegistry.registerBlock(blockWitor, BlockLib.BLOCK_WITOR_NAME);
GameRegistry.registerTileEntity(TileWitor.class, BlockLib.TILE_WITOR_NAME);
MasterAbdoTGM50/ThaumicWarden
src/main/java/matgm50/twarden/item/ItemWardenLegs.java
// Path: src/main/java/matgm50/twarden/TWarden.java // @Mod(modid = ModLib.ID, name = ModLib.NAME, version = ModLib.VERSION, dependencies = ModLib.DEPENDENCIES) // // public class TWarden { // // @Instance(ModLib.ID) // public static TWarden instance; // // @SidedProxy(serverSide = ModLib.COMMONPROXY, clientSide = ModLib.CLIENTPROXY) // public static CommonProxy proxy; // // public static CreativeTabs tabTWarden = new TabTWarden(ModLib.ID); // // @EventHandler // public void preInit(FMLPreInitializationEvent event) { // // proxy.initRenderers(); // GuiHandler.init(); // // WardenicChargeEvents.init(); // WardenicUpgrades.init(); // // ModItems.init(); // ModBlocks.init(); // ModEntities.init(); // ModGen.init(); // // } // // @EventHandler // public void init(FMLInitializationEvent event) { // // } // // @EventHandler // public void postInit(FMLPostInitializationEvent event) { // // ModRecipes.init(); // ModResearch.init(); // // } // // } // // Path: src/main/java/matgm50/twarden/lib/ItemLib.java // public class ItemLib { // // public static final String RESOURCE_NAME = "itemResource"; // public static final String[] RESOURCE_ICON = {"wardenpetal", "wardenstone", "wardenquartz"}; // // public static final String WARDEN_AMULET_NAME = "itemWardenAmulet"; // public static final String WARDEN_WEAPON_NAME = "itemWardenWeapon"; // public static final String WARDEN_HELM_NAME = "itemWardenHelm"; // public static final String WARDEN_CHEST_NAME = "itemWardenChest"; // public static final String WARDEN_LEGS_NAME = "itemWardenLegs"; // public static final String WARDEN_BOOTS_NAME = "itemWardenBoots"; // public static final String PURITY_FOCUS_NAME = "itemFocusPurity"; // public static final String LOVE_RING_NAME = "itemLoveRing"; // public static final String WASLIE_HAMMER_NAME = "itemWaslieHammer"; // public static final String ILLUMI_FOCUS_NAME = "itemFocusIllumination"; // // } // // Path: src/main/java/matgm50/twarden/lib/ModLib.java // public class ModLib { // // public static final String ID = "TWarden"; // public static final String NAME = "Thaumic Warden"; // public static final String VERSION = "1.1.1"; // public static final String DEPENDENCIES = "required-after:Thaumcraft"; // // public static final String CLIENTPROXY = "matgm50.twarden.proxy.ClientProxy"; // public static final String COMMONPROXY = "matgm50.twarden.proxy.CommonProxy"; // // }
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import matgm50.twarden.TWarden; import matgm50.twarden.lib.ItemLib; import matgm50.twarden.lib.ModLib; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.Entity; import net.minecraft.item.ItemStack;
package matgm50.twarden.item; /** * Created by MasterAbdoTGM50 on 6/26/2014. */ public class ItemWardenLegs extends ItemWardenArmor { public ItemWardenLegs() { super(2);
// Path: src/main/java/matgm50/twarden/TWarden.java // @Mod(modid = ModLib.ID, name = ModLib.NAME, version = ModLib.VERSION, dependencies = ModLib.DEPENDENCIES) // // public class TWarden { // // @Instance(ModLib.ID) // public static TWarden instance; // // @SidedProxy(serverSide = ModLib.COMMONPROXY, clientSide = ModLib.CLIENTPROXY) // public static CommonProxy proxy; // // public static CreativeTabs tabTWarden = new TabTWarden(ModLib.ID); // // @EventHandler // public void preInit(FMLPreInitializationEvent event) { // // proxy.initRenderers(); // GuiHandler.init(); // // WardenicChargeEvents.init(); // WardenicUpgrades.init(); // // ModItems.init(); // ModBlocks.init(); // ModEntities.init(); // ModGen.init(); // // } // // @EventHandler // public void init(FMLInitializationEvent event) { // // } // // @EventHandler // public void postInit(FMLPostInitializationEvent event) { // // ModRecipes.init(); // ModResearch.init(); // // } // // } // // Path: src/main/java/matgm50/twarden/lib/ItemLib.java // public class ItemLib { // // public static final String RESOURCE_NAME = "itemResource"; // public static final String[] RESOURCE_ICON = {"wardenpetal", "wardenstone", "wardenquartz"}; // // public static final String WARDEN_AMULET_NAME = "itemWardenAmulet"; // public static final String WARDEN_WEAPON_NAME = "itemWardenWeapon"; // public static final String WARDEN_HELM_NAME = "itemWardenHelm"; // public static final String WARDEN_CHEST_NAME = "itemWardenChest"; // public static final String WARDEN_LEGS_NAME = "itemWardenLegs"; // public static final String WARDEN_BOOTS_NAME = "itemWardenBoots"; // public static final String PURITY_FOCUS_NAME = "itemFocusPurity"; // public static final String LOVE_RING_NAME = "itemLoveRing"; // public static final String WASLIE_HAMMER_NAME = "itemWaslieHammer"; // public static final String ILLUMI_FOCUS_NAME = "itemFocusIllumination"; // // } // // Path: src/main/java/matgm50/twarden/lib/ModLib.java // public class ModLib { // // public static final String ID = "TWarden"; // public static final String NAME = "Thaumic Warden"; // public static final String VERSION = "1.1.1"; // public static final String DEPENDENCIES = "required-after:Thaumcraft"; // // public static final String CLIENTPROXY = "matgm50.twarden.proxy.ClientProxy"; // public static final String COMMONPROXY = "matgm50.twarden.proxy.CommonProxy"; // // } // Path: src/main/java/matgm50/twarden/item/ItemWardenLegs.java import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import matgm50.twarden.TWarden; import matgm50.twarden.lib.ItemLib; import matgm50.twarden.lib.ModLib; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.Entity; import net.minecraft.item.ItemStack; package matgm50.twarden.item; /** * Created by MasterAbdoTGM50 on 6/26/2014. */ public class ItemWardenLegs extends ItemWardenArmor { public ItemWardenLegs() { super(2);
setUnlocalizedName(ItemLib.WARDEN_LEGS_NAME);
MasterAbdoTGM50/ThaumicWarden
src/main/java/matgm50/twarden/item/ItemWardenLegs.java
// Path: src/main/java/matgm50/twarden/TWarden.java // @Mod(modid = ModLib.ID, name = ModLib.NAME, version = ModLib.VERSION, dependencies = ModLib.DEPENDENCIES) // // public class TWarden { // // @Instance(ModLib.ID) // public static TWarden instance; // // @SidedProxy(serverSide = ModLib.COMMONPROXY, clientSide = ModLib.CLIENTPROXY) // public static CommonProxy proxy; // // public static CreativeTabs tabTWarden = new TabTWarden(ModLib.ID); // // @EventHandler // public void preInit(FMLPreInitializationEvent event) { // // proxy.initRenderers(); // GuiHandler.init(); // // WardenicChargeEvents.init(); // WardenicUpgrades.init(); // // ModItems.init(); // ModBlocks.init(); // ModEntities.init(); // ModGen.init(); // // } // // @EventHandler // public void init(FMLInitializationEvent event) { // // } // // @EventHandler // public void postInit(FMLPostInitializationEvent event) { // // ModRecipes.init(); // ModResearch.init(); // // } // // } // // Path: src/main/java/matgm50/twarden/lib/ItemLib.java // public class ItemLib { // // public static final String RESOURCE_NAME = "itemResource"; // public static final String[] RESOURCE_ICON = {"wardenpetal", "wardenstone", "wardenquartz"}; // // public static final String WARDEN_AMULET_NAME = "itemWardenAmulet"; // public static final String WARDEN_WEAPON_NAME = "itemWardenWeapon"; // public static final String WARDEN_HELM_NAME = "itemWardenHelm"; // public static final String WARDEN_CHEST_NAME = "itemWardenChest"; // public static final String WARDEN_LEGS_NAME = "itemWardenLegs"; // public static final String WARDEN_BOOTS_NAME = "itemWardenBoots"; // public static final String PURITY_FOCUS_NAME = "itemFocusPurity"; // public static final String LOVE_RING_NAME = "itemLoveRing"; // public static final String WASLIE_HAMMER_NAME = "itemWaslieHammer"; // public static final String ILLUMI_FOCUS_NAME = "itemFocusIllumination"; // // } // // Path: src/main/java/matgm50/twarden/lib/ModLib.java // public class ModLib { // // public static final String ID = "TWarden"; // public static final String NAME = "Thaumic Warden"; // public static final String VERSION = "1.1.1"; // public static final String DEPENDENCIES = "required-after:Thaumcraft"; // // public static final String CLIENTPROXY = "matgm50.twarden.proxy.ClientProxy"; // public static final String COMMONPROXY = "matgm50.twarden.proxy.CommonProxy"; // // }
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import matgm50.twarden.TWarden; import matgm50.twarden.lib.ItemLib; import matgm50.twarden.lib.ModLib; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.Entity; import net.minecraft.item.ItemStack;
package matgm50.twarden.item; /** * Created by MasterAbdoTGM50 on 6/26/2014. */ public class ItemWardenLegs extends ItemWardenArmor { public ItemWardenLegs() { super(2); setUnlocalizedName(ItemLib.WARDEN_LEGS_NAME); } @Override @SideOnly(Side.CLIENT) public void registerIcons(IIconRegister register) {
// Path: src/main/java/matgm50/twarden/TWarden.java // @Mod(modid = ModLib.ID, name = ModLib.NAME, version = ModLib.VERSION, dependencies = ModLib.DEPENDENCIES) // // public class TWarden { // // @Instance(ModLib.ID) // public static TWarden instance; // // @SidedProxy(serverSide = ModLib.COMMONPROXY, clientSide = ModLib.CLIENTPROXY) // public static CommonProxy proxy; // // public static CreativeTabs tabTWarden = new TabTWarden(ModLib.ID); // // @EventHandler // public void preInit(FMLPreInitializationEvent event) { // // proxy.initRenderers(); // GuiHandler.init(); // // WardenicChargeEvents.init(); // WardenicUpgrades.init(); // // ModItems.init(); // ModBlocks.init(); // ModEntities.init(); // ModGen.init(); // // } // // @EventHandler // public void init(FMLInitializationEvent event) { // // } // // @EventHandler // public void postInit(FMLPostInitializationEvent event) { // // ModRecipes.init(); // ModResearch.init(); // // } // // } // // Path: src/main/java/matgm50/twarden/lib/ItemLib.java // public class ItemLib { // // public static final String RESOURCE_NAME = "itemResource"; // public static final String[] RESOURCE_ICON = {"wardenpetal", "wardenstone", "wardenquartz"}; // // public static final String WARDEN_AMULET_NAME = "itemWardenAmulet"; // public static final String WARDEN_WEAPON_NAME = "itemWardenWeapon"; // public static final String WARDEN_HELM_NAME = "itemWardenHelm"; // public static final String WARDEN_CHEST_NAME = "itemWardenChest"; // public static final String WARDEN_LEGS_NAME = "itemWardenLegs"; // public static final String WARDEN_BOOTS_NAME = "itemWardenBoots"; // public static final String PURITY_FOCUS_NAME = "itemFocusPurity"; // public static final String LOVE_RING_NAME = "itemLoveRing"; // public static final String WASLIE_HAMMER_NAME = "itemWaslieHammer"; // public static final String ILLUMI_FOCUS_NAME = "itemFocusIllumination"; // // } // // Path: src/main/java/matgm50/twarden/lib/ModLib.java // public class ModLib { // // public static final String ID = "TWarden"; // public static final String NAME = "Thaumic Warden"; // public static final String VERSION = "1.1.1"; // public static final String DEPENDENCIES = "required-after:Thaumcraft"; // // public static final String CLIENTPROXY = "matgm50.twarden.proxy.ClientProxy"; // public static final String COMMONPROXY = "matgm50.twarden.proxy.CommonProxy"; // // } // Path: src/main/java/matgm50/twarden/item/ItemWardenLegs.java import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import matgm50.twarden.TWarden; import matgm50.twarden.lib.ItemLib; import matgm50.twarden.lib.ModLib; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.Entity; import net.minecraft.item.ItemStack; package matgm50.twarden.item; /** * Created by MasterAbdoTGM50 on 6/26/2014. */ public class ItemWardenLegs extends ItemWardenArmor { public ItemWardenLegs() { super(2); setUnlocalizedName(ItemLib.WARDEN_LEGS_NAME); } @Override @SideOnly(Side.CLIENT) public void registerIcons(IIconRegister register) {
itemIcon = register.registerIcon(ModLib.ID.toLowerCase() + ":" + "wardenlegs");
MasterAbdoTGM50/ThaumicWarden
src/main/java/matgm50/twarden/item/ModItems.java
// Path: src/main/java/matgm50/twarden/lib/ItemLib.java // public class ItemLib { // // public static final String RESOURCE_NAME = "itemResource"; // public static final String[] RESOURCE_ICON = {"wardenpetal", "wardenstone", "wardenquartz"}; // // public static final String WARDEN_AMULET_NAME = "itemWardenAmulet"; // public static final String WARDEN_WEAPON_NAME = "itemWardenWeapon"; // public static final String WARDEN_HELM_NAME = "itemWardenHelm"; // public static final String WARDEN_CHEST_NAME = "itemWardenChest"; // public static final String WARDEN_LEGS_NAME = "itemWardenLegs"; // public static final String WARDEN_BOOTS_NAME = "itemWardenBoots"; // public static final String PURITY_FOCUS_NAME = "itemFocusPurity"; // public static final String LOVE_RING_NAME = "itemLoveRing"; // public static final String WASLIE_HAMMER_NAME = "itemWaslieHammer"; // public static final String ILLUMI_FOCUS_NAME = "itemFocusIllumination"; // // }
import cpw.mods.fml.common.registry.GameRegistry; import matgm50.twarden.lib.ItemLib; import net.minecraft.item.Item; import net.minecraft.item.ItemArmor.ArmorMaterial; import net.minecraftforge.common.util.EnumHelper;
package matgm50.twarden.item; /** * Created by MasterAbdoTGM50 on 5/13/2014. */ public class ModItems { public static ArmorMaterial materialWarden = EnumHelper.addArmorMaterial("WARDEN", 33, new int[]{3, 8, 6, 3}, 50); public static Item itemResource = new ItemResource(); public static Item itemWardenAmulet = new ItemWardenAmulet(); public static Item itemWardenSword = new ItemWardenWeapon(); public static Item itemFocusPurity = new ItemFocusPurity(); public static Item itemWardenHelm = new ItemWardenHelm(); public static Item itemWardenChest = new ItemWardenChest(); public static Item itemWardenLegs = new ItemWardenLegs(); public static Item itemWardenBoots = new ItemWardenBoots(); public static Item itemLoveRing = new ItemLoveRing(); public static Item itemWaslieHammer = new ItemWaslieHammer(); public static Item itemFocusIllumination = new ItemFocusIllumination(); public static void init() {
// Path: src/main/java/matgm50/twarden/lib/ItemLib.java // public class ItemLib { // // public static final String RESOURCE_NAME = "itemResource"; // public static final String[] RESOURCE_ICON = {"wardenpetal", "wardenstone", "wardenquartz"}; // // public static final String WARDEN_AMULET_NAME = "itemWardenAmulet"; // public static final String WARDEN_WEAPON_NAME = "itemWardenWeapon"; // public static final String WARDEN_HELM_NAME = "itemWardenHelm"; // public static final String WARDEN_CHEST_NAME = "itemWardenChest"; // public static final String WARDEN_LEGS_NAME = "itemWardenLegs"; // public static final String WARDEN_BOOTS_NAME = "itemWardenBoots"; // public static final String PURITY_FOCUS_NAME = "itemFocusPurity"; // public static final String LOVE_RING_NAME = "itemLoveRing"; // public static final String WASLIE_HAMMER_NAME = "itemWaslieHammer"; // public static final String ILLUMI_FOCUS_NAME = "itemFocusIllumination"; // // } // Path: src/main/java/matgm50/twarden/item/ModItems.java import cpw.mods.fml.common.registry.GameRegistry; import matgm50.twarden.lib.ItemLib; import net.minecraft.item.Item; import net.minecraft.item.ItemArmor.ArmorMaterial; import net.minecraftforge.common.util.EnumHelper; package matgm50.twarden.item; /** * Created by MasterAbdoTGM50 on 5/13/2014. */ public class ModItems { public static ArmorMaterial materialWarden = EnumHelper.addArmorMaterial("WARDEN", 33, new int[]{3, 8, 6, 3}, 50); public static Item itemResource = new ItemResource(); public static Item itemWardenAmulet = new ItemWardenAmulet(); public static Item itemWardenSword = new ItemWardenWeapon(); public static Item itemFocusPurity = new ItemFocusPurity(); public static Item itemWardenHelm = new ItemWardenHelm(); public static Item itemWardenChest = new ItemWardenChest(); public static Item itemWardenLegs = new ItemWardenLegs(); public static Item itemWardenBoots = new ItemWardenBoots(); public static Item itemLoveRing = new ItemLoveRing(); public static Item itemWaslieHammer = new ItemWaslieHammer(); public static Item itemFocusIllumination = new ItemFocusIllumination(); public static void init() {
GameRegistry.registerItem(itemResource, ItemLib.RESOURCE_NAME);
MasterAbdoTGM50/ThaumicWarden
src/main/java/matgm50/twarden/block/BlockQuartzStair.java
// Path: src/main/java/matgm50/twarden/TWarden.java // @Mod(modid = ModLib.ID, name = ModLib.NAME, version = ModLib.VERSION, dependencies = ModLib.DEPENDENCIES) // // public class TWarden { // // @Instance(ModLib.ID) // public static TWarden instance; // // @SidedProxy(serverSide = ModLib.COMMONPROXY, clientSide = ModLib.CLIENTPROXY) // public static CommonProxy proxy; // // public static CreativeTabs tabTWarden = new TabTWarden(ModLib.ID); // // @EventHandler // public void preInit(FMLPreInitializationEvent event) { // // proxy.initRenderers(); // GuiHandler.init(); // // WardenicChargeEvents.init(); // WardenicUpgrades.init(); // // ModItems.init(); // ModBlocks.init(); // ModEntities.init(); // ModGen.init(); // // } // // @EventHandler // public void init(FMLInitializationEvent event) { // // } // // @EventHandler // public void postInit(FMLPostInitializationEvent event) { // // ModRecipes.init(); // ModResearch.init(); // // } // // } // // Path: src/main/java/matgm50/twarden/lib/BlockLib.java // public class BlockLib { // // public static final String EXUBITURA_NAME = "blockExubitura"; // public static final String QUARTZ_NORMAL_NAME = "blockInfusedQuartzNormal"; // public static final String QUARTZ_SLAB_NAME = "blockInfusedQuartzSlab"; // public static final String QUARTZ_STAIR_NAME = "blockInfusedQuartzStair"; // public static final String QUARTZ_CHISELED_NAME = "blockInfusedQuartzChiseled"; // public static final String QUARTZ_PILLAR_NAME = "blockInfusedQuartzPillar"; // public static final String BLOCK_WITOR_NAME = "blockWitor"; // public static final String TILE_WITOR_NAME = "tileWitor"; // // }
import matgm50.twarden.TWarden; import matgm50.twarden.lib.BlockLib; import net.minecraft.block.Block; import net.minecraft.block.BlockStairs;
package matgm50.twarden.block; /** * Created by MasterAbdoTGM50 on 5/22/2014. */ public class BlockQuartzStair extends BlockStairs { protected BlockQuartzStair() { super(ModBlocks.blockInfusedQuartzNormal, 0);
// Path: src/main/java/matgm50/twarden/TWarden.java // @Mod(modid = ModLib.ID, name = ModLib.NAME, version = ModLib.VERSION, dependencies = ModLib.DEPENDENCIES) // // public class TWarden { // // @Instance(ModLib.ID) // public static TWarden instance; // // @SidedProxy(serverSide = ModLib.COMMONPROXY, clientSide = ModLib.CLIENTPROXY) // public static CommonProxy proxy; // // public static CreativeTabs tabTWarden = new TabTWarden(ModLib.ID); // // @EventHandler // public void preInit(FMLPreInitializationEvent event) { // // proxy.initRenderers(); // GuiHandler.init(); // // WardenicChargeEvents.init(); // WardenicUpgrades.init(); // // ModItems.init(); // ModBlocks.init(); // ModEntities.init(); // ModGen.init(); // // } // // @EventHandler // public void init(FMLInitializationEvent event) { // // } // // @EventHandler // public void postInit(FMLPostInitializationEvent event) { // // ModRecipes.init(); // ModResearch.init(); // // } // // } // // Path: src/main/java/matgm50/twarden/lib/BlockLib.java // public class BlockLib { // // public static final String EXUBITURA_NAME = "blockExubitura"; // public static final String QUARTZ_NORMAL_NAME = "blockInfusedQuartzNormal"; // public static final String QUARTZ_SLAB_NAME = "blockInfusedQuartzSlab"; // public static final String QUARTZ_STAIR_NAME = "blockInfusedQuartzStair"; // public static final String QUARTZ_CHISELED_NAME = "blockInfusedQuartzChiseled"; // public static final String QUARTZ_PILLAR_NAME = "blockInfusedQuartzPillar"; // public static final String BLOCK_WITOR_NAME = "blockWitor"; // public static final String TILE_WITOR_NAME = "tileWitor"; // // } // Path: src/main/java/matgm50/twarden/block/BlockQuartzStair.java import matgm50.twarden.TWarden; import matgm50.twarden.lib.BlockLib; import net.minecraft.block.Block; import net.minecraft.block.BlockStairs; package matgm50.twarden.block; /** * Created by MasterAbdoTGM50 on 5/22/2014. */ public class BlockQuartzStair extends BlockStairs { protected BlockQuartzStair() { super(ModBlocks.blockInfusedQuartzNormal, 0);
setBlockName(BlockLib.QUARTZ_STAIR_NAME);
MasterAbdoTGM50/ThaumicWarden
src/main/java/matgm50/twarden/block/BlockQuartzStair.java
// Path: src/main/java/matgm50/twarden/TWarden.java // @Mod(modid = ModLib.ID, name = ModLib.NAME, version = ModLib.VERSION, dependencies = ModLib.DEPENDENCIES) // // public class TWarden { // // @Instance(ModLib.ID) // public static TWarden instance; // // @SidedProxy(serverSide = ModLib.COMMONPROXY, clientSide = ModLib.CLIENTPROXY) // public static CommonProxy proxy; // // public static CreativeTabs tabTWarden = new TabTWarden(ModLib.ID); // // @EventHandler // public void preInit(FMLPreInitializationEvent event) { // // proxy.initRenderers(); // GuiHandler.init(); // // WardenicChargeEvents.init(); // WardenicUpgrades.init(); // // ModItems.init(); // ModBlocks.init(); // ModEntities.init(); // ModGen.init(); // // } // // @EventHandler // public void init(FMLInitializationEvent event) { // // } // // @EventHandler // public void postInit(FMLPostInitializationEvent event) { // // ModRecipes.init(); // ModResearch.init(); // // } // // } // // Path: src/main/java/matgm50/twarden/lib/BlockLib.java // public class BlockLib { // // public static final String EXUBITURA_NAME = "blockExubitura"; // public static final String QUARTZ_NORMAL_NAME = "blockInfusedQuartzNormal"; // public static final String QUARTZ_SLAB_NAME = "blockInfusedQuartzSlab"; // public static final String QUARTZ_STAIR_NAME = "blockInfusedQuartzStair"; // public static final String QUARTZ_CHISELED_NAME = "blockInfusedQuartzChiseled"; // public static final String QUARTZ_PILLAR_NAME = "blockInfusedQuartzPillar"; // public static final String BLOCK_WITOR_NAME = "blockWitor"; // public static final String TILE_WITOR_NAME = "tileWitor"; // // }
import matgm50.twarden.TWarden; import matgm50.twarden.lib.BlockLib; import net.minecraft.block.Block; import net.minecraft.block.BlockStairs;
package matgm50.twarden.block; /** * Created by MasterAbdoTGM50 on 5/22/2014. */ public class BlockQuartzStair extends BlockStairs { protected BlockQuartzStair() { super(ModBlocks.blockInfusedQuartzNormal, 0); setBlockName(BlockLib.QUARTZ_STAIR_NAME);
// Path: src/main/java/matgm50/twarden/TWarden.java // @Mod(modid = ModLib.ID, name = ModLib.NAME, version = ModLib.VERSION, dependencies = ModLib.DEPENDENCIES) // // public class TWarden { // // @Instance(ModLib.ID) // public static TWarden instance; // // @SidedProxy(serverSide = ModLib.COMMONPROXY, clientSide = ModLib.CLIENTPROXY) // public static CommonProxy proxy; // // public static CreativeTabs tabTWarden = new TabTWarden(ModLib.ID); // // @EventHandler // public void preInit(FMLPreInitializationEvent event) { // // proxy.initRenderers(); // GuiHandler.init(); // // WardenicChargeEvents.init(); // WardenicUpgrades.init(); // // ModItems.init(); // ModBlocks.init(); // ModEntities.init(); // ModGen.init(); // // } // // @EventHandler // public void init(FMLInitializationEvent event) { // // } // // @EventHandler // public void postInit(FMLPostInitializationEvent event) { // // ModRecipes.init(); // ModResearch.init(); // // } // // } // // Path: src/main/java/matgm50/twarden/lib/BlockLib.java // public class BlockLib { // // public static final String EXUBITURA_NAME = "blockExubitura"; // public static final String QUARTZ_NORMAL_NAME = "blockInfusedQuartzNormal"; // public static final String QUARTZ_SLAB_NAME = "blockInfusedQuartzSlab"; // public static final String QUARTZ_STAIR_NAME = "blockInfusedQuartzStair"; // public static final String QUARTZ_CHISELED_NAME = "blockInfusedQuartzChiseled"; // public static final String QUARTZ_PILLAR_NAME = "blockInfusedQuartzPillar"; // public static final String BLOCK_WITOR_NAME = "blockWitor"; // public static final String TILE_WITOR_NAME = "tileWitor"; // // } // Path: src/main/java/matgm50/twarden/block/BlockQuartzStair.java import matgm50.twarden.TWarden; import matgm50.twarden.lib.BlockLib; import net.minecraft.block.Block; import net.minecraft.block.BlockStairs; package matgm50.twarden.block; /** * Created by MasterAbdoTGM50 on 5/22/2014. */ public class BlockQuartzStair extends BlockStairs { protected BlockQuartzStair() { super(ModBlocks.blockInfusedQuartzNormal, 0); setBlockName(BlockLib.QUARTZ_STAIR_NAME);
setCreativeTab(TWarden.tabTWarden);
MasterAbdoTGM50/ThaumicWarden
src/main/java/matgm50/twarden/util/wardenic/WardenicChargeEvents.java
// Path: src/main/java/matgm50/twarden/item/ItemWardenArmor.java // public class ItemWardenArmor extends ItemArmor implements ISpecialArmor, IVisDiscountGear { // // public ItemWardenArmor(int type) { // // super(ModItems.materialWarden, 3, type); // setCreativeTab(TWarden.tabTWarden); // setMaxStackSize(1); // // } // // @Override // public boolean getShareTag() {return true;} // // @Override // public boolean isBookEnchantable(ItemStack stack, ItemStack book) {return false;} // // @Override // public int getMaxDamage(ItemStack stack) {return 50;} // // @Override // public boolean isDamageable() {return false;} // // @Override // public EnumRarity getRarity(ItemStack par1ItemStack) {return EnumRarity.epic;} // // @Override // public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) { // // par3List.add(EnumChatFormatting.AQUA + StatCollector.translateToLocal("tooltip.wardenic.charge") + ": " + (par1ItemStack.getMaxDamage() - par1ItemStack.getItemDamage()) + "/" + par1ItemStack.getMaxDamage()); // par3List.add(EnumChatFormatting.GOLD + StatCollector.translateToLocal("tooltip.wardenic.upgrade") + ": " + WardenicChargeHelper.getUpgrade(par1ItemStack).getQuote()); // // super.addInformation(par1ItemStack, par2EntityPlayer, par3List, par4); // // } // // @Override // public void onArmorTick(World world, EntityPlayer player, ItemStack itemStack) { // // WardenicChargeHelper.getUpgrade(itemStack).onTick(world, player, itemStack); // // super.onArmorTick(world, player, itemStack); // // } // // @Override // public ArmorProperties getProperties(EntityLivingBase player, ItemStack armor, DamageSource source, double damage, int slot) { // // if(armor.getItemDamage() != armor.getMaxDamage()) { // // return new ArmorProperties(0, getArmorMaterial().getDamageReductionAmount(slot) / 25D, 20); // // } else { // // return new ArmorProperties(0, 0, 0); // // } // // } // // @Override // public int getArmorDisplay(EntityPlayer player, ItemStack armor, int slot) {return getArmorMaterial().getDamageReductionAmount(slot);} // // @Override // public void damageArmor(EntityLivingBase entity, ItemStack stack, DamageSource source, int damage, int slot) {} // // @Override // public int getVisDiscount(ItemStack stack, EntityPlayer player, Aspect aspect) {return 5;} // // } // // Path: src/main/java/matgm50/twarden/item/ItemWardenWeapon.java // public class ItemWardenWeapon extends Item { // // public ItemWardenWeapon() { // // super(); // setUnlocalizedName(ItemLib.WARDEN_WEAPON_NAME); // setCreativeTab(TWarden.tabTWarden); // setMaxStackSize(1); // // setFull3D(); // // } // // @Override // public boolean getShareTag() {return true;} // // @Override // public boolean isBookEnchantable(ItemStack stack, ItemStack book) {return false;} // // @Override // public int getMaxDamage(ItemStack stack) {return 50;} // // @Override // public boolean isDamageable() {return false;} // // @Override // public EnumRarity getRarity(ItemStack par1ItemStack) {return EnumRarity.epic;} // // @Override // public EnumAction getItemUseAction(ItemStack par1ItemStack) {return EnumAction.block;} // // @Override // public int getMaxItemUseDuration(ItemStack par1ItemStack) {return 72000;} // // @Override // public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) { // // par3List.add(EnumChatFormatting.AQUA + StatCollector.translateToLocal("tooltip.wardenic.charge") + ": " + (par1ItemStack.getMaxDamage() - par1ItemStack.getItemDamage()) + "/" + par1ItemStack.getMaxDamage()); // par3List.add(EnumChatFormatting.GOLD + StatCollector.translateToLocal("tooltip.wardenic.upgrade") + ": " + WardenicChargeHelper.getUpgrade(par1ItemStack).getQuote()); // // super.addInformation(par1ItemStack, par2EntityPlayer, par3List, par4); // // } // // @Override // public boolean onLeftClickEntity(ItemStack stack, EntityPlayer player, Entity entity) { // // if(stack.getItemDamage() != stack.getMaxDamage()) { // // DamageSource damageSource = new DamageSourceWarden("warden", player); // // entity.attackEntityFrom(damageSource, 5); // // WardenicChargeHelper.getUpgrade(stack).onAttack(stack, player, entity); // // stack.setItemDamage(stack.getItemDamage() + 1); // // } // // return super.onLeftClickEntity(stack, player, entity); // // } // // @Override // @SideOnly(Side.CLIENT) // public void registerIcons(IIconRegister register) { // // itemIcon = register.registerIcon(ModLib.ID.toLowerCase() + ":" + "wardensword"); // // } // // }
import cpw.mods.fml.common.eventhandler.SubscribeEvent; import matgm50.twarden.item.ItemWardenArmor; import matgm50.twarden.item.ItemWardenWeapon; import net.minecraft.entity.player.EntityPlayer; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent; import net.minecraftforge.event.entity.living.LivingHurtEvent; import java.util.Random;
package matgm50.twarden.util.wardenic; /** * Created by MasterAbdoTGM50 on 7/16/2014. */ public class WardenicChargeEvents { private Random random = new Random(); public static void init() { MinecraftForge.EVENT_BUS.register(new WardenicChargeEvents()); } @SubscribeEvent public void onTick(LivingUpdateEvent event) { if(event.entity instanceof EntityPlayer) { EntityPlayer player = (EntityPlayer)event.entity; for(int i = 0; i < 5; i++) { if(player.getEquipmentInSlot(i) != null) {
// Path: src/main/java/matgm50/twarden/item/ItemWardenArmor.java // public class ItemWardenArmor extends ItemArmor implements ISpecialArmor, IVisDiscountGear { // // public ItemWardenArmor(int type) { // // super(ModItems.materialWarden, 3, type); // setCreativeTab(TWarden.tabTWarden); // setMaxStackSize(1); // // } // // @Override // public boolean getShareTag() {return true;} // // @Override // public boolean isBookEnchantable(ItemStack stack, ItemStack book) {return false;} // // @Override // public int getMaxDamage(ItemStack stack) {return 50;} // // @Override // public boolean isDamageable() {return false;} // // @Override // public EnumRarity getRarity(ItemStack par1ItemStack) {return EnumRarity.epic;} // // @Override // public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) { // // par3List.add(EnumChatFormatting.AQUA + StatCollector.translateToLocal("tooltip.wardenic.charge") + ": " + (par1ItemStack.getMaxDamage() - par1ItemStack.getItemDamage()) + "/" + par1ItemStack.getMaxDamage()); // par3List.add(EnumChatFormatting.GOLD + StatCollector.translateToLocal("tooltip.wardenic.upgrade") + ": " + WardenicChargeHelper.getUpgrade(par1ItemStack).getQuote()); // // super.addInformation(par1ItemStack, par2EntityPlayer, par3List, par4); // // } // // @Override // public void onArmorTick(World world, EntityPlayer player, ItemStack itemStack) { // // WardenicChargeHelper.getUpgrade(itemStack).onTick(world, player, itemStack); // // super.onArmorTick(world, player, itemStack); // // } // // @Override // public ArmorProperties getProperties(EntityLivingBase player, ItemStack armor, DamageSource source, double damage, int slot) { // // if(armor.getItemDamage() != armor.getMaxDamage()) { // // return new ArmorProperties(0, getArmorMaterial().getDamageReductionAmount(slot) / 25D, 20); // // } else { // // return new ArmorProperties(0, 0, 0); // // } // // } // // @Override // public int getArmorDisplay(EntityPlayer player, ItemStack armor, int slot) {return getArmorMaterial().getDamageReductionAmount(slot);} // // @Override // public void damageArmor(EntityLivingBase entity, ItemStack stack, DamageSource source, int damage, int slot) {} // // @Override // public int getVisDiscount(ItemStack stack, EntityPlayer player, Aspect aspect) {return 5;} // // } // // Path: src/main/java/matgm50/twarden/item/ItemWardenWeapon.java // public class ItemWardenWeapon extends Item { // // public ItemWardenWeapon() { // // super(); // setUnlocalizedName(ItemLib.WARDEN_WEAPON_NAME); // setCreativeTab(TWarden.tabTWarden); // setMaxStackSize(1); // // setFull3D(); // // } // // @Override // public boolean getShareTag() {return true;} // // @Override // public boolean isBookEnchantable(ItemStack stack, ItemStack book) {return false;} // // @Override // public int getMaxDamage(ItemStack stack) {return 50;} // // @Override // public boolean isDamageable() {return false;} // // @Override // public EnumRarity getRarity(ItemStack par1ItemStack) {return EnumRarity.epic;} // // @Override // public EnumAction getItemUseAction(ItemStack par1ItemStack) {return EnumAction.block;} // // @Override // public int getMaxItemUseDuration(ItemStack par1ItemStack) {return 72000;} // // @Override // public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) { // // par3List.add(EnumChatFormatting.AQUA + StatCollector.translateToLocal("tooltip.wardenic.charge") + ": " + (par1ItemStack.getMaxDamage() - par1ItemStack.getItemDamage()) + "/" + par1ItemStack.getMaxDamage()); // par3List.add(EnumChatFormatting.GOLD + StatCollector.translateToLocal("tooltip.wardenic.upgrade") + ": " + WardenicChargeHelper.getUpgrade(par1ItemStack).getQuote()); // // super.addInformation(par1ItemStack, par2EntityPlayer, par3List, par4); // // } // // @Override // public boolean onLeftClickEntity(ItemStack stack, EntityPlayer player, Entity entity) { // // if(stack.getItemDamage() != stack.getMaxDamage()) { // // DamageSource damageSource = new DamageSourceWarden("warden", player); // // entity.attackEntityFrom(damageSource, 5); // // WardenicChargeHelper.getUpgrade(stack).onAttack(stack, player, entity); // // stack.setItemDamage(stack.getItemDamage() + 1); // // } // // return super.onLeftClickEntity(stack, player, entity); // // } // // @Override // @SideOnly(Side.CLIENT) // public void registerIcons(IIconRegister register) { // // itemIcon = register.registerIcon(ModLib.ID.toLowerCase() + ":" + "wardensword"); // // } // // } // Path: src/main/java/matgm50/twarden/util/wardenic/WardenicChargeEvents.java import cpw.mods.fml.common.eventhandler.SubscribeEvent; import matgm50.twarden.item.ItemWardenArmor; import matgm50.twarden.item.ItemWardenWeapon; import net.minecraft.entity.player.EntityPlayer; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent; import net.minecraftforge.event.entity.living.LivingHurtEvent; import java.util.Random; package matgm50.twarden.util.wardenic; /** * Created by MasterAbdoTGM50 on 7/16/2014. */ public class WardenicChargeEvents { private Random random = new Random(); public static void init() { MinecraftForge.EVENT_BUS.register(new WardenicChargeEvents()); } @SubscribeEvent public void onTick(LivingUpdateEvent event) { if(event.entity instanceof EntityPlayer) { EntityPlayer player = (EntityPlayer)event.entity; for(int i = 0; i < 5; i++) { if(player.getEquipmentInSlot(i) != null) {
if(player.getEquipmentInSlot(i).getItem() instanceof ItemWardenArmor || player.getEquipmentInSlot(i).getItem() instanceof ItemWardenWeapon) {
MasterAbdoTGM50/ThaumicWarden
src/main/java/matgm50/twarden/util/wardenic/WardenicChargeEvents.java
// Path: src/main/java/matgm50/twarden/item/ItemWardenArmor.java // public class ItemWardenArmor extends ItemArmor implements ISpecialArmor, IVisDiscountGear { // // public ItemWardenArmor(int type) { // // super(ModItems.materialWarden, 3, type); // setCreativeTab(TWarden.tabTWarden); // setMaxStackSize(1); // // } // // @Override // public boolean getShareTag() {return true;} // // @Override // public boolean isBookEnchantable(ItemStack stack, ItemStack book) {return false;} // // @Override // public int getMaxDamage(ItemStack stack) {return 50;} // // @Override // public boolean isDamageable() {return false;} // // @Override // public EnumRarity getRarity(ItemStack par1ItemStack) {return EnumRarity.epic;} // // @Override // public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) { // // par3List.add(EnumChatFormatting.AQUA + StatCollector.translateToLocal("tooltip.wardenic.charge") + ": " + (par1ItemStack.getMaxDamage() - par1ItemStack.getItemDamage()) + "/" + par1ItemStack.getMaxDamage()); // par3List.add(EnumChatFormatting.GOLD + StatCollector.translateToLocal("tooltip.wardenic.upgrade") + ": " + WardenicChargeHelper.getUpgrade(par1ItemStack).getQuote()); // // super.addInformation(par1ItemStack, par2EntityPlayer, par3List, par4); // // } // // @Override // public void onArmorTick(World world, EntityPlayer player, ItemStack itemStack) { // // WardenicChargeHelper.getUpgrade(itemStack).onTick(world, player, itemStack); // // super.onArmorTick(world, player, itemStack); // // } // // @Override // public ArmorProperties getProperties(EntityLivingBase player, ItemStack armor, DamageSource source, double damage, int slot) { // // if(armor.getItemDamage() != armor.getMaxDamage()) { // // return new ArmorProperties(0, getArmorMaterial().getDamageReductionAmount(slot) / 25D, 20); // // } else { // // return new ArmorProperties(0, 0, 0); // // } // // } // // @Override // public int getArmorDisplay(EntityPlayer player, ItemStack armor, int slot) {return getArmorMaterial().getDamageReductionAmount(slot);} // // @Override // public void damageArmor(EntityLivingBase entity, ItemStack stack, DamageSource source, int damage, int slot) {} // // @Override // public int getVisDiscount(ItemStack stack, EntityPlayer player, Aspect aspect) {return 5;} // // } // // Path: src/main/java/matgm50/twarden/item/ItemWardenWeapon.java // public class ItemWardenWeapon extends Item { // // public ItemWardenWeapon() { // // super(); // setUnlocalizedName(ItemLib.WARDEN_WEAPON_NAME); // setCreativeTab(TWarden.tabTWarden); // setMaxStackSize(1); // // setFull3D(); // // } // // @Override // public boolean getShareTag() {return true;} // // @Override // public boolean isBookEnchantable(ItemStack stack, ItemStack book) {return false;} // // @Override // public int getMaxDamage(ItemStack stack) {return 50;} // // @Override // public boolean isDamageable() {return false;} // // @Override // public EnumRarity getRarity(ItemStack par1ItemStack) {return EnumRarity.epic;} // // @Override // public EnumAction getItemUseAction(ItemStack par1ItemStack) {return EnumAction.block;} // // @Override // public int getMaxItemUseDuration(ItemStack par1ItemStack) {return 72000;} // // @Override // public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) { // // par3List.add(EnumChatFormatting.AQUA + StatCollector.translateToLocal("tooltip.wardenic.charge") + ": " + (par1ItemStack.getMaxDamage() - par1ItemStack.getItemDamage()) + "/" + par1ItemStack.getMaxDamage()); // par3List.add(EnumChatFormatting.GOLD + StatCollector.translateToLocal("tooltip.wardenic.upgrade") + ": " + WardenicChargeHelper.getUpgrade(par1ItemStack).getQuote()); // // super.addInformation(par1ItemStack, par2EntityPlayer, par3List, par4); // // } // // @Override // public boolean onLeftClickEntity(ItemStack stack, EntityPlayer player, Entity entity) { // // if(stack.getItemDamage() != stack.getMaxDamage()) { // // DamageSource damageSource = new DamageSourceWarden("warden", player); // // entity.attackEntityFrom(damageSource, 5); // // WardenicChargeHelper.getUpgrade(stack).onAttack(stack, player, entity); // // stack.setItemDamage(stack.getItemDamage() + 1); // // } // // return super.onLeftClickEntity(stack, player, entity); // // } // // @Override // @SideOnly(Side.CLIENT) // public void registerIcons(IIconRegister register) { // // itemIcon = register.registerIcon(ModLib.ID.toLowerCase() + ":" + "wardensword"); // // } // // }
import cpw.mods.fml.common.eventhandler.SubscribeEvent; import matgm50.twarden.item.ItemWardenArmor; import matgm50.twarden.item.ItemWardenWeapon; import net.minecraft.entity.player.EntityPlayer; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent; import net.minecraftforge.event.entity.living.LivingHurtEvent; import java.util.Random;
package matgm50.twarden.util.wardenic; /** * Created by MasterAbdoTGM50 on 7/16/2014. */ public class WardenicChargeEvents { private Random random = new Random(); public static void init() { MinecraftForge.EVENT_BUS.register(new WardenicChargeEvents()); } @SubscribeEvent public void onTick(LivingUpdateEvent event) { if(event.entity instanceof EntityPlayer) { EntityPlayer player = (EntityPlayer)event.entity; for(int i = 0; i < 5; i++) { if(player.getEquipmentInSlot(i) != null) {
// Path: src/main/java/matgm50/twarden/item/ItemWardenArmor.java // public class ItemWardenArmor extends ItemArmor implements ISpecialArmor, IVisDiscountGear { // // public ItemWardenArmor(int type) { // // super(ModItems.materialWarden, 3, type); // setCreativeTab(TWarden.tabTWarden); // setMaxStackSize(1); // // } // // @Override // public boolean getShareTag() {return true;} // // @Override // public boolean isBookEnchantable(ItemStack stack, ItemStack book) {return false;} // // @Override // public int getMaxDamage(ItemStack stack) {return 50;} // // @Override // public boolean isDamageable() {return false;} // // @Override // public EnumRarity getRarity(ItemStack par1ItemStack) {return EnumRarity.epic;} // // @Override // public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) { // // par3List.add(EnumChatFormatting.AQUA + StatCollector.translateToLocal("tooltip.wardenic.charge") + ": " + (par1ItemStack.getMaxDamage() - par1ItemStack.getItemDamage()) + "/" + par1ItemStack.getMaxDamage()); // par3List.add(EnumChatFormatting.GOLD + StatCollector.translateToLocal("tooltip.wardenic.upgrade") + ": " + WardenicChargeHelper.getUpgrade(par1ItemStack).getQuote()); // // super.addInformation(par1ItemStack, par2EntityPlayer, par3List, par4); // // } // // @Override // public void onArmorTick(World world, EntityPlayer player, ItemStack itemStack) { // // WardenicChargeHelper.getUpgrade(itemStack).onTick(world, player, itemStack); // // super.onArmorTick(world, player, itemStack); // // } // // @Override // public ArmorProperties getProperties(EntityLivingBase player, ItemStack armor, DamageSource source, double damage, int slot) { // // if(armor.getItemDamage() != armor.getMaxDamage()) { // // return new ArmorProperties(0, getArmorMaterial().getDamageReductionAmount(slot) / 25D, 20); // // } else { // // return new ArmorProperties(0, 0, 0); // // } // // } // // @Override // public int getArmorDisplay(EntityPlayer player, ItemStack armor, int slot) {return getArmorMaterial().getDamageReductionAmount(slot);} // // @Override // public void damageArmor(EntityLivingBase entity, ItemStack stack, DamageSource source, int damage, int slot) {} // // @Override // public int getVisDiscount(ItemStack stack, EntityPlayer player, Aspect aspect) {return 5;} // // } // // Path: src/main/java/matgm50/twarden/item/ItemWardenWeapon.java // public class ItemWardenWeapon extends Item { // // public ItemWardenWeapon() { // // super(); // setUnlocalizedName(ItemLib.WARDEN_WEAPON_NAME); // setCreativeTab(TWarden.tabTWarden); // setMaxStackSize(1); // // setFull3D(); // // } // // @Override // public boolean getShareTag() {return true;} // // @Override // public boolean isBookEnchantable(ItemStack stack, ItemStack book) {return false;} // // @Override // public int getMaxDamage(ItemStack stack) {return 50;} // // @Override // public boolean isDamageable() {return false;} // // @Override // public EnumRarity getRarity(ItemStack par1ItemStack) {return EnumRarity.epic;} // // @Override // public EnumAction getItemUseAction(ItemStack par1ItemStack) {return EnumAction.block;} // // @Override // public int getMaxItemUseDuration(ItemStack par1ItemStack) {return 72000;} // // @Override // public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) { // // par3List.add(EnumChatFormatting.AQUA + StatCollector.translateToLocal("tooltip.wardenic.charge") + ": " + (par1ItemStack.getMaxDamage() - par1ItemStack.getItemDamage()) + "/" + par1ItemStack.getMaxDamage()); // par3List.add(EnumChatFormatting.GOLD + StatCollector.translateToLocal("tooltip.wardenic.upgrade") + ": " + WardenicChargeHelper.getUpgrade(par1ItemStack).getQuote()); // // super.addInformation(par1ItemStack, par2EntityPlayer, par3List, par4); // // } // // @Override // public boolean onLeftClickEntity(ItemStack stack, EntityPlayer player, Entity entity) { // // if(stack.getItemDamage() != stack.getMaxDamage()) { // // DamageSource damageSource = new DamageSourceWarden("warden", player); // // entity.attackEntityFrom(damageSource, 5); // // WardenicChargeHelper.getUpgrade(stack).onAttack(stack, player, entity); // // stack.setItemDamage(stack.getItemDamage() + 1); // // } // // return super.onLeftClickEntity(stack, player, entity); // // } // // @Override // @SideOnly(Side.CLIENT) // public void registerIcons(IIconRegister register) { // // itemIcon = register.registerIcon(ModLib.ID.toLowerCase() + ":" + "wardensword"); // // } // // } // Path: src/main/java/matgm50/twarden/util/wardenic/WardenicChargeEvents.java import cpw.mods.fml.common.eventhandler.SubscribeEvent; import matgm50.twarden.item.ItemWardenArmor; import matgm50.twarden.item.ItemWardenWeapon; import net.minecraft.entity.player.EntityPlayer; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent; import net.minecraftforge.event.entity.living.LivingHurtEvent; import java.util.Random; package matgm50.twarden.util.wardenic; /** * Created by MasterAbdoTGM50 on 7/16/2014. */ public class WardenicChargeEvents { private Random random = new Random(); public static void init() { MinecraftForge.EVENT_BUS.register(new WardenicChargeEvents()); } @SubscribeEvent public void onTick(LivingUpdateEvent event) { if(event.entity instanceof EntityPlayer) { EntityPlayer player = (EntityPlayer)event.entity; for(int i = 0; i < 5; i++) { if(player.getEquipmentInSlot(i) != null) {
if(player.getEquipmentInSlot(i).getItem() instanceof ItemWardenArmor || player.getEquipmentInSlot(i).getItem() instanceof ItemWardenWeapon) {
MasterAbdoTGM50/ThaumicWarden
src/main/java/matgm50/twarden/util/wardenic/upgrade/WardenicUpgradeWarden.java
// Path: src/main/java/matgm50/twarden/util/DamageSourceWarden.java // public class DamageSourceWarden extends EntityDamageSource { // // public DamageSourceWarden(String par1Str, Entity par2Entity) { // // super(par1Str, par2Entity); // setDamageBypassesArmor(); // setDamageIsAbsolute(); // // } // }
import matgm50.twarden.util.DamageSourceWarden; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.potion.Potion; import net.minecraft.util.DamageSource; import net.minecraft.world.World; import net.minecraftforge.event.entity.living.LivingHurtEvent; import thaumcraft.api.aspects.Aspect; import thaumcraft.api.entities.ITaintedMob; import thaumcraft.common.config.Config; import thaumcraft.common.entities.monster.EntityEldritchGuardian;
package matgm50.twarden.util.wardenic.upgrade; /** * Created by MasterAbdoTGM50 on 7/16/2014. */ public class WardenicUpgradeWarden extends WardenicUpgrade { public WardenicUpgradeWarden(Aspect aspect) {super(aspect);} @Override public void onAttack(ItemStack stack, EntityPlayer player, Entity entity) { super.onAttack(stack, player, entity); if(entity instanceof EntityEldritchGuardian || entity instanceof ITaintedMob) {
// Path: src/main/java/matgm50/twarden/util/DamageSourceWarden.java // public class DamageSourceWarden extends EntityDamageSource { // // public DamageSourceWarden(String par1Str, Entity par2Entity) { // // super(par1Str, par2Entity); // setDamageBypassesArmor(); // setDamageIsAbsolute(); // // } // } // Path: src/main/java/matgm50/twarden/util/wardenic/upgrade/WardenicUpgradeWarden.java import matgm50.twarden.util.DamageSourceWarden; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.potion.Potion; import net.minecraft.util.DamageSource; import net.minecraft.world.World; import net.minecraftforge.event.entity.living.LivingHurtEvent; import thaumcraft.api.aspects.Aspect; import thaumcraft.api.entities.ITaintedMob; import thaumcraft.common.config.Config; import thaumcraft.common.entities.monster.EntityEldritchGuardian; package matgm50.twarden.util.wardenic.upgrade; /** * Created by MasterAbdoTGM50 on 7/16/2014. */ public class WardenicUpgradeWarden extends WardenicUpgrade { public WardenicUpgradeWarden(Aspect aspect) {super(aspect);} @Override public void onAttack(ItemStack stack, EntityPlayer player, Entity entity) { super.onAttack(stack, player, entity); if(entity instanceof EntityEldritchGuardian || entity instanceof ITaintedMob) {
DamageSource damageSource = new DamageSourceWarden("warden", player);
MasterAbdoTGM50/ThaumicWarden
src/main/java/matgm50/twarden/item/ItemWardenWeapon.java
// Path: src/main/java/matgm50/twarden/TWarden.java // @Mod(modid = ModLib.ID, name = ModLib.NAME, version = ModLib.VERSION, dependencies = ModLib.DEPENDENCIES) // // public class TWarden { // // @Instance(ModLib.ID) // public static TWarden instance; // // @SidedProxy(serverSide = ModLib.COMMONPROXY, clientSide = ModLib.CLIENTPROXY) // public static CommonProxy proxy; // // public static CreativeTabs tabTWarden = new TabTWarden(ModLib.ID); // // @EventHandler // public void preInit(FMLPreInitializationEvent event) { // // proxy.initRenderers(); // GuiHandler.init(); // // WardenicChargeEvents.init(); // WardenicUpgrades.init(); // // ModItems.init(); // ModBlocks.init(); // ModEntities.init(); // ModGen.init(); // // } // // @EventHandler // public void init(FMLInitializationEvent event) { // // } // // @EventHandler // public void postInit(FMLPostInitializationEvent event) { // // ModRecipes.init(); // ModResearch.init(); // // } // // } // // Path: src/main/java/matgm50/twarden/lib/ItemLib.java // public class ItemLib { // // public static final String RESOURCE_NAME = "itemResource"; // public static final String[] RESOURCE_ICON = {"wardenpetal", "wardenstone", "wardenquartz"}; // // public static final String WARDEN_AMULET_NAME = "itemWardenAmulet"; // public static final String WARDEN_WEAPON_NAME = "itemWardenWeapon"; // public static final String WARDEN_HELM_NAME = "itemWardenHelm"; // public static final String WARDEN_CHEST_NAME = "itemWardenChest"; // public static final String WARDEN_LEGS_NAME = "itemWardenLegs"; // public static final String WARDEN_BOOTS_NAME = "itemWardenBoots"; // public static final String PURITY_FOCUS_NAME = "itemFocusPurity"; // public static final String LOVE_RING_NAME = "itemLoveRing"; // public static final String WASLIE_HAMMER_NAME = "itemWaslieHammer"; // public static final String ILLUMI_FOCUS_NAME = "itemFocusIllumination"; // // } // // Path: src/main/java/matgm50/twarden/lib/ModLib.java // public class ModLib { // // public static final String ID = "TWarden"; // public static final String NAME = "Thaumic Warden"; // public static final String VERSION = "1.1.1"; // public static final String DEPENDENCIES = "required-after:Thaumcraft"; // // public static final String CLIENTPROXY = "matgm50.twarden.proxy.ClientProxy"; // public static final String COMMONPROXY = "matgm50.twarden.proxy.CommonProxy"; // // } // // Path: src/main/java/matgm50/twarden/util/DamageSourceWarden.java // public class DamageSourceWarden extends EntityDamageSource { // // public DamageSourceWarden(String par1Str, Entity par2Entity) { // // super(par1Str, par2Entity); // setDamageBypassesArmor(); // setDamageIsAbsolute(); // // } // } // // Path: src/main/java/matgm50/twarden/util/wardenic/WardenicChargeHelper.java // public class WardenicChargeHelper { // // public static HashMap<String, WardenicUpgrade> upgrades = new HashMap<String, WardenicUpgrade>(); // // public static void addUpgrade(WardenicUpgrade upgrade) { // // addUpgrade(upgrade.aspect.getName(), upgrade); // // } // // public static void addUpgrade(String key, WardenicUpgrade upgrade) { // // upgrades.put(key, upgrade); // // } // // public static WardenicUpgrade getUpgrade(ItemStack stack) { // // if(stack.stackTagCompound != null) { // // if(stack.stackTagCompound.hasKey("upgrade")) { // // return upgrades.get(stack.stackTagCompound.getString("upgrade")); // // } else { // // return upgrades.get(ModResearch.EXUBITOR.getName()); // // } // // } else { // // return upgrades.get(ModResearch.EXUBITOR.getName()); // // } // // } // // public static void setUpgradeOnStack(ItemStack stack, String key) { // // if(stack.stackTagCompound == null) { // // stack.setTagCompound(new NBTTagCompound()); // // } // // stack.stackTagCompound.setString("upgrade", key); // // } // // }
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import matgm50.twarden.TWarden; import matgm50.twarden.lib.ItemLib; import matgm50.twarden.lib.ModLib; import matgm50.twarden.util.DamageSourceWarden; import matgm50.twarden.util.wardenic.WardenicChargeHelper; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.EnumAction; import net.minecraft.item.EnumRarity; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.DamageSource; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.StatCollector; import java.util.List;
package matgm50.twarden.item; /** * Created by MasterAbdoTGM50 on 6/24/2014. */ public class ItemWardenWeapon extends Item { public ItemWardenWeapon() { super();
// Path: src/main/java/matgm50/twarden/TWarden.java // @Mod(modid = ModLib.ID, name = ModLib.NAME, version = ModLib.VERSION, dependencies = ModLib.DEPENDENCIES) // // public class TWarden { // // @Instance(ModLib.ID) // public static TWarden instance; // // @SidedProxy(serverSide = ModLib.COMMONPROXY, clientSide = ModLib.CLIENTPROXY) // public static CommonProxy proxy; // // public static CreativeTabs tabTWarden = new TabTWarden(ModLib.ID); // // @EventHandler // public void preInit(FMLPreInitializationEvent event) { // // proxy.initRenderers(); // GuiHandler.init(); // // WardenicChargeEvents.init(); // WardenicUpgrades.init(); // // ModItems.init(); // ModBlocks.init(); // ModEntities.init(); // ModGen.init(); // // } // // @EventHandler // public void init(FMLInitializationEvent event) { // // } // // @EventHandler // public void postInit(FMLPostInitializationEvent event) { // // ModRecipes.init(); // ModResearch.init(); // // } // // } // // Path: src/main/java/matgm50/twarden/lib/ItemLib.java // public class ItemLib { // // public static final String RESOURCE_NAME = "itemResource"; // public static final String[] RESOURCE_ICON = {"wardenpetal", "wardenstone", "wardenquartz"}; // // public static final String WARDEN_AMULET_NAME = "itemWardenAmulet"; // public static final String WARDEN_WEAPON_NAME = "itemWardenWeapon"; // public static final String WARDEN_HELM_NAME = "itemWardenHelm"; // public static final String WARDEN_CHEST_NAME = "itemWardenChest"; // public static final String WARDEN_LEGS_NAME = "itemWardenLegs"; // public static final String WARDEN_BOOTS_NAME = "itemWardenBoots"; // public static final String PURITY_FOCUS_NAME = "itemFocusPurity"; // public static final String LOVE_RING_NAME = "itemLoveRing"; // public static final String WASLIE_HAMMER_NAME = "itemWaslieHammer"; // public static final String ILLUMI_FOCUS_NAME = "itemFocusIllumination"; // // } // // Path: src/main/java/matgm50/twarden/lib/ModLib.java // public class ModLib { // // public static final String ID = "TWarden"; // public static final String NAME = "Thaumic Warden"; // public static final String VERSION = "1.1.1"; // public static final String DEPENDENCIES = "required-after:Thaumcraft"; // // public static final String CLIENTPROXY = "matgm50.twarden.proxy.ClientProxy"; // public static final String COMMONPROXY = "matgm50.twarden.proxy.CommonProxy"; // // } // // Path: src/main/java/matgm50/twarden/util/DamageSourceWarden.java // public class DamageSourceWarden extends EntityDamageSource { // // public DamageSourceWarden(String par1Str, Entity par2Entity) { // // super(par1Str, par2Entity); // setDamageBypassesArmor(); // setDamageIsAbsolute(); // // } // } // // Path: src/main/java/matgm50/twarden/util/wardenic/WardenicChargeHelper.java // public class WardenicChargeHelper { // // public static HashMap<String, WardenicUpgrade> upgrades = new HashMap<String, WardenicUpgrade>(); // // public static void addUpgrade(WardenicUpgrade upgrade) { // // addUpgrade(upgrade.aspect.getName(), upgrade); // // } // // public static void addUpgrade(String key, WardenicUpgrade upgrade) { // // upgrades.put(key, upgrade); // // } // // public static WardenicUpgrade getUpgrade(ItemStack stack) { // // if(stack.stackTagCompound != null) { // // if(stack.stackTagCompound.hasKey("upgrade")) { // // return upgrades.get(stack.stackTagCompound.getString("upgrade")); // // } else { // // return upgrades.get(ModResearch.EXUBITOR.getName()); // // } // // } else { // // return upgrades.get(ModResearch.EXUBITOR.getName()); // // } // // } // // public static void setUpgradeOnStack(ItemStack stack, String key) { // // if(stack.stackTagCompound == null) { // // stack.setTagCompound(new NBTTagCompound()); // // } // // stack.stackTagCompound.setString("upgrade", key); // // } // // } // Path: src/main/java/matgm50/twarden/item/ItemWardenWeapon.java import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import matgm50.twarden.TWarden; import matgm50.twarden.lib.ItemLib; import matgm50.twarden.lib.ModLib; import matgm50.twarden.util.DamageSourceWarden; import matgm50.twarden.util.wardenic.WardenicChargeHelper; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.EnumAction; import net.minecraft.item.EnumRarity; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.DamageSource; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.StatCollector; import java.util.List; package matgm50.twarden.item; /** * Created by MasterAbdoTGM50 on 6/24/2014. */ public class ItemWardenWeapon extends Item { public ItemWardenWeapon() { super();
setUnlocalizedName(ItemLib.WARDEN_WEAPON_NAME);
MasterAbdoTGM50/ThaumicWarden
src/main/java/matgm50/twarden/item/ItemWardenWeapon.java
// Path: src/main/java/matgm50/twarden/TWarden.java // @Mod(modid = ModLib.ID, name = ModLib.NAME, version = ModLib.VERSION, dependencies = ModLib.DEPENDENCIES) // // public class TWarden { // // @Instance(ModLib.ID) // public static TWarden instance; // // @SidedProxy(serverSide = ModLib.COMMONPROXY, clientSide = ModLib.CLIENTPROXY) // public static CommonProxy proxy; // // public static CreativeTabs tabTWarden = new TabTWarden(ModLib.ID); // // @EventHandler // public void preInit(FMLPreInitializationEvent event) { // // proxy.initRenderers(); // GuiHandler.init(); // // WardenicChargeEvents.init(); // WardenicUpgrades.init(); // // ModItems.init(); // ModBlocks.init(); // ModEntities.init(); // ModGen.init(); // // } // // @EventHandler // public void init(FMLInitializationEvent event) { // // } // // @EventHandler // public void postInit(FMLPostInitializationEvent event) { // // ModRecipes.init(); // ModResearch.init(); // // } // // } // // Path: src/main/java/matgm50/twarden/lib/ItemLib.java // public class ItemLib { // // public static final String RESOURCE_NAME = "itemResource"; // public static final String[] RESOURCE_ICON = {"wardenpetal", "wardenstone", "wardenquartz"}; // // public static final String WARDEN_AMULET_NAME = "itemWardenAmulet"; // public static final String WARDEN_WEAPON_NAME = "itemWardenWeapon"; // public static final String WARDEN_HELM_NAME = "itemWardenHelm"; // public static final String WARDEN_CHEST_NAME = "itemWardenChest"; // public static final String WARDEN_LEGS_NAME = "itemWardenLegs"; // public static final String WARDEN_BOOTS_NAME = "itemWardenBoots"; // public static final String PURITY_FOCUS_NAME = "itemFocusPurity"; // public static final String LOVE_RING_NAME = "itemLoveRing"; // public static final String WASLIE_HAMMER_NAME = "itemWaslieHammer"; // public static final String ILLUMI_FOCUS_NAME = "itemFocusIllumination"; // // } // // Path: src/main/java/matgm50/twarden/lib/ModLib.java // public class ModLib { // // public static final String ID = "TWarden"; // public static final String NAME = "Thaumic Warden"; // public static final String VERSION = "1.1.1"; // public static final String DEPENDENCIES = "required-after:Thaumcraft"; // // public static final String CLIENTPROXY = "matgm50.twarden.proxy.ClientProxy"; // public static final String COMMONPROXY = "matgm50.twarden.proxy.CommonProxy"; // // } // // Path: src/main/java/matgm50/twarden/util/DamageSourceWarden.java // public class DamageSourceWarden extends EntityDamageSource { // // public DamageSourceWarden(String par1Str, Entity par2Entity) { // // super(par1Str, par2Entity); // setDamageBypassesArmor(); // setDamageIsAbsolute(); // // } // } // // Path: src/main/java/matgm50/twarden/util/wardenic/WardenicChargeHelper.java // public class WardenicChargeHelper { // // public static HashMap<String, WardenicUpgrade> upgrades = new HashMap<String, WardenicUpgrade>(); // // public static void addUpgrade(WardenicUpgrade upgrade) { // // addUpgrade(upgrade.aspect.getName(), upgrade); // // } // // public static void addUpgrade(String key, WardenicUpgrade upgrade) { // // upgrades.put(key, upgrade); // // } // // public static WardenicUpgrade getUpgrade(ItemStack stack) { // // if(stack.stackTagCompound != null) { // // if(stack.stackTagCompound.hasKey("upgrade")) { // // return upgrades.get(stack.stackTagCompound.getString("upgrade")); // // } else { // // return upgrades.get(ModResearch.EXUBITOR.getName()); // // } // // } else { // // return upgrades.get(ModResearch.EXUBITOR.getName()); // // } // // } // // public static void setUpgradeOnStack(ItemStack stack, String key) { // // if(stack.stackTagCompound == null) { // // stack.setTagCompound(new NBTTagCompound()); // // } // // stack.stackTagCompound.setString("upgrade", key); // // } // // }
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import matgm50.twarden.TWarden; import matgm50.twarden.lib.ItemLib; import matgm50.twarden.lib.ModLib; import matgm50.twarden.util.DamageSourceWarden; import matgm50.twarden.util.wardenic.WardenicChargeHelper; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.EnumAction; import net.minecraft.item.EnumRarity; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.DamageSource; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.StatCollector; import java.util.List;
package matgm50.twarden.item; /** * Created by MasterAbdoTGM50 on 6/24/2014. */ public class ItemWardenWeapon extends Item { public ItemWardenWeapon() { super(); setUnlocalizedName(ItemLib.WARDEN_WEAPON_NAME);
// Path: src/main/java/matgm50/twarden/TWarden.java // @Mod(modid = ModLib.ID, name = ModLib.NAME, version = ModLib.VERSION, dependencies = ModLib.DEPENDENCIES) // // public class TWarden { // // @Instance(ModLib.ID) // public static TWarden instance; // // @SidedProxy(serverSide = ModLib.COMMONPROXY, clientSide = ModLib.CLIENTPROXY) // public static CommonProxy proxy; // // public static CreativeTabs tabTWarden = new TabTWarden(ModLib.ID); // // @EventHandler // public void preInit(FMLPreInitializationEvent event) { // // proxy.initRenderers(); // GuiHandler.init(); // // WardenicChargeEvents.init(); // WardenicUpgrades.init(); // // ModItems.init(); // ModBlocks.init(); // ModEntities.init(); // ModGen.init(); // // } // // @EventHandler // public void init(FMLInitializationEvent event) { // // } // // @EventHandler // public void postInit(FMLPostInitializationEvent event) { // // ModRecipes.init(); // ModResearch.init(); // // } // // } // // Path: src/main/java/matgm50/twarden/lib/ItemLib.java // public class ItemLib { // // public static final String RESOURCE_NAME = "itemResource"; // public static final String[] RESOURCE_ICON = {"wardenpetal", "wardenstone", "wardenquartz"}; // // public static final String WARDEN_AMULET_NAME = "itemWardenAmulet"; // public static final String WARDEN_WEAPON_NAME = "itemWardenWeapon"; // public static final String WARDEN_HELM_NAME = "itemWardenHelm"; // public static final String WARDEN_CHEST_NAME = "itemWardenChest"; // public static final String WARDEN_LEGS_NAME = "itemWardenLegs"; // public static final String WARDEN_BOOTS_NAME = "itemWardenBoots"; // public static final String PURITY_FOCUS_NAME = "itemFocusPurity"; // public static final String LOVE_RING_NAME = "itemLoveRing"; // public static final String WASLIE_HAMMER_NAME = "itemWaslieHammer"; // public static final String ILLUMI_FOCUS_NAME = "itemFocusIllumination"; // // } // // Path: src/main/java/matgm50/twarden/lib/ModLib.java // public class ModLib { // // public static final String ID = "TWarden"; // public static final String NAME = "Thaumic Warden"; // public static final String VERSION = "1.1.1"; // public static final String DEPENDENCIES = "required-after:Thaumcraft"; // // public static final String CLIENTPROXY = "matgm50.twarden.proxy.ClientProxy"; // public static final String COMMONPROXY = "matgm50.twarden.proxy.CommonProxy"; // // } // // Path: src/main/java/matgm50/twarden/util/DamageSourceWarden.java // public class DamageSourceWarden extends EntityDamageSource { // // public DamageSourceWarden(String par1Str, Entity par2Entity) { // // super(par1Str, par2Entity); // setDamageBypassesArmor(); // setDamageIsAbsolute(); // // } // } // // Path: src/main/java/matgm50/twarden/util/wardenic/WardenicChargeHelper.java // public class WardenicChargeHelper { // // public static HashMap<String, WardenicUpgrade> upgrades = new HashMap<String, WardenicUpgrade>(); // // public static void addUpgrade(WardenicUpgrade upgrade) { // // addUpgrade(upgrade.aspect.getName(), upgrade); // // } // // public static void addUpgrade(String key, WardenicUpgrade upgrade) { // // upgrades.put(key, upgrade); // // } // // public static WardenicUpgrade getUpgrade(ItemStack stack) { // // if(stack.stackTagCompound != null) { // // if(stack.stackTagCompound.hasKey("upgrade")) { // // return upgrades.get(stack.stackTagCompound.getString("upgrade")); // // } else { // // return upgrades.get(ModResearch.EXUBITOR.getName()); // // } // // } else { // // return upgrades.get(ModResearch.EXUBITOR.getName()); // // } // // } // // public static void setUpgradeOnStack(ItemStack stack, String key) { // // if(stack.stackTagCompound == null) { // // stack.setTagCompound(new NBTTagCompound()); // // } // // stack.stackTagCompound.setString("upgrade", key); // // } // // } // Path: src/main/java/matgm50/twarden/item/ItemWardenWeapon.java import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import matgm50.twarden.TWarden; import matgm50.twarden.lib.ItemLib; import matgm50.twarden.lib.ModLib; import matgm50.twarden.util.DamageSourceWarden; import matgm50.twarden.util.wardenic.WardenicChargeHelper; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.EnumAction; import net.minecraft.item.EnumRarity; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.DamageSource; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.StatCollector; import java.util.List; package matgm50.twarden.item; /** * Created by MasterAbdoTGM50 on 6/24/2014. */ public class ItemWardenWeapon extends Item { public ItemWardenWeapon() { super(); setUnlocalizedName(ItemLib.WARDEN_WEAPON_NAME);
setCreativeTab(TWarden.tabTWarden);
MasterAbdoTGM50/ThaumicWarden
src/main/java/matgm50/twarden/block/BlockQuartzPillar.java
// Path: src/main/java/matgm50/twarden/TWarden.java // @Mod(modid = ModLib.ID, name = ModLib.NAME, version = ModLib.VERSION, dependencies = ModLib.DEPENDENCIES) // // public class TWarden { // // @Instance(ModLib.ID) // public static TWarden instance; // // @SidedProxy(serverSide = ModLib.COMMONPROXY, clientSide = ModLib.CLIENTPROXY) // public static CommonProxy proxy; // // public static CreativeTabs tabTWarden = new TabTWarden(ModLib.ID); // // @EventHandler // public void preInit(FMLPreInitializationEvent event) { // // proxy.initRenderers(); // GuiHandler.init(); // // WardenicChargeEvents.init(); // WardenicUpgrades.init(); // // ModItems.init(); // ModBlocks.init(); // ModEntities.init(); // ModGen.init(); // // } // // @EventHandler // public void init(FMLInitializationEvent event) { // // } // // @EventHandler // public void postInit(FMLPostInitializationEvent event) { // // ModRecipes.init(); // ModResearch.init(); // // } // // } // // Path: src/main/java/matgm50/twarden/lib/BlockLib.java // public class BlockLib { // // public static final String EXUBITURA_NAME = "blockExubitura"; // public static final String QUARTZ_NORMAL_NAME = "blockInfusedQuartzNormal"; // public static final String QUARTZ_SLAB_NAME = "blockInfusedQuartzSlab"; // public static final String QUARTZ_STAIR_NAME = "blockInfusedQuartzStair"; // public static final String QUARTZ_CHISELED_NAME = "blockInfusedQuartzChiseled"; // public static final String QUARTZ_PILLAR_NAME = "blockInfusedQuartzPillar"; // public static final String BLOCK_WITOR_NAME = "blockWitor"; // public static final String TILE_WITOR_NAME = "tileWitor"; // // } // // Path: src/main/java/matgm50/twarden/lib/ModLib.java // public class ModLib { // // public static final String ID = "TWarden"; // public static final String NAME = "Thaumic Warden"; // public static final String VERSION = "1.1.1"; // public static final String DEPENDENCIES = "required-after:Thaumcraft"; // // public static final String CLIENTPROXY = "matgm50.twarden.proxy.ClientProxy"; // public static final String COMMONPROXY = "matgm50.twarden.proxy.CommonProxy"; // // }
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import matgm50.twarden.TWarden; import matgm50.twarden.lib.BlockLib; import matgm50.twarden.lib.ModLib; import net.minecraft.block.Block; import net.minecraft.block.BlockRotatedPillar; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.util.IIcon;
package matgm50.twarden.block; /** * Created by MasterAbdoTGM50 on 5/22/2014. */ public class BlockQuartzPillar extends BlockRotatedPillar { public IIcon topIcon; public IIcon sideIcon; protected BlockQuartzPillar() { super(Material.rock);
// Path: src/main/java/matgm50/twarden/TWarden.java // @Mod(modid = ModLib.ID, name = ModLib.NAME, version = ModLib.VERSION, dependencies = ModLib.DEPENDENCIES) // // public class TWarden { // // @Instance(ModLib.ID) // public static TWarden instance; // // @SidedProxy(serverSide = ModLib.COMMONPROXY, clientSide = ModLib.CLIENTPROXY) // public static CommonProxy proxy; // // public static CreativeTabs tabTWarden = new TabTWarden(ModLib.ID); // // @EventHandler // public void preInit(FMLPreInitializationEvent event) { // // proxy.initRenderers(); // GuiHandler.init(); // // WardenicChargeEvents.init(); // WardenicUpgrades.init(); // // ModItems.init(); // ModBlocks.init(); // ModEntities.init(); // ModGen.init(); // // } // // @EventHandler // public void init(FMLInitializationEvent event) { // // } // // @EventHandler // public void postInit(FMLPostInitializationEvent event) { // // ModRecipes.init(); // ModResearch.init(); // // } // // } // // Path: src/main/java/matgm50/twarden/lib/BlockLib.java // public class BlockLib { // // public static final String EXUBITURA_NAME = "blockExubitura"; // public static final String QUARTZ_NORMAL_NAME = "blockInfusedQuartzNormal"; // public static final String QUARTZ_SLAB_NAME = "blockInfusedQuartzSlab"; // public static final String QUARTZ_STAIR_NAME = "blockInfusedQuartzStair"; // public static final String QUARTZ_CHISELED_NAME = "blockInfusedQuartzChiseled"; // public static final String QUARTZ_PILLAR_NAME = "blockInfusedQuartzPillar"; // public static final String BLOCK_WITOR_NAME = "blockWitor"; // public static final String TILE_WITOR_NAME = "tileWitor"; // // } // // Path: src/main/java/matgm50/twarden/lib/ModLib.java // public class ModLib { // // public static final String ID = "TWarden"; // public static final String NAME = "Thaumic Warden"; // public static final String VERSION = "1.1.1"; // public static final String DEPENDENCIES = "required-after:Thaumcraft"; // // public static final String CLIENTPROXY = "matgm50.twarden.proxy.ClientProxy"; // public static final String COMMONPROXY = "matgm50.twarden.proxy.CommonProxy"; // // } // Path: src/main/java/matgm50/twarden/block/BlockQuartzPillar.java import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import matgm50.twarden.TWarden; import matgm50.twarden.lib.BlockLib; import matgm50.twarden.lib.ModLib; import net.minecraft.block.Block; import net.minecraft.block.BlockRotatedPillar; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.util.IIcon; package matgm50.twarden.block; /** * Created by MasterAbdoTGM50 on 5/22/2014. */ public class BlockQuartzPillar extends BlockRotatedPillar { public IIcon topIcon; public IIcon sideIcon; protected BlockQuartzPillar() { super(Material.rock);
setBlockName(BlockLib.QUARTZ_PILLAR_NAME);
MasterAbdoTGM50/ThaumicWarden
src/main/java/matgm50/twarden/block/BlockQuartzPillar.java
// Path: src/main/java/matgm50/twarden/TWarden.java // @Mod(modid = ModLib.ID, name = ModLib.NAME, version = ModLib.VERSION, dependencies = ModLib.DEPENDENCIES) // // public class TWarden { // // @Instance(ModLib.ID) // public static TWarden instance; // // @SidedProxy(serverSide = ModLib.COMMONPROXY, clientSide = ModLib.CLIENTPROXY) // public static CommonProxy proxy; // // public static CreativeTabs tabTWarden = new TabTWarden(ModLib.ID); // // @EventHandler // public void preInit(FMLPreInitializationEvent event) { // // proxy.initRenderers(); // GuiHandler.init(); // // WardenicChargeEvents.init(); // WardenicUpgrades.init(); // // ModItems.init(); // ModBlocks.init(); // ModEntities.init(); // ModGen.init(); // // } // // @EventHandler // public void init(FMLInitializationEvent event) { // // } // // @EventHandler // public void postInit(FMLPostInitializationEvent event) { // // ModRecipes.init(); // ModResearch.init(); // // } // // } // // Path: src/main/java/matgm50/twarden/lib/BlockLib.java // public class BlockLib { // // public static final String EXUBITURA_NAME = "blockExubitura"; // public static final String QUARTZ_NORMAL_NAME = "blockInfusedQuartzNormal"; // public static final String QUARTZ_SLAB_NAME = "blockInfusedQuartzSlab"; // public static final String QUARTZ_STAIR_NAME = "blockInfusedQuartzStair"; // public static final String QUARTZ_CHISELED_NAME = "blockInfusedQuartzChiseled"; // public static final String QUARTZ_PILLAR_NAME = "blockInfusedQuartzPillar"; // public static final String BLOCK_WITOR_NAME = "blockWitor"; // public static final String TILE_WITOR_NAME = "tileWitor"; // // } // // Path: src/main/java/matgm50/twarden/lib/ModLib.java // public class ModLib { // // public static final String ID = "TWarden"; // public static final String NAME = "Thaumic Warden"; // public static final String VERSION = "1.1.1"; // public static final String DEPENDENCIES = "required-after:Thaumcraft"; // // public static final String CLIENTPROXY = "matgm50.twarden.proxy.ClientProxy"; // public static final String COMMONPROXY = "matgm50.twarden.proxy.CommonProxy"; // // }
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import matgm50.twarden.TWarden; import matgm50.twarden.lib.BlockLib; import matgm50.twarden.lib.ModLib; import net.minecraft.block.Block; import net.minecraft.block.BlockRotatedPillar; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.util.IIcon;
package matgm50.twarden.block; /** * Created by MasterAbdoTGM50 on 5/22/2014. */ public class BlockQuartzPillar extends BlockRotatedPillar { public IIcon topIcon; public IIcon sideIcon; protected BlockQuartzPillar() { super(Material.rock); setBlockName(BlockLib.QUARTZ_PILLAR_NAME);
// Path: src/main/java/matgm50/twarden/TWarden.java // @Mod(modid = ModLib.ID, name = ModLib.NAME, version = ModLib.VERSION, dependencies = ModLib.DEPENDENCIES) // // public class TWarden { // // @Instance(ModLib.ID) // public static TWarden instance; // // @SidedProxy(serverSide = ModLib.COMMONPROXY, clientSide = ModLib.CLIENTPROXY) // public static CommonProxy proxy; // // public static CreativeTabs tabTWarden = new TabTWarden(ModLib.ID); // // @EventHandler // public void preInit(FMLPreInitializationEvent event) { // // proxy.initRenderers(); // GuiHandler.init(); // // WardenicChargeEvents.init(); // WardenicUpgrades.init(); // // ModItems.init(); // ModBlocks.init(); // ModEntities.init(); // ModGen.init(); // // } // // @EventHandler // public void init(FMLInitializationEvent event) { // // } // // @EventHandler // public void postInit(FMLPostInitializationEvent event) { // // ModRecipes.init(); // ModResearch.init(); // // } // // } // // Path: src/main/java/matgm50/twarden/lib/BlockLib.java // public class BlockLib { // // public static final String EXUBITURA_NAME = "blockExubitura"; // public static final String QUARTZ_NORMAL_NAME = "blockInfusedQuartzNormal"; // public static final String QUARTZ_SLAB_NAME = "blockInfusedQuartzSlab"; // public static final String QUARTZ_STAIR_NAME = "blockInfusedQuartzStair"; // public static final String QUARTZ_CHISELED_NAME = "blockInfusedQuartzChiseled"; // public static final String QUARTZ_PILLAR_NAME = "blockInfusedQuartzPillar"; // public static final String BLOCK_WITOR_NAME = "blockWitor"; // public static final String TILE_WITOR_NAME = "tileWitor"; // // } // // Path: src/main/java/matgm50/twarden/lib/ModLib.java // public class ModLib { // // public static final String ID = "TWarden"; // public static final String NAME = "Thaumic Warden"; // public static final String VERSION = "1.1.1"; // public static final String DEPENDENCIES = "required-after:Thaumcraft"; // // public static final String CLIENTPROXY = "matgm50.twarden.proxy.ClientProxy"; // public static final String COMMONPROXY = "matgm50.twarden.proxy.CommonProxy"; // // } // Path: src/main/java/matgm50/twarden/block/BlockQuartzPillar.java import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import matgm50.twarden.TWarden; import matgm50.twarden.lib.BlockLib; import matgm50.twarden.lib.ModLib; import net.minecraft.block.Block; import net.minecraft.block.BlockRotatedPillar; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.util.IIcon; package matgm50.twarden.block; /** * Created by MasterAbdoTGM50 on 5/22/2014. */ public class BlockQuartzPillar extends BlockRotatedPillar { public IIcon topIcon; public IIcon sideIcon; protected BlockQuartzPillar() { super(Material.rock); setBlockName(BlockLib.QUARTZ_PILLAR_NAME);
setCreativeTab(TWarden.tabTWarden);
MasterAbdoTGM50/ThaumicWarden
src/main/java/matgm50/twarden/block/BlockQuartzPillar.java
// Path: src/main/java/matgm50/twarden/TWarden.java // @Mod(modid = ModLib.ID, name = ModLib.NAME, version = ModLib.VERSION, dependencies = ModLib.DEPENDENCIES) // // public class TWarden { // // @Instance(ModLib.ID) // public static TWarden instance; // // @SidedProxy(serverSide = ModLib.COMMONPROXY, clientSide = ModLib.CLIENTPROXY) // public static CommonProxy proxy; // // public static CreativeTabs tabTWarden = new TabTWarden(ModLib.ID); // // @EventHandler // public void preInit(FMLPreInitializationEvent event) { // // proxy.initRenderers(); // GuiHandler.init(); // // WardenicChargeEvents.init(); // WardenicUpgrades.init(); // // ModItems.init(); // ModBlocks.init(); // ModEntities.init(); // ModGen.init(); // // } // // @EventHandler // public void init(FMLInitializationEvent event) { // // } // // @EventHandler // public void postInit(FMLPostInitializationEvent event) { // // ModRecipes.init(); // ModResearch.init(); // // } // // } // // Path: src/main/java/matgm50/twarden/lib/BlockLib.java // public class BlockLib { // // public static final String EXUBITURA_NAME = "blockExubitura"; // public static final String QUARTZ_NORMAL_NAME = "blockInfusedQuartzNormal"; // public static final String QUARTZ_SLAB_NAME = "blockInfusedQuartzSlab"; // public static final String QUARTZ_STAIR_NAME = "blockInfusedQuartzStair"; // public static final String QUARTZ_CHISELED_NAME = "blockInfusedQuartzChiseled"; // public static final String QUARTZ_PILLAR_NAME = "blockInfusedQuartzPillar"; // public static final String BLOCK_WITOR_NAME = "blockWitor"; // public static final String TILE_WITOR_NAME = "tileWitor"; // // } // // Path: src/main/java/matgm50/twarden/lib/ModLib.java // public class ModLib { // // public static final String ID = "TWarden"; // public static final String NAME = "Thaumic Warden"; // public static final String VERSION = "1.1.1"; // public static final String DEPENDENCIES = "required-after:Thaumcraft"; // // public static final String CLIENTPROXY = "matgm50.twarden.proxy.ClientProxy"; // public static final String COMMONPROXY = "matgm50.twarden.proxy.CommonProxy"; // // }
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import matgm50.twarden.TWarden; import matgm50.twarden.lib.BlockLib; import matgm50.twarden.lib.ModLib; import net.minecraft.block.Block; import net.minecraft.block.BlockRotatedPillar; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.util.IIcon;
package matgm50.twarden.block; /** * Created by MasterAbdoTGM50 on 5/22/2014. */ public class BlockQuartzPillar extends BlockRotatedPillar { public IIcon topIcon; public IIcon sideIcon; protected BlockQuartzPillar() { super(Material.rock); setBlockName(BlockLib.QUARTZ_PILLAR_NAME); setCreativeTab(TWarden.tabTWarden); setStepSound(Block.soundTypeStone); setHardness(0.8F); } @SideOnly(Side.CLIENT) @Override public void registerBlockIcons(IIconRegister register) {
// Path: src/main/java/matgm50/twarden/TWarden.java // @Mod(modid = ModLib.ID, name = ModLib.NAME, version = ModLib.VERSION, dependencies = ModLib.DEPENDENCIES) // // public class TWarden { // // @Instance(ModLib.ID) // public static TWarden instance; // // @SidedProxy(serverSide = ModLib.COMMONPROXY, clientSide = ModLib.CLIENTPROXY) // public static CommonProxy proxy; // // public static CreativeTabs tabTWarden = new TabTWarden(ModLib.ID); // // @EventHandler // public void preInit(FMLPreInitializationEvent event) { // // proxy.initRenderers(); // GuiHandler.init(); // // WardenicChargeEvents.init(); // WardenicUpgrades.init(); // // ModItems.init(); // ModBlocks.init(); // ModEntities.init(); // ModGen.init(); // // } // // @EventHandler // public void init(FMLInitializationEvent event) { // // } // // @EventHandler // public void postInit(FMLPostInitializationEvent event) { // // ModRecipes.init(); // ModResearch.init(); // // } // // } // // Path: src/main/java/matgm50/twarden/lib/BlockLib.java // public class BlockLib { // // public static final String EXUBITURA_NAME = "blockExubitura"; // public static final String QUARTZ_NORMAL_NAME = "blockInfusedQuartzNormal"; // public static final String QUARTZ_SLAB_NAME = "blockInfusedQuartzSlab"; // public static final String QUARTZ_STAIR_NAME = "blockInfusedQuartzStair"; // public static final String QUARTZ_CHISELED_NAME = "blockInfusedQuartzChiseled"; // public static final String QUARTZ_PILLAR_NAME = "blockInfusedQuartzPillar"; // public static final String BLOCK_WITOR_NAME = "blockWitor"; // public static final String TILE_WITOR_NAME = "tileWitor"; // // } // // Path: src/main/java/matgm50/twarden/lib/ModLib.java // public class ModLib { // // public static final String ID = "TWarden"; // public static final String NAME = "Thaumic Warden"; // public static final String VERSION = "1.1.1"; // public static final String DEPENDENCIES = "required-after:Thaumcraft"; // // public static final String CLIENTPROXY = "matgm50.twarden.proxy.ClientProxy"; // public static final String COMMONPROXY = "matgm50.twarden.proxy.CommonProxy"; // // } // Path: src/main/java/matgm50/twarden/block/BlockQuartzPillar.java import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import matgm50.twarden.TWarden; import matgm50.twarden.lib.BlockLib; import matgm50.twarden.lib.ModLib; import net.minecraft.block.Block; import net.minecraft.block.BlockRotatedPillar; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.util.IIcon; package matgm50.twarden.block; /** * Created by MasterAbdoTGM50 on 5/22/2014. */ public class BlockQuartzPillar extends BlockRotatedPillar { public IIcon topIcon; public IIcon sideIcon; protected BlockQuartzPillar() { super(Material.rock); setBlockName(BlockLib.QUARTZ_PILLAR_NAME); setCreativeTab(TWarden.tabTWarden); setStepSound(Block.soundTypeStone); setHardness(0.8F); } @SideOnly(Side.CLIENT) @Override public void registerBlockIcons(IIconRegister register) {
topIcon = register.registerIcon(ModLib.ID.toLowerCase() + ":" + "infusedquartzpillartop" );
MasterAbdoTGM50/ThaumicWarden
src/main/java/matgm50/twarden/item/ItemLoveRing.java
// Path: src/main/java/matgm50/twarden/TWarden.java // @Mod(modid = ModLib.ID, name = ModLib.NAME, version = ModLib.VERSION, dependencies = ModLib.DEPENDENCIES) // // public class TWarden { // // @Instance(ModLib.ID) // public static TWarden instance; // // @SidedProxy(serverSide = ModLib.COMMONPROXY, clientSide = ModLib.CLIENTPROXY) // public static CommonProxy proxy; // // public static CreativeTabs tabTWarden = new TabTWarden(ModLib.ID); // // @EventHandler // public void preInit(FMLPreInitializationEvent event) { // // proxy.initRenderers(); // GuiHandler.init(); // // WardenicChargeEvents.init(); // WardenicUpgrades.init(); // // ModItems.init(); // ModBlocks.init(); // ModEntities.init(); // ModGen.init(); // // } // // @EventHandler // public void init(FMLInitializationEvent event) { // // } // // @EventHandler // public void postInit(FMLPostInitializationEvent event) { // // ModRecipes.init(); // ModResearch.init(); // // } // // } // // Path: src/main/java/matgm50/twarden/lib/ItemLib.java // public class ItemLib { // // public static final String RESOURCE_NAME = "itemResource"; // public static final String[] RESOURCE_ICON = {"wardenpetal", "wardenstone", "wardenquartz"}; // // public static final String WARDEN_AMULET_NAME = "itemWardenAmulet"; // public static final String WARDEN_WEAPON_NAME = "itemWardenWeapon"; // public static final String WARDEN_HELM_NAME = "itemWardenHelm"; // public static final String WARDEN_CHEST_NAME = "itemWardenChest"; // public static final String WARDEN_LEGS_NAME = "itemWardenLegs"; // public static final String WARDEN_BOOTS_NAME = "itemWardenBoots"; // public static final String PURITY_FOCUS_NAME = "itemFocusPurity"; // public static final String LOVE_RING_NAME = "itemLoveRing"; // public static final String WASLIE_HAMMER_NAME = "itemWaslieHammer"; // public static final String ILLUMI_FOCUS_NAME = "itemFocusIllumination"; // // } // // Path: src/main/java/matgm50/twarden/lib/ModLib.java // public class ModLib { // // public static final String ID = "TWarden"; // public static final String NAME = "Thaumic Warden"; // public static final String VERSION = "1.1.1"; // public static final String DEPENDENCIES = "required-after:Thaumcraft"; // // public static final String CLIENTPROXY = "matgm50.twarden.proxy.ClientProxy"; // public static final String COMMONPROXY = "matgm50.twarden.proxy.CommonProxy"; // // }
import baubles.api.BaubleType; import baubles.api.IBauble; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import matgm50.twarden.TWarden; import matgm50.twarden.lib.ItemLib; import matgm50.twarden.lib.ModLib; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.EnumRarity; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.world.World;
package matgm50.twarden.item; /** * Created by MasterAbdoTGM50 on 6/26/2014. */ public class ItemLoveRing extends Item implements IBauble { public ItemLoveRing() { super();
// Path: src/main/java/matgm50/twarden/TWarden.java // @Mod(modid = ModLib.ID, name = ModLib.NAME, version = ModLib.VERSION, dependencies = ModLib.DEPENDENCIES) // // public class TWarden { // // @Instance(ModLib.ID) // public static TWarden instance; // // @SidedProxy(serverSide = ModLib.COMMONPROXY, clientSide = ModLib.CLIENTPROXY) // public static CommonProxy proxy; // // public static CreativeTabs tabTWarden = new TabTWarden(ModLib.ID); // // @EventHandler // public void preInit(FMLPreInitializationEvent event) { // // proxy.initRenderers(); // GuiHandler.init(); // // WardenicChargeEvents.init(); // WardenicUpgrades.init(); // // ModItems.init(); // ModBlocks.init(); // ModEntities.init(); // ModGen.init(); // // } // // @EventHandler // public void init(FMLInitializationEvent event) { // // } // // @EventHandler // public void postInit(FMLPostInitializationEvent event) { // // ModRecipes.init(); // ModResearch.init(); // // } // // } // // Path: src/main/java/matgm50/twarden/lib/ItemLib.java // public class ItemLib { // // public static final String RESOURCE_NAME = "itemResource"; // public static final String[] RESOURCE_ICON = {"wardenpetal", "wardenstone", "wardenquartz"}; // // public static final String WARDEN_AMULET_NAME = "itemWardenAmulet"; // public static final String WARDEN_WEAPON_NAME = "itemWardenWeapon"; // public static final String WARDEN_HELM_NAME = "itemWardenHelm"; // public static final String WARDEN_CHEST_NAME = "itemWardenChest"; // public static final String WARDEN_LEGS_NAME = "itemWardenLegs"; // public static final String WARDEN_BOOTS_NAME = "itemWardenBoots"; // public static final String PURITY_FOCUS_NAME = "itemFocusPurity"; // public static final String LOVE_RING_NAME = "itemLoveRing"; // public static final String WASLIE_HAMMER_NAME = "itemWaslieHammer"; // public static final String ILLUMI_FOCUS_NAME = "itemFocusIllumination"; // // } // // Path: src/main/java/matgm50/twarden/lib/ModLib.java // public class ModLib { // // public static final String ID = "TWarden"; // public static final String NAME = "Thaumic Warden"; // public static final String VERSION = "1.1.1"; // public static final String DEPENDENCIES = "required-after:Thaumcraft"; // // public static final String CLIENTPROXY = "matgm50.twarden.proxy.ClientProxy"; // public static final String COMMONPROXY = "matgm50.twarden.proxy.CommonProxy"; // // } // Path: src/main/java/matgm50/twarden/item/ItemLoveRing.java import baubles.api.BaubleType; import baubles.api.IBauble; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import matgm50.twarden.TWarden; import matgm50.twarden.lib.ItemLib; import matgm50.twarden.lib.ModLib; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.EnumRarity; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.world.World; package matgm50.twarden.item; /** * Created by MasterAbdoTGM50 on 6/26/2014. */ public class ItemLoveRing extends Item implements IBauble { public ItemLoveRing() { super();
setUnlocalizedName(ItemLib.LOVE_RING_NAME);
MasterAbdoTGM50/ThaumicWarden
src/main/java/matgm50/twarden/item/ItemLoveRing.java
// Path: src/main/java/matgm50/twarden/TWarden.java // @Mod(modid = ModLib.ID, name = ModLib.NAME, version = ModLib.VERSION, dependencies = ModLib.DEPENDENCIES) // // public class TWarden { // // @Instance(ModLib.ID) // public static TWarden instance; // // @SidedProxy(serverSide = ModLib.COMMONPROXY, clientSide = ModLib.CLIENTPROXY) // public static CommonProxy proxy; // // public static CreativeTabs tabTWarden = new TabTWarden(ModLib.ID); // // @EventHandler // public void preInit(FMLPreInitializationEvent event) { // // proxy.initRenderers(); // GuiHandler.init(); // // WardenicChargeEvents.init(); // WardenicUpgrades.init(); // // ModItems.init(); // ModBlocks.init(); // ModEntities.init(); // ModGen.init(); // // } // // @EventHandler // public void init(FMLInitializationEvent event) { // // } // // @EventHandler // public void postInit(FMLPostInitializationEvent event) { // // ModRecipes.init(); // ModResearch.init(); // // } // // } // // Path: src/main/java/matgm50/twarden/lib/ItemLib.java // public class ItemLib { // // public static final String RESOURCE_NAME = "itemResource"; // public static final String[] RESOURCE_ICON = {"wardenpetal", "wardenstone", "wardenquartz"}; // // public static final String WARDEN_AMULET_NAME = "itemWardenAmulet"; // public static final String WARDEN_WEAPON_NAME = "itemWardenWeapon"; // public static final String WARDEN_HELM_NAME = "itemWardenHelm"; // public static final String WARDEN_CHEST_NAME = "itemWardenChest"; // public static final String WARDEN_LEGS_NAME = "itemWardenLegs"; // public static final String WARDEN_BOOTS_NAME = "itemWardenBoots"; // public static final String PURITY_FOCUS_NAME = "itemFocusPurity"; // public static final String LOVE_RING_NAME = "itemLoveRing"; // public static final String WASLIE_HAMMER_NAME = "itemWaslieHammer"; // public static final String ILLUMI_FOCUS_NAME = "itemFocusIllumination"; // // } // // Path: src/main/java/matgm50/twarden/lib/ModLib.java // public class ModLib { // // public static final String ID = "TWarden"; // public static final String NAME = "Thaumic Warden"; // public static final String VERSION = "1.1.1"; // public static final String DEPENDENCIES = "required-after:Thaumcraft"; // // public static final String CLIENTPROXY = "matgm50.twarden.proxy.ClientProxy"; // public static final String COMMONPROXY = "matgm50.twarden.proxy.CommonProxy"; // // }
import baubles.api.BaubleType; import baubles.api.IBauble; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import matgm50.twarden.TWarden; import matgm50.twarden.lib.ItemLib; import matgm50.twarden.lib.ModLib; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.EnumRarity; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.world.World;
package matgm50.twarden.item; /** * Created by MasterAbdoTGM50 on 6/26/2014. */ public class ItemLoveRing extends Item implements IBauble { public ItemLoveRing() { super(); setUnlocalizedName(ItemLib.LOVE_RING_NAME);
// Path: src/main/java/matgm50/twarden/TWarden.java // @Mod(modid = ModLib.ID, name = ModLib.NAME, version = ModLib.VERSION, dependencies = ModLib.DEPENDENCIES) // // public class TWarden { // // @Instance(ModLib.ID) // public static TWarden instance; // // @SidedProxy(serverSide = ModLib.COMMONPROXY, clientSide = ModLib.CLIENTPROXY) // public static CommonProxy proxy; // // public static CreativeTabs tabTWarden = new TabTWarden(ModLib.ID); // // @EventHandler // public void preInit(FMLPreInitializationEvent event) { // // proxy.initRenderers(); // GuiHandler.init(); // // WardenicChargeEvents.init(); // WardenicUpgrades.init(); // // ModItems.init(); // ModBlocks.init(); // ModEntities.init(); // ModGen.init(); // // } // // @EventHandler // public void init(FMLInitializationEvent event) { // // } // // @EventHandler // public void postInit(FMLPostInitializationEvent event) { // // ModRecipes.init(); // ModResearch.init(); // // } // // } // // Path: src/main/java/matgm50/twarden/lib/ItemLib.java // public class ItemLib { // // public static final String RESOURCE_NAME = "itemResource"; // public static final String[] RESOURCE_ICON = {"wardenpetal", "wardenstone", "wardenquartz"}; // // public static final String WARDEN_AMULET_NAME = "itemWardenAmulet"; // public static final String WARDEN_WEAPON_NAME = "itemWardenWeapon"; // public static final String WARDEN_HELM_NAME = "itemWardenHelm"; // public static final String WARDEN_CHEST_NAME = "itemWardenChest"; // public static final String WARDEN_LEGS_NAME = "itemWardenLegs"; // public static final String WARDEN_BOOTS_NAME = "itemWardenBoots"; // public static final String PURITY_FOCUS_NAME = "itemFocusPurity"; // public static final String LOVE_RING_NAME = "itemLoveRing"; // public static final String WASLIE_HAMMER_NAME = "itemWaslieHammer"; // public static final String ILLUMI_FOCUS_NAME = "itemFocusIllumination"; // // } // // Path: src/main/java/matgm50/twarden/lib/ModLib.java // public class ModLib { // // public static final String ID = "TWarden"; // public static final String NAME = "Thaumic Warden"; // public static final String VERSION = "1.1.1"; // public static final String DEPENDENCIES = "required-after:Thaumcraft"; // // public static final String CLIENTPROXY = "matgm50.twarden.proxy.ClientProxy"; // public static final String COMMONPROXY = "matgm50.twarden.proxy.CommonProxy"; // // } // Path: src/main/java/matgm50/twarden/item/ItemLoveRing.java import baubles.api.BaubleType; import baubles.api.IBauble; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import matgm50.twarden.TWarden; import matgm50.twarden.lib.ItemLib; import matgm50.twarden.lib.ModLib; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.EnumRarity; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.world.World; package matgm50.twarden.item; /** * Created by MasterAbdoTGM50 on 6/26/2014. */ public class ItemLoveRing extends Item implements IBauble { public ItemLoveRing() { super(); setUnlocalizedName(ItemLib.LOVE_RING_NAME);
setCreativeTab(TWarden.tabTWarden);
MasterAbdoTGM50/ThaumicWarden
src/main/java/matgm50/twarden/item/ItemLoveRing.java
// Path: src/main/java/matgm50/twarden/TWarden.java // @Mod(modid = ModLib.ID, name = ModLib.NAME, version = ModLib.VERSION, dependencies = ModLib.DEPENDENCIES) // // public class TWarden { // // @Instance(ModLib.ID) // public static TWarden instance; // // @SidedProxy(serverSide = ModLib.COMMONPROXY, clientSide = ModLib.CLIENTPROXY) // public static CommonProxy proxy; // // public static CreativeTabs tabTWarden = new TabTWarden(ModLib.ID); // // @EventHandler // public void preInit(FMLPreInitializationEvent event) { // // proxy.initRenderers(); // GuiHandler.init(); // // WardenicChargeEvents.init(); // WardenicUpgrades.init(); // // ModItems.init(); // ModBlocks.init(); // ModEntities.init(); // ModGen.init(); // // } // // @EventHandler // public void init(FMLInitializationEvent event) { // // } // // @EventHandler // public void postInit(FMLPostInitializationEvent event) { // // ModRecipes.init(); // ModResearch.init(); // // } // // } // // Path: src/main/java/matgm50/twarden/lib/ItemLib.java // public class ItemLib { // // public static final String RESOURCE_NAME = "itemResource"; // public static final String[] RESOURCE_ICON = {"wardenpetal", "wardenstone", "wardenquartz"}; // // public static final String WARDEN_AMULET_NAME = "itemWardenAmulet"; // public static final String WARDEN_WEAPON_NAME = "itemWardenWeapon"; // public static final String WARDEN_HELM_NAME = "itemWardenHelm"; // public static final String WARDEN_CHEST_NAME = "itemWardenChest"; // public static final String WARDEN_LEGS_NAME = "itemWardenLegs"; // public static final String WARDEN_BOOTS_NAME = "itemWardenBoots"; // public static final String PURITY_FOCUS_NAME = "itemFocusPurity"; // public static final String LOVE_RING_NAME = "itemLoveRing"; // public static final String WASLIE_HAMMER_NAME = "itemWaslieHammer"; // public static final String ILLUMI_FOCUS_NAME = "itemFocusIllumination"; // // } // // Path: src/main/java/matgm50/twarden/lib/ModLib.java // public class ModLib { // // public static final String ID = "TWarden"; // public static final String NAME = "Thaumic Warden"; // public static final String VERSION = "1.1.1"; // public static final String DEPENDENCIES = "required-after:Thaumcraft"; // // public static final String CLIENTPROXY = "matgm50.twarden.proxy.ClientProxy"; // public static final String COMMONPROXY = "matgm50.twarden.proxy.CommonProxy"; // // }
import baubles.api.BaubleType; import baubles.api.IBauble; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import matgm50.twarden.TWarden; import matgm50.twarden.lib.ItemLib; import matgm50.twarden.lib.ModLib; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.EnumRarity; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.world.World;
package matgm50.twarden.item; /** * Created by MasterAbdoTGM50 on 6/26/2014. */ public class ItemLoveRing extends Item implements IBauble { public ItemLoveRing() { super(); setUnlocalizedName(ItemLib.LOVE_RING_NAME); setCreativeTab(TWarden.tabTWarden); } @Override public EnumRarity getRarity(ItemStack par1ItemStack) {return EnumRarity.epic;} @Override @SideOnly(Side.CLIENT) public void registerIcons(IIconRegister register) {
// Path: src/main/java/matgm50/twarden/TWarden.java // @Mod(modid = ModLib.ID, name = ModLib.NAME, version = ModLib.VERSION, dependencies = ModLib.DEPENDENCIES) // // public class TWarden { // // @Instance(ModLib.ID) // public static TWarden instance; // // @SidedProxy(serverSide = ModLib.COMMONPROXY, clientSide = ModLib.CLIENTPROXY) // public static CommonProxy proxy; // // public static CreativeTabs tabTWarden = new TabTWarden(ModLib.ID); // // @EventHandler // public void preInit(FMLPreInitializationEvent event) { // // proxy.initRenderers(); // GuiHandler.init(); // // WardenicChargeEvents.init(); // WardenicUpgrades.init(); // // ModItems.init(); // ModBlocks.init(); // ModEntities.init(); // ModGen.init(); // // } // // @EventHandler // public void init(FMLInitializationEvent event) { // // } // // @EventHandler // public void postInit(FMLPostInitializationEvent event) { // // ModRecipes.init(); // ModResearch.init(); // // } // // } // // Path: src/main/java/matgm50/twarden/lib/ItemLib.java // public class ItemLib { // // public static final String RESOURCE_NAME = "itemResource"; // public static final String[] RESOURCE_ICON = {"wardenpetal", "wardenstone", "wardenquartz"}; // // public static final String WARDEN_AMULET_NAME = "itemWardenAmulet"; // public static final String WARDEN_WEAPON_NAME = "itemWardenWeapon"; // public static final String WARDEN_HELM_NAME = "itemWardenHelm"; // public static final String WARDEN_CHEST_NAME = "itemWardenChest"; // public static final String WARDEN_LEGS_NAME = "itemWardenLegs"; // public static final String WARDEN_BOOTS_NAME = "itemWardenBoots"; // public static final String PURITY_FOCUS_NAME = "itemFocusPurity"; // public static final String LOVE_RING_NAME = "itemLoveRing"; // public static final String WASLIE_HAMMER_NAME = "itemWaslieHammer"; // public static final String ILLUMI_FOCUS_NAME = "itemFocusIllumination"; // // } // // Path: src/main/java/matgm50/twarden/lib/ModLib.java // public class ModLib { // // public static final String ID = "TWarden"; // public static final String NAME = "Thaumic Warden"; // public static final String VERSION = "1.1.1"; // public static final String DEPENDENCIES = "required-after:Thaumcraft"; // // public static final String CLIENTPROXY = "matgm50.twarden.proxy.ClientProxy"; // public static final String COMMONPROXY = "matgm50.twarden.proxy.CommonProxy"; // // } // Path: src/main/java/matgm50/twarden/item/ItemLoveRing.java import baubles.api.BaubleType; import baubles.api.IBauble; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import matgm50.twarden.TWarden; import matgm50.twarden.lib.ItemLib; import matgm50.twarden.lib.ModLib; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.EnumRarity; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.world.World; package matgm50.twarden.item; /** * Created by MasterAbdoTGM50 on 6/26/2014. */ public class ItemLoveRing extends Item implements IBauble { public ItemLoveRing() { super(); setUnlocalizedName(ItemLib.LOVE_RING_NAME); setCreativeTab(TWarden.tabTWarden); } @Override public EnumRarity getRarity(ItemStack par1ItemStack) {return EnumRarity.epic;} @Override @SideOnly(Side.CLIENT) public void registerIcons(IIconRegister register) {
itemIcon = register.registerIcon(ModLib.ID.toLowerCase() + ":" + "lovering");
MasterAbdoTGM50/ThaumicWarden
src/main/java/matgm50/twarden/client/gui/GuiHandler.java
// Path: src/main/java/matgm50/twarden/TWarden.java // @Mod(modid = ModLib.ID, name = ModLib.NAME, version = ModLib.VERSION, dependencies = ModLib.DEPENDENCIES) // // public class TWarden { // // @Instance(ModLib.ID) // public static TWarden instance; // // @SidedProxy(serverSide = ModLib.COMMONPROXY, clientSide = ModLib.CLIENTPROXY) // public static CommonProxy proxy; // // public static CreativeTabs tabTWarden = new TabTWarden(ModLib.ID); // // @EventHandler // public void preInit(FMLPreInitializationEvent event) { // // proxy.initRenderers(); // GuiHandler.init(); // // WardenicChargeEvents.init(); // WardenicUpgrades.init(); // // ModItems.init(); // ModBlocks.init(); // ModEntities.init(); // ModGen.init(); // // } // // @EventHandler // public void init(FMLInitializationEvent event) { // // } // // @EventHandler // public void postInit(FMLPostInitializationEvent event) { // // ModRecipes.init(); // ModResearch.init(); // // } // // } // // Path: src/main/java/matgm50/twarden/inventory/ContainerHammer.java // public class ContainerHammer extends Container { // // InventoryPlayer playerInv; // InventoryCrafting hammerInv; // IInventory resultInv; // // public ContainerHammer(EntityPlayer player) { // // playerInv = player.inventory; // hammerInv = new InventoryCrafting(this, 2, 1); // resultInv = new InventoryCraftResult(); // // for(int hotbar = 0; hotbar < 9; hotbar++) { // // addSlotToContainer(new Slot(playerInv, hotbar, 8 + 18 * hotbar, 142)); // // } // // for(int row = 0; row < 3; row++) { // // for(int collumn = 0; collumn < 9; collumn++) { // // addSlotToContainer(new Slot(playerInv, 9 + row * 9 + collumn, 8 + 18 * collumn, 84 + row * 18)); // // } // // } // // addSlotToContainer(new SlotEssentia(hammerInv, 0, 80, 54)); // addSlotToContainer(new Slot(hammerInv, 1, 80, 33)); // addSlotToContainer(new SlotCrafting(player, hammerInv, resultInv, 0, 80, 12)); // // onCraftMatrixChanged(hammerInv); // // } // // @Override // public void onCraftMatrixChanged(IInventory craftingMatrix) { // // ItemStack essentia = craftingMatrix.getStackInSlot(0); // ItemStack item = craftingMatrix.getStackInSlot(1); // // if(item != null) { // // if(!(item.getItem() instanceof ItemWardenArmor || item.getItem() instanceof ItemWardenWeapon)) { // // ItemStack repairedItem = new ItemStack(item.getItem()); // // if(item.getItemDamage() != 0 && item.getItem().isRepairable()) { // // repairedItem.setItemDamage(0); // resultInv.setInventorySlotContents(0, repairedItem); // // } // // } else if(essentia != null) { // // ItemStack infusedArmor = new ItemStack(item.getItem()); // String aspectKey = ((IEssentiaContainerItem)essentia.getItem()).getAspects(essentia).getAspects()[0].getName(); // // if(WardenicChargeHelper.upgrades.containsKey(aspectKey)) { // // WardenicChargeHelper.setUpgradeOnStack(infusedArmor, aspectKey); // // } // // resultInv.setInventorySlotContents(0, infusedArmor); // // } else {resultInv.setInventorySlotContents(0, null);} // // } else {resultInv.setInventorySlotContents(0, null);} // // } // // @Override // public void onContainerClosed(EntityPlayer player) { // // super.onContainerClosed(player); // // ItemStack essentia = this.hammerInv.getStackInSlotOnClosing(0); // if(essentia != null) {player.dropPlayerItemWithRandomChoice(essentia, false);} // // ItemStack item = this.hammerInv.getStackInSlotOnClosing(1); // if(item != null) {player.dropPlayerItemWithRandomChoice(item, false);} // // } // // @Override // public boolean canInteractWith(EntityPlayer player) {return true;} // // @Override // public ItemStack transferStackInSlot(EntityPlayer player, int slot) {return null;} // // @Override // public ItemStack slotClick(int slot, int button, int flag, EntityPlayer player) { // // if (slot >= 0 && getSlot(slot) != null && getSlot(slot).getStack() == player.getHeldItem()) {return null;} // return super.slotClick(slot, button, flag, player); // // } // // }
import cpw.mods.fml.common.network.IGuiHandler; import cpw.mods.fml.common.network.NetworkRegistry; import matgm50.twarden.TWarden; import matgm50.twarden.inventory.ContainerHammer; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.world.World;
package matgm50.twarden.client.gui; /** * Created by MasterAbdoTGM50 on 8/26/2014. */ public class GuiHandler implements IGuiHandler { public static void init() {
// Path: src/main/java/matgm50/twarden/TWarden.java // @Mod(modid = ModLib.ID, name = ModLib.NAME, version = ModLib.VERSION, dependencies = ModLib.DEPENDENCIES) // // public class TWarden { // // @Instance(ModLib.ID) // public static TWarden instance; // // @SidedProxy(serverSide = ModLib.COMMONPROXY, clientSide = ModLib.CLIENTPROXY) // public static CommonProxy proxy; // // public static CreativeTabs tabTWarden = new TabTWarden(ModLib.ID); // // @EventHandler // public void preInit(FMLPreInitializationEvent event) { // // proxy.initRenderers(); // GuiHandler.init(); // // WardenicChargeEvents.init(); // WardenicUpgrades.init(); // // ModItems.init(); // ModBlocks.init(); // ModEntities.init(); // ModGen.init(); // // } // // @EventHandler // public void init(FMLInitializationEvent event) { // // } // // @EventHandler // public void postInit(FMLPostInitializationEvent event) { // // ModRecipes.init(); // ModResearch.init(); // // } // // } // // Path: src/main/java/matgm50/twarden/inventory/ContainerHammer.java // public class ContainerHammer extends Container { // // InventoryPlayer playerInv; // InventoryCrafting hammerInv; // IInventory resultInv; // // public ContainerHammer(EntityPlayer player) { // // playerInv = player.inventory; // hammerInv = new InventoryCrafting(this, 2, 1); // resultInv = new InventoryCraftResult(); // // for(int hotbar = 0; hotbar < 9; hotbar++) { // // addSlotToContainer(new Slot(playerInv, hotbar, 8 + 18 * hotbar, 142)); // // } // // for(int row = 0; row < 3; row++) { // // for(int collumn = 0; collumn < 9; collumn++) { // // addSlotToContainer(new Slot(playerInv, 9 + row * 9 + collumn, 8 + 18 * collumn, 84 + row * 18)); // // } // // } // // addSlotToContainer(new SlotEssentia(hammerInv, 0, 80, 54)); // addSlotToContainer(new Slot(hammerInv, 1, 80, 33)); // addSlotToContainer(new SlotCrafting(player, hammerInv, resultInv, 0, 80, 12)); // // onCraftMatrixChanged(hammerInv); // // } // // @Override // public void onCraftMatrixChanged(IInventory craftingMatrix) { // // ItemStack essentia = craftingMatrix.getStackInSlot(0); // ItemStack item = craftingMatrix.getStackInSlot(1); // // if(item != null) { // // if(!(item.getItem() instanceof ItemWardenArmor || item.getItem() instanceof ItemWardenWeapon)) { // // ItemStack repairedItem = new ItemStack(item.getItem()); // // if(item.getItemDamage() != 0 && item.getItem().isRepairable()) { // // repairedItem.setItemDamage(0); // resultInv.setInventorySlotContents(0, repairedItem); // // } // // } else if(essentia != null) { // // ItemStack infusedArmor = new ItemStack(item.getItem()); // String aspectKey = ((IEssentiaContainerItem)essentia.getItem()).getAspects(essentia).getAspects()[0].getName(); // // if(WardenicChargeHelper.upgrades.containsKey(aspectKey)) { // // WardenicChargeHelper.setUpgradeOnStack(infusedArmor, aspectKey); // // } // // resultInv.setInventorySlotContents(0, infusedArmor); // // } else {resultInv.setInventorySlotContents(0, null);} // // } else {resultInv.setInventorySlotContents(0, null);} // // } // // @Override // public void onContainerClosed(EntityPlayer player) { // // super.onContainerClosed(player); // // ItemStack essentia = this.hammerInv.getStackInSlotOnClosing(0); // if(essentia != null) {player.dropPlayerItemWithRandomChoice(essentia, false);} // // ItemStack item = this.hammerInv.getStackInSlotOnClosing(1); // if(item != null) {player.dropPlayerItemWithRandomChoice(item, false);} // // } // // @Override // public boolean canInteractWith(EntityPlayer player) {return true;} // // @Override // public ItemStack transferStackInSlot(EntityPlayer player, int slot) {return null;} // // @Override // public ItemStack slotClick(int slot, int button, int flag, EntityPlayer player) { // // if (slot >= 0 && getSlot(slot) != null && getSlot(slot).getStack() == player.getHeldItem()) {return null;} // return super.slotClick(slot, button, flag, player); // // } // // } // Path: src/main/java/matgm50/twarden/client/gui/GuiHandler.java import cpw.mods.fml.common.network.IGuiHandler; import cpw.mods.fml.common.network.NetworkRegistry; import matgm50.twarden.TWarden; import matgm50.twarden.inventory.ContainerHammer; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.world.World; package matgm50.twarden.client.gui; /** * Created by MasterAbdoTGM50 on 8/26/2014. */ public class GuiHandler implements IGuiHandler { public static void init() {
NetworkRegistry.INSTANCE.registerGuiHandler(TWarden.instance, new GuiHandler());
MasterAbdoTGM50/ThaumicWarden
src/main/java/matgm50/twarden/client/gui/GuiHandler.java
// Path: src/main/java/matgm50/twarden/TWarden.java // @Mod(modid = ModLib.ID, name = ModLib.NAME, version = ModLib.VERSION, dependencies = ModLib.DEPENDENCIES) // // public class TWarden { // // @Instance(ModLib.ID) // public static TWarden instance; // // @SidedProxy(serverSide = ModLib.COMMONPROXY, clientSide = ModLib.CLIENTPROXY) // public static CommonProxy proxy; // // public static CreativeTabs tabTWarden = new TabTWarden(ModLib.ID); // // @EventHandler // public void preInit(FMLPreInitializationEvent event) { // // proxy.initRenderers(); // GuiHandler.init(); // // WardenicChargeEvents.init(); // WardenicUpgrades.init(); // // ModItems.init(); // ModBlocks.init(); // ModEntities.init(); // ModGen.init(); // // } // // @EventHandler // public void init(FMLInitializationEvent event) { // // } // // @EventHandler // public void postInit(FMLPostInitializationEvent event) { // // ModRecipes.init(); // ModResearch.init(); // // } // // } // // Path: src/main/java/matgm50/twarden/inventory/ContainerHammer.java // public class ContainerHammer extends Container { // // InventoryPlayer playerInv; // InventoryCrafting hammerInv; // IInventory resultInv; // // public ContainerHammer(EntityPlayer player) { // // playerInv = player.inventory; // hammerInv = new InventoryCrafting(this, 2, 1); // resultInv = new InventoryCraftResult(); // // for(int hotbar = 0; hotbar < 9; hotbar++) { // // addSlotToContainer(new Slot(playerInv, hotbar, 8 + 18 * hotbar, 142)); // // } // // for(int row = 0; row < 3; row++) { // // for(int collumn = 0; collumn < 9; collumn++) { // // addSlotToContainer(new Slot(playerInv, 9 + row * 9 + collumn, 8 + 18 * collumn, 84 + row * 18)); // // } // // } // // addSlotToContainer(new SlotEssentia(hammerInv, 0, 80, 54)); // addSlotToContainer(new Slot(hammerInv, 1, 80, 33)); // addSlotToContainer(new SlotCrafting(player, hammerInv, resultInv, 0, 80, 12)); // // onCraftMatrixChanged(hammerInv); // // } // // @Override // public void onCraftMatrixChanged(IInventory craftingMatrix) { // // ItemStack essentia = craftingMatrix.getStackInSlot(0); // ItemStack item = craftingMatrix.getStackInSlot(1); // // if(item != null) { // // if(!(item.getItem() instanceof ItemWardenArmor || item.getItem() instanceof ItemWardenWeapon)) { // // ItemStack repairedItem = new ItemStack(item.getItem()); // // if(item.getItemDamage() != 0 && item.getItem().isRepairable()) { // // repairedItem.setItemDamage(0); // resultInv.setInventorySlotContents(0, repairedItem); // // } // // } else if(essentia != null) { // // ItemStack infusedArmor = new ItemStack(item.getItem()); // String aspectKey = ((IEssentiaContainerItem)essentia.getItem()).getAspects(essentia).getAspects()[0].getName(); // // if(WardenicChargeHelper.upgrades.containsKey(aspectKey)) { // // WardenicChargeHelper.setUpgradeOnStack(infusedArmor, aspectKey); // // } // // resultInv.setInventorySlotContents(0, infusedArmor); // // } else {resultInv.setInventorySlotContents(0, null);} // // } else {resultInv.setInventorySlotContents(0, null);} // // } // // @Override // public void onContainerClosed(EntityPlayer player) { // // super.onContainerClosed(player); // // ItemStack essentia = this.hammerInv.getStackInSlotOnClosing(0); // if(essentia != null) {player.dropPlayerItemWithRandomChoice(essentia, false);} // // ItemStack item = this.hammerInv.getStackInSlotOnClosing(1); // if(item != null) {player.dropPlayerItemWithRandomChoice(item, false);} // // } // // @Override // public boolean canInteractWith(EntityPlayer player) {return true;} // // @Override // public ItemStack transferStackInSlot(EntityPlayer player, int slot) {return null;} // // @Override // public ItemStack slotClick(int slot, int button, int flag, EntityPlayer player) { // // if (slot >= 0 && getSlot(slot) != null && getSlot(slot).getStack() == player.getHeldItem()) {return null;} // return super.slotClick(slot, button, flag, player); // // } // // }
import cpw.mods.fml.common.network.IGuiHandler; import cpw.mods.fml.common.network.NetworkRegistry; import matgm50.twarden.TWarden; import matgm50.twarden.inventory.ContainerHammer; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.world.World;
package matgm50.twarden.client.gui; /** * Created by MasterAbdoTGM50 on 8/26/2014. */ public class GuiHandler implements IGuiHandler { public static void init() { NetworkRegistry.INSTANCE.registerGuiHandler(TWarden.instance, new GuiHandler()); } @Override public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { switch(ID) {
// Path: src/main/java/matgm50/twarden/TWarden.java // @Mod(modid = ModLib.ID, name = ModLib.NAME, version = ModLib.VERSION, dependencies = ModLib.DEPENDENCIES) // // public class TWarden { // // @Instance(ModLib.ID) // public static TWarden instance; // // @SidedProxy(serverSide = ModLib.COMMONPROXY, clientSide = ModLib.CLIENTPROXY) // public static CommonProxy proxy; // // public static CreativeTabs tabTWarden = new TabTWarden(ModLib.ID); // // @EventHandler // public void preInit(FMLPreInitializationEvent event) { // // proxy.initRenderers(); // GuiHandler.init(); // // WardenicChargeEvents.init(); // WardenicUpgrades.init(); // // ModItems.init(); // ModBlocks.init(); // ModEntities.init(); // ModGen.init(); // // } // // @EventHandler // public void init(FMLInitializationEvent event) { // // } // // @EventHandler // public void postInit(FMLPostInitializationEvent event) { // // ModRecipes.init(); // ModResearch.init(); // // } // // } // // Path: src/main/java/matgm50/twarden/inventory/ContainerHammer.java // public class ContainerHammer extends Container { // // InventoryPlayer playerInv; // InventoryCrafting hammerInv; // IInventory resultInv; // // public ContainerHammer(EntityPlayer player) { // // playerInv = player.inventory; // hammerInv = new InventoryCrafting(this, 2, 1); // resultInv = new InventoryCraftResult(); // // for(int hotbar = 0; hotbar < 9; hotbar++) { // // addSlotToContainer(new Slot(playerInv, hotbar, 8 + 18 * hotbar, 142)); // // } // // for(int row = 0; row < 3; row++) { // // for(int collumn = 0; collumn < 9; collumn++) { // // addSlotToContainer(new Slot(playerInv, 9 + row * 9 + collumn, 8 + 18 * collumn, 84 + row * 18)); // // } // // } // // addSlotToContainer(new SlotEssentia(hammerInv, 0, 80, 54)); // addSlotToContainer(new Slot(hammerInv, 1, 80, 33)); // addSlotToContainer(new SlotCrafting(player, hammerInv, resultInv, 0, 80, 12)); // // onCraftMatrixChanged(hammerInv); // // } // // @Override // public void onCraftMatrixChanged(IInventory craftingMatrix) { // // ItemStack essentia = craftingMatrix.getStackInSlot(0); // ItemStack item = craftingMatrix.getStackInSlot(1); // // if(item != null) { // // if(!(item.getItem() instanceof ItemWardenArmor || item.getItem() instanceof ItemWardenWeapon)) { // // ItemStack repairedItem = new ItemStack(item.getItem()); // // if(item.getItemDamage() != 0 && item.getItem().isRepairable()) { // // repairedItem.setItemDamage(0); // resultInv.setInventorySlotContents(0, repairedItem); // // } // // } else if(essentia != null) { // // ItemStack infusedArmor = new ItemStack(item.getItem()); // String aspectKey = ((IEssentiaContainerItem)essentia.getItem()).getAspects(essentia).getAspects()[0].getName(); // // if(WardenicChargeHelper.upgrades.containsKey(aspectKey)) { // // WardenicChargeHelper.setUpgradeOnStack(infusedArmor, aspectKey); // // } // // resultInv.setInventorySlotContents(0, infusedArmor); // // } else {resultInv.setInventorySlotContents(0, null);} // // } else {resultInv.setInventorySlotContents(0, null);} // // } // // @Override // public void onContainerClosed(EntityPlayer player) { // // super.onContainerClosed(player); // // ItemStack essentia = this.hammerInv.getStackInSlotOnClosing(0); // if(essentia != null) {player.dropPlayerItemWithRandomChoice(essentia, false);} // // ItemStack item = this.hammerInv.getStackInSlotOnClosing(1); // if(item != null) {player.dropPlayerItemWithRandomChoice(item, false);} // // } // // @Override // public boolean canInteractWith(EntityPlayer player) {return true;} // // @Override // public ItemStack transferStackInSlot(EntityPlayer player, int slot) {return null;} // // @Override // public ItemStack slotClick(int slot, int button, int flag, EntityPlayer player) { // // if (slot >= 0 && getSlot(slot) != null && getSlot(slot).getStack() == player.getHeldItem()) {return null;} // return super.slotClick(slot, button, flag, player); // // } // // } // Path: src/main/java/matgm50/twarden/client/gui/GuiHandler.java import cpw.mods.fml.common.network.IGuiHandler; import cpw.mods.fml.common.network.NetworkRegistry; import matgm50.twarden.TWarden; import matgm50.twarden.inventory.ContainerHammer; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.world.World; package matgm50.twarden.client.gui; /** * Created by MasterAbdoTGM50 on 8/26/2014. */ public class GuiHandler implements IGuiHandler { public static void init() { NetworkRegistry.INSTANCE.registerGuiHandler(TWarden.instance, new GuiHandler()); } @Override public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { switch(ID) {
case 0 : return new ContainerHammer(player);
MasterAbdoTGM50/ThaumicWarden
src/main/java/matgm50/twarden/block/BlockQuartzNormal.java
// Path: src/main/java/matgm50/twarden/TWarden.java // @Mod(modid = ModLib.ID, name = ModLib.NAME, version = ModLib.VERSION, dependencies = ModLib.DEPENDENCIES) // // public class TWarden { // // @Instance(ModLib.ID) // public static TWarden instance; // // @SidedProxy(serverSide = ModLib.COMMONPROXY, clientSide = ModLib.CLIENTPROXY) // public static CommonProxy proxy; // // public static CreativeTabs tabTWarden = new TabTWarden(ModLib.ID); // // @EventHandler // public void preInit(FMLPreInitializationEvent event) { // // proxy.initRenderers(); // GuiHandler.init(); // // WardenicChargeEvents.init(); // WardenicUpgrades.init(); // // ModItems.init(); // ModBlocks.init(); // ModEntities.init(); // ModGen.init(); // // } // // @EventHandler // public void init(FMLInitializationEvent event) { // // } // // @EventHandler // public void postInit(FMLPostInitializationEvent event) { // // ModRecipes.init(); // ModResearch.init(); // // } // // } // // Path: src/main/java/matgm50/twarden/lib/BlockLib.java // public class BlockLib { // // public static final String EXUBITURA_NAME = "blockExubitura"; // public static final String QUARTZ_NORMAL_NAME = "blockInfusedQuartzNormal"; // public static final String QUARTZ_SLAB_NAME = "blockInfusedQuartzSlab"; // public static final String QUARTZ_STAIR_NAME = "blockInfusedQuartzStair"; // public static final String QUARTZ_CHISELED_NAME = "blockInfusedQuartzChiseled"; // public static final String QUARTZ_PILLAR_NAME = "blockInfusedQuartzPillar"; // public static final String BLOCK_WITOR_NAME = "blockWitor"; // public static final String TILE_WITOR_NAME = "tileWitor"; // // } // // Path: src/main/java/matgm50/twarden/lib/ModLib.java // public class ModLib { // // public static final String ID = "TWarden"; // public static final String NAME = "Thaumic Warden"; // public static final String VERSION = "1.1.1"; // public static final String DEPENDENCIES = "required-after:Thaumcraft"; // // public static final String CLIENTPROXY = "matgm50.twarden.proxy.ClientProxy"; // public static final String COMMONPROXY = "matgm50.twarden.proxy.CommonProxy"; // // }
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import matgm50.twarden.TWarden; import matgm50.twarden.lib.BlockLib; import matgm50.twarden.lib.ModLib; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.util.IIcon;
package matgm50.twarden.block; /** * Created by MasterAbdoTGM50 on 5/22/2014. */ public class BlockQuartzNormal extends Block { public IIcon topIcon; public IIcon botIcon; public IIcon sideIcon; protected BlockQuartzNormal() { super(Material.rock);
// Path: src/main/java/matgm50/twarden/TWarden.java // @Mod(modid = ModLib.ID, name = ModLib.NAME, version = ModLib.VERSION, dependencies = ModLib.DEPENDENCIES) // // public class TWarden { // // @Instance(ModLib.ID) // public static TWarden instance; // // @SidedProxy(serverSide = ModLib.COMMONPROXY, clientSide = ModLib.CLIENTPROXY) // public static CommonProxy proxy; // // public static CreativeTabs tabTWarden = new TabTWarden(ModLib.ID); // // @EventHandler // public void preInit(FMLPreInitializationEvent event) { // // proxy.initRenderers(); // GuiHandler.init(); // // WardenicChargeEvents.init(); // WardenicUpgrades.init(); // // ModItems.init(); // ModBlocks.init(); // ModEntities.init(); // ModGen.init(); // // } // // @EventHandler // public void init(FMLInitializationEvent event) { // // } // // @EventHandler // public void postInit(FMLPostInitializationEvent event) { // // ModRecipes.init(); // ModResearch.init(); // // } // // } // // Path: src/main/java/matgm50/twarden/lib/BlockLib.java // public class BlockLib { // // public static final String EXUBITURA_NAME = "blockExubitura"; // public static final String QUARTZ_NORMAL_NAME = "blockInfusedQuartzNormal"; // public static final String QUARTZ_SLAB_NAME = "blockInfusedQuartzSlab"; // public static final String QUARTZ_STAIR_NAME = "blockInfusedQuartzStair"; // public static final String QUARTZ_CHISELED_NAME = "blockInfusedQuartzChiseled"; // public static final String QUARTZ_PILLAR_NAME = "blockInfusedQuartzPillar"; // public static final String BLOCK_WITOR_NAME = "blockWitor"; // public static final String TILE_WITOR_NAME = "tileWitor"; // // } // // Path: src/main/java/matgm50/twarden/lib/ModLib.java // public class ModLib { // // public static final String ID = "TWarden"; // public static final String NAME = "Thaumic Warden"; // public static final String VERSION = "1.1.1"; // public static final String DEPENDENCIES = "required-after:Thaumcraft"; // // public static final String CLIENTPROXY = "matgm50.twarden.proxy.ClientProxy"; // public static final String COMMONPROXY = "matgm50.twarden.proxy.CommonProxy"; // // } // Path: src/main/java/matgm50/twarden/block/BlockQuartzNormal.java import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import matgm50.twarden.TWarden; import matgm50.twarden.lib.BlockLib; import matgm50.twarden.lib.ModLib; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.util.IIcon; package matgm50.twarden.block; /** * Created by MasterAbdoTGM50 on 5/22/2014. */ public class BlockQuartzNormal extends Block { public IIcon topIcon; public IIcon botIcon; public IIcon sideIcon; protected BlockQuartzNormal() { super(Material.rock);
setBlockName(BlockLib.QUARTZ_NORMAL_NAME);
MasterAbdoTGM50/ThaumicWarden
src/main/java/matgm50/twarden/block/BlockQuartzNormal.java
// Path: src/main/java/matgm50/twarden/TWarden.java // @Mod(modid = ModLib.ID, name = ModLib.NAME, version = ModLib.VERSION, dependencies = ModLib.DEPENDENCIES) // // public class TWarden { // // @Instance(ModLib.ID) // public static TWarden instance; // // @SidedProxy(serverSide = ModLib.COMMONPROXY, clientSide = ModLib.CLIENTPROXY) // public static CommonProxy proxy; // // public static CreativeTabs tabTWarden = new TabTWarden(ModLib.ID); // // @EventHandler // public void preInit(FMLPreInitializationEvent event) { // // proxy.initRenderers(); // GuiHandler.init(); // // WardenicChargeEvents.init(); // WardenicUpgrades.init(); // // ModItems.init(); // ModBlocks.init(); // ModEntities.init(); // ModGen.init(); // // } // // @EventHandler // public void init(FMLInitializationEvent event) { // // } // // @EventHandler // public void postInit(FMLPostInitializationEvent event) { // // ModRecipes.init(); // ModResearch.init(); // // } // // } // // Path: src/main/java/matgm50/twarden/lib/BlockLib.java // public class BlockLib { // // public static final String EXUBITURA_NAME = "blockExubitura"; // public static final String QUARTZ_NORMAL_NAME = "blockInfusedQuartzNormal"; // public static final String QUARTZ_SLAB_NAME = "blockInfusedQuartzSlab"; // public static final String QUARTZ_STAIR_NAME = "blockInfusedQuartzStair"; // public static final String QUARTZ_CHISELED_NAME = "blockInfusedQuartzChiseled"; // public static final String QUARTZ_PILLAR_NAME = "blockInfusedQuartzPillar"; // public static final String BLOCK_WITOR_NAME = "blockWitor"; // public static final String TILE_WITOR_NAME = "tileWitor"; // // } // // Path: src/main/java/matgm50/twarden/lib/ModLib.java // public class ModLib { // // public static final String ID = "TWarden"; // public static final String NAME = "Thaumic Warden"; // public static final String VERSION = "1.1.1"; // public static final String DEPENDENCIES = "required-after:Thaumcraft"; // // public static final String CLIENTPROXY = "matgm50.twarden.proxy.ClientProxy"; // public static final String COMMONPROXY = "matgm50.twarden.proxy.CommonProxy"; // // }
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import matgm50.twarden.TWarden; import matgm50.twarden.lib.BlockLib; import matgm50.twarden.lib.ModLib; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.util.IIcon;
package matgm50.twarden.block; /** * Created by MasterAbdoTGM50 on 5/22/2014. */ public class BlockQuartzNormal extends Block { public IIcon topIcon; public IIcon botIcon; public IIcon sideIcon; protected BlockQuartzNormal() { super(Material.rock); setBlockName(BlockLib.QUARTZ_NORMAL_NAME);
// Path: src/main/java/matgm50/twarden/TWarden.java // @Mod(modid = ModLib.ID, name = ModLib.NAME, version = ModLib.VERSION, dependencies = ModLib.DEPENDENCIES) // // public class TWarden { // // @Instance(ModLib.ID) // public static TWarden instance; // // @SidedProxy(serverSide = ModLib.COMMONPROXY, clientSide = ModLib.CLIENTPROXY) // public static CommonProxy proxy; // // public static CreativeTabs tabTWarden = new TabTWarden(ModLib.ID); // // @EventHandler // public void preInit(FMLPreInitializationEvent event) { // // proxy.initRenderers(); // GuiHandler.init(); // // WardenicChargeEvents.init(); // WardenicUpgrades.init(); // // ModItems.init(); // ModBlocks.init(); // ModEntities.init(); // ModGen.init(); // // } // // @EventHandler // public void init(FMLInitializationEvent event) { // // } // // @EventHandler // public void postInit(FMLPostInitializationEvent event) { // // ModRecipes.init(); // ModResearch.init(); // // } // // } // // Path: src/main/java/matgm50/twarden/lib/BlockLib.java // public class BlockLib { // // public static final String EXUBITURA_NAME = "blockExubitura"; // public static final String QUARTZ_NORMAL_NAME = "blockInfusedQuartzNormal"; // public static final String QUARTZ_SLAB_NAME = "blockInfusedQuartzSlab"; // public static final String QUARTZ_STAIR_NAME = "blockInfusedQuartzStair"; // public static final String QUARTZ_CHISELED_NAME = "blockInfusedQuartzChiseled"; // public static final String QUARTZ_PILLAR_NAME = "blockInfusedQuartzPillar"; // public static final String BLOCK_WITOR_NAME = "blockWitor"; // public static final String TILE_WITOR_NAME = "tileWitor"; // // } // // Path: src/main/java/matgm50/twarden/lib/ModLib.java // public class ModLib { // // public static final String ID = "TWarden"; // public static final String NAME = "Thaumic Warden"; // public static final String VERSION = "1.1.1"; // public static final String DEPENDENCIES = "required-after:Thaumcraft"; // // public static final String CLIENTPROXY = "matgm50.twarden.proxy.ClientProxy"; // public static final String COMMONPROXY = "matgm50.twarden.proxy.CommonProxy"; // // } // Path: src/main/java/matgm50/twarden/block/BlockQuartzNormal.java import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import matgm50.twarden.TWarden; import matgm50.twarden.lib.BlockLib; import matgm50.twarden.lib.ModLib; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.util.IIcon; package matgm50.twarden.block; /** * Created by MasterAbdoTGM50 on 5/22/2014. */ public class BlockQuartzNormal extends Block { public IIcon topIcon; public IIcon botIcon; public IIcon sideIcon; protected BlockQuartzNormal() { super(Material.rock); setBlockName(BlockLib.QUARTZ_NORMAL_NAME);
setCreativeTab(TWarden.tabTWarden);
MasterAbdoTGM50/ThaumicWarden
src/main/java/matgm50/twarden/block/BlockQuartzNormal.java
// Path: src/main/java/matgm50/twarden/TWarden.java // @Mod(modid = ModLib.ID, name = ModLib.NAME, version = ModLib.VERSION, dependencies = ModLib.DEPENDENCIES) // // public class TWarden { // // @Instance(ModLib.ID) // public static TWarden instance; // // @SidedProxy(serverSide = ModLib.COMMONPROXY, clientSide = ModLib.CLIENTPROXY) // public static CommonProxy proxy; // // public static CreativeTabs tabTWarden = new TabTWarden(ModLib.ID); // // @EventHandler // public void preInit(FMLPreInitializationEvent event) { // // proxy.initRenderers(); // GuiHandler.init(); // // WardenicChargeEvents.init(); // WardenicUpgrades.init(); // // ModItems.init(); // ModBlocks.init(); // ModEntities.init(); // ModGen.init(); // // } // // @EventHandler // public void init(FMLInitializationEvent event) { // // } // // @EventHandler // public void postInit(FMLPostInitializationEvent event) { // // ModRecipes.init(); // ModResearch.init(); // // } // // } // // Path: src/main/java/matgm50/twarden/lib/BlockLib.java // public class BlockLib { // // public static final String EXUBITURA_NAME = "blockExubitura"; // public static final String QUARTZ_NORMAL_NAME = "blockInfusedQuartzNormal"; // public static final String QUARTZ_SLAB_NAME = "blockInfusedQuartzSlab"; // public static final String QUARTZ_STAIR_NAME = "blockInfusedQuartzStair"; // public static final String QUARTZ_CHISELED_NAME = "blockInfusedQuartzChiseled"; // public static final String QUARTZ_PILLAR_NAME = "blockInfusedQuartzPillar"; // public static final String BLOCK_WITOR_NAME = "blockWitor"; // public static final String TILE_WITOR_NAME = "tileWitor"; // // } // // Path: src/main/java/matgm50/twarden/lib/ModLib.java // public class ModLib { // // public static final String ID = "TWarden"; // public static final String NAME = "Thaumic Warden"; // public static final String VERSION = "1.1.1"; // public static final String DEPENDENCIES = "required-after:Thaumcraft"; // // public static final String CLIENTPROXY = "matgm50.twarden.proxy.ClientProxy"; // public static final String COMMONPROXY = "matgm50.twarden.proxy.CommonProxy"; // // }
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import matgm50.twarden.TWarden; import matgm50.twarden.lib.BlockLib; import matgm50.twarden.lib.ModLib; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.util.IIcon;
package matgm50.twarden.block; /** * Created by MasterAbdoTGM50 on 5/22/2014. */ public class BlockQuartzNormal extends Block { public IIcon topIcon; public IIcon botIcon; public IIcon sideIcon; protected BlockQuartzNormal() { super(Material.rock); setBlockName(BlockLib.QUARTZ_NORMAL_NAME); setCreativeTab(TWarden.tabTWarden); setStepSound(Block.soundTypeStone); setHardness(0.8F); } @SideOnly(Side.CLIENT) @Override public void registerBlockIcons(IIconRegister register) {
// Path: src/main/java/matgm50/twarden/TWarden.java // @Mod(modid = ModLib.ID, name = ModLib.NAME, version = ModLib.VERSION, dependencies = ModLib.DEPENDENCIES) // // public class TWarden { // // @Instance(ModLib.ID) // public static TWarden instance; // // @SidedProxy(serverSide = ModLib.COMMONPROXY, clientSide = ModLib.CLIENTPROXY) // public static CommonProxy proxy; // // public static CreativeTabs tabTWarden = new TabTWarden(ModLib.ID); // // @EventHandler // public void preInit(FMLPreInitializationEvent event) { // // proxy.initRenderers(); // GuiHandler.init(); // // WardenicChargeEvents.init(); // WardenicUpgrades.init(); // // ModItems.init(); // ModBlocks.init(); // ModEntities.init(); // ModGen.init(); // // } // // @EventHandler // public void init(FMLInitializationEvent event) { // // } // // @EventHandler // public void postInit(FMLPostInitializationEvent event) { // // ModRecipes.init(); // ModResearch.init(); // // } // // } // // Path: src/main/java/matgm50/twarden/lib/BlockLib.java // public class BlockLib { // // public static final String EXUBITURA_NAME = "blockExubitura"; // public static final String QUARTZ_NORMAL_NAME = "blockInfusedQuartzNormal"; // public static final String QUARTZ_SLAB_NAME = "blockInfusedQuartzSlab"; // public static final String QUARTZ_STAIR_NAME = "blockInfusedQuartzStair"; // public static final String QUARTZ_CHISELED_NAME = "blockInfusedQuartzChiseled"; // public static final String QUARTZ_PILLAR_NAME = "blockInfusedQuartzPillar"; // public static final String BLOCK_WITOR_NAME = "blockWitor"; // public static final String TILE_WITOR_NAME = "tileWitor"; // // } // // Path: src/main/java/matgm50/twarden/lib/ModLib.java // public class ModLib { // // public static final String ID = "TWarden"; // public static final String NAME = "Thaumic Warden"; // public static final String VERSION = "1.1.1"; // public static final String DEPENDENCIES = "required-after:Thaumcraft"; // // public static final String CLIENTPROXY = "matgm50.twarden.proxy.ClientProxy"; // public static final String COMMONPROXY = "matgm50.twarden.proxy.CommonProxy"; // // } // Path: src/main/java/matgm50/twarden/block/BlockQuartzNormal.java import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import matgm50.twarden.TWarden; import matgm50.twarden.lib.BlockLib; import matgm50.twarden.lib.ModLib; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.util.IIcon; package matgm50.twarden.block; /** * Created by MasterAbdoTGM50 on 5/22/2014. */ public class BlockQuartzNormal extends Block { public IIcon topIcon; public IIcon botIcon; public IIcon sideIcon; protected BlockQuartzNormal() { super(Material.rock); setBlockName(BlockLib.QUARTZ_NORMAL_NAME); setCreativeTab(TWarden.tabTWarden); setStepSound(Block.soundTypeStone); setHardness(0.8F); } @SideOnly(Side.CLIENT) @Override public void registerBlockIcons(IIconRegister register) {
topIcon = register.registerIcon(ModLib.ID.toLowerCase() + ":" + "infusedquartztop" );
MasterAbdoTGM50/ThaumicWarden
src/main/java/matgm50/twarden/item/ItemWardenChest.java
// Path: src/main/java/matgm50/twarden/TWarden.java // @Mod(modid = ModLib.ID, name = ModLib.NAME, version = ModLib.VERSION, dependencies = ModLib.DEPENDENCIES) // // public class TWarden { // // @Instance(ModLib.ID) // public static TWarden instance; // // @SidedProxy(serverSide = ModLib.COMMONPROXY, clientSide = ModLib.CLIENTPROXY) // public static CommonProxy proxy; // // public static CreativeTabs tabTWarden = new TabTWarden(ModLib.ID); // // @EventHandler // public void preInit(FMLPreInitializationEvent event) { // // proxy.initRenderers(); // GuiHandler.init(); // // WardenicChargeEvents.init(); // WardenicUpgrades.init(); // // ModItems.init(); // ModBlocks.init(); // ModEntities.init(); // ModGen.init(); // // } // // @EventHandler // public void init(FMLInitializationEvent event) { // // } // // @EventHandler // public void postInit(FMLPostInitializationEvent event) { // // ModRecipes.init(); // ModResearch.init(); // // } // // } // // Path: src/main/java/matgm50/twarden/lib/ItemLib.java // public class ItemLib { // // public static final String RESOURCE_NAME = "itemResource"; // public static final String[] RESOURCE_ICON = {"wardenpetal", "wardenstone", "wardenquartz"}; // // public static final String WARDEN_AMULET_NAME = "itemWardenAmulet"; // public static final String WARDEN_WEAPON_NAME = "itemWardenWeapon"; // public static final String WARDEN_HELM_NAME = "itemWardenHelm"; // public static final String WARDEN_CHEST_NAME = "itemWardenChest"; // public static final String WARDEN_LEGS_NAME = "itemWardenLegs"; // public static final String WARDEN_BOOTS_NAME = "itemWardenBoots"; // public static final String PURITY_FOCUS_NAME = "itemFocusPurity"; // public static final String LOVE_RING_NAME = "itemLoveRing"; // public static final String WASLIE_HAMMER_NAME = "itemWaslieHammer"; // public static final String ILLUMI_FOCUS_NAME = "itemFocusIllumination"; // // } // // Path: src/main/java/matgm50/twarden/lib/ModLib.java // public class ModLib { // // public static final String ID = "TWarden"; // public static final String NAME = "Thaumic Warden"; // public static final String VERSION = "1.1.1"; // public static final String DEPENDENCIES = "required-after:Thaumcraft"; // // public static final String CLIENTPROXY = "matgm50.twarden.proxy.ClientProxy"; // public static final String COMMONPROXY = "matgm50.twarden.proxy.CommonProxy"; // // }
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import matgm50.twarden.TWarden; import matgm50.twarden.lib.ItemLib; import matgm50.twarden.lib.ModLib; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.Entity; import net.minecraft.item.ItemStack;
package matgm50.twarden.item; /** * Created by MasterAbdoTGM50 on 6/26/2014. */ public class ItemWardenChest extends ItemWardenArmor { public ItemWardenChest() { super(1);
// Path: src/main/java/matgm50/twarden/TWarden.java // @Mod(modid = ModLib.ID, name = ModLib.NAME, version = ModLib.VERSION, dependencies = ModLib.DEPENDENCIES) // // public class TWarden { // // @Instance(ModLib.ID) // public static TWarden instance; // // @SidedProxy(serverSide = ModLib.COMMONPROXY, clientSide = ModLib.CLIENTPROXY) // public static CommonProxy proxy; // // public static CreativeTabs tabTWarden = new TabTWarden(ModLib.ID); // // @EventHandler // public void preInit(FMLPreInitializationEvent event) { // // proxy.initRenderers(); // GuiHandler.init(); // // WardenicChargeEvents.init(); // WardenicUpgrades.init(); // // ModItems.init(); // ModBlocks.init(); // ModEntities.init(); // ModGen.init(); // // } // // @EventHandler // public void init(FMLInitializationEvent event) { // // } // // @EventHandler // public void postInit(FMLPostInitializationEvent event) { // // ModRecipes.init(); // ModResearch.init(); // // } // // } // // Path: src/main/java/matgm50/twarden/lib/ItemLib.java // public class ItemLib { // // public static final String RESOURCE_NAME = "itemResource"; // public static final String[] RESOURCE_ICON = {"wardenpetal", "wardenstone", "wardenquartz"}; // // public static final String WARDEN_AMULET_NAME = "itemWardenAmulet"; // public static final String WARDEN_WEAPON_NAME = "itemWardenWeapon"; // public static final String WARDEN_HELM_NAME = "itemWardenHelm"; // public static final String WARDEN_CHEST_NAME = "itemWardenChest"; // public static final String WARDEN_LEGS_NAME = "itemWardenLegs"; // public static final String WARDEN_BOOTS_NAME = "itemWardenBoots"; // public static final String PURITY_FOCUS_NAME = "itemFocusPurity"; // public static final String LOVE_RING_NAME = "itemLoveRing"; // public static final String WASLIE_HAMMER_NAME = "itemWaslieHammer"; // public static final String ILLUMI_FOCUS_NAME = "itemFocusIllumination"; // // } // // Path: src/main/java/matgm50/twarden/lib/ModLib.java // public class ModLib { // // public static final String ID = "TWarden"; // public static final String NAME = "Thaumic Warden"; // public static final String VERSION = "1.1.1"; // public static final String DEPENDENCIES = "required-after:Thaumcraft"; // // public static final String CLIENTPROXY = "matgm50.twarden.proxy.ClientProxy"; // public static final String COMMONPROXY = "matgm50.twarden.proxy.CommonProxy"; // // } // Path: src/main/java/matgm50/twarden/item/ItemWardenChest.java import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import matgm50.twarden.TWarden; import matgm50.twarden.lib.ItemLib; import matgm50.twarden.lib.ModLib; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.Entity; import net.minecraft.item.ItemStack; package matgm50.twarden.item; /** * Created by MasterAbdoTGM50 on 6/26/2014. */ public class ItemWardenChest extends ItemWardenArmor { public ItemWardenChest() { super(1);
setUnlocalizedName(ItemLib.WARDEN_CHEST_NAME);
MasterAbdoTGM50/ThaumicWarden
src/main/java/matgm50/twarden/item/ItemWardenChest.java
// Path: src/main/java/matgm50/twarden/TWarden.java // @Mod(modid = ModLib.ID, name = ModLib.NAME, version = ModLib.VERSION, dependencies = ModLib.DEPENDENCIES) // // public class TWarden { // // @Instance(ModLib.ID) // public static TWarden instance; // // @SidedProxy(serverSide = ModLib.COMMONPROXY, clientSide = ModLib.CLIENTPROXY) // public static CommonProxy proxy; // // public static CreativeTabs tabTWarden = new TabTWarden(ModLib.ID); // // @EventHandler // public void preInit(FMLPreInitializationEvent event) { // // proxy.initRenderers(); // GuiHandler.init(); // // WardenicChargeEvents.init(); // WardenicUpgrades.init(); // // ModItems.init(); // ModBlocks.init(); // ModEntities.init(); // ModGen.init(); // // } // // @EventHandler // public void init(FMLInitializationEvent event) { // // } // // @EventHandler // public void postInit(FMLPostInitializationEvent event) { // // ModRecipes.init(); // ModResearch.init(); // // } // // } // // Path: src/main/java/matgm50/twarden/lib/ItemLib.java // public class ItemLib { // // public static final String RESOURCE_NAME = "itemResource"; // public static final String[] RESOURCE_ICON = {"wardenpetal", "wardenstone", "wardenquartz"}; // // public static final String WARDEN_AMULET_NAME = "itemWardenAmulet"; // public static final String WARDEN_WEAPON_NAME = "itemWardenWeapon"; // public static final String WARDEN_HELM_NAME = "itemWardenHelm"; // public static final String WARDEN_CHEST_NAME = "itemWardenChest"; // public static final String WARDEN_LEGS_NAME = "itemWardenLegs"; // public static final String WARDEN_BOOTS_NAME = "itemWardenBoots"; // public static final String PURITY_FOCUS_NAME = "itemFocusPurity"; // public static final String LOVE_RING_NAME = "itemLoveRing"; // public static final String WASLIE_HAMMER_NAME = "itemWaslieHammer"; // public static final String ILLUMI_FOCUS_NAME = "itemFocusIllumination"; // // } // // Path: src/main/java/matgm50/twarden/lib/ModLib.java // public class ModLib { // // public static final String ID = "TWarden"; // public static final String NAME = "Thaumic Warden"; // public static final String VERSION = "1.1.1"; // public static final String DEPENDENCIES = "required-after:Thaumcraft"; // // public static final String CLIENTPROXY = "matgm50.twarden.proxy.ClientProxy"; // public static final String COMMONPROXY = "matgm50.twarden.proxy.CommonProxy"; // // }
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import matgm50.twarden.TWarden; import matgm50.twarden.lib.ItemLib; import matgm50.twarden.lib.ModLib; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.Entity; import net.minecraft.item.ItemStack;
package matgm50.twarden.item; /** * Created by MasterAbdoTGM50 on 6/26/2014. */ public class ItemWardenChest extends ItemWardenArmor { public ItemWardenChest() { super(1); setUnlocalizedName(ItemLib.WARDEN_CHEST_NAME);
// Path: src/main/java/matgm50/twarden/TWarden.java // @Mod(modid = ModLib.ID, name = ModLib.NAME, version = ModLib.VERSION, dependencies = ModLib.DEPENDENCIES) // // public class TWarden { // // @Instance(ModLib.ID) // public static TWarden instance; // // @SidedProxy(serverSide = ModLib.COMMONPROXY, clientSide = ModLib.CLIENTPROXY) // public static CommonProxy proxy; // // public static CreativeTabs tabTWarden = new TabTWarden(ModLib.ID); // // @EventHandler // public void preInit(FMLPreInitializationEvent event) { // // proxy.initRenderers(); // GuiHandler.init(); // // WardenicChargeEvents.init(); // WardenicUpgrades.init(); // // ModItems.init(); // ModBlocks.init(); // ModEntities.init(); // ModGen.init(); // // } // // @EventHandler // public void init(FMLInitializationEvent event) { // // } // // @EventHandler // public void postInit(FMLPostInitializationEvent event) { // // ModRecipes.init(); // ModResearch.init(); // // } // // } // // Path: src/main/java/matgm50/twarden/lib/ItemLib.java // public class ItemLib { // // public static final String RESOURCE_NAME = "itemResource"; // public static final String[] RESOURCE_ICON = {"wardenpetal", "wardenstone", "wardenquartz"}; // // public static final String WARDEN_AMULET_NAME = "itemWardenAmulet"; // public static final String WARDEN_WEAPON_NAME = "itemWardenWeapon"; // public static final String WARDEN_HELM_NAME = "itemWardenHelm"; // public static final String WARDEN_CHEST_NAME = "itemWardenChest"; // public static final String WARDEN_LEGS_NAME = "itemWardenLegs"; // public static final String WARDEN_BOOTS_NAME = "itemWardenBoots"; // public static final String PURITY_FOCUS_NAME = "itemFocusPurity"; // public static final String LOVE_RING_NAME = "itemLoveRing"; // public static final String WASLIE_HAMMER_NAME = "itemWaslieHammer"; // public static final String ILLUMI_FOCUS_NAME = "itemFocusIllumination"; // // } // // Path: src/main/java/matgm50/twarden/lib/ModLib.java // public class ModLib { // // public static final String ID = "TWarden"; // public static final String NAME = "Thaumic Warden"; // public static final String VERSION = "1.1.1"; // public static final String DEPENDENCIES = "required-after:Thaumcraft"; // // public static final String CLIENTPROXY = "matgm50.twarden.proxy.ClientProxy"; // public static final String COMMONPROXY = "matgm50.twarden.proxy.CommonProxy"; // // } // Path: src/main/java/matgm50/twarden/item/ItemWardenChest.java import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import matgm50.twarden.TWarden; import matgm50.twarden.lib.ItemLib; import matgm50.twarden.lib.ModLib; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.Entity; import net.minecraft.item.ItemStack; package matgm50.twarden.item; /** * Created by MasterAbdoTGM50 on 6/26/2014. */ public class ItemWardenChest extends ItemWardenArmor { public ItemWardenChest() { super(1); setUnlocalizedName(ItemLib.WARDEN_CHEST_NAME);
setCreativeTab(TWarden.tabTWarden);
MasterAbdoTGM50/ThaumicWarden
src/main/java/matgm50/twarden/item/ItemWardenChest.java
// Path: src/main/java/matgm50/twarden/TWarden.java // @Mod(modid = ModLib.ID, name = ModLib.NAME, version = ModLib.VERSION, dependencies = ModLib.DEPENDENCIES) // // public class TWarden { // // @Instance(ModLib.ID) // public static TWarden instance; // // @SidedProxy(serverSide = ModLib.COMMONPROXY, clientSide = ModLib.CLIENTPROXY) // public static CommonProxy proxy; // // public static CreativeTabs tabTWarden = new TabTWarden(ModLib.ID); // // @EventHandler // public void preInit(FMLPreInitializationEvent event) { // // proxy.initRenderers(); // GuiHandler.init(); // // WardenicChargeEvents.init(); // WardenicUpgrades.init(); // // ModItems.init(); // ModBlocks.init(); // ModEntities.init(); // ModGen.init(); // // } // // @EventHandler // public void init(FMLInitializationEvent event) { // // } // // @EventHandler // public void postInit(FMLPostInitializationEvent event) { // // ModRecipes.init(); // ModResearch.init(); // // } // // } // // Path: src/main/java/matgm50/twarden/lib/ItemLib.java // public class ItemLib { // // public static final String RESOURCE_NAME = "itemResource"; // public static final String[] RESOURCE_ICON = {"wardenpetal", "wardenstone", "wardenquartz"}; // // public static final String WARDEN_AMULET_NAME = "itemWardenAmulet"; // public static final String WARDEN_WEAPON_NAME = "itemWardenWeapon"; // public static final String WARDEN_HELM_NAME = "itemWardenHelm"; // public static final String WARDEN_CHEST_NAME = "itemWardenChest"; // public static final String WARDEN_LEGS_NAME = "itemWardenLegs"; // public static final String WARDEN_BOOTS_NAME = "itemWardenBoots"; // public static final String PURITY_FOCUS_NAME = "itemFocusPurity"; // public static final String LOVE_RING_NAME = "itemLoveRing"; // public static final String WASLIE_HAMMER_NAME = "itemWaslieHammer"; // public static final String ILLUMI_FOCUS_NAME = "itemFocusIllumination"; // // } // // Path: src/main/java/matgm50/twarden/lib/ModLib.java // public class ModLib { // // public static final String ID = "TWarden"; // public static final String NAME = "Thaumic Warden"; // public static final String VERSION = "1.1.1"; // public static final String DEPENDENCIES = "required-after:Thaumcraft"; // // public static final String CLIENTPROXY = "matgm50.twarden.proxy.ClientProxy"; // public static final String COMMONPROXY = "matgm50.twarden.proxy.CommonProxy"; // // }
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import matgm50.twarden.TWarden; import matgm50.twarden.lib.ItemLib; import matgm50.twarden.lib.ModLib; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.Entity; import net.minecraft.item.ItemStack;
package matgm50.twarden.item; /** * Created by MasterAbdoTGM50 on 6/26/2014. */ public class ItemWardenChest extends ItemWardenArmor { public ItemWardenChest() { super(1); setUnlocalizedName(ItemLib.WARDEN_CHEST_NAME); setCreativeTab(TWarden.tabTWarden); } @Override @SideOnly(Side.CLIENT) public void registerIcons(IIconRegister register) {
// Path: src/main/java/matgm50/twarden/TWarden.java // @Mod(modid = ModLib.ID, name = ModLib.NAME, version = ModLib.VERSION, dependencies = ModLib.DEPENDENCIES) // // public class TWarden { // // @Instance(ModLib.ID) // public static TWarden instance; // // @SidedProxy(serverSide = ModLib.COMMONPROXY, clientSide = ModLib.CLIENTPROXY) // public static CommonProxy proxy; // // public static CreativeTabs tabTWarden = new TabTWarden(ModLib.ID); // // @EventHandler // public void preInit(FMLPreInitializationEvent event) { // // proxy.initRenderers(); // GuiHandler.init(); // // WardenicChargeEvents.init(); // WardenicUpgrades.init(); // // ModItems.init(); // ModBlocks.init(); // ModEntities.init(); // ModGen.init(); // // } // // @EventHandler // public void init(FMLInitializationEvent event) { // // } // // @EventHandler // public void postInit(FMLPostInitializationEvent event) { // // ModRecipes.init(); // ModResearch.init(); // // } // // } // // Path: src/main/java/matgm50/twarden/lib/ItemLib.java // public class ItemLib { // // public static final String RESOURCE_NAME = "itemResource"; // public static final String[] RESOURCE_ICON = {"wardenpetal", "wardenstone", "wardenquartz"}; // // public static final String WARDEN_AMULET_NAME = "itemWardenAmulet"; // public static final String WARDEN_WEAPON_NAME = "itemWardenWeapon"; // public static final String WARDEN_HELM_NAME = "itemWardenHelm"; // public static final String WARDEN_CHEST_NAME = "itemWardenChest"; // public static final String WARDEN_LEGS_NAME = "itemWardenLegs"; // public static final String WARDEN_BOOTS_NAME = "itemWardenBoots"; // public static final String PURITY_FOCUS_NAME = "itemFocusPurity"; // public static final String LOVE_RING_NAME = "itemLoveRing"; // public static final String WASLIE_HAMMER_NAME = "itemWaslieHammer"; // public static final String ILLUMI_FOCUS_NAME = "itemFocusIllumination"; // // } // // Path: src/main/java/matgm50/twarden/lib/ModLib.java // public class ModLib { // // public static final String ID = "TWarden"; // public static final String NAME = "Thaumic Warden"; // public static final String VERSION = "1.1.1"; // public static final String DEPENDENCIES = "required-after:Thaumcraft"; // // public static final String CLIENTPROXY = "matgm50.twarden.proxy.ClientProxy"; // public static final String COMMONPROXY = "matgm50.twarden.proxy.CommonProxy"; // // } // Path: src/main/java/matgm50/twarden/item/ItemWardenChest.java import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import matgm50.twarden.TWarden; import matgm50.twarden.lib.ItemLib; import matgm50.twarden.lib.ModLib; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.Entity; import net.minecraft.item.ItemStack; package matgm50.twarden.item; /** * Created by MasterAbdoTGM50 on 6/26/2014. */ public class ItemWardenChest extends ItemWardenArmor { public ItemWardenChest() { super(1); setUnlocalizedName(ItemLib.WARDEN_CHEST_NAME); setCreativeTab(TWarden.tabTWarden); } @Override @SideOnly(Side.CLIENT) public void registerIcons(IIconRegister register) {
itemIcon = register.registerIcon(ModLib.ID.toLowerCase() + ":" + "wardenchest");
MasterAbdoTGM50/ThaumicWarden
src/main/java/matgm50/twarden/block/BlockQuartzSlab.java
// Path: src/main/java/matgm50/twarden/TWarden.java // @Mod(modid = ModLib.ID, name = ModLib.NAME, version = ModLib.VERSION, dependencies = ModLib.DEPENDENCIES) // // public class TWarden { // // @Instance(ModLib.ID) // public static TWarden instance; // // @SidedProxy(serverSide = ModLib.COMMONPROXY, clientSide = ModLib.CLIENTPROXY) // public static CommonProxy proxy; // // public static CreativeTabs tabTWarden = new TabTWarden(ModLib.ID); // // @EventHandler // public void preInit(FMLPreInitializationEvent event) { // // proxy.initRenderers(); // GuiHandler.init(); // // WardenicChargeEvents.init(); // WardenicUpgrades.init(); // // ModItems.init(); // ModBlocks.init(); // ModEntities.init(); // ModGen.init(); // // } // // @EventHandler // public void init(FMLInitializationEvent event) { // // } // // @EventHandler // public void postInit(FMLPostInitializationEvent event) { // // ModRecipes.init(); // ModResearch.init(); // // } // // } // // Path: src/main/java/matgm50/twarden/lib/BlockLib.java // public class BlockLib { // // public static final String EXUBITURA_NAME = "blockExubitura"; // public static final String QUARTZ_NORMAL_NAME = "blockInfusedQuartzNormal"; // public static final String QUARTZ_SLAB_NAME = "blockInfusedQuartzSlab"; // public static final String QUARTZ_STAIR_NAME = "blockInfusedQuartzStair"; // public static final String QUARTZ_CHISELED_NAME = "blockInfusedQuartzChiseled"; // public static final String QUARTZ_PILLAR_NAME = "blockInfusedQuartzPillar"; // public static final String BLOCK_WITOR_NAME = "blockWitor"; // public static final String TILE_WITOR_NAME = "tileWitor"; // // }
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import matgm50.twarden.TWarden; import matgm50.twarden.lib.BlockLib; import net.minecraft.block.Block; import net.minecraft.block.BlockSlab; import net.minecraft.block.material.Material; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; import net.minecraft.world.World; import java.util.Random;
package matgm50.twarden.block; /** * Created by MasterAbdoTGM50 on 5/22/2014. */ public class BlockQuartzSlab extends BlockSlab{ public BlockQuartzSlab() { super(false, Material.rock);
// Path: src/main/java/matgm50/twarden/TWarden.java // @Mod(modid = ModLib.ID, name = ModLib.NAME, version = ModLib.VERSION, dependencies = ModLib.DEPENDENCIES) // // public class TWarden { // // @Instance(ModLib.ID) // public static TWarden instance; // // @SidedProxy(serverSide = ModLib.COMMONPROXY, clientSide = ModLib.CLIENTPROXY) // public static CommonProxy proxy; // // public static CreativeTabs tabTWarden = new TabTWarden(ModLib.ID); // // @EventHandler // public void preInit(FMLPreInitializationEvent event) { // // proxy.initRenderers(); // GuiHandler.init(); // // WardenicChargeEvents.init(); // WardenicUpgrades.init(); // // ModItems.init(); // ModBlocks.init(); // ModEntities.init(); // ModGen.init(); // // } // // @EventHandler // public void init(FMLInitializationEvent event) { // // } // // @EventHandler // public void postInit(FMLPostInitializationEvent event) { // // ModRecipes.init(); // ModResearch.init(); // // } // // } // // Path: src/main/java/matgm50/twarden/lib/BlockLib.java // public class BlockLib { // // public static final String EXUBITURA_NAME = "blockExubitura"; // public static final String QUARTZ_NORMAL_NAME = "blockInfusedQuartzNormal"; // public static final String QUARTZ_SLAB_NAME = "blockInfusedQuartzSlab"; // public static final String QUARTZ_STAIR_NAME = "blockInfusedQuartzStair"; // public static final String QUARTZ_CHISELED_NAME = "blockInfusedQuartzChiseled"; // public static final String QUARTZ_PILLAR_NAME = "blockInfusedQuartzPillar"; // public static final String BLOCK_WITOR_NAME = "blockWitor"; // public static final String TILE_WITOR_NAME = "tileWitor"; // // } // Path: src/main/java/matgm50/twarden/block/BlockQuartzSlab.java import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import matgm50.twarden.TWarden; import matgm50.twarden.lib.BlockLib; import net.minecraft.block.Block; import net.minecraft.block.BlockSlab; import net.minecraft.block.material.Material; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; import net.minecraft.world.World; import java.util.Random; package matgm50.twarden.block; /** * Created by MasterAbdoTGM50 on 5/22/2014. */ public class BlockQuartzSlab extends BlockSlab{ public BlockQuartzSlab() { super(false, Material.rock);
setBlockName(BlockLib.QUARTZ_SLAB_NAME);
MasterAbdoTGM50/ThaumicWarden
src/main/java/matgm50/twarden/block/BlockQuartzSlab.java
// Path: src/main/java/matgm50/twarden/TWarden.java // @Mod(modid = ModLib.ID, name = ModLib.NAME, version = ModLib.VERSION, dependencies = ModLib.DEPENDENCIES) // // public class TWarden { // // @Instance(ModLib.ID) // public static TWarden instance; // // @SidedProxy(serverSide = ModLib.COMMONPROXY, clientSide = ModLib.CLIENTPROXY) // public static CommonProxy proxy; // // public static CreativeTabs tabTWarden = new TabTWarden(ModLib.ID); // // @EventHandler // public void preInit(FMLPreInitializationEvent event) { // // proxy.initRenderers(); // GuiHandler.init(); // // WardenicChargeEvents.init(); // WardenicUpgrades.init(); // // ModItems.init(); // ModBlocks.init(); // ModEntities.init(); // ModGen.init(); // // } // // @EventHandler // public void init(FMLInitializationEvent event) { // // } // // @EventHandler // public void postInit(FMLPostInitializationEvent event) { // // ModRecipes.init(); // ModResearch.init(); // // } // // } // // Path: src/main/java/matgm50/twarden/lib/BlockLib.java // public class BlockLib { // // public static final String EXUBITURA_NAME = "blockExubitura"; // public static final String QUARTZ_NORMAL_NAME = "blockInfusedQuartzNormal"; // public static final String QUARTZ_SLAB_NAME = "blockInfusedQuartzSlab"; // public static final String QUARTZ_STAIR_NAME = "blockInfusedQuartzStair"; // public static final String QUARTZ_CHISELED_NAME = "blockInfusedQuartzChiseled"; // public static final String QUARTZ_PILLAR_NAME = "blockInfusedQuartzPillar"; // public static final String BLOCK_WITOR_NAME = "blockWitor"; // public static final String TILE_WITOR_NAME = "tileWitor"; // // }
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import matgm50.twarden.TWarden; import matgm50.twarden.lib.BlockLib; import net.minecraft.block.Block; import net.minecraft.block.BlockSlab; import net.minecraft.block.material.Material; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; import net.minecraft.world.World; import java.util.Random;
package matgm50.twarden.block; /** * Created by MasterAbdoTGM50 on 5/22/2014. */ public class BlockQuartzSlab extends BlockSlab{ public BlockQuartzSlab() { super(false, Material.rock); setBlockName(BlockLib.QUARTZ_SLAB_NAME);
// Path: src/main/java/matgm50/twarden/TWarden.java // @Mod(modid = ModLib.ID, name = ModLib.NAME, version = ModLib.VERSION, dependencies = ModLib.DEPENDENCIES) // // public class TWarden { // // @Instance(ModLib.ID) // public static TWarden instance; // // @SidedProxy(serverSide = ModLib.COMMONPROXY, clientSide = ModLib.CLIENTPROXY) // public static CommonProxy proxy; // // public static CreativeTabs tabTWarden = new TabTWarden(ModLib.ID); // // @EventHandler // public void preInit(FMLPreInitializationEvent event) { // // proxy.initRenderers(); // GuiHandler.init(); // // WardenicChargeEvents.init(); // WardenicUpgrades.init(); // // ModItems.init(); // ModBlocks.init(); // ModEntities.init(); // ModGen.init(); // // } // // @EventHandler // public void init(FMLInitializationEvent event) { // // } // // @EventHandler // public void postInit(FMLPostInitializationEvent event) { // // ModRecipes.init(); // ModResearch.init(); // // } // // } // // Path: src/main/java/matgm50/twarden/lib/BlockLib.java // public class BlockLib { // // public static final String EXUBITURA_NAME = "blockExubitura"; // public static final String QUARTZ_NORMAL_NAME = "blockInfusedQuartzNormal"; // public static final String QUARTZ_SLAB_NAME = "blockInfusedQuartzSlab"; // public static final String QUARTZ_STAIR_NAME = "blockInfusedQuartzStair"; // public static final String QUARTZ_CHISELED_NAME = "blockInfusedQuartzChiseled"; // public static final String QUARTZ_PILLAR_NAME = "blockInfusedQuartzPillar"; // public static final String BLOCK_WITOR_NAME = "blockWitor"; // public static final String TILE_WITOR_NAME = "tileWitor"; // // } // Path: src/main/java/matgm50/twarden/block/BlockQuartzSlab.java import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import matgm50.twarden.TWarden; import matgm50.twarden.lib.BlockLib; import net.minecraft.block.Block; import net.minecraft.block.BlockSlab; import net.minecraft.block.material.Material; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; import net.minecraft.world.World; import java.util.Random; package matgm50.twarden.block; /** * Created by MasterAbdoTGM50 on 5/22/2014. */ public class BlockQuartzSlab extends BlockSlab{ public BlockQuartzSlab() { super(false, Material.rock); setBlockName(BlockLib.QUARTZ_SLAB_NAME);
setCreativeTab(TWarden.tabTWarden);
MasterAbdoTGM50/ThaumicWarden
src/main/java/matgm50/twarden/item/ItemResource.java
// Path: src/main/java/matgm50/twarden/TWarden.java // @Mod(modid = ModLib.ID, name = ModLib.NAME, version = ModLib.VERSION, dependencies = ModLib.DEPENDENCIES) // // public class TWarden { // // @Instance(ModLib.ID) // public static TWarden instance; // // @SidedProxy(serverSide = ModLib.COMMONPROXY, clientSide = ModLib.CLIENTPROXY) // public static CommonProxy proxy; // // public static CreativeTabs tabTWarden = new TabTWarden(ModLib.ID); // // @EventHandler // public void preInit(FMLPreInitializationEvent event) { // // proxy.initRenderers(); // GuiHandler.init(); // // WardenicChargeEvents.init(); // WardenicUpgrades.init(); // // ModItems.init(); // ModBlocks.init(); // ModEntities.init(); // ModGen.init(); // // } // // @EventHandler // public void init(FMLInitializationEvent event) { // // } // // @EventHandler // public void postInit(FMLPostInitializationEvent event) { // // ModRecipes.init(); // ModResearch.init(); // // } // // } // // Path: src/main/java/matgm50/twarden/lib/ItemLib.java // public class ItemLib { // // public static final String RESOURCE_NAME = "itemResource"; // public static final String[] RESOURCE_ICON = {"wardenpetal", "wardenstone", "wardenquartz"}; // // public static final String WARDEN_AMULET_NAME = "itemWardenAmulet"; // public static final String WARDEN_WEAPON_NAME = "itemWardenWeapon"; // public static final String WARDEN_HELM_NAME = "itemWardenHelm"; // public static final String WARDEN_CHEST_NAME = "itemWardenChest"; // public static final String WARDEN_LEGS_NAME = "itemWardenLegs"; // public static final String WARDEN_BOOTS_NAME = "itemWardenBoots"; // public static final String PURITY_FOCUS_NAME = "itemFocusPurity"; // public static final String LOVE_RING_NAME = "itemLoveRing"; // public static final String WASLIE_HAMMER_NAME = "itemWaslieHammer"; // public static final String ILLUMI_FOCUS_NAME = "itemFocusIllumination"; // // } // // Path: src/main/java/matgm50/twarden/lib/ModLib.java // public class ModLib { // // public static final String ID = "TWarden"; // public static final String NAME = "Thaumic Warden"; // public static final String VERSION = "1.1.1"; // public static final String DEPENDENCIES = "required-after:Thaumcraft"; // // public static final String CLIENTPROXY = "matgm50.twarden.proxy.ClientProxy"; // public static final String COMMONPROXY = "matgm50.twarden.proxy.CommonProxy"; // // }
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import matgm50.twarden.TWarden; import matgm50.twarden.lib.ItemLib; import matgm50.twarden.lib.ModLib; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; import java.util.List;
package matgm50.twarden.item; /** * Created by MasterAbdoTGM50 on 5/13/2014. */ public class ItemResource extends Item { private IIcon[] icons; public ItemResource() { super();
// Path: src/main/java/matgm50/twarden/TWarden.java // @Mod(modid = ModLib.ID, name = ModLib.NAME, version = ModLib.VERSION, dependencies = ModLib.DEPENDENCIES) // // public class TWarden { // // @Instance(ModLib.ID) // public static TWarden instance; // // @SidedProxy(serverSide = ModLib.COMMONPROXY, clientSide = ModLib.CLIENTPROXY) // public static CommonProxy proxy; // // public static CreativeTabs tabTWarden = new TabTWarden(ModLib.ID); // // @EventHandler // public void preInit(FMLPreInitializationEvent event) { // // proxy.initRenderers(); // GuiHandler.init(); // // WardenicChargeEvents.init(); // WardenicUpgrades.init(); // // ModItems.init(); // ModBlocks.init(); // ModEntities.init(); // ModGen.init(); // // } // // @EventHandler // public void init(FMLInitializationEvent event) { // // } // // @EventHandler // public void postInit(FMLPostInitializationEvent event) { // // ModRecipes.init(); // ModResearch.init(); // // } // // } // // Path: src/main/java/matgm50/twarden/lib/ItemLib.java // public class ItemLib { // // public static final String RESOURCE_NAME = "itemResource"; // public static final String[] RESOURCE_ICON = {"wardenpetal", "wardenstone", "wardenquartz"}; // // public static final String WARDEN_AMULET_NAME = "itemWardenAmulet"; // public static final String WARDEN_WEAPON_NAME = "itemWardenWeapon"; // public static final String WARDEN_HELM_NAME = "itemWardenHelm"; // public static final String WARDEN_CHEST_NAME = "itemWardenChest"; // public static final String WARDEN_LEGS_NAME = "itemWardenLegs"; // public static final String WARDEN_BOOTS_NAME = "itemWardenBoots"; // public static final String PURITY_FOCUS_NAME = "itemFocusPurity"; // public static final String LOVE_RING_NAME = "itemLoveRing"; // public static final String WASLIE_HAMMER_NAME = "itemWaslieHammer"; // public static final String ILLUMI_FOCUS_NAME = "itemFocusIllumination"; // // } // // Path: src/main/java/matgm50/twarden/lib/ModLib.java // public class ModLib { // // public static final String ID = "TWarden"; // public static final String NAME = "Thaumic Warden"; // public static final String VERSION = "1.1.1"; // public static final String DEPENDENCIES = "required-after:Thaumcraft"; // // public static final String CLIENTPROXY = "matgm50.twarden.proxy.ClientProxy"; // public static final String COMMONPROXY = "matgm50.twarden.proxy.CommonProxy"; // // } // Path: src/main/java/matgm50/twarden/item/ItemResource.java import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import matgm50.twarden.TWarden; import matgm50.twarden.lib.ItemLib; import matgm50.twarden.lib.ModLib; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; import java.util.List; package matgm50.twarden.item; /** * Created by MasterAbdoTGM50 on 5/13/2014. */ public class ItemResource extends Item { private IIcon[] icons; public ItemResource() { super();
setUnlocalizedName(ItemLib.RESOURCE_NAME);
MasterAbdoTGM50/ThaumicWarden
src/main/java/matgm50/twarden/item/ItemResource.java
// Path: src/main/java/matgm50/twarden/TWarden.java // @Mod(modid = ModLib.ID, name = ModLib.NAME, version = ModLib.VERSION, dependencies = ModLib.DEPENDENCIES) // // public class TWarden { // // @Instance(ModLib.ID) // public static TWarden instance; // // @SidedProxy(serverSide = ModLib.COMMONPROXY, clientSide = ModLib.CLIENTPROXY) // public static CommonProxy proxy; // // public static CreativeTabs tabTWarden = new TabTWarden(ModLib.ID); // // @EventHandler // public void preInit(FMLPreInitializationEvent event) { // // proxy.initRenderers(); // GuiHandler.init(); // // WardenicChargeEvents.init(); // WardenicUpgrades.init(); // // ModItems.init(); // ModBlocks.init(); // ModEntities.init(); // ModGen.init(); // // } // // @EventHandler // public void init(FMLInitializationEvent event) { // // } // // @EventHandler // public void postInit(FMLPostInitializationEvent event) { // // ModRecipes.init(); // ModResearch.init(); // // } // // } // // Path: src/main/java/matgm50/twarden/lib/ItemLib.java // public class ItemLib { // // public static final String RESOURCE_NAME = "itemResource"; // public static final String[] RESOURCE_ICON = {"wardenpetal", "wardenstone", "wardenquartz"}; // // public static final String WARDEN_AMULET_NAME = "itemWardenAmulet"; // public static final String WARDEN_WEAPON_NAME = "itemWardenWeapon"; // public static final String WARDEN_HELM_NAME = "itemWardenHelm"; // public static final String WARDEN_CHEST_NAME = "itemWardenChest"; // public static final String WARDEN_LEGS_NAME = "itemWardenLegs"; // public static final String WARDEN_BOOTS_NAME = "itemWardenBoots"; // public static final String PURITY_FOCUS_NAME = "itemFocusPurity"; // public static final String LOVE_RING_NAME = "itemLoveRing"; // public static final String WASLIE_HAMMER_NAME = "itemWaslieHammer"; // public static final String ILLUMI_FOCUS_NAME = "itemFocusIllumination"; // // } // // Path: src/main/java/matgm50/twarden/lib/ModLib.java // public class ModLib { // // public static final String ID = "TWarden"; // public static final String NAME = "Thaumic Warden"; // public static final String VERSION = "1.1.1"; // public static final String DEPENDENCIES = "required-after:Thaumcraft"; // // public static final String CLIENTPROXY = "matgm50.twarden.proxy.ClientProxy"; // public static final String COMMONPROXY = "matgm50.twarden.proxy.CommonProxy"; // // }
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import matgm50.twarden.TWarden; import matgm50.twarden.lib.ItemLib; import matgm50.twarden.lib.ModLib; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; import java.util.List;
package matgm50.twarden.item; /** * Created by MasterAbdoTGM50 on 5/13/2014. */ public class ItemResource extends Item { private IIcon[] icons; public ItemResource() { super(); setUnlocalizedName(ItemLib.RESOURCE_NAME);
// Path: src/main/java/matgm50/twarden/TWarden.java // @Mod(modid = ModLib.ID, name = ModLib.NAME, version = ModLib.VERSION, dependencies = ModLib.DEPENDENCIES) // // public class TWarden { // // @Instance(ModLib.ID) // public static TWarden instance; // // @SidedProxy(serverSide = ModLib.COMMONPROXY, clientSide = ModLib.CLIENTPROXY) // public static CommonProxy proxy; // // public static CreativeTabs tabTWarden = new TabTWarden(ModLib.ID); // // @EventHandler // public void preInit(FMLPreInitializationEvent event) { // // proxy.initRenderers(); // GuiHandler.init(); // // WardenicChargeEvents.init(); // WardenicUpgrades.init(); // // ModItems.init(); // ModBlocks.init(); // ModEntities.init(); // ModGen.init(); // // } // // @EventHandler // public void init(FMLInitializationEvent event) { // // } // // @EventHandler // public void postInit(FMLPostInitializationEvent event) { // // ModRecipes.init(); // ModResearch.init(); // // } // // } // // Path: src/main/java/matgm50/twarden/lib/ItemLib.java // public class ItemLib { // // public static final String RESOURCE_NAME = "itemResource"; // public static final String[] RESOURCE_ICON = {"wardenpetal", "wardenstone", "wardenquartz"}; // // public static final String WARDEN_AMULET_NAME = "itemWardenAmulet"; // public static final String WARDEN_WEAPON_NAME = "itemWardenWeapon"; // public static final String WARDEN_HELM_NAME = "itemWardenHelm"; // public static final String WARDEN_CHEST_NAME = "itemWardenChest"; // public static final String WARDEN_LEGS_NAME = "itemWardenLegs"; // public static final String WARDEN_BOOTS_NAME = "itemWardenBoots"; // public static final String PURITY_FOCUS_NAME = "itemFocusPurity"; // public static final String LOVE_RING_NAME = "itemLoveRing"; // public static final String WASLIE_HAMMER_NAME = "itemWaslieHammer"; // public static final String ILLUMI_FOCUS_NAME = "itemFocusIllumination"; // // } // // Path: src/main/java/matgm50/twarden/lib/ModLib.java // public class ModLib { // // public static final String ID = "TWarden"; // public static final String NAME = "Thaumic Warden"; // public static final String VERSION = "1.1.1"; // public static final String DEPENDENCIES = "required-after:Thaumcraft"; // // public static final String CLIENTPROXY = "matgm50.twarden.proxy.ClientProxy"; // public static final String COMMONPROXY = "matgm50.twarden.proxy.CommonProxy"; // // } // Path: src/main/java/matgm50/twarden/item/ItemResource.java import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import matgm50.twarden.TWarden; import matgm50.twarden.lib.ItemLib; import matgm50.twarden.lib.ModLib; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; import java.util.List; package matgm50.twarden.item; /** * Created by MasterAbdoTGM50 on 5/13/2014. */ public class ItemResource extends Item { private IIcon[] icons; public ItemResource() { super(); setUnlocalizedName(ItemLib.RESOURCE_NAME);
setCreativeTab(TWarden.tabTWarden);
MasterAbdoTGM50/ThaumicWarden
src/main/java/matgm50/twarden/item/ItemResource.java
// Path: src/main/java/matgm50/twarden/TWarden.java // @Mod(modid = ModLib.ID, name = ModLib.NAME, version = ModLib.VERSION, dependencies = ModLib.DEPENDENCIES) // // public class TWarden { // // @Instance(ModLib.ID) // public static TWarden instance; // // @SidedProxy(serverSide = ModLib.COMMONPROXY, clientSide = ModLib.CLIENTPROXY) // public static CommonProxy proxy; // // public static CreativeTabs tabTWarden = new TabTWarden(ModLib.ID); // // @EventHandler // public void preInit(FMLPreInitializationEvent event) { // // proxy.initRenderers(); // GuiHandler.init(); // // WardenicChargeEvents.init(); // WardenicUpgrades.init(); // // ModItems.init(); // ModBlocks.init(); // ModEntities.init(); // ModGen.init(); // // } // // @EventHandler // public void init(FMLInitializationEvent event) { // // } // // @EventHandler // public void postInit(FMLPostInitializationEvent event) { // // ModRecipes.init(); // ModResearch.init(); // // } // // } // // Path: src/main/java/matgm50/twarden/lib/ItemLib.java // public class ItemLib { // // public static final String RESOURCE_NAME = "itemResource"; // public static final String[] RESOURCE_ICON = {"wardenpetal", "wardenstone", "wardenquartz"}; // // public static final String WARDEN_AMULET_NAME = "itemWardenAmulet"; // public static final String WARDEN_WEAPON_NAME = "itemWardenWeapon"; // public static final String WARDEN_HELM_NAME = "itemWardenHelm"; // public static final String WARDEN_CHEST_NAME = "itemWardenChest"; // public static final String WARDEN_LEGS_NAME = "itemWardenLegs"; // public static final String WARDEN_BOOTS_NAME = "itemWardenBoots"; // public static final String PURITY_FOCUS_NAME = "itemFocusPurity"; // public static final String LOVE_RING_NAME = "itemLoveRing"; // public static final String WASLIE_HAMMER_NAME = "itemWaslieHammer"; // public static final String ILLUMI_FOCUS_NAME = "itemFocusIllumination"; // // } // // Path: src/main/java/matgm50/twarden/lib/ModLib.java // public class ModLib { // // public static final String ID = "TWarden"; // public static final String NAME = "Thaumic Warden"; // public static final String VERSION = "1.1.1"; // public static final String DEPENDENCIES = "required-after:Thaumcraft"; // // public static final String CLIENTPROXY = "matgm50.twarden.proxy.ClientProxy"; // public static final String COMMONPROXY = "matgm50.twarden.proxy.CommonProxy"; // // }
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import matgm50.twarden.TWarden; import matgm50.twarden.lib.ItemLib; import matgm50.twarden.lib.ModLib; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; import java.util.List;
package matgm50.twarden.item; /** * Created by MasterAbdoTGM50 on 5/13/2014. */ public class ItemResource extends Item { private IIcon[] icons; public ItemResource() { super(); setUnlocalizedName(ItemLib.RESOURCE_NAME); setCreativeTab(TWarden.tabTWarden); setHasSubtypes(true); icons = new IIcon[ItemLib.RESOURCE_NAME.length()]; } @Override public String getUnlocalizedName(ItemStack par1ItemStack) { return super.getUnlocalizedName() + "." + par1ItemStack.getItemDamage(); } @Override public void getSubItems(Item par1Item, CreativeTabs par2Tab, List par3List) { for(int i = 0; i < ItemLib.RESOURCE_ICON.length; i++) { par3List.add(new ItemStack(par1Item, 1, i)); } } @Override @SideOnly(Side.CLIENT) public IIcon getIconFromDamage(int damage) { return icons[damage]; } @Override @SideOnly(Side.CLIENT) public void registerIcons(IIconRegister register) { for(int i = 0; i < ItemLib.RESOURCE_ICON.length; i++) {
// Path: src/main/java/matgm50/twarden/TWarden.java // @Mod(modid = ModLib.ID, name = ModLib.NAME, version = ModLib.VERSION, dependencies = ModLib.DEPENDENCIES) // // public class TWarden { // // @Instance(ModLib.ID) // public static TWarden instance; // // @SidedProxy(serverSide = ModLib.COMMONPROXY, clientSide = ModLib.CLIENTPROXY) // public static CommonProxy proxy; // // public static CreativeTabs tabTWarden = new TabTWarden(ModLib.ID); // // @EventHandler // public void preInit(FMLPreInitializationEvent event) { // // proxy.initRenderers(); // GuiHandler.init(); // // WardenicChargeEvents.init(); // WardenicUpgrades.init(); // // ModItems.init(); // ModBlocks.init(); // ModEntities.init(); // ModGen.init(); // // } // // @EventHandler // public void init(FMLInitializationEvent event) { // // } // // @EventHandler // public void postInit(FMLPostInitializationEvent event) { // // ModRecipes.init(); // ModResearch.init(); // // } // // } // // Path: src/main/java/matgm50/twarden/lib/ItemLib.java // public class ItemLib { // // public static final String RESOURCE_NAME = "itemResource"; // public static final String[] RESOURCE_ICON = {"wardenpetal", "wardenstone", "wardenquartz"}; // // public static final String WARDEN_AMULET_NAME = "itemWardenAmulet"; // public static final String WARDEN_WEAPON_NAME = "itemWardenWeapon"; // public static final String WARDEN_HELM_NAME = "itemWardenHelm"; // public static final String WARDEN_CHEST_NAME = "itemWardenChest"; // public static final String WARDEN_LEGS_NAME = "itemWardenLegs"; // public static final String WARDEN_BOOTS_NAME = "itemWardenBoots"; // public static final String PURITY_FOCUS_NAME = "itemFocusPurity"; // public static final String LOVE_RING_NAME = "itemLoveRing"; // public static final String WASLIE_HAMMER_NAME = "itemWaslieHammer"; // public static final String ILLUMI_FOCUS_NAME = "itemFocusIllumination"; // // } // // Path: src/main/java/matgm50/twarden/lib/ModLib.java // public class ModLib { // // public static final String ID = "TWarden"; // public static final String NAME = "Thaumic Warden"; // public static final String VERSION = "1.1.1"; // public static final String DEPENDENCIES = "required-after:Thaumcraft"; // // public static final String CLIENTPROXY = "matgm50.twarden.proxy.ClientProxy"; // public static final String COMMONPROXY = "matgm50.twarden.proxy.CommonProxy"; // // } // Path: src/main/java/matgm50/twarden/item/ItemResource.java import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import matgm50.twarden.TWarden; import matgm50.twarden.lib.ItemLib; import matgm50.twarden.lib.ModLib; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; import java.util.List; package matgm50.twarden.item; /** * Created by MasterAbdoTGM50 on 5/13/2014. */ public class ItemResource extends Item { private IIcon[] icons; public ItemResource() { super(); setUnlocalizedName(ItemLib.RESOURCE_NAME); setCreativeTab(TWarden.tabTWarden); setHasSubtypes(true); icons = new IIcon[ItemLib.RESOURCE_NAME.length()]; } @Override public String getUnlocalizedName(ItemStack par1ItemStack) { return super.getUnlocalizedName() + "." + par1ItemStack.getItemDamage(); } @Override public void getSubItems(Item par1Item, CreativeTabs par2Tab, List par3List) { for(int i = 0; i < ItemLib.RESOURCE_ICON.length; i++) { par3List.add(new ItemStack(par1Item, 1, i)); } } @Override @SideOnly(Side.CLIENT) public IIcon getIconFromDamage(int damage) { return icons[damage]; } @Override @SideOnly(Side.CLIENT) public void registerIcons(IIconRegister register) { for(int i = 0; i < ItemLib.RESOURCE_ICON.length; i++) {
icons[i] = register.registerIcon(ModLib.ID.toLowerCase() + ":" + ItemLib.RESOURCE_ICON[i]);
MasterAbdoTGM50/ThaumicWarden
src/main/java/matgm50/twarden/entity/ModEntities.java
// Path: src/main/java/matgm50/twarden/TWarden.java // @Mod(modid = ModLib.ID, name = ModLib.NAME, version = ModLib.VERSION, dependencies = ModLib.DEPENDENCIES) // // public class TWarden { // // @Instance(ModLib.ID) // public static TWarden instance; // // @SidedProxy(serverSide = ModLib.COMMONPROXY, clientSide = ModLib.CLIENTPROXY) // public static CommonProxy proxy; // // public static CreativeTabs tabTWarden = new TabTWarden(ModLib.ID); // // @EventHandler // public void preInit(FMLPreInitializationEvent event) { // // proxy.initRenderers(); // GuiHandler.init(); // // WardenicChargeEvents.init(); // WardenicUpgrades.init(); // // ModItems.init(); // ModBlocks.init(); // ModEntities.init(); // ModGen.init(); // // } // // @EventHandler // public void init(FMLInitializationEvent event) { // // } // // @EventHandler // public void postInit(FMLPostInitializationEvent event) { // // ModRecipes.init(); // ModResearch.init(); // // } // // }
import cpw.mods.fml.common.registry.EntityRegistry; import matgm50.twarden.TWarden;
package matgm50.twarden.entity; /** * Created by MasterAbdoTGM50 on 5/20/2014. */ public class ModEntities { public static void init() {
// Path: src/main/java/matgm50/twarden/TWarden.java // @Mod(modid = ModLib.ID, name = ModLib.NAME, version = ModLib.VERSION, dependencies = ModLib.DEPENDENCIES) // // public class TWarden { // // @Instance(ModLib.ID) // public static TWarden instance; // // @SidedProxy(serverSide = ModLib.COMMONPROXY, clientSide = ModLib.CLIENTPROXY) // public static CommonProxy proxy; // // public static CreativeTabs tabTWarden = new TabTWarden(ModLib.ID); // // @EventHandler // public void preInit(FMLPreInitializationEvent event) { // // proxy.initRenderers(); // GuiHandler.init(); // // WardenicChargeEvents.init(); // WardenicUpgrades.init(); // // ModItems.init(); // ModBlocks.init(); // ModEntities.init(); // ModGen.init(); // // } // // @EventHandler // public void init(FMLInitializationEvent event) { // // } // // @EventHandler // public void postInit(FMLPostInitializationEvent event) { // // ModRecipes.init(); // ModResearch.init(); // // } // // } // Path: src/main/java/matgm50/twarden/entity/ModEntities.java import cpw.mods.fml.common.registry.EntityRegistry; import matgm50.twarden.TWarden; package matgm50.twarden.entity; /** * Created by MasterAbdoTGM50 on 5/20/2014. */ public class ModEntities { public static void init() {
EntityRegistry.registerModEntity(EntityPurity.class, "PurityOrb", 0, TWarden.instance, 64, 10, true);
MasterAbdoTGM50/ThaumicWarden
src/main/java/matgm50/twarden/item/ItemWardenArmor.java
// Path: src/main/java/matgm50/twarden/TWarden.java // @Mod(modid = ModLib.ID, name = ModLib.NAME, version = ModLib.VERSION, dependencies = ModLib.DEPENDENCIES) // // public class TWarden { // // @Instance(ModLib.ID) // public static TWarden instance; // // @SidedProxy(serverSide = ModLib.COMMONPROXY, clientSide = ModLib.CLIENTPROXY) // public static CommonProxy proxy; // // public static CreativeTabs tabTWarden = new TabTWarden(ModLib.ID); // // @EventHandler // public void preInit(FMLPreInitializationEvent event) { // // proxy.initRenderers(); // GuiHandler.init(); // // WardenicChargeEvents.init(); // WardenicUpgrades.init(); // // ModItems.init(); // ModBlocks.init(); // ModEntities.init(); // ModGen.init(); // // } // // @EventHandler // public void init(FMLInitializationEvent event) { // // } // // @EventHandler // public void postInit(FMLPostInitializationEvent event) { // // ModRecipes.init(); // ModResearch.init(); // // } // // } // // Path: src/main/java/matgm50/twarden/lib/ItemLib.java // public class ItemLib { // // public static final String RESOURCE_NAME = "itemResource"; // public static final String[] RESOURCE_ICON = {"wardenpetal", "wardenstone", "wardenquartz"}; // // public static final String WARDEN_AMULET_NAME = "itemWardenAmulet"; // public static final String WARDEN_WEAPON_NAME = "itemWardenWeapon"; // public static final String WARDEN_HELM_NAME = "itemWardenHelm"; // public static final String WARDEN_CHEST_NAME = "itemWardenChest"; // public static final String WARDEN_LEGS_NAME = "itemWardenLegs"; // public static final String WARDEN_BOOTS_NAME = "itemWardenBoots"; // public static final String PURITY_FOCUS_NAME = "itemFocusPurity"; // public static final String LOVE_RING_NAME = "itemLoveRing"; // public static final String WASLIE_HAMMER_NAME = "itemWaslieHammer"; // public static final String ILLUMI_FOCUS_NAME = "itemFocusIllumination"; // // } // // Path: src/main/java/matgm50/twarden/util/wardenic/WardenicChargeHelper.java // public class WardenicChargeHelper { // // public static HashMap<String, WardenicUpgrade> upgrades = new HashMap<String, WardenicUpgrade>(); // // public static void addUpgrade(WardenicUpgrade upgrade) { // // addUpgrade(upgrade.aspect.getName(), upgrade); // // } // // public static void addUpgrade(String key, WardenicUpgrade upgrade) { // // upgrades.put(key, upgrade); // // } // // public static WardenicUpgrade getUpgrade(ItemStack stack) { // // if(stack.stackTagCompound != null) { // // if(stack.stackTagCompound.hasKey("upgrade")) { // // return upgrades.get(stack.stackTagCompound.getString("upgrade")); // // } else { // // return upgrades.get(ModResearch.EXUBITOR.getName()); // // } // // } else { // // return upgrades.get(ModResearch.EXUBITOR.getName()); // // } // // } // // public static void setUpgradeOnStack(ItemStack stack, String key) { // // if(stack.stackTagCompound == null) { // // stack.setTagCompound(new NBTTagCompound()); // // } // // stack.stackTagCompound.setString("upgrade", key); // // } // // }
import matgm50.twarden.TWarden; import matgm50.twarden.lib.ItemLib; import matgm50.twarden.util.wardenic.WardenicChargeHelper; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemArmor; import net.minecraft.item.ItemStack; import net.minecraft.util.DamageSource; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.StatCollector; import net.minecraft.world.World; import net.minecraftforge.common.ISpecialArmor; import thaumcraft.api.IVisDiscountGear; import thaumcraft.api.aspects.Aspect; import java.util.List;
package matgm50.twarden.item; /** * Created by MasterAbdoTGM50 on 6/26/2014. */ public class ItemWardenArmor extends ItemArmor implements ISpecialArmor, IVisDiscountGear { public ItemWardenArmor(int type) { super(ModItems.materialWarden, 3, type);
// Path: src/main/java/matgm50/twarden/TWarden.java // @Mod(modid = ModLib.ID, name = ModLib.NAME, version = ModLib.VERSION, dependencies = ModLib.DEPENDENCIES) // // public class TWarden { // // @Instance(ModLib.ID) // public static TWarden instance; // // @SidedProxy(serverSide = ModLib.COMMONPROXY, clientSide = ModLib.CLIENTPROXY) // public static CommonProxy proxy; // // public static CreativeTabs tabTWarden = new TabTWarden(ModLib.ID); // // @EventHandler // public void preInit(FMLPreInitializationEvent event) { // // proxy.initRenderers(); // GuiHandler.init(); // // WardenicChargeEvents.init(); // WardenicUpgrades.init(); // // ModItems.init(); // ModBlocks.init(); // ModEntities.init(); // ModGen.init(); // // } // // @EventHandler // public void init(FMLInitializationEvent event) { // // } // // @EventHandler // public void postInit(FMLPostInitializationEvent event) { // // ModRecipes.init(); // ModResearch.init(); // // } // // } // // Path: src/main/java/matgm50/twarden/lib/ItemLib.java // public class ItemLib { // // public static final String RESOURCE_NAME = "itemResource"; // public static final String[] RESOURCE_ICON = {"wardenpetal", "wardenstone", "wardenquartz"}; // // public static final String WARDEN_AMULET_NAME = "itemWardenAmulet"; // public static final String WARDEN_WEAPON_NAME = "itemWardenWeapon"; // public static final String WARDEN_HELM_NAME = "itemWardenHelm"; // public static final String WARDEN_CHEST_NAME = "itemWardenChest"; // public static final String WARDEN_LEGS_NAME = "itemWardenLegs"; // public static final String WARDEN_BOOTS_NAME = "itemWardenBoots"; // public static final String PURITY_FOCUS_NAME = "itemFocusPurity"; // public static final String LOVE_RING_NAME = "itemLoveRing"; // public static final String WASLIE_HAMMER_NAME = "itemWaslieHammer"; // public static final String ILLUMI_FOCUS_NAME = "itemFocusIllumination"; // // } // // Path: src/main/java/matgm50/twarden/util/wardenic/WardenicChargeHelper.java // public class WardenicChargeHelper { // // public static HashMap<String, WardenicUpgrade> upgrades = new HashMap<String, WardenicUpgrade>(); // // public static void addUpgrade(WardenicUpgrade upgrade) { // // addUpgrade(upgrade.aspect.getName(), upgrade); // // } // // public static void addUpgrade(String key, WardenicUpgrade upgrade) { // // upgrades.put(key, upgrade); // // } // // public static WardenicUpgrade getUpgrade(ItemStack stack) { // // if(stack.stackTagCompound != null) { // // if(stack.stackTagCompound.hasKey("upgrade")) { // // return upgrades.get(stack.stackTagCompound.getString("upgrade")); // // } else { // // return upgrades.get(ModResearch.EXUBITOR.getName()); // // } // // } else { // // return upgrades.get(ModResearch.EXUBITOR.getName()); // // } // // } // // public static void setUpgradeOnStack(ItemStack stack, String key) { // // if(stack.stackTagCompound == null) { // // stack.setTagCompound(new NBTTagCompound()); // // } // // stack.stackTagCompound.setString("upgrade", key); // // } // // } // Path: src/main/java/matgm50/twarden/item/ItemWardenArmor.java import matgm50.twarden.TWarden; import matgm50.twarden.lib.ItemLib; import matgm50.twarden.util.wardenic.WardenicChargeHelper; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemArmor; import net.minecraft.item.ItemStack; import net.minecraft.util.DamageSource; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.StatCollector; import net.minecraft.world.World; import net.minecraftforge.common.ISpecialArmor; import thaumcraft.api.IVisDiscountGear; import thaumcraft.api.aspects.Aspect; import java.util.List; package matgm50.twarden.item; /** * Created by MasterAbdoTGM50 on 6/26/2014. */ public class ItemWardenArmor extends ItemArmor implements ISpecialArmor, IVisDiscountGear { public ItemWardenArmor(int type) { super(ModItems.materialWarden, 3, type);
setCreativeTab(TWarden.tabTWarden);
MasterAbdoTGM50/ThaumicWarden
src/main/java/matgm50/twarden/item/ItemWardenArmor.java
// Path: src/main/java/matgm50/twarden/TWarden.java // @Mod(modid = ModLib.ID, name = ModLib.NAME, version = ModLib.VERSION, dependencies = ModLib.DEPENDENCIES) // // public class TWarden { // // @Instance(ModLib.ID) // public static TWarden instance; // // @SidedProxy(serverSide = ModLib.COMMONPROXY, clientSide = ModLib.CLIENTPROXY) // public static CommonProxy proxy; // // public static CreativeTabs tabTWarden = new TabTWarden(ModLib.ID); // // @EventHandler // public void preInit(FMLPreInitializationEvent event) { // // proxy.initRenderers(); // GuiHandler.init(); // // WardenicChargeEvents.init(); // WardenicUpgrades.init(); // // ModItems.init(); // ModBlocks.init(); // ModEntities.init(); // ModGen.init(); // // } // // @EventHandler // public void init(FMLInitializationEvent event) { // // } // // @EventHandler // public void postInit(FMLPostInitializationEvent event) { // // ModRecipes.init(); // ModResearch.init(); // // } // // } // // Path: src/main/java/matgm50/twarden/lib/ItemLib.java // public class ItemLib { // // public static final String RESOURCE_NAME = "itemResource"; // public static final String[] RESOURCE_ICON = {"wardenpetal", "wardenstone", "wardenquartz"}; // // public static final String WARDEN_AMULET_NAME = "itemWardenAmulet"; // public static final String WARDEN_WEAPON_NAME = "itemWardenWeapon"; // public static final String WARDEN_HELM_NAME = "itemWardenHelm"; // public static final String WARDEN_CHEST_NAME = "itemWardenChest"; // public static final String WARDEN_LEGS_NAME = "itemWardenLegs"; // public static final String WARDEN_BOOTS_NAME = "itemWardenBoots"; // public static final String PURITY_FOCUS_NAME = "itemFocusPurity"; // public static final String LOVE_RING_NAME = "itemLoveRing"; // public static final String WASLIE_HAMMER_NAME = "itemWaslieHammer"; // public static final String ILLUMI_FOCUS_NAME = "itemFocusIllumination"; // // } // // Path: src/main/java/matgm50/twarden/util/wardenic/WardenicChargeHelper.java // public class WardenicChargeHelper { // // public static HashMap<String, WardenicUpgrade> upgrades = new HashMap<String, WardenicUpgrade>(); // // public static void addUpgrade(WardenicUpgrade upgrade) { // // addUpgrade(upgrade.aspect.getName(), upgrade); // // } // // public static void addUpgrade(String key, WardenicUpgrade upgrade) { // // upgrades.put(key, upgrade); // // } // // public static WardenicUpgrade getUpgrade(ItemStack stack) { // // if(stack.stackTagCompound != null) { // // if(stack.stackTagCompound.hasKey("upgrade")) { // // return upgrades.get(stack.stackTagCompound.getString("upgrade")); // // } else { // // return upgrades.get(ModResearch.EXUBITOR.getName()); // // } // // } else { // // return upgrades.get(ModResearch.EXUBITOR.getName()); // // } // // } // // public static void setUpgradeOnStack(ItemStack stack, String key) { // // if(stack.stackTagCompound == null) { // // stack.setTagCompound(new NBTTagCompound()); // // } // // stack.stackTagCompound.setString("upgrade", key); // // } // // }
import matgm50.twarden.TWarden; import matgm50.twarden.lib.ItemLib; import matgm50.twarden.util.wardenic.WardenicChargeHelper; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemArmor; import net.minecraft.item.ItemStack; import net.minecraft.util.DamageSource; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.StatCollector; import net.minecraft.world.World; import net.minecraftforge.common.ISpecialArmor; import thaumcraft.api.IVisDiscountGear; import thaumcraft.api.aspects.Aspect; import java.util.List;
package matgm50.twarden.item; /** * Created by MasterAbdoTGM50 on 6/26/2014. */ public class ItemWardenArmor extends ItemArmor implements ISpecialArmor, IVisDiscountGear { public ItemWardenArmor(int type) { super(ModItems.materialWarden, 3, type); setCreativeTab(TWarden.tabTWarden); setMaxStackSize(1); } @Override public boolean getShareTag() {return true;} @Override public boolean isBookEnchantable(ItemStack stack, ItemStack book) {return false;} @Override public int getMaxDamage(ItemStack stack) {return 50;} @Override public boolean isDamageable() {return false;} @Override public EnumRarity getRarity(ItemStack par1ItemStack) {return EnumRarity.epic;} @Override public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) { par3List.add(EnumChatFormatting.AQUA + StatCollector.translateToLocal("tooltip.wardenic.charge") + ": " + (par1ItemStack.getMaxDamage() - par1ItemStack.getItemDamage()) + "/" + par1ItemStack.getMaxDamage());
// Path: src/main/java/matgm50/twarden/TWarden.java // @Mod(modid = ModLib.ID, name = ModLib.NAME, version = ModLib.VERSION, dependencies = ModLib.DEPENDENCIES) // // public class TWarden { // // @Instance(ModLib.ID) // public static TWarden instance; // // @SidedProxy(serverSide = ModLib.COMMONPROXY, clientSide = ModLib.CLIENTPROXY) // public static CommonProxy proxy; // // public static CreativeTabs tabTWarden = new TabTWarden(ModLib.ID); // // @EventHandler // public void preInit(FMLPreInitializationEvent event) { // // proxy.initRenderers(); // GuiHandler.init(); // // WardenicChargeEvents.init(); // WardenicUpgrades.init(); // // ModItems.init(); // ModBlocks.init(); // ModEntities.init(); // ModGen.init(); // // } // // @EventHandler // public void init(FMLInitializationEvent event) { // // } // // @EventHandler // public void postInit(FMLPostInitializationEvent event) { // // ModRecipes.init(); // ModResearch.init(); // // } // // } // // Path: src/main/java/matgm50/twarden/lib/ItemLib.java // public class ItemLib { // // public static final String RESOURCE_NAME = "itemResource"; // public static final String[] RESOURCE_ICON = {"wardenpetal", "wardenstone", "wardenquartz"}; // // public static final String WARDEN_AMULET_NAME = "itemWardenAmulet"; // public static final String WARDEN_WEAPON_NAME = "itemWardenWeapon"; // public static final String WARDEN_HELM_NAME = "itemWardenHelm"; // public static final String WARDEN_CHEST_NAME = "itemWardenChest"; // public static final String WARDEN_LEGS_NAME = "itemWardenLegs"; // public static final String WARDEN_BOOTS_NAME = "itemWardenBoots"; // public static final String PURITY_FOCUS_NAME = "itemFocusPurity"; // public static final String LOVE_RING_NAME = "itemLoveRing"; // public static final String WASLIE_HAMMER_NAME = "itemWaslieHammer"; // public static final String ILLUMI_FOCUS_NAME = "itemFocusIllumination"; // // } // // Path: src/main/java/matgm50/twarden/util/wardenic/WardenicChargeHelper.java // public class WardenicChargeHelper { // // public static HashMap<String, WardenicUpgrade> upgrades = new HashMap<String, WardenicUpgrade>(); // // public static void addUpgrade(WardenicUpgrade upgrade) { // // addUpgrade(upgrade.aspect.getName(), upgrade); // // } // // public static void addUpgrade(String key, WardenicUpgrade upgrade) { // // upgrades.put(key, upgrade); // // } // // public static WardenicUpgrade getUpgrade(ItemStack stack) { // // if(stack.stackTagCompound != null) { // // if(stack.stackTagCompound.hasKey("upgrade")) { // // return upgrades.get(stack.stackTagCompound.getString("upgrade")); // // } else { // // return upgrades.get(ModResearch.EXUBITOR.getName()); // // } // // } else { // // return upgrades.get(ModResearch.EXUBITOR.getName()); // // } // // } // // public static void setUpgradeOnStack(ItemStack stack, String key) { // // if(stack.stackTagCompound == null) { // // stack.setTagCompound(new NBTTagCompound()); // // } // // stack.stackTagCompound.setString("upgrade", key); // // } // // } // Path: src/main/java/matgm50/twarden/item/ItemWardenArmor.java import matgm50.twarden.TWarden; import matgm50.twarden.lib.ItemLib; import matgm50.twarden.util.wardenic.WardenicChargeHelper; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemArmor; import net.minecraft.item.ItemStack; import net.minecraft.util.DamageSource; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.StatCollector; import net.minecraft.world.World; import net.minecraftforge.common.ISpecialArmor; import thaumcraft.api.IVisDiscountGear; import thaumcraft.api.aspects.Aspect; import java.util.List; package matgm50.twarden.item; /** * Created by MasterAbdoTGM50 on 6/26/2014. */ public class ItemWardenArmor extends ItemArmor implements ISpecialArmor, IVisDiscountGear { public ItemWardenArmor(int type) { super(ModItems.materialWarden, 3, type); setCreativeTab(TWarden.tabTWarden); setMaxStackSize(1); } @Override public boolean getShareTag() {return true;} @Override public boolean isBookEnchantable(ItemStack stack, ItemStack book) {return false;} @Override public int getMaxDamage(ItemStack stack) {return 50;} @Override public boolean isDamageable() {return false;} @Override public EnumRarity getRarity(ItemStack par1ItemStack) {return EnumRarity.epic;} @Override public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) { par3List.add(EnumChatFormatting.AQUA + StatCollector.translateToLocal("tooltip.wardenic.charge") + ": " + (par1ItemStack.getMaxDamage() - par1ItemStack.getItemDamage()) + "/" + par1ItemStack.getMaxDamage());
par3List.add(EnumChatFormatting.GOLD + StatCollector.translateToLocal("tooltip.wardenic.upgrade") + ": " + WardenicChargeHelper.getUpgrade(par1ItemStack).getQuote());
MasterAbdoTGM50/ThaumicWarden
src/main/java/matgm50/twarden/crafting/ModRecipes.java
// Path: src/main/java/matgm50/twarden/block/ModBlocks.java // public class ModBlocks { // // public static Block blockExubitura = new BlockExubitura(); // public static Block blockInfusedQuartzNormal = new BlockQuartzNormal(); // public static Block blockInfusedQuartzChiseled = new BlockQuartzChiseled(); // public static Block blockInfusedQuartzPillar = new BlockQuartzPillar(); // public static Block blockInfusedQuartzSlab = new BlockQuartzSlab(); // public static Block blockInfusedQuartzStair = new BlockQuartzStair(); // public static Block blockWitor = new BlockWitor(); // // public static void init() { // // GameRegistry.registerBlock(blockExubitura, BlockLib.EXUBITURA_NAME); // GameRegistry.registerBlock(blockInfusedQuartzNormal, BlockLib.QUARTZ_NORMAL_NAME); // GameRegistry.registerBlock(blockInfusedQuartzChiseled, BlockLib.QUARTZ_CHISELED_NAME); // GameRegistry.registerBlock(blockInfusedQuartzPillar, BlockLib.QUARTZ_PILLAR_NAME); // GameRegistry.registerBlock(blockInfusedQuartzSlab, BlockLib.QUARTZ_SLAB_NAME); // GameRegistry.registerBlock(blockInfusedQuartzStair, BlockLib.QUARTZ_STAIR_NAME); // GameRegistry.registerBlock(blockWitor, BlockLib.BLOCK_WITOR_NAME); // // GameRegistry.registerTileEntity(TileWitor.class, BlockLib.TILE_WITOR_NAME); // // } // // } // // Path: src/main/java/matgm50/twarden/item/ModItems.java // public class ModItems { // // public static ArmorMaterial materialWarden = EnumHelper.addArmorMaterial("WARDEN", 33, new int[]{3, 8, 6, 3}, 50); // // public static Item itemResource = new ItemResource(); // public static Item itemWardenAmulet = new ItemWardenAmulet(); // public static Item itemWardenSword = new ItemWardenWeapon(); // public static Item itemFocusPurity = new ItemFocusPurity(); // public static Item itemWardenHelm = new ItemWardenHelm(); // public static Item itemWardenChest = new ItemWardenChest(); // public static Item itemWardenLegs = new ItemWardenLegs(); // public static Item itemWardenBoots = new ItemWardenBoots(); // public static Item itemLoveRing = new ItemLoveRing(); // public static Item itemWaslieHammer = new ItemWaslieHammer(); // public static Item itemFocusIllumination = new ItemFocusIllumination(); // // public static void init() { // // GameRegistry.registerItem(itemResource, ItemLib.RESOURCE_NAME); // GameRegistry.registerItem(itemFocusPurity, ItemLib.PURITY_FOCUS_NAME); // GameRegistry.registerItem(itemWardenSword, ItemLib.WARDEN_WEAPON_NAME); // GameRegistry.registerItem(itemWardenAmulet, ItemLib.WARDEN_AMULET_NAME); // GameRegistry.registerItem(itemWardenHelm, ItemLib.WARDEN_HELM_NAME); // GameRegistry.registerItem(itemWardenChest, ItemLib.WARDEN_CHEST_NAME); // GameRegistry.registerItem(itemWardenLegs, ItemLib.WARDEN_LEGS_NAME); // GameRegistry.registerItem(itemWardenBoots, ItemLib.WARDEN_BOOTS_NAME); // GameRegistry.registerItem(itemLoveRing, ItemLib.LOVE_RING_NAME); // GameRegistry.registerItem(itemWaslieHammer, ItemLib.WASLIE_HAMMER_NAME); // GameRegistry.registerItem(itemFocusIllumination, ItemLib.ILLUMI_FOCUS_NAME); // // } // // } // // Path: src/main/java/matgm50/twarden/lib/ResearchLib.java // public class ResearchLib { // // public static final String EXUBITOR_NAME = "exubitor"; // public static final ResourceLocation EXUBITOR_ICON = new ResourceLocation(ModLib.ID.toLowerCase() ,"textures/aspects/exubitor.png"); // // public static final String CATEGORY_KEY = ModLib.ID.toUpperCase(); // public static final ResourceLocation CATEGORY_ICON = new ResourceLocation(ModLib.ID.toLowerCase() ,"textures/items/wardenamulet.png"); // public static final ResourceLocation CATEGORY_BACK = new ResourceLocation("thaumcraft" ,"textures/gui/gui_researchback.png"); // // public static final String TWARDEN_KEY = "TWARDEN"; // public static final String EXUBITURA_KEY = "EXUBITURA"; // public static final String QUARTZ_KEY = "INFUSEDQUARTZ"; // public static final String CRYSTAL_KEY = "WARDENCRYSTAL"; // public static final String WARDEN_ARMOR_KEY = "WARDENARMOR"; // public static final String WARDEN_WEAPON_KEY = "WARDENWEAPON"; // public static final String WASLIE_HAMMER_KEY = "WASLIEHAMMER"; // public static final String LORE1_KEY = "LORE1"; // public static final String LORE2_KEY = "LORE2"; // public static final String LORE3_KEY = "LORE3"; // public static final String LORE4_KEY = "LORE4"; // public static final String FOCUS_ILLUMINATION_KEY = "ILLUMINATION"; // // }
import cpw.mods.fml.common.registry.GameRegistry; import matgm50.twarden.block.ModBlocks; import matgm50.twarden.item.ModItems; import matgm50.twarden.lib.ResearchLib; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import thaumcraft.api.ThaumcraftApi; import thaumcraft.api.aspects.Aspect; import thaumcraft.api.aspects.AspectList; import thaumcraft.api.crafting.CrucibleRecipe; import thaumcraft.api.crafting.ShapedArcaneRecipe; import thaumcraft.common.config.ConfigBlocks; import thaumcraft.common.config.ConfigItems;
package matgm50.twarden.crafting; /** * Created by MasterAbdoTGM50 on 5/22/2014. */ public class ModRecipes { public static CrucibleRecipe recipeQuartz; public static CrucibleRecipe recipeCrystal; public static ShapedArcaneRecipe recipeWardenHelm; public static ShapedArcaneRecipe recipeWardenChest; public static ShapedArcaneRecipe recipeWardenLegs; public static ShapedArcaneRecipe recipeWardenBoots; public static ShapedArcaneRecipe recipeWardenSword; public static ShapedArcaneRecipe recipeWaslieHammer; public static ShapedArcaneRecipe recipeFocusIllumination; public static void init() { initMundane(); initThaumic(); } public static void initMundane() {
// Path: src/main/java/matgm50/twarden/block/ModBlocks.java // public class ModBlocks { // // public static Block blockExubitura = new BlockExubitura(); // public static Block blockInfusedQuartzNormal = new BlockQuartzNormal(); // public static Block blockInfusedQuartzChiseled = new BlockQuartzChiseled(); // public static Block blockInfusedQuartzPillar = new BlockQuartzPillar(); // public static Block blockInfusedQuartzSlab = new BlockQuartzSlab(); // public static Block blockInfusedQuartzStair = new BlockQuartzStair(); // public static Block blockWitor = new BlockWitor(); // // public static void init() { // // GameRegistry.registerBlock(blockExubitura, BlockLib.EXUBITURA_NAME); // GameRegistry.registerBlock(blockInfusedQuartzNormal, BlockLib.QUARTZ_NORMAL_NAME); // GameRegistry.registerBlock(blockInfusedQuartzChiseled, BlockLib.QUARTZ_CHISELED_NAME); // GameRegistry.registerBlock(blockInfusedQuartzPillar, BlockLib.QUARTZ_PILLAR_NAME); // GameRegistry.registerBlock(blockInfusedQuartzSlab, BlockLib.QUARTZ_SLAB_NAME); // GameRegistry.registerBlock(blockInfusedQuartzStair, BlockLib.QUARTZ_STAIR_NAME); // GameRegistry.registerBlock(blockWitor, BlockLib.BLOCK_WITOR_NAME); // // GameRegistry.registerTileEntity(TileWitor.class, BlockLib.TILE_WITOR_NAME); // // } // // } // // Path: src/main/java/matgm50/twarden/item/ModItems.java // public class ModItems { // // public static ArmorMaterial materialWarden = EnumHelper.addArmorMaterial("WARDEN", 33, new int[]{3, 8, 6, 3}, 50); // // public static Item itemResource = new ItemResource(); // public static Item itemWardenAmulet = new ItemWardenAmulet(); // public static Item itemWardenSword = new ItemWardenWeapon(); // public static Item itemFocusPurity = new ItemFocusPurity(); // public static Item itemWardenHelm = new ItemWardenHelm(); // public static Item itemWardenChest = new ItemWardenChest(); // public static Item itemWardenLegs = new ItemWardenLegs(); // public static Item itemWardenBoots = new ItemWardenBoots(); // public static Item itemLoveRing = new ItemLoveRing(); // public static Item itemWaslieHammer = new ItemWaslieHammer(); // public static Item itemFocusIllumination = new ItemFocusIllumination(); // // public static void init() { // // GameRegistry.registerItem(itemResource, ItemLib.RESOURCE_NAME); // GameRegistry.registerItem(itemFocusPurity, ItemLib.PURITY_FOCUS_NAME); // GameRegistry.registerItem(itemWardenSword, ItemLib.WARDEN_WEAPON_NAME); // GameRegistry.registerItem(itemWardenAmulet, ItemLib.WARDEN_AMULET_NAME); // GameRegistry.registerItem(itemWardenHelm, ItemLib.WARDEN_HELM_NAME); // GameRegistry.registerItem(itemWardenChest, ItemLib.WARDEN_CHEST_NAME); // GameRegistry.registerItem(itemWardenLegs, ItemLib.WARDEN_LEGS_NAME); // GameRegistry.registerItem(itemWardenBoots, ItemLib.WARDEN_BOOTS_NAME); // GameRegistry.registerItem(itemLoveRing, ItemLib.LOVE_RING_NAME); // GameRegistry.registerItem(itemWaslieHammer, ItemLib.WASLIE_HAMMER_NAME); // GameRegistry.registerItem(itemFocusIllumination, ItemLib.ILLUMI_FOCUS_NAME); // // } // // } // // Path: src/main/java/matgm50/twarden/lib/ResearchLib.java // public class ResearchLib { // // public static final String EXUBITOR_NAME = "exubitor"; // public static final ResourceLocation EXUBITOR_ICON = new ResourceLocation(ModLib.ID.toLowerCase() ,"textures/aspects/exubitor.png"); // // public static final String CATEGORY_KEY = ModLib.ID.toUpperCase(); // public static final ResourceLocation CATEGORY_ICON = new ResourceLocation(ModLib.ID.toLowerCase() ,"textures/items/wardenamulet.png"); // public static final ResourceLocation CATEGORY_BACK = new ResourceLocation("thaumcraft" ,"textures/gui/gui_researchback.png"); // // public static final String TWARDEN_KEY = "TWARDEN"; // public static final String EXUBITURA_KEY = "EXUBITURA"; // public static final String QUARTZ_KEY = "INFUSEDQUARTZ"; // public static final String CRYSTAL_KEY = "WARDENCRYSTAL"; // public static final String WARDEN_ARMOR_KEY = "WARDENARMOR"; // public static final String WARDEN_WEAPON_KEY = "WARDENWEAPON"; // public static final String WASLIE_HAMMER_KEY = "WASLIEHAMMER"; // public static final String LORE1_KEY = "LORE1"; // public static final String LORE2_KEY = "LORE2"; // public static final String LORE3_KEY = "LORE3"; // public static final String LORE4_KEY = "LORE4"; // public static final String FOCUS_ILLUMINATION_KEY = "ILLUMINATION"; // // } // Path: src/main/java/matgm50/twarden/crafting/ModRecipes.java import cpw.mods.fml.common.registry.GameRegistry; import matgm50.twarden.block.ModBlocks; import matgm50.twarden.item.ModItems; import matgm50.twarden.lib.ResearchLib; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import thaumcraft.api.ThaumcraftApi; import thaumcraft.api.aspects.Aspect; import thaumcraft.api.aspects.AspectList; import thaumcraft.api.crafting.CrucibleRecipe; import thaumcraft.api.crafting.ShapedArcaneRecipe; import thaumcraft.common.config.ConfigBlocks; import thaumcraft.common.config.ConfigItems; package matgm50.twarden.crafting; /** * Created by MasterAbdoTGM50 on 5/22/2014. */ public class ModRecipes { public static CrucibleRecipe recipeQuartz; public static CrucibleRecipe recipeCrystal; public static ShapedArcaneRecipe recipeWardenHelm; public static ShapedArcaneRecipe recipeWardenChest; public static ShapedArcaneRecipe recipeWardenLegs; public static ShapedArcaneRecipe recipeWardenBoots; public static ShapedArcaneRecipe recipeWardenSword; public static ShapedArcaneRecipe recipeWaslieHammer; public static ShapedArcaneRecipe recipeFocusIllumination; public static void init() { initMundane(); initThaumic(); } public static void initMundane() {
GameRegistry.addShapedRecipe(new ItemStack(ModBlocks.blockInfusedQuartzNormal), "XX", "XX", 'X', new ItemStack(ModItems.itemResource, 1, 2));
MasterAbdoTGM50/ThaumicWarden
src/main/java/matgm50/twarden/crafting/ModRecipes.java
// Path: src/main/java/matgm50/twarden/block/ModBlocks.java // public class ModBlocks { // // public static Block blockExubitura = new BlockExubitura(); // public static Block blockInfusedQuartzNormal = new BlockQuartzNormal(); // public static Block blockInfusedQuartzChiseled = new BlockQuartzChiseled(); // public static Block blockInfusedQuartzPillar = new BlockQuartzPillar(); // public static Block blockInfusedQuartzSlab = new BlockQuartzSlab(); // public static Block blockInfusedQuartzStair = new BlockQuartzStair(); // public static Block blockWitor = new BlockWitor(); // // public static void init() { // // GameRegistry.registerBlock(blockExubitura, BlockLib.EXUBITURA_NAME); // GameRegistry.registerBlock(blockInfusedQuartzNormal, BlockLib.QUARTZ_NORMAL_NAME); // GameRegistry.registerBlock(blockInfusedQuartzChiseled, BlockLib.QUARTZ_CHISELED_NAME); // GameRegistry.registerBlock(blockInfusedQuartzPillar, BlockLib.QUARTZ_PILLAR_NAME); // GameRegistry.registerBlock(blockInfusedQuartzSlab, BlockLib.QUARTZ_SLAB_NAME); // GameRegistry.registerBlock(blockInfusedQuartzStair, BlockLib.QUARTZ_STAIR_NAME); // GameRegistry.registerBlock(blockWitor, BlockLib.BLOCK_WITOR_NAME); // // GameRegistry.registerTileEntity(TileWitor.class, BlockLib.TILE_WITOR_NAME); // // } // // } // // Path: src/main/java/matgm50/twarden/item/ModItems.java // public class ModItems { // // public static ArmorMaterial materialWarden = EnumHelper.addArmorMaterial("WARDEN", 33, new int[]{3, 8, 6, 3}, 50); // // public static Item itemResource = new ItemResource(); // public static Item itemWardenAmulet = new ItemWardenAmulet(); // public static Item itemWardenSword = new ItemWardenWeapon(); // public static Item itemFocusPurity = new ItemFocusPurity(); // public static Item itemWardenHelm = new ItemWardenHelm(); // public static Item itemWardenChest = new ItemWardenChest(); // public static Item itemWardenLegs = new ItemWardenLegs(); // public static Item itemWardenBoots = new ItemWardenBoots(); // public static Item itemLoveRing = new ItemLoveRing(); // public static Item itemWaslieHammer = new ItemWaslieHammer(); // public static Item itemFocusIllumination = new ItemFocusIllumination(); // // public static void init() { // // GameRegistry.registerItem(itemResource, ItemLib.RESOURCE_NAME); // GameRegistry.registerItem(itemFocusPurity, ItemLib.PURITY_FOCUS_NAME); // GameRegistry.registerItem(itemWardenSword, ItemLib.WARDEN_WEAPON_NAME); // GameRegistry.registerItem(itemWardenAmulet, ItemLib.WARDEN_AMULET_NAME); // GameRegistry.registerItem(itemWardenHelm, ItemLib.WARDEN_HELM_NAME); // GameRegistry.registerItem(itemWardenChest, ItemLib.WARDEN_CHEST_NAME); // GameRegistry.registerItem(itemWardenLegs, ItemLib.WARDEN_LEGS_NAME); // GameRegistry.registerItem(itemWardenBoots, ItemLib.WARDEN_BOOTS_NAME); // GameRegistry.registerItem(itemLoveRing, ItemLib.LOVE_RING_NAME); // GameRegistry.registerItem(itemWaslieHammer, ItemLib.WASLIE_HAMMER_NAME); // GameRegistry.registerItem(itemFocusIllumination, ItemLib.ILLUMI_FOCUS_NAME); // // } // // } // // Path: src/main/java/matgm50/twarden/lib/ResearchLib.java // public class ResearchLib { // // public static final String EXUBITOR_NAME = "exubitor"; // public static final ResourceLocation EXUBITOR_ICON = new ResourceLocation(ModLib.ID.toLowerCase() ,"textures/aspects/exubitor.png"); // // public static final String CATEGORY_KEY = ModLib.ID.toUpperCase(); // public static final ResourceLocation CATEGORY_ICON = new ResourceLocation(ModLib.ID.toLowerCase() ,"textures/items/wardenamulet.png"); // public static final ResourceLocation CATEGORY_BACK = new ResourceLocation("thaumcraft" ,"textures/gui/gui_researchback.png"); // // public static final String TWARDEN_KEY = "TWARDEN"; // public static final String EXUBITURA_KEY = "EXUBITURA"; // public static final String QUARTZ_KEY = "INFUSEDQUARTZ"; // public static final String CRYSTAL_KEY = "WARDENCRYSTAL"; // public static final String WARDEN_ARMOR_KEY = "WARDENARMOR"; // public static final String WARDEN_WEAPON_KEY = "WARDENWEAPON"; // public static final String WASLIE_HAMMER_KEY = "WASLIEHAMMER"; // public static final String LORE1_KEY = "LORE1"; // public static final String LORE2_KEY = "LORE2"; // public static final String LORE3_KEY = "LORE3"; // public static final String LORE4_KEY = "LORE4"; // public static final String FOCUS_ILLUMINATION_KEY = "ILLUMINATION"; // // }
import cpw.mods.fml.common.registry.GameRegistry; import matgm50.twarden.block.ModBlocks; import matgm50.twarden.item.ModItems; import matgm50.twarden.lib.ResearchLib; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import thaumcraft.api.ThaumcraftApi; import thaumcraft.api.aspects.Aspect; import thaumcraft.api.aspects.AspectList; import thaumcraft.api.crafting.CrucibleRecipe; import thaumcraft.api.crafting.ShapedArcaneRecipe; import thaumcraft.common.config.ConfigBlocks; import thaumcraft.common.config.ConfigItems;
package matgm50.twarden.crafting; /** * Created by MasterAbdoTGM50 on 5/22/2014. */ public class ModRecipes { public static CrucibleRecipe recipeQuartz; public static CrucibleRecipe recipeCrystal; public static ShapedArcaneRecipe recipeWardenHelm; public static ShapedArcaneRecipe recipeWardenChest; public static ShapedArcaneRecipe recipeWardenLegs; public static ShapedArcaneRecipe recipeWardenBoots; public static ShapedArcaneRecipe recipeWardenSword; public static ShapedArcaneRecipe recipeWaslieHammer; public static ShapedArcaneRecipe recipeFocusIllumination; public static void init() { initMundane(); initThaumic(); } public static void initMundane() {
// Path: src/main/java/matgm50/twarden/block/ModBlocks.java // public class ModBlocks { // // public static Block blockExubitura = new BlockExubitura(); // public static Block blockInfusedQuartzNormal = new BlockQuartzNormal(); // public static Block blockInfusedQuartzChiseled = new BlockQuartzChiseled(); // public static Block blockInfusedQuartzPillar = new BlockQuartzPillar(); // public static Block blockInfusedQuartzSlab = new BlockQuartzSlab(); // public static Block blockInfusedQuartzStair = new BlockQuartzStair(); // public static Block blockWitor = new BlockWitor(); // // public static void init() { // // GameRegistry.registerBlock(blockExubitura, BlockLib.EXUBITURA_NAME); // GameRegistry.registerBlock(blockInfusedQuartzNormal, BlockLib.QUARTZ_NORMAL_NAME); // GameRegistry.registerBlock(blockInfusedQuartzChiseled, BlockLib.QUARTZ_CHISELED_NAME); // GameRegistry.registerBlock(blockInfusedQuartzPillar, BlockLib.QUARTZ_PILLAR_NAME); // GameRegistry.registerBlock(blockInfusedQuartzSlab, BlockLib.QUARTZ_SLAB_NAME); // GameRegistry.registerBlock(blockInfusedQuartzStair, BlockLib.QUARTZ_STAIR_NAME); // GameRegistry.registerBlock(blockWitor, BlockLib.BLOCK_WITOR_NAME); // // GameRegistry.registerTileEntity(TileWitor.class, BlockLib.TILE_WITOR_NAME); // // } // // } // // Path: src/main/java/matgm50/twarden/item/ModItems.java // public class ModItems { // // public static ArmorMaterial materialWarden = EnumHelper.addArmorMaterial("WARDEN", 33, new int[]{3, 8, 6, 3}, 50); // // public static Item itemResource = new ItemResource(); // public static Item itemWardenAmulet = new ItemWardenAmulet(); // public static Item itemWardenSword = new ItemWardenWeapon(); // public static Item itemFocusPurity = new ItemFocusPurity(); // public static Item itemWardenHelm = new ItemWardenHelm(); // public static Item itemWardenChest = new ItemWardenChest(); // public static Item itemWardenLegs = new ItemWardenLegs(); // public static Item itemWardenBoots = new ItemWardenBoots(); // public static Item itemLoveRing = new ItemLoveRing(); // public static Item itemWaslieHammer = new ItemWaslieHammer(); // public static Item itemFocusIllumination = new ItemFocusIllumination(); // // public static void init() { // // GameRegistry.registerItem(itemResource, ItemLib.RESOURCE_NAME); // GameRegistry.registerItem(itemFocusPurity, ItemLib.PURITY_FOCUS_NAME); // GameRegistry.registerItem(itemWardenSword, ItemLib.WARDEN_WEAPON_NAME); // GameRegistry.registerItem(itemWardenAmulet, ItemLib.WARDEN_AMULET_NAME); // GameRegistry.registerItem(itemWardenHelm, ItemLib.WARDEN_HELM_NAME); // GameRegistry.registerItem(itemWardenChest, ItemLib.WARDEN_CHEST_NAME); // GameRegistry.registerItem(itemWardenLegs, ItemLib.WARDEN_LEGS_NAME); // GameRegistry.registerItem(itemWardenBoots, ItemLib.WARDEN_BOOTS_NAME); // GameRegistry.registerItem(itemLoveRing, ItemLib.LOVE_RING_NAME); // GameRegistry.registerItem(itemWaslieHammer, ItemLib.WASLIE_HAMMER_NAME); // GameRegistry.registerItem(itemFocusIllumination, ItemLib.ILLUMI_FOCUS_NAME); // // } // // } // // Path: src/main/java/matgm50/twarden/lib/ResearchLib.java // public class ResearchLib { // // public static final String EXUBITOR_NAME = "exubitor"; // public static final ResourceLocation EXUBITOR_ICON = new ResourceLocation(ModLib.ID.toLowerCase() ,"textures/aspects/exubitor.png"); // // public static final String CATEGORY_KEY = ModLib.ID.toUpperCase(); // public static final ResourceLocation CATEGORY_ICON = new ResourceLocation(ModLib.ID.toLowerCase() ,"textures/items/wardenamulet.png"); // public static final ResourceLocation CATEGORY_BACK = new ResourceLocation("thaumcraft" ,"textures/gui/gui_researchback.png"); // // public static final String TWARDEN_KEY = "TWARDEN"; // public static final String EXUBITURA_KEY = "EXUBITURA"; // public static final String QUARTZ_KEY = "INFUSEDQUARTZ"; // public static final String CRYSTAL_KEY = "WARDENCRYSTAL"; // public static final String WARDEN_ARMOR_KEY = "WARDENARMOR"; // public static final String WARDEN_WEAPON_KEY = "WARDENWEAPON"; // public static final String WASLIE_HAMMER_KEY = "WASLIEHAMMER"; // public static final String LORE1_KEY = "LORE1"; // public static final String LORE2_KEY = "LORE2"; // public static final String LORE3_KEY = "LORE3"; // public static final String LORE4_KEY = "LORE4"; // public static final String FOCUS_ILLUMINATION_KEY = "ILLUMINATION"; // // } // Path: src/main/java/matgm50/twarden/crafting/ModRecipes.java import cpw.mods.fml.common.registry.GameRegistry; import matgm50.twarden.block.ModBlocks; import matgm50.twarden.item.ModItems; import matgm50.twarden.lib.ResearchLib; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import thaumcraft.api.ThaumcraftApi; import thaumcraft.api.aspects.Aspect; import thaumcraft.api.aspects.AspectList; import thaumcraft.api.crafting.CrucibleRecipe; import thaumcraft.api.crafting.ShapedArcaneRecipe; import thaumcraft.common.config.ConfigBlocks; import thaumcraft.common.config.ConfigItems; package matgm50.twarden.crafting; /** * Created by MasterAbdoTGM50 on 5/22/2014. */ public class ModRecipes { public static CrucibleRecipe recipeQuartz; public static CrucibleRecipe recipeCrystal; public static ShapedArcaneRecipe recipeWardenHelm; public static ShapedArcaneRecipe recipeWardenChest; public static ShapedArcaneRecipe recipeWardenLegs; public static ShapedArcaneRecipe recipeWardenBoots; public static ShapedArcaneRecipe recipeWardenSword; public static ShapedArcaneRecipe recipeWaslieHammer; public static ShapedArcaneRecipe recipeFocusIllumination; public static void init() { initMundane(); initThaumic(); } public static void initMundane() {
GameRegistry.addShapedRecipe(new ItemStack(ModBlocks.blockInfusedQuartzNormal), "XX", "XX", 'X', new ItemStack(ModItems.itemResource, 1, 2));
MasterAbdoTGM50/ThaumicWarden
src/main/java/matgm50/twarden/util/wardenic/upgrade/WardenicUpgradeArmor.java
// Path: src/main/java/matgm50/twarden/util/DamageSourceWarden.java // public class DamageSourceWarden extends EntityDamageSource { // // public DamageSourceWarden(String par1Str, Entity par2Entity) { // // super(par1Str, par2Entity); // setDamageBypassesArmor(); // setDamageIsAbsolute(); // // } // }
import matgm50.twarden.util.DamageSourceWarden; import net.minecraft.util.DamageSource; import net.minecraftforge.event.entity.living.LivingHurtEvent; import thaumcraft.api.aspects.Aspect;
package matgm50.twarden.util.wardenic.upgrade; /** * Created by MasterAbdoTGM50 on 8/28/2014. */ public class WardenicUpgradeArmor extends WardenicUpgrade { public WardenicUpgradeArmor(Aspect aspect) {super(aspect);} @Override public void onAttacked(LivingHurtEvent event) { super.onAttacked(event); if(event.source.getEntity() != null) {
// Path: src/main/java/matgm50/twarden/util/DamageSourceWarden.java // public class DamageSourceWarden extends EntityDamageSource { // // public DamageSourceWarden(String par1Str, Entity par2Entity) { // // super(par1Str, par2Entity); // setDamageBypassesArmor(); // setDamageIsAbsolute(); // // } // } // Path: src/main/java/matgm50/twarden/util/wardenic/upgrade/WardenicUpgradeArmor.java import matgm50.twarden.util.DamageSourceWarden; import net.minecraft.util.DamageSource; import net.minecraftforge.event.entity.living.LivingHurtEvent; import thaumcraft.api.aspects.Aspect; package matgm50.twarden.util.wardenic.upgrade; /** * Created by MasterAbdoTGM50 on 8/28/2014. */ public class WardenicUpgradeArmor extends WardenicUpgrade { public WardenicUpgradeArmor(Aspect aspect) {super(aspect);} @Override public void onAttacked(LivingHurtEvent event) { super.onAttacked(event); if(event.source.getEntity() != null) {
DamageSource damageSource = new DamageSourceWarden("warden", event.entity);
MasterAbdoTGM50/ThaumicWarden
src/main/java/matgm50/twarden/item/ItemWardenAmulet.java
// Path: src/main/java/matgm50/twarden/TWarden.java // @Mod(modid = ModLib.ID, name = ModLib.NAME, version = ModLib.VERSION, dependencies = ModLib.DEPENDENCIES) // // public class TWarden { // // @Instance(ModLib.ID) // public static TWarden instance; // // @SidedProxy(serverSide = ModLib.COMMONPROXY, clientSide = ModLib.CLIENTPROXY) // public static CommonProxy proxy; // // public static CreativeTabs tabTWarden = new TabTWarden(ModLib.ID); // // @EventHandler // public void preInit(FMLPreInitializationEvent event) { // // proxy.initRenderers(); // GuiHandler.init(); // // WardenicChargeEvents.init(); // WardenicUpgrades.init(); // // ModItems.init(); // ModBlocks.init(); // ModEntities.init(); // ModGen.init(); // // } // // @EventHandler // public void init(FMLInitializationEvent event) { // // } // // @EventHandler // public void postInit(FMLPostInitializationEvent event) { // // ModRecipes.init(); // ModResearch.init(); // // } // // } // // Path: src/main/java/matgm50/twarden/lib/ItemLib.java // public class ItemLib { // // public static final String RESOURCE_NAME = "itemResource"; // public static final String[] RESOURCE_ICON = {"wardenpetal", "wardenstone", "wardenquartz"}; // // public static final String WARDEN_AMULET_NAME = "itemWardenAmulet"; // public static final String WARDEN_WEAPON_NAME = "itemWardenWeapon"; // public static final String WARDEN_HELM_NAME = "itemWardenHelm"; // public static final String WARDEN_CHEST_NAME = "itemWardenChest"; // public static final String WARDEN_LEGS_NAME = "itemWardenLegs"; // public static final String WARDEN_BOOTS_NAME = "itemWardenBoots"; // public static final String PURITY_FOCUS_NAME = "itemFocusPurity"; // public static final String LOVE_RING_NAME = "itemLoveRing"; // public static final String WASLIE_HAMMER_NAME = "itemWaslieHammer"; // public static final String ILLUMI_FOCUS_NAME = "itemFocusIllumination"; // // } // // Path: src/main/java/matgm50/twarden/lib/ModLib.java // public class ModLib { // // public static final String ID = "TWarden"; // public static final String NAME = "Thaumic Warden"; // public static final String VERSION = "1.1.1"; // public static final String DEPENDENCIES = "required-after:Thaumcraft"; // // public static final String CLIENTPROXY = "matgm50.twarden.proxy.ClientProxy"; // public static final String COMMONPROXY = "matgm50.twarden.proxy.CommonProxy"; // // }
import baubles.api.BaubleType; import baubles.api.IBauble; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import matgm50.twarden.TWarden; import matgm50.twarden.lib.ItemLib; import matgm50.twarden.lib.ModLib; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.EnumRarity; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.potion.Potion; import thaumcraft.common.config.Config;
package matgm50.twarden.item; /** * Created by MasterAbdoTGM50 on 5/22/2014. */ public class ItemWardenAmulet extends Item implements IBauble { public ItemWardenAmulet() { super();
// Path: src/main/java/matgm50/twarden/TWarden.java // @Mod(modid = ModLib.ID, name = ModLib.NAME, version = ModLib.VERSION, dependencies = ModLib.DEPENDENCIES) // // public class TWarden { // // @Instance(ModLib.ID) // public static TWarden instance; // // @SidedProxy(serverSide = ModLib.COMMONPROXY, clientSide = ModLib.CLIENTPROXY) // public static CommonProxy proxy; // // public static CreativeTabs tabTWarden = new TabTWarden(ModLib.ID); // // @EventHandler // public void preInit(FMLPreInitializationEvent event) { // // proxy.initRenderers(); // GuiHandler.init(); // // WardenicChargeEvents.init(); // WardenicUpgrades.init(); // // ModItems.init(); // ModBlocks.init(); // ModEntities.init(); // ModGen.init(); // // } // // @EventHandler // public void init(FMLInitializationEvent event) { // // } // // @EventHandler // public void postInit(FMLPostInitializationEvent event) { // // ModRecipes.init(); // ModResearch.init(); // // } // // } // // Path: src/main/java/matgm50/twarden/lib/ItemLib.java // public class ItemLib { // // public static final String RESOURCE_NAME = "itemResource"; // public static final String[] RESOURCE_ICON = {"wardenpetal", "wardenstone", "wardenquartz"}; // // public static final String WARDEN_AMULET_NAME = "itemWardenAmulet"; // public static final String WARDEN_WEAPON_NAME = "itemWardenWeapon"; // public static final String WARDEN_HELM_NAME = "itemWardenHelm"; // public static final String WARDEN_CHEST_NAME = "itemWardenChest"; // public static final String WARDEN_LEGS_NAME = "itemWardenLegs"; // public static final String WARDEN_BOOTS_NAME = "itemWardenBoots"; // public static final String PURITY_FOCUS_NAME = "itemFocusPurity"; // public static final String LOVE_RING_NAME = "itemLoveRing"; // public static final String WASLIE_HAMMER_NAME = "itemWaslieHammer"; // public static final String ILLUMI_FOCUS_NAME = "itemFocusIllumination"; // // } // // Path: src/main/java/matgm50/twarden/lib/ModLib.java // public class ModLib { // // public static final String ID = "TWarden"; // public static final String NAME = "Thaumic Warden"; // public static final String VERSION = "1.1.1"; // public static final String DEPENDENCIES = "required-after:Thaumcraft"; // // public static final String CLIENTPROXY = "matgm50.twarden.proxy.ClientProxy"; // public static final String COMMONPROXY = "matgm50.twarden.proxy.CommonProxy"; // // } // Path: src/main/java/matgm50/twarden/item/ItemWardenAmulet.java import baubles.api.BaubleType; import baubles.api.IBauble; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import matgm50.twarden.TWarden; import matgm50.twarden.lib.ItemLib; import matgm50.twarden.lib.ModLib; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.EnumRarity; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.potion.Potion; import thaumcraft.common.config.Config; package matgm50.twarden.item; /** * Created by MasterAbdoTGM50 on 5/22/2014. */ public class ItemWardenAmulet extends Item implements IBauble { public ItemWardenAmulet() { super();
setUnlocalizedName(ItemLib.WARDEN_AMULET_NAME);
MasterAbdoTGM50/ThaumicWarden
src/main/java/matgm50/twarden/item/ItemWardenAmulet.java
// Path: src/main/java/matgm50/twarden/TWarden.java // @Mod(modid = ModLib.ID, name = ModLib.NAME, version = ModLib.VERSION, dependencies = ModLib.DEPENDENCIES) // // public class TWarden { // // @Instance(ModLib.ID) // public static TWarden instance; // // @SidedProxy(serverSide = ModLib.COMMONPROXY, clientSide = ModLib.CLIENTPROXY) // public static CommonProxy proxy; // // public static CreativeTabs tabTWarden = new TabTWarden(ModLib.ID); // // @EventHandler // public void preInit(FMLPreInitializationEvent event) { // // proxy.initRenderers(); // GuiHandler.init(); // // WardenicChargeEvents.init(); // WardenicUpgrades.init(); // // ModItems.init(); // ModBlocks.init(); // ModEntities.init(); // ModGen.init(); // // } // // @EventHandler // public void init(FMLInitializationEvent event) { // // } // // @EventHandler // public void postInit(FMLPostInitializationEvent event) { // // ModRecipes.init(); // ModResearch.init(); // // } // // } // // Path: src/main/java/matgm50/twarden/lib/ItemLib.java // public class ItemLib { // // public static final String RESOURCE_NAME = "itemResource"; // public static final String[] RESOURCE_ICON = {"wardenpetal", "wardenstone", "wardenquartz"}; // // public static final String WARDEN_AMULET_NAME = "itemWardenAmulet"; // public static final String WARDEN_WEAPON_NAME = "itemWardenWeapon"; // public static final String WARDEN_HELM_NAME = "itemWardenHelm"; // public static final String WARDEN_CHEST_NAME = "itemWardenChest"; // public static final String WARDEN_LEGS_NAME = "itemWardenLegs"; // public static final String WARDEN_BOOTS_NAME = "itemWardenBoots"; // public static final String PURITY_FOCUS_NAME = "itemFocusPurity"; // public static final String LOVE_RING_NAME = "itemLoveRing"; // public static final String WASLIE_HAMMER_NAME = "itemWaslieHammer"; // public static final String ILLUMI_FOCUS_NAME = "itemFocusIllumination"; // // } // // Path: src/main/java/matgm50/twarden/lib/ModLib.java // public class ModLib { // // public static final String ID = "TWarden"; // public static final String NAME = "Thaumic Warden"; // public static final String VERSION = "1.1.1"; // public static final String DEPENDENCIES = "required-after:Thaumcraft"; // // public static final String CLIENTPROXY = "matgm50.twarden.proxy.ClientProxy"; // public static final String COMMONPROXY = "matgm50.twarden.proxy.CommonProxy"; // // }
import baubles.api.BaubleType; import baubles.api.IBauble; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import matgm50.twarden.TWarden; import matgm50.twarden.lib.ItemLib; import matgm50.twarden.lib.ModLib; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.EnumRarity; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.potion.Potion; import thaumcraft.common.config.Config;
package matgm50.twarden.item; /** * Created by MasterAbdoTGM50 on 5/22/2014. */ public class ItemWardenAmulet extends Item implements IBauble { public ItemWardenAmulet() { super(); setUnlocalizedName(ItemLib.WARDEN_AMULET_NAME);
// Path: src/main/java/matgm50/twarden/TWarden.java // @Mod(modid = ModLib.ID, name = ModLib.NAME, version = ModLib.VERSION, dependencies = ModLib.DEPENDENCIES) // // public class TWarden { // // @Instance(ModLib.ID) // public static TWarden instance; // // @SidedProxy(serverSide = ModLib.COMMONPROXY, clientSide = ModLib.CLIENTPROXY) // public static CommonProxy proxy; // // public static CreativeTabs tabTWarden = new TabTWarden(ModLib.ID); // // @EventHandler // public void preInit(FMLPreInitializationEvent event) { // // proxy.initRenderers(); // GuiHandler.init(); // // WardenicChargeEvents.init(); // WardenicUpgrades.init(); // // ModItems.init(); // ModBlocks.init(); // ModEntities.init(); // ModGen.init(); // // } // // @EventHandler // public void init(FMLInitializationEvent event) { // // } // // @EventHandler // public void postInit(FMLPostInitializationEvent event) { // // ModRecipes.init(); // ModResearch.init(); // // } // // } // // Path: src/main/java/matgm50/twarden/lib/ItemLib.java // public class ItemLib { // // public static final String RESOURCE_NAME = "itemResource"; // public static final String[] RESOURCE_ICON = {"wardenpetal", "wardenstone", "wardenquartz"}; // // public static final String WARDEN_AMULET_NAME = "itemWardenAmulet"; // public static final String WARDEN_WEAPON_NAME = "itemWardenWeapon"; // public static final String WARDEN_HELM_NAME = "itemWardenHelm"; // public static final String WARDEN_CHEST_NAME = "itemWardenChest"; // public static final String WARDEN_LEGS_NAME = "itemWardenLegs"; // public static final String WARDEN_BOOTS_NAME = "itemWardenBoots"; // public static final String PURITY_FOCUS_NAME = "itemFocusPurity"; // public static final String LOVE_RING_NAME = "itemLoveRing"; // public static final String WASLIE_HAMMER_NAME = "itemWaslieHammer"; // public static final String ILLUMI_FOCUS_NAME = "itemFocusIllumination"; // // } // // Path: src/main/java/matgm50/twarden/lib/ModLib.java // public class ModLib { // // public static final String ID = "TWarden"; // public static final String NAME = "Thaumic Warden"; // public static final String VERSION = "1.1.1"; // public static final String DEPENDENCIES = "required-after:Thaumcraft"; // // public static final String CLIENTPROXY = "matgm50.twarden.proxy.ClientProxy"; // public static final String COMMONPROXY = "matgm50.twarden.proxy.CommonProxy"; // // } // Path: src/main/java/matgm50/twarden/item/ItemWardenAmulet.java import baubles.api.BaubleType; import baubles.api.IBauble; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import matgm50.twarden.TWarden; import matgm50.twarden.lib.ItemLib; import matgm50.twarden.lib.ModLib; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.EnumRarity; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.potion.Potion; import thaumcraft.common.config.Config; package matgm50.twarden.item; /** * Created by MasterAbdoTGM50 on 5/22/2014. */ public class ItemWardenAmulet extends Item implements IBauble { public ItemWardenAmulet() { super(); setUnlocalizedName(ItemLib.WARDEN_AMULET_NAME);
setCreativeTab(TWarden.tabTWarden);
MasterAbdoTGM50/ThaumicWarden
src/main/java/matgm50/twarden/item/ItemWardenAmulet.java
// Path: src/main/java/matgm50/twarden/TWarden.java // @Mod(modid = ModLib.ID, name = ModLib.NAME, version = ModLib.VERSION, dependencies = ModLib.DEPENDENCIES) // // public class TWarden { // // @Instance(ModLib.ID) // public static TWarden instance; // // @SidedProxy(serverSide = ModLib.COMMONPROXY, clientSide = ModLib.CLIENTPROXY) // public static CommonProxy proxy; // // public static CreativeTabs tabTWarden = new TabTWarden(ModLib.ID); // // @EventHandler // public void preInit(FMLPreInitializationEvent event) { // // proxy.initRenderers(); // GuiHandler.init(); // // WardenicChargeEvents.init(); // WardenicUpgrades.init(); // // ModItems.init(); // ModBlocks.init(); // ModEntities.init(); // ModGen.init(); // // } // // @EventHandler // public void init(FMLInitializationEvent event) { // // } // // @EventHandler // public void postInit(FMLPostInitializationEvent event) { // // ModRecipes.init(); // ModResearch.init(); // // } // // } // // Path: src/main/java/matgm50/twarden/lib/ItemLib.java // public class ItemLib { // // public static final String RESOURCE_NAME = "itemResource"; // public static final String[] RESOURCE_ICON = {"wardenpetal", "wardenstone", "wardenquartz"}; // // public static final String WARDEN_AMULET_NAME = "itemWardenAmulet"; // public static final String WARDEN_WEAPON_NAME = "itemWardenWeapon"; // public static final String WARDEN_HELM_NAME = "itemWardenHelm"; // public static final String WARDEN_CHEST_NAME = "itemWardenChest"; // public static final String WARDEN_LEGS_NAME = "itemWardenLegs"; // public static final String WARDEN_BOOTS_NAME = "itemWardenBoots"; // public static final String PURITY_FOCUS_NAME = "itemFocusPurity"; // public static final String LOVE_RING_NAME = "itemLoveRing"; // public static final String WASLIE_HAMMER_NAME = "itemWaslieHammer"; // public static final String ILLUMI_FOCUS_NAME = "itemFocusIllumination"; // // } // // Path: src/main/java/matgm50/twarden/lib/ModLib.java // public class ModLib { // // public static final String ID = "TWarden"; // public static final String NAME = "Thaumic Warden"; // public static final String VERSION = "1.1.1"; // public static final String DEPENDENCIES = "required-after:Thaumcraft"; // // public static final String CLIENTPROXY = "matgm50.twarden.proxy.ClientProxy"; // public static final String COMMONPROXY = "matgm50.twarden.proxy.CommonProxy"; // // }
import baubles.api.BaubleType; import baubles.api.IBauble; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import matgm50.twarden.TWarden; import matgm50.twarden.lib.ItemLib; import matgm50.twarden.lib.ModLib; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.EnumRarity; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.potion.Potion; import thaumcraft.common.config.Config;
package matgm50.twarden.item; /** * Created by MasterAbdoTGM50 on 5/22/2014. */ public class ItemWardenAmulet extends Item implements IBauble { public ItemWardenAmulet() { super(); setUnlocalizedName(ItemLib.WARDEN_AMULET_NAME); setCreativeTab(TWarden.tabTWarden); } @Override public EnumRarity getRarity(ItemStack par1ItemStack) {return EnumRarity.rare;} @Override @SideOnly(Side.CLIENT) public void registerIcons(IIconRegister register) {
// Path: src/main/java/matgm50/twarden/TWarden.java // @Mod(modid = ModLib.ID, name = ModLib.NAME, version = ModLib.VERSION, dependencies = ModLib.DEPENDENCIES) // // public class TWarden { // // @Instance(ModLib.ID) // public static TWarden instance; // // @SidedProxy(serverSide = ModLib.COMMONPROXY, clientSide = ModLib.CLIENTPROXY) // public static CommonProxy proxy; // // public static CreativeTabs tabTWarden = new TabTWarden(ModLib.ID); // // @EventHandler // public void preInit(FMLPreInitializationEvent event) { // // proxy.initRenderers(); // GuiHandler.init(); // // WardenicChargeEvents.init(); // WardenicUpgrades.init(); // // ModItems.init(); // ModBlocks.init(); // ModEntities.init(); // ModGen.init(); // // } // // @EventHandler // public void init(FMLInitializationEvent event) { // // } // // @EventHandler // public void postInit(FMLPostInitializationEvent event) { // // ModRecipes.init(); // ModResearch.init(); // // } // // } // // Path: src/main/java/matgm50/twarden/lib/ItemLib.java // public class ItemLib { // // public static final String RESOURCE_NAME = "itemResource"; // public static final String[] RESOURCE_ICON = {"wardenpetal", "wardenstone", "wardenquartz"}; // // public static final String WARDEN_AMULET_NAME = "itemWardenAmulet"; // public static final String WARDEN_WEAPON_NAME = "itemWardenWeapon"; // public static final String WARDEN_HELM_NAME = "itemWardenHelm"; // public static final String WARDEN_CHEST_NAME = "itemWardenChest"; // public static final String WARDEN_LEGS_NAME = "itemWardenLegs"; // public static final String WARDEN_BOOTS_NAME = "itemWardenBoots"; // public static final String PURITY_FOCUS_NAME = "itemFocusPurity"; // public static final String LOVE_RING_NAME = "itemLoveRing"; // public static final String WASLIE_HAMMER_NAME = "itemWaslieHammer"; // public static final String ILLUMI_FOCUS_NAME = "itemFocusIllumination"; // // } // // Path: src/main/java/matgm50/twarden/lib/ModLib.java // public class ModLib { // // public static final String ID = "TWarden"; // public static final String NAME = "Thaumic Warden"; // public static final String VERSION = "1.1.1"; // public static final String DEPENDENCIES = "required-after:Thaumcraft"; // // public static final String CLIENTPROXY = "matgm50.twarden.proxy.ClientProxy"; // public static final String COMMONPROXY = "matgm50.twarden.proxy.CommonProxy"; // // } // Path: src/main/java/matgm50/twarden/item/ItemWardenAmulet.java import baubles.api.BaubleType; import baubles.api.IBauble; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import matgm50.twarden.TWarden; import matgm50.twarden.lib.ItemLib; import matgm50.twarden.lib.ModLib; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.EnumRarity; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.potion.Potion; import thaumcraft.common.config.Config; package matgm50.twarden.item; /** * Created by MasterAbdoTGM50 on 5/22/2014. */ public class ItemWardenAmulet extends Item implements IBauble { public ItemWardenAmulet() { super(); setUnlocalizedName(ItemLib.WARDEN_AMULET_NAME); setCreativeTab(TWarden.tabTWarden); } @Override public EnumRarity getRarity(ItemStack par1ItemStack) {return EnumRarity.rare;} @Override @SideOnly(Side.CLIENT) public void registerIcons(IIconRegister register) {
itemIcon = register.registerIcon(ModLib.ID.toLowerCase() + ":" + "wardenamulet");
MasterAbdoTGM50/ThaumicWarden
src/main/java/matgm50/twarden/block/BlockExubitura.java
// Path: src/main/java/matgm50/twarden/TWarden.java // @Mod(modid = ModLib.ID, name = ModLib.NAME, version = ModLib.VERSION, dependencies = ModLib.DEPENDENCIES) // // public class TWarden { // // @Instance(ModLib.ID) // public static TWarden instance; // // @SidedProxy(serverSide = ModLib.COMMONPROXY, clientSide = ModLib.CLIENTPROXY) // public static CommonProxy proxy; // // public static CreativeTabs tabTWarden = new TabTWarden(ModLib.ID); // // @EventHandler // public void preInit(FMLPreInitializationEvent event) { // // proxy.initRenderers(); // GuiHandler.init(); // // WardenicChargeEvents.init(); // WardenicUpgrades.init(); // // ModItems.init(); // ModBlocks.init(); // ModEntities.init(); // ModGen.init(); // // } // // @EventHandler // public void init(FMLInitializationEvent event) { // // } // // @EventHandler // public void postInit(FMLPostInitializationEvent event) { // // ModRecipes.init(); // ModResearch.init(); // // } // // } // // Path: src/main/java/matgm50/twarden/item/ModItems.java // public class ModItems { // // public static ArmorMaterial materialWarden = EnumHelper.addArmorMaterial("WARDEN", 33, new int[]{3, 8, 6, 3}, 50); // // public static Item itemResource = new ItemResource(); // public static Item itemWardenAmulet = new ItemWardenAmulet(); // public static Item itemWardenSword = new ItemWardenWeapon(); // public static Item itemFocusPurity = new ItemFocusPurity(); // public static Item itemWardenHelm = new ItemWardenHelm(); // public static Item itemWardenChest = new ItemWardenChest(); // public static Item itemWardenLegs = new ItemWardenLegs(); // public static Item itemWardenBoots = new ItemWardenBoots(); // public static Item itemLoveRing = new ItemLoveRing(); // public static Item itemWaslieHammer = new ItemWaslieHammer(); // public static Item itemFocusIllumination = new ItemFocusIllumination(); // // public static void init() { // // GameRegistry.registerItem(itemResource, ItemLib.RESOURCE_NAME); // GameRegistry.registerItem(itemFocusPurity, ItemLib.PURITY_FOCUS_NAME); // GameRegistry.registerItem(itemWardenSword, ItemLib.WARDEN_WEAPON_NAME); // GameRegistry.registerItem(itemWardenAmulet, ItemLib.WARDEN_AMULET_NAME); // GameRegistry.registerItem(itemWardenHelm, ItemLib.WARDEN_HELM_NAME); // GameRegistry.registerItem(itemWardenChest, ItemLib.WARDEN_CHEST_NAME); // GameRegistry.registerItem(itemWardenLegs, ItemLib.WARDEN_LEGS_NAME); // GameRegistry.registerItem(itemWardenBoots, ItemLib.WARDEN_BOOTS_NAME); // GameRegistry.registerItem(itemLoveRing, ItemLib.LOVE_RING_NAME); // GameRegistry.registerItem(itemWaslieHammer, ItemLib.WASLIE_HAMMER_NAME); // GameRegistry.registerItem(itemFocusIllumination, ItemLib.ILLUMI_FOCUS_NAME); // // } // // } // // Path: src/main/java/matgm50/twarden/lib/BlockLib.java // public class BlockLib { // // public static final String EXUBITURA_NAME = "blockExubitura"; // public static final String QUARTZ_NORMAL_NAME = "blockInfusedQuartzNormal"; // public static final String QUARTZ_SLAB_NAME = "blockInfusedQuartzSlab"; // public static final String QUARTZ_STAIR_NAME = "blockInfusedQuartzStair"; // public static final String QUARTZ_CHISELED_NAME = "blockInfusedQuartzChiseled"; // public static final String QUARTZ_PILLAR_NAME = "blockInfusedQuartzPillar"; // public static final String BLOCK_WITOR_NAME = "blockWitor"; // public static final String TILE_WITOR_NAME = "tileWitor"; // // } // // Path: src/main/java/matgm50/twarden/lib/ModLib.java // public class ModLib { // // public static final String ID = "TWarden"; // public static final String NAME = "Thaumic Warden"; // public static final String VERSION = "1.1.1"; // public static final String DEPENDENCIES = "required-after:Thaumcraft"; // // public static final String CLIENTPROXY = "matgm50.twarden.proxy.ClientProxy"; // public static final String COMMONPROXY = "matgm50.twarden.proxy.CommonProxy"; // // }
import matgm50.twarden.TWarden; import matgm50.twarden.item.ModItems; import matgm50.twarden.lib.BlockLib; import matgm50.twarden.lib.ModLib; import net.minecraft.block.Block; import net.minecraft.block.BlockBush; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.item.Item; import java.util.Random;
package matgm50.twarden.block; /** * Created by MasterAbdoTGM50 on 5/22/2014. */ public class BlockExubitura extends BlockBush{ protected BlockExubitura() { super(Material.plants);
// Path: src/main/java/matgm50/twarden/TWarden.java // @Mod(modid = ModLib.ID, name = ModLib.NAME, version = ModLib.VERSION, dependencies = ModLib.DEPENDENCIES) // // public class TWarden { // // @Instance(ModLib.ID) // public static TWarden instance; // // @SidedProxy(serverSide = ModLib.COMMONPROXY, clientSide = ModLib.CLIENTPROXY) // public static CommonProxy proxy; // // public static CreativeTabs tabTWarden = new TabTWarden(ModLib.ID); // // @EventHandler // public void preInit(FMLPreInitializationEvent event) { // // proxy.initRenderers(); // GuiHandler.init(); // // WardenicChargeEvents.init(); // WardenicUpgrades.init(); // // ModItems.init(); // ModBlocks.init(); // ModEntities.init(); // ModGen.init(); // // } // // @EventHandler // public void init(FMLInitializationEvent event) { // // } // // @EventHandler // public void postInit(FMLPostInitializationEvent event) { // // ModRecipes.init(); // ModResearch.init(); // // } // // } // // Path: src/main/java/matgm50/twarden/item/ModItems.java // public class ModItems { // // public static ArmorMaterial materialWarden = EnumHelper.addArmorMaterial("WARDEN", 33, new int[]{3, 8, 6, 3}, 50); // // public static Item itemResource = new ItemResource(); // public static Item itemWardenAmulet = new ItemWardenAmulet(); // public static Item itemWardenSword = new ItemWardenWeapon(); // public static Item itemFocusPurity = new ItemFocusPurity(); // public static Item itemWardenHelm = new ItemWardenHelm(); // public static Item itemWardenChest = new ItemWardenChest(); // public static Item itemWardenLegs = new ItemWardenLegs(); // public static Item itemWardenBoots = new ItemWardenBoots(); // public static Item itemLoveRing = new ItemLoveRing(); // public static Item itemWaslieHammer = new ItemWaslieHammer(); // public static Item itemFocusIllumination = new ItemFocusIllumination(); // // public static void init() { // // GameRegistry.registerItem(itemResource, ItemLib.RESOURCE_NAME); // GameRegistry.registerItem(itemFocusPurity, ItemLib.PURITY_FOCUS_NAME); // GameRegistry.registerItem(itemWardenSword, ItemLib.WARDEN_WEAPON_NAME); // GameRegistry.registerItem(itemWardenAmulet, ItemLib.WARDEN_AMULET_NAME); // GameRegistry.registerItem(itemWardenHelm, ItemLib.WARDEN_HELM_NAME); // GameRegistry.registerItem(itemWardenChest, ItemLib.WARDEN_CHEST_NAME); // GameRegistry.registerItem(itemWardenLegs, ItemLib.WARDEN_LEGS_NAME); // GameRegistry.registerItem(itemWardenBoots, ItemLib.WARDEN_BOOTS_NAME); // GameRegistry.registerItem(itemLoveRing, ItemLib.LOVE_RING_NAME); // GameRegistry.registerItem(itemWaslieHammer, ItemLib.WASLIE_HAMMER_NAME); // GameRegistry.registerItem(itemFocusIllumination, ItemLib.ILLUMI_FOCUS_NAME); // // } // // } // // Path: src/main/java/matgm50/twarden/lib/BlockLib.java // public class BlockLib { // // public static final String EXUBITURA_NAME = "blockExubitura"; // public static final String QUARTZ_NORMAL_NAME = "blockInfusedQuartzNormal"; // public static final String QUARTZ_SLAB_NAME = "blockInfusedQuartzSlab"; // public static final String QUARTZ_STAIR_NAME = "blockInfusedQuartzStair"; // public static final String QUARTZ_CHISELED_NAME = "blockInfusedQuartzChiseled"; // public static final String QUARTZ_PILLAR_NAME = "blockInfusedQuartzPillar"; // public static final String BLOCK_WITOR_NAME = "blockWitor"; // public static final String TILE_WITOR_NAME = "tileWitor"; // // } // // Path: src/main/java/matgm50/twarden/lib/ModLib.java // public class ModLib { // // public static final String ID = "TWarden"; // public static final String NAME = "Thaumic Warden"; // public static final String VERSION = "1.1.1"; // public static final String DEPENDENCIES = "required-after:Thaumcraft"; // // public static final String CLIENTPROXY = "matgm50.twarden.proxy.ClientProxy"; // public static final String COMMONPROXY = "matgm50.twarden.proxy.CommonProxy"; // // } // Path: src/main/java/matgm50/twarden/block/BlockExubitura.java import matgm50.twarden.TWarden; import matgm50.twarden.item.ModItems; import matgm50.twarden.lib.BlockLib; import matgm50.twarden.lib.ModLib; import net.minecraft.block.Block; import net.minecraft.block.BlockBush; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.item.Item; import java.util.Random; package matgm50.twarden.block; /** * Created by MasterAbdoTGM50 on 5/22/2014. */ public class BlockExubitura extends BlockBush{ protected BlockExubitura() { super(Material.plants);
setBlockName(BlockLib.EXUBITURA_NAME);
MasterAbdoTGM50/ThaumicWarden
src/main/java/matgm50/twarden/block/BlockExubitura.java
// Path: src/main/java/matgm50/twarden/TWarden.java // @Mod(modid = ModLib.ID, name = ModLib.NAME, version = ModLib.VERSION, dependencies = ModLib.DEPENDENCIES) // // public class TWarden { // // @Instance(ModLib.ID) // public static TWarden instance; // // @SidedProxy(serverSide = ModLib.COMMONPROXY, clientSide = ModLib.CLIENTPROXY) // public static CommonProxy proxy; // // public static CreativeTabs tabTWarden = new TabTWarden(ModLib.ID); // // @EventHandler // public void preInit(FMLPreInitializationEvent event) { // // proxy.initRenderers(); // GuiHandler.init(); // // WardenicChargeEvents.init(); // WardenicUpgrades.init(); // // ModItems.init(); // ModBlocks.init(); // ModEntities.init(); // ModGen.init(); // // } // // @EventHandler // public void init(FMLInitializationEvent event) { // // } // // @EventHandler // public void postInit(FMLPostInitializationEvent event) { // // ModRecipes.init(); // ModResearch.init(); // // } // // } // // Path: src/main/java/matgm50/twarden/item/ModItems.java // public class ModItems { // // public static ArmorMaterial materialWarden = EnumHelper.addArmorMaterial("WARDEN", 33, new int[]{3, 8, 6, 3}, 50); // // public static Item itemResource = new ItemResource(); // public static Item itemWardenAmulet = new ItemWardenAmulet(); // public static Item itemWardenSword = new ItemWardenWeapon(); // public static Item itemFocusPurity = new ItemFocusPurity(); // public static Item itemWardenHelm = new ItemWardenHelm(); // public static Item itemWardenChest = new ItemWardenChest(); // public static Item itemWardenLegs = new ItemWardenLegs(); // public static Item itemWardenBoots = new ItemWardenBoots(); // public static Item itemLoveRing = new ItemLoveRing(); // public static Item itemWaslieHammer = new ItemWaslieHammer(); // public static Item itemFocusIllumination = new ItemFocusIllumination(); // // public static void init() { // // GameRegistry.registerItem(itemResource, ItemLib.RESOURCE_NAME); // GameRegistry.registerItem(itemFocusPurity, ItemLib.PURITY_FOCUS_NAME); // GameRegistry.registerItem(itemWardenSword, ItemLib.WARDEN_WEAPON_NAME); // GameRegistry.registerItem(itemWardenAmulet, ItemLib.WARDEN_AMULET_NAME); // GameRegistry.registerItem(itemWardenHelm, ItemLib.WARDEN_HELM_NAME); // GameRegistry.registerItem(itemWardenChest, ItemLib.WARDEN_CHEST_NAME); // GameRegistry.registerItem(itemWardenLegs, ItemLib.WARDEN_LEGS_NAME); // GameRegistry.registerItem(itemWardenBoots, ItemLib.WARDEN_BOOTS_NAME); // GameRegistry.registerItem(itemLoveRing, ItemLib.LOVE_RING_NAME); // GameRegistry.registerItem(itemWaslieHammer, ItemLib.WASLIE_HAMMER_NAME); // GameRegistry.registerItem(itemFocusIllumination, ItemLib.ILLUMI_FOCUS_NAME); // // } // // } // // Path: src/main/java/matgm50/twarden/lib/BlockLib.java // public class BlockLib { // // public static final String EXUBITURA_NAME = "blockExubitura"; // public static final String QUARTZ_NORMAL_NAME = "blockInfusedQuartzNormal"; // public static final String QUARTZ_SLAB_NAME = "blockInfusedQuartzSlab"; // public static final String QUARTZ_STAIR_NAME = "blockInfusedQuartzStair"; // public static final String QUARTZ_CHISELED_NAME = "blockInfusedQuartzChiseled"; // public static final String QUARTZ_PILLAR_NAME = "blockInfusedQuartzPillar"; // public static final String BLOCK_WITOR_NAME = "blockWitor"; // public static final String TILE_WITOR_NAME = "tileWitor"; // // } // // Path: src/main/java/matgm50/twarden/lib/ModLib.java // public class ModLib { // // public static final String ID = "TWarden"; // public static final String NAME = "Thaumic Warden"; // public static final String VERSION = "1.1.1"; // public static final String DEPENDENCIES = "required-after:Thaumcraft"; // // public static final String CLIENTPROXY = "matgm50.twarden.proxy.ClientProxy"; // public static final String COMMONPROXY = "matgm50.twarden.proxy.CommonProxy"; // // }
import matgm50.twarden.TWarden; import matgm50.twarden.item.ModItems; import matgm50.twarden.lib.BlockLib; import matgm50.twarden.lib.ModLib; import net.minecraft.block.Block; import net.minecraft.block.BlockBush; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.item.Item; import java.util.Random;
package matgm50.twarden.block; /** * Created by MasterAbdoTGM50 on 5/22/2014. */ public class BlockExubitura extends BlockBush{ protected BlockExubitura() { super(Material.plants); setBlockName(BlockLib.EXUBITURA_NAME);
// Path: src/main/java/matgm50/twarden/TWarden.java // @Mod(modid = ModLib.ID, name = ModLib.NAME, version = ModLib.VERSION, dependencies = ModLib.DEPENDENCIES) // // public class TWarden { // // @Instance(ModLib.ID) // public static TWarden instance; // // @SidedProxy(serverSide = ModLib.COMMONPROXY, clientSide = ModLib.CLIENTPROXY) // public static CommonProxy proxy; // // public static CreativeTabs tabTWarden = new TabTWarden(ModLib.ID); // // @EventHandler // public void preInit(FMLPreInitializationEvent event) { // // proxy.initRenderers(); // GuiHandler.init(); // // WardenicChargeEvents.init(); // WardenicUpgrades.init(); // // ModItems.init(); // ModBlocks.init(); // ModEntities.init(); // ModGen.init(); // // } // // @EventHandler // public void init(FMLInitializationEvent event) { // // } // // @EventHandler // public void postInit(FMLPostInitializationEvent event) { // // ModRecipes.init(); // ModResearch.init(); // // } // // } // // Path: src/main/java/matgm50/twarden/item/ModItems.java // public class ModItems { // // public static ArmorMaterial materialWarden = EnumHelper.addArmorMaterial("WARDEN", 33, new int[]{3, 8, 6, 3}, 50); // // public static Item itemResource = new ItemResource(); // public static Item itemWardenAmulet = new ItemWardenAmulet(); // public static Item itemWardenSword = new ItemWardenWeapon(); // public static Item itemFocusPurity = new ItemFocusPurity(); // public static Item itemWardenHelm = new ItemWardenHelm(); // public static Item itemWardenChest = new ItemWardenChest(); // public static Item itemWardenLegs = new ItemWardenLegs(); // public static Item itemWardenBoots = new ItemWardenBoots(); // public static Item itemLoveRing = new ItemLoveRing(); // public static Item itemWaslieHammer = new ItemWaslieHammer(); // public static Item itemFocusIllumination = new ItemFocusIllumination(); // // public static void init() { // // GameRegistry.registerItem(itemResource, ItemLib.RESOURCE_NAME); // GameRegistry.registerItem(itemFocusPurity, ItemLib.PURITY_FOCUS_NAME); // GameRegistry.registerItem(itemWardenSword, ItemLib.WARDEN_WEAPON_NAME); // GameRegistry.registerItem(itemWardenAmulet, ItemLib.WARDEN_AMULET_NAME); // GameRegistry.registerItem(itemWardenHelm, ItemLib.WARDEN_HELM_NAME); // GameRegistry.registerItem(itemWardenChest, ItemLib.WARDEN_CHEST_NAME); // GameRegistry.registerItem(itemWardenLegs, ItemLib.WARDEN_LEGS_NAME); // GameRegistry.registerItem(itemWardenBoots, ItemLib.WARDEN_BOOTS_NAME); // GameRegistry.registerItem(itemLoveRing, ItemLib.LOVE_RING_NAME); // GameRegistry.registerItem(itemWaslieHammer, ItemLib.WASLIE_HAMMER_NAME); // GameRegistry.registerItem(itemFocusIllumination, ItemLib.ILLUMI_FOCUS_NAME); // // } // // } // // Path: src/main/java/matgm50/twarden/lib/BlockLib.java // public class BlockLib { // // public static final String EXUBITURA_NAME = "blockExubitura"; // public static final String QUARTZ_NORMAL_NAME = "blockInfusedQuartzNormal"; // public static final String QUARTZ_SLAB_NAME = "blockInfusedQuartzSlab"; // public static final String QUARTZ_STAIR_NAME = "blockInfusedQuartzStair"; // public static final String QUARTZ_CHISELED_NAME = "blockInfusedQuartzChiseled"; // public static final String QUARTZ_PILLAR_NAME = "blockInfusedQuartzPillar"; // public static final String BLOCK_WITOR_NAME = "blockWitor"; // public static final String TILE_WITOR_NAME = "tileWitor"; // // } // // Path: src/main/java/matgm50/twarden/lib/ModLib.java // public class ModLib { // // public static final String ID = "TWarden"; // public static final String NAME = "Thaumic Warden"; // public static final String VERSION = "1.1.1"; // public static final String DEPENDENCIES = "required-after:Thaumcraft"; // // public static final String CLIENTPROXY = "matgm50.twarden.proxy.ClientProxy"; // public static final String COMMONPROXY = "matgm50.twarden.proxy.CommonProxy"; // // } // Path: src/main/java/matgm50/twarden/block/BlockExubitura.java import matgm50.twarden.TWarden; import matgm50.twarden.item.ModItems; import matgm50.twarden.lib.BlockLib; import matgm50.twarden.lib.ModLib; import net.minecraft.block.Block; import net.minecraft.block.BlockBush; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.item.Item; import java.util.Random; package matgm50.twarden.block; /** * Created by MasterAbdoTGM50 on 5/22/2014. */ public class BlockExubitura extends BlockBush{ protected BlockExubitura() { super(Material.plants); setBlockName(BlockLib.EXUBITURA_NAME);
setCreativeTab(TWarden.tabTWarden);
MasterAbdoTGM50/ThaumicWarden
src/main/java/matgm50/twarden/block/BlockExubitura.java
// Path: src/main/java/matgm50/twarden/TWarden.java // @Mod(modid = ModLib.ID, name = ModLib.NAME, version = ModLib.VERSION, dependencies = ModLib.DEPENDENCIES) // // public class TWarden { // // @Instance(ModLib.ID) // public static TWarden instance; // // @SidedProxy(serverSide = ModLib.COMMONPROXY, clientSide = ModLib.CLIENTPROXY) // public static CommonProxy proxy; // // public static CreativeTabs tabTWarden = new TabTWarden(ModLib.ID); // // @EventHandler // public void preInit(FMLPreInitializationEvent event) { // // proxy.initRenderers(); // GuiHandler.init(); // // WardenicChargeEvents.init(); // WardenicUpgrades.init(); // // ModItems.init(); // ModBlocks.init(); // ModEntities.init(); // ModGen.init(); // // } // // @EventHandler // public void init(FMLInitializationEvent event) { // // } // // @EventHandler // public void postInit(FMLPostInitializationEvent event) { // // ModRecipes.init(); // ModResearch.init(); // // } // // } // // Path: src/main/java/matgm50/twarden/item/ModItems.java // public class ModItems { // // public static ArmorMaterial materialWarden = EnumHelper.addArmorMaterial("WARDEN", 33, new int[]{3, 8, 6, 3}, 50); // // public static Item itemResource = new ItemResource(); // public static Item itemWardenAmulet = new ItemWardenAmulet(); // public static Item itemWardenSword = new ItemWardenWeapon(); // public static Item itemFocusPurity = new ItemFocusPurity(); // public static Item itemWardenHelm = new ItemWardenHelm(); // public static Item itemWardenChest = new ItemWardenChest(); // public static Item itemWardenLegs = new ItemWardenLegs(); // public static Item itemWardenBoots = new ItemWardenBoots(); // public static Item itemLoveRing = new ItemLoveRing(); // public static Item itemWaslieHammer = new ItemWaslieHammer(); // public static Item itemFocusIllumination = new ItemFocusIllumination(); // // public static void init() { // // GameRegistry.registerItem(itemResource, ItemLib.RESOURCE_NAME); // GameRegistry.registerItem(itemFocusPurity, ItemLib.PURITY_FOCUS_NAME); // GameRegistry.registerItem(itemWardenSword, ItemLib.WARDEN_WEAPON_NAME); // GameRegistry.registerItem(itemWardenAmulet, ItemLib.WARDEN_AMULET_NAME); // GameRegistry.registerItem(itemWardenHelm, ItemLib.WARDEN_HELM_NAME); // GameRegistry.registerItem(itemWardenChest, ItemLib.WARDEN_CHEST_NAME); // GameRegistry.registerItem(itemWardenLegs, ItemLib.WARDEN_LEGS_NAME); // GameRegistry.registerItem(itemWardenBoots, ItemLib.WARDEN_BOOTS_NAME); // GameRegistry.registerItem(itemLoveRing, ItemLib.LOVE_RING_NAME); // GameRegistry.registerItem(itemWaslieHammer, ItemLib.WASLIE_HAMMER_NAME); // GameRegistry.registerItem(itemFocusIllumination, ItemLib.ILLUMI_FOCUS_NAME); // // } // // } // // Path: src/main/java/matgm50/twarden/lib/BlockLib.java // public class BlockLib { // // public static final String EXUBITURA_NAME = "blockExubitura"; // public static final String QUARTZ_NORMAL_NAME = "blockInfusedQuartzNormal"; // public static final String QUARTZ_SLAB_NAME = "blockInfusedQuartzSlab"; // public static final String QUARTZ_STAIR_NAME = "blockInfusedQuartzStair"; // public static final String QUARTZ_CHISELED_NAME = "blockInfusedQuartzChiseled"; // public static final String QUARTZ_PILLAR_NAME = "blockInfusedQuartzPillar"; // public static final String BLOCK_WITOR_NAME = "blockWitor"; // public static final String TILE_WITOR_NAME = "tileWitor"; // // } // // Path: src/main/java/matgm50/twarden/lib/ModLib.java // public class ModLib { // // public static final String ID = "TWarden"; // public static final String NAME = "Thaumic Warden"; // public static final String VERSION = "1.1.1"; // public static final String DEPENDENCIES = "required-after:Thaumcraft"; // // public static final String CLIENTPROXY = "matgm50.twarden.proxy.ClientProxy"; // public static final String COMMONPROXY = "matgm50.twarden.proxy.CommonProxy"; // // }
import matgm50.twarden.TWarden; import matgm50.twarden.item.ModItems; import matgm50.twarden.lib.BlockLib; import matgm50.twarden.lib.ModLib; import net.minecraft.block.Block; import net.minecraft.block.BlockBush; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.item.Item; import java.util.Random;
package matgm50.twarden.block; /** * Created by MasterAbdoTGM50 on 5/22/2014. */ public class BlockExubitura extends BlockBush{ protected BlockExubitura() { super(Material.plants); setBlockName(BlockLib.EXUBITURA_NAME); setCreativeTab(TWarden.tabTWarden); setStepSound(Block.soundTypeGrass); } @Override public Item getItemDropped(int par1, Random random, int par2) {
// Path: src/main/java/matgm50/twarden/TWarden.java // @Mod(modid = ModLib.ID, name = ModLib.NAME, version = ModLib.VERSION, dependencies = ModLib.DEPENDENCIES) // // public class TWarden { // // @Instance(ModLib.ID) // public static TWarden instance; // // @SidedProxy(serverSide = ModLib.COMMONPROXY, clientSide = ModLib.CLIENTPROXY) // public static CommonProxy proxy; // // public static CreativeTabs tabTWarden = new TabTWarden(ModLib.ID); // // @EventHandler // public void preInit(FMLPreInitializationEvent event) { // // proxy.initRenderers(); // GuiHandler.init(); // // WardenicChargeEvents.init(); // WardenicUpgrades.init(); // // ModItems.init(); // ModBlocks.init(); // ModEntities.init(); // ModGen.init(); // // } // // @EventHandler // public void init(FMLInitializationEvent event) { // // } // // @EventHandler // public void postInit(FMLPostInitializationEvent event) { // // ModRecipes.init(); // ModResearch.init(); // // } // // } // // Path: src/main/java/matgm50/twarden/item/ModItems.java // public class ModItems { // // public static ArmorMaterial materialWarden = EnumHelper.addArmorMaterial("WARDEN", 33, new int[]{3, 8, 6, 3}, 50); // // public static Item itemResource = new ItemResource(); // public static Item itemWardenAmulet = new ItemWardenAmulet(); // public static Item itemWardenSword = new ItemWardenWeapon(); // public static Item itemFocusPurity = new ItemFocusPurity(); // public static Item itemWardenHelm = new ItemWardenHelm(); // public static Item itemWardenChest = new ItemWardenChest(); // public static Item itemWardenLegs = new ItemWardenLegs(); // public static Item itemWardenBoots = new ItemWardenBoots(); // public static Item itemLoveRing = new ItemLoveRing(); // public static Item itemWaslieHammer = new ItemWaslieHammer(); // public static Item itemFocusIllumination = new ItemFocusIllumination(); // // public static void init() { // // GameRegistry.registerItem(itemResource, ItemLib.RESOURCE_NAME); // GameRegistry.registerItem(itemFocusPurity, ItemLib.PURITY_FOCUS_NAME); // GameRegistry.registerItem(itemWardenSword, ItemLib.WARDEN_WEAPON_NAME); // GameRegistry.registerItem(itemWardenAmulet, ItemLib.WARDEN_AMULET_NAME); // GameRegistry.registerItem(itemWardenHelm, ItemLib.WARDEN_HELM_NAME); // GameRegistry.registerItem(itemWardenChest, ItemLib.WARDEN_CHEST_NAME); // GameRegistry.registerItem(itemWardenLegs, ItemLib.WARDEN_LEGS_NAME); // GameRegistry.registerItem(itemWardenBoots, ItemLib.WARDEN_BOOTS_NAME); // GameRegistry.registerItem(itemLoveRing, ItemLib.LOVE_RING_NAME); // GameRegistry.registerItem(itemWaslieHammer, ItemLib.WASLIE_HAMMER_NAME); // GameRegistry.registerItem(itemFocusIllumination, ItemLib.ILLUMI_FOCUS_NAME); // // } // // } // // Path: src/main/java/matgm50/twarden/lib/BlockLib.java // public class BlockLib { // // public static final String EXUBITURA_NAME = "blockExubitura"; // public static final String QUARTZ_NORMAL_NAME = "blockInfusedQuartzNormal"; // public static final String QUARTZ_SLAB_NAME = "blockInfusedQuartzSlab"; // public static final String QUARTZ_STAIR_NAME = "blockInfusedQuartzStair"; // public static final String QUARTZ_CHISELED_NAME = "blockInfusedQuartzChiseled"; // public static final String QUARTZ_PILLAR_NAME = "blockInfusedQuartzPillar"; // public static final String BLOCK_WITOR_NAME = "blockWitor"; // public static final String TILE_WITOR_NAME = "tileWitor"; // // } // // Path: src/main/java/matgm50/twarden/lib/ModLib.java // public class ModLib { // // public static final String ID = "TWarden"; // public static final String NAME = "Thaumic Warden"; // public static final String VERSION = "1.1.1"; // public static final String DEPENDENCIES = "required-after:Thaumcraft"; // // public static final String CLIENTPROXY = "matgm50.twarden.proxy.ClientProxy"; // public static final String COMMONPROXY = "matgm50.twarden.proxy.CommonProxy"; // // } // Path: src/main/java/matgm50/twarden/block/BlockExubitura.java import matgm50.twarden.TWarden; import matgm50.twarden.item.ModItems; import matgm50.twarden.lib.BlockLib; import matgm50.twarden.lib.ModLib; import net.minecraft.block.Block; import net.minecraft.block.BlockBush; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.item.Item; import java.util.Random; package matgm50.twarden.block; /** * Created by MasterAbdoTGM50 on 5/22/2014. */ public class BlockExubitura extends BlockBush{ protected BlockExubitura() { super(Material.plants); setBlockName(BlockLib.EXUBITURA_NAME); setCreativeTab(TWarden.tabTWarden); setStepSound(Block.soundTypeGrass); } @Override public Item getItemDropped(int par1, Random random, int par2) {
return ModItems.itemResource;
MasterAbdoTGM50/ThaumicWarden
src/main/java/matgm50/twarden/block/BlockExubitura.java
// Path: src/main/java/matgm50/twarden/TWarden.java // @Mod(modid = ModLib.ID, name = ModLib.NAME, version = ModLib.VERSION, dependencies = ModLib.DEPENDENCIES) // // public class TWarden { // // @Instance(ModLib.ID) // public static TWarden instance; // // @SidedProxy(serverSide = ModLib.COMMONPROXY, clientSide = ModLib.CLIENTPROXY) // public static CommonProxy proxy; // // public static CreativeTabs tabTWarden = new TabTWarden(ModLib.ID); // // @EventHandler // public void preInit(FMLPreInitializationEvent event) { // // proxy.initRenderers(); // GuiHandler.init(); // // WardenicChargeEvents.init(); // WardenicUpgrades.init(); // // ModItems.init(); // ModBlocks.init(); // ModEntities.init(); // ModGen.init(); // // } // // @EventHandler // public void init(FMLInitializationEvent event) { // // } // // @EventHandler // public void postInit(FMLPostInitializationEvent event) { // // ModRecipes.init(); // ModResearch.init(); // // } // // } // // Path: src/main/java/matgm50/twarden/item/ModItems.java // public class ModItems { // // public static ArmorMaterial materialWarden = EnumHelper.addArmorMaterial("WARDEN", 33, new int[]{3, 8, 6, 3}, 50); // // public static Item itemResource = new ItemResource(); // public static Item itemWardenAmulet = new ItemWardenAmulet(); // public static Item itemWardenSword = new ItemWardenWeapon(); // public static Item itemFocusPurity = new ItemFocusPurity(); // public static Item itemWardenHelm = new ItemWardenHelm(); // public static Item itemWardenChest = new ItemWardenChest(); // public static Item itemWardenLegs = new ItemWardenLegs(); // public static Item itemWardenBoots = new ItemWardenBoots(); // public static Item itemLoveRing = new ItemLoveRing(); // public static Item itemWaslieHammer = new ItemWaslieHammer(); // public static Item itemFocusIllumination = new ItemFocusIllumination(); // // public static void init() { // // GameRegistry.registerItem(itemResource, ItemLib.RESOURCE_NAME); // GameRegistry.registerItem(itemFocusPurity, ItemLib.PURITY_FOCUS_NAME); // GameRegistry.registerItem(itemWardenSword, ItemLib.WARDEN_WEAPON_NAME); // GameRegistry.registerItem(itemWardenAmulet, ItemLib.WARDEN_AMULET_NAME); // GameRegistry.registerItem(itemWardenHelm, ItemLib.WARDEN_HELM_NAME); // GameRegistry.registerItem(itemWardenChest, ItemLib.WARDEN_CHEST_NAME); // GameRegistry.registerItem(itemWardenLegs, ItemLib.WARDEN_LEGS_NAME); // GameRegistry.registerItem(itemWardenBoots, ItemLib.WARDEN_BOOTS_NAME); // GameRegistry.registerItem(itemLoveRing, ItemLib.LOVE_RING_NAME); // GameRegistry.registerItem(itemWaslieHammer, ItemLib.WASLIE_HAMMER_NAME); // GameRegistry.registerItem(itemFocusIllumination, ItemLib.ILLUMI_FOCUS_NAME); // // } // // } // // Path: src/main/java/matgm50/twarden/lib/BlockLib.java // public class BlockLib { // // public static final String EXUBITURA_NAME = "blockExubitura"; // public static final String QUARTZ_NORMAL_NAME = "blockInfusedQuartzNormal"; // public static final String QUARTZ_SLAB_NAME = "blockInfusedQuartzSlab"; // public static final String QUARTZ_STAIR_NAME = "blockInfusedQuartzStair"; // public static final String QUARTZ_CHISELED_NAME = "blockInfusedQuartzChiseled"; // public static final String QUARTZ_PILLAR_NAME = "blockInfusedQuartzPillar"; // public static final String BLOCK_WITOR_NAME = "blockWitor"; // public static final String TILE_WITOR_NAME = "tileWitor"; // // } // // Path: src/main/java/matgm50/twarden/lib/ModLib.java // public class ModLib { // // public static final String ID = "TWarden"; // public static final String NAME = "Thaumic Warden"; // public static final String VERSION = "1.1.1"; // public static final String DEPENDENCIES = "required-after:Thaumcraft"; // // public static final String CLIENTPROXY = "matgm50.twarden.proxy.ClientProxy"; // public static final String COMMONPROXY = "matgm50.twarden.proxy.CommonProxy"; // // }
import matgm50.twarden.TWarden; import matgm50.twarden.item.ModItems; import matgm50.twarden.lib.BlockLib; import matgm50.twarden.lib.ModLib; import net.minecraft.block.Block; import net.minecraft.block.BlockBush; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.item.Item; import java.util.Random;
package matgm50.twarden.block; /** * Created by MasterAbdoTGM50 on 5/22/2014. */ public class BlockExubitura extends BlockBush{ protected BlockExubitura() { super(Material.plants); setBlockName(BlockLib.EXUBITURA_NAME); setCreativeTab(TWarden.tabTWarden); setStepSound(Block.soundTypeGrass); } @Override public Item getItemDropped(int par1, Random random, int par2) { return ModItems.itemResource; } @Override public int damageDropped(int par1) { return 0; } @Override public void registerBlockIcons(IIconRegister register) {
// Path: src/main/java/matgm50/twarden/TWarden.java // @Mod(modid = ModLib.ID, name = ModLib.NAME, version = ModLib.VERSION, dependencies = ModLib.DEPENDENCIES) // // public class TWarden { // // @Instance(ModLib.ID) // public static TWarden instance; // // @SidedProxy(serverSide = ModLib.COMMONPROXY, clientSide = ModLib.CLIENTPROXY) // public static CommonProxy proxy; // // public static CreativeTabs tabTWarden = new TabTWarden(ModLib.ID); // // @EventHandler // public void preInit(FMLPreInitializationEvent event) { // // proxy.initRenderers(); // GuiHandler.init(); // // WardenicChargeEvents.init(); // WardenicUpgrades.init(); // // ModItems.init(); // ModBlocks.init(); // ModEntities.init(); // ModGen.init(); // // } // // @EventHandler // public void init(FMLInitializationEvent event) { // // } // // @EventHandler // public void postInit(FMLPostInitializationEvent event) { // // ModRecipes.init(); // ModResearch.init(); // // } // // } // // Path: src/main/java/matgm50/twarden/item/ModItems.java // public class ModItems { // // public static ArmorMaterial materialWarden = EnumHelper.addArmorMaterial("WARDEN", 33, new int[]{3, 8, 6, 3}, 50); // // public static Item itemResource = new ItemResource(); // public static Item itemWardenAmulet = new ItemWardenAmulet(); // public static Item itemWardenSword = new ItemWardenWeapon(); // public static Item itemFocusPurity = new ItemFocusPurity(); // public static Item itemWardenHelm = new ItemWardenHelm(); // public static Item itemWardenChest = new ItemWardenChest(); // public static Item itemWardenLegs = new ItemWardenLegs(); // public static Item itemWardenBoots = new ItemWardenBoots(); // public static Item itemLoveRing = new ItemLoveRing(); // public static Item itemWaslieHammer = new ItemWaslieHammer(); // public static Item itemFocusIllumination = new ItemFocusIllumination(); // // public static void init() { // // GameRegistry.registerItem(itemResource, ItemLib.RESOURCE_NAME); // GameRegistry.registerItem(itemFocusPurity, ItemLib.PURITY_FOCUS_NAME); // GameRegistry.registerItem(itemWardenSword, ItemLib.WARDEN_WEAPON_NAME); // GameRegistry.registerItem(itemWardenAmulet, ItemLib.WARDEN_AMULET_NAME); // GameRegistry.registerItem(itemWardenHelm, ItemLib.WARDEN_HELM_NAME); // GameRegistry.registerItem(itemWardenChest, ItemLib.WARDEN_CHEST_NAME); // GameRegistry.registerItem(itemWardenLegs, ItemLib.WARDEN_LEGS_NAME); // GameRegistry.registerItem(itemWardenBoots, ItemLib.WARDEN_BOOTS_NAME); // GameRegistry.registerItem(itemLoveRing, ItemLib.LOVE_RING_NAME); // GameRegistry.registerItem(itemWaslieHammer, ItemLib.WASLIE_HAMMER_NAME); // GameRegistry.registerItem(itemFocusIllumination, ItemLib.ILLUMI_FOCUS_NAME); // // } // // } // // Path: src/main/java/matgm50/twarden/lib/BlockLib.java // public class BlockLib { // // public static final String EXUBITURA_NAME = "blockExubitura"; // public static final String QUARTZ_NORMAL_NAME = "blockInfusedQuartzNormal"; // public static final String QUARTZ_SLAB_NAME = "blockInfusedQuartzSlab"; // public static final String QUARTZ_STAIR_NAME = "blockInfusedQuartzStair"; // public static final String QUARTZ_CHISELED_NAME = "blockInfusedQuartzChiseled"; // public static final String QUARTZ_PILLAR_NAME = "blockInfusedQuartzPillar"; // public static final String BLOCK_WITOR_NAME = "blockWitor"; // public static final String TILE_WITOR_NAME = "tileWitor"; // // } // // Path: src/main/java/matgm50/twarden/lib/ModLib.java // public class ModLib { // // public static final String ID = "TWarden"; // public static final String NAME = "Thaumic Warden"; // public static final String VERSION = "1.1.1"; // public static final String DEPENDENCIES = "required-after:Thaumcraft"; // // public static final String CLIENTPROXY = "matgm50.twarden.proxy.ClientProxy"; // public static final String COMMONPROXY = "matgm50.twarden.proxy.CommonProxy"; // // } // Path: src/main/java/matgm50/twarden/block/BlockExubitura.java import matgm50.twarden.TWarden; import matgm50.twarden.item.ModItems; import matgm50.twarden.lib.BlockLib; import matgm50.twarden.lib.ModLib; import net.minecraft.block.Block; import net.minecraft.block.BlockBush; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.item.Item; import java.util.Random; package matgm50.twarden.block; /** * Created by MasterAbdoTGM50 on 5/22/2014. */ public class BlockExubitura extends BlockBush{ protected BlockExubitura() { super(Material.plants); setBlockName(BlockLib.EXUBITURA_NAME); setCreativeTab(TWarden.tabTWarden); setStepSound(Block.soundTypeGrass); } @Override public Item getItemDropped(int par1, Random random, int par2) { return ModItems.itemResource; } @Override public int damageDropped(int par1) { return 0; } @Override public void registerBlockIcons(IIconRegister register) {
blockIcon = register.registerIcon(ModLib.ID.toLowerCase() + ":" + "exubitura");