diff --git a/examples/sourcemeter_mapping_example.xml b/examples/sourcemeter_mapping_example.xml new file mode 100644 index 00000000..1d140776 --- /dev/null +++ b/examples/sourcemeter_mapping_example.xml @@ -0,0 +1,65 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/sources/codemetropolis-toolchain-commons/.classpath b/sources/codemetropolis-toolchain-commons/.classpath index e7a868fb..277cacad 100644 --- a/sources/codemetropolis-toolchain-commons/.classpath +++ b/sources/codemetropolis-toolchain-commons/.classpath @@ -1,38 +1,10 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + \ No newline at end of file diff --git a/sources/codemetropolis-toolchain-commons/.project b/sources/codemetropolis-toolchain-commons/.project index 1c053230..8a3abdf6 100644 --- a/sources/codemetropolis-toolchain-commons/.project +++ b/sources/codemetropolis-toolchain-commons/.project @@ -1,23 +1,18 @@ - codemetropolis-toolchain-commons - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.m2e.core.maven2Builder - - - - - - org.eclipse.jdt.core.javanature - org.eclipse.m2e.core.maven2Nature - - + codemetropolis-toolchain-commons + NO_M2ECLIPSE_SUPPORT: Project files created with the maven-eclipse-plugin are not supported in M2Eclipse. + + + + org.eclipse.jdt.core.javabuilder + + + org.eclipse.m2e.core.maven2Builder + + + + org.eclipse.jdt.core.javanature + org.eclipse.m2e.core.maven2Nature + + \ No newline at end of file diff --git a/sources/codemetropolis-toolchain-commons/src/main/java/codemetropolis/toolchain/commons/cmxml/Buildable.java b/sources/codemetropolis-toolchain-commons/src/main/java/codemetropolis/toolchain/commons/cmxml/Buildable.java index 6ce6fda9..fb31a568 100644 --- a/sources/codemetropolis-toolchain-commons/src/main/java/codemetropolis/toolchain/commons/cmxml/Buildable.java +++ b/sources/codemetropolis-toolchain-commons/src/main/java/codemetropolis/toolchain/commons/cmxml/Buildable.java @@ -16,7 +16,9 @@ public enum Type { GARDEN, FLOOR, CELLAR, - CONTAINER; + CONTAINER, + + } private String id; @@ -28,6 +30,7 @@ public enum Type { private List children; private Buildable parent; private String cdfNames; + private int BuiltMetric1, BuiltMetric2, BuiltMetric3; public Buildable(String id, String name, Type type) { this(id, name, type, new Point(), new Point()); @@ -165,7 +168,7 @@ public void addAttribute(String name, String value) { name, value ); - attributes.add(a); + attributes.add(a); } public void addAttributes(Attribute... attributes) { @@ -310,6 +313,30 @@ public void setSizeZ(int z) { size.setZ(z); } + public int getBuiltMetric1() { + return BuiltMetric1; + } + + public void setBuiltMetric1(int builtMetric1) { + BuiltMetric1 = builtMetric1; + } + + public int getBuiltMetric2() { + return BuiltMetric2; + } + + public void setBuiltMetric2(int builtMetric2) { + BuiltMetric2 = builtMetric2; + } + + public int getBuiltMetric3() { + return BuiltMetric3; + } + + public void setBuiltMetric3(int builtMetric3) { + BuiltMetric3 = builtMetric3; + } + public Attribute[] getAttributes() { return attributes.toArray(new Attribute[attributes.size()]); } diff --git a/sources/codemetropolis-toolchain-commons/src/main/java/codemetropolis/toolchain/commons/cmxml/BuildableTree.java b/sources/codemetropolis-toolchain-commons/src/main/java/codemetropolis/toolchain/commons/cmxml/BuildableTree.java index 06ebe60b..408459b6 100644 --- a/sources/codemetropolis-toolchain-commons/src/main/java/codemetropolis/toolchain/commons/cmxml/BuildableTree.java +++ b/sources/codemetropolis-toolchain-commons/src/main/java/codemetropolis/toolchain/commons/cmxml/BuildableTree.java @@ -146,14 +146,22 @@ public void loadFromFile(String path) throws CmxmlReaderException { } Point size; + + + if(eElement.getElementsByTagName("size").item(0) != null && eElement.getElementsByTagName("size").item(0).getParentNode() == nNode) { size = new Point( - Integer.parseInt(((Element)eElement.getElementsByTagName("size").item(0)).getAttribute("x")), - Integer.parseInt(((Element)eElement.getElementsByTagName("size").item(0)).getAttribute("y")), - Integer.parseInt(((Element)eElement.getElementsByTagName("size").item(0)).getAttribute("z")) - ); - } else { + Integer.parseInt(((Element) eElement.getElementsByTagName("size").item(0)).getAttribute("x")), + Integer.parseInt(((Element) eElement.getElementsByTagName("size").item(0)).getAttribute("y")), + Integer.parseInt(((Element) eElement.getElementsByTagName("size").item(0)).getAttribute("z")) + ); + + + + } + else { size = new Point(); + } Buildable b = new Buildable( @@ -163,7 +171,8 @@ public void loadFromFile(String path) throws CmxmlReaderException { position, size ); - + + NodeList attributeNodes = eElement.getElementsByTagName("attributes").item(0).getChildNodes(); for(int i = 1; attributeNodes.item(i) != null; i += 2) { @@ -171,6 +180,7 @@ public void loadFromFile(String path) throws CmxmlReaderException { ((Element)attributeNodes.item(i)).getAttribute("name"), ((Element)attributeNodes.item(i)).getAttribute("value") ); + } if(!nNode.getParentNode().getNodeName().equals("buildables")) { diff --git a/sources/codemetropolis-toolchain-commons/src/main/java/codemetropolis/toolchain/commons/util/FileLogger.java b/sources/codemetropolis-toolchain-commons/src/main/java/codemetropolis/toolchain/commons/util/FileLogger.java index 7099fcd8..2649a550 100644 --- a/sources/codemetropolis-toolchain-commons/src/main/java/codemetropolis/toolchain/commons/util/FileLogger.java +++ b/sources/codemetropolis-toolchain-commons/src/main/java/codemetropolis/toolchain/commons/util/FileLogger.java @@ -29,14 +29,17 @@ public static void load(String filePath) { } public static void logInfo(String message) { + if(logger == null) return; logger.log(Level.INFO, message); } public static void logWarning(String message, Exception exception) { + if(logger == null) return; logger.log(Level.WARNING, message, exception); } public static void logError(String message, Exception exception) { + if(logger == null) return; logger.log(Level.SEVERE, message, exception); } diff --git a/sources/codemetropolis-toolchain-converter/.classpath b/sources/codemetropolis-toolchain-converter/.classpath index af1430be..cf7b6e44 100644 --- a/sources/codemetropolis-toolchain-converter/.classpath +++ b/sources/codemetropolis-toolchain-converter/.classpath @@ -1,26 +1,12 @@ - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + \ No newline at end of file diff --git a/sources/codemetropolis-toolchain-converter/.project b/sources/codemetropolis-toolchain-converter/.project index 6d3ab881..570b4dd8 100644 --- a/sources/codemetropolis-toolchain-converter/.project +++ b/sources/codemetropolis-toolchain-converter/.project @@ -1,23 +1,20 @@ - codemetropolis-toolchain-converter - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.m2e.core.maven2Builder - - - - - - org.eclipse.jdt.core.javanature - org.eclipse.m2e.core.maven2Nature - - + codemetropolis-toolchain-converter + NO_M2ECLIPSE_SUPPORT: Project files created with the maven-eclipse-plugin are not supported in M2Eclipse. + + codemetropolis-toolchain-commons + + + + org.eclipse.jdt.core.javabuilder + + + org.eclipse.m2e.core.maven2Builder + + + + org.eclipse.jdt.core.javanature + org.eclipse.m2e.core.maven2Nature + + \ No newline at end of file diff --git a/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/ConverterExecutorArgs.java b/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/ConverterExecutorArgs.java index 7f971e52..bccaacd9 100644 --- a/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/ConverterExecutorArgs.java +++ b/sources/codemetropolis-toolchain-converter/src/main/java/codemetropolis/toolchain/converter/ConverterExecutorArgs.java @@ -1,5 +1,6 @@ package codemetropolis.toolchain.converter; +import java.util.Collections; import java.util.HashMap; import java.util.Map; @@ -14,7 +15,7 @@ public class ConverterExecutorArgs extends ExecutorArgs { private Map params; public ConverterExecutorArgs(ConverterType type, String source, String outputFile) { - this(type, source, outputFile, null); + this(type, source, outputFile, new HashMap()); } public ConverterExecutorArgs(ConverterType type, String source, String outputFile, Map params) { @@ -38,7 +39,7 @@ public String getOutputFile(){ } public Map getParams() { - return new HashMap<>(params); + return Collections.unmodifiableMap(params); } public String getParameter(String key) { diff --git a/sources/codemetropolis-toolchain-mapping/.classpath b/sources/codemetropolis-toolchain-mapping/.classpath index e7a868fb..887ed4cd 100644 --- a/sources/codemetropolis-toolchain-mapping/.classpath +++ b/sources/codemetropolis-toolchain-mapping/.classpath @@ -1,38 +1,12 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + \ No newline at end of file diff --git a/sources/codemetropolis-toolchain-mapping/.project b/sources/codemetropolis-toolchain-mapping/.project index 2bd1712a..1152b192 100644 --- a/sources/codemetropolis-toolchain-mapping/.project +++ b/sources/codemetropolis-toolchain-mapping/.project @@ -1,23 +1,20 @@ - codemetropolis-toolchain-mapping - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.m2e.core.maven2Builder - - - - - - org.eclipse.jdt.core.javanature - org.eclipse.m2e.core.maven2Nature - - + codemetropolis-toolchain-mapping + NO_M2ECLIPSE_SUPPORT: Project files created with the maven-eclipse-plugin are not supported in M2Eclipse. + + codemetropolis-toolchain-commons + + + + org.eclipse.jdt.core.javabuilder + + + org.eclipse.m2e.core.maven2Builder + + + + org.eclipse.jdt.core.javanature + org.eclipse.m2e.core.maven2Nature + + \ No newline at end of file diff --git a/sources/codemetropolis-toolchain-mapping/src/main/java/codemetropolis/toolchain/mapping/control/MappingController.java b/sources/codemetropolis-toolchain-mapping/src/main/java/codemetropolis/toolchain/mapping/control/MappingController.java index 6a69d02c..45b3aca7 100644 --- a/sources/codemetropolis-toolchain-mapping/src/main/java/codemetropolis/toolchain/mapping/control/MappingController.java +++ b/sources/codemetropolis-toolchain-mapping/src/main/java/codemetropolis/toolchain/mapping/control/MappingController.java @@ -39,7 +39,7 @@ public class MappingController { private boolean skipInvalidStructures; private Stack buildableStack = new Stack<>(); private Mapping mapping; - + protected int metricValue; public MappingController(Mapping mapping) { this(mapping, 1.0, false); } @@ -90,6 +90,9 @@ public BuildableTree linkBuildablesToMetrics() { for(Map.Entry> entry : attributesByBuildables.entrySet()) { Buildable b = entry.getKey(); + + + Map attributes = entry.getValue(); Linking linking = null; @@ -138,25 +141,51 @@ public BuildableTree linkBuildablesToMetrics() { } private void setProperty(Buildable b, String propertyName, Object value, boolean adjustSize) { - + + + switch(propertyName) { - case "height": - case "width": - case "length": - value = Conversion.toInt(value); - if(adjustSize) value = Conversion.toInt(MIN_SIZE + (int)value * scale); - break; - } + case "height": + case "width": + case "length": + case "BuiltMetric1": + case "BuiltMetric2": + case "BuiltMetric3": + + + value = Conversion.toInt(value); + metricValue=(int)value; + + if(adjustSize){ value = Conversion.toInt(MIN_SIZE + (int)value * scale);} + break; + } + switch(propertyName) { + case "BuiltMetric1": + b.setBuiltMetric1(metricValue); + b.addAttribute(propertyName, String.valueOf(metricValue)); + break; + + case "BuiltMetric2": + b.setBuiltMetric2(metricValue); + b.addAttribute(propertyName, String.valueOf(metricValue)); + break; + case "BuiltMetric3": + b.setBuiltMetric3(metricValue); + b.addAttribute(propertyName, String.valueOf(metricValue)); + break; + case "height": b.setSizeY((int)value); break; case "width": b.setSizeX((int)value); + break; case "length": b.setSizeZ((int)value); + break; default: b.addAttribute(propertyName, String.valueOf(value)); @@ -269,7 +298,9 @@ private void prepareBuildables(BuildableTree buildables) { Iterator it = buildables.iterator(); while(it.hasNext()) { Buildable b = it.next(); - + + + if(b.getSizeX() % 2 == 0) b.setSizeX(b.getSizeX() + 1); if(b.getSizeY() % 2 == 0) b.setSizeY(b.getSizeY() + 1); if(b.getSizeZ() % 2 == 0) b.setSizeZ(b.getSizeZ() + 1); diff --git a/sources/codemetropolis-toolchain-mapping/src/main/java/codemetropolis/toolchain/mapping/conversions/Conversion.java b/sources/codemetropolis-toolchain-mapping/src/main/java/codemetropolis/toolchain/mapping/conversions/Conversion.java index 23dce56e..5d52d6ac 100644 --- a/sources/codemetropolis-toolchain-mapping/src/main/java/codemetropolis/toolchain/mapping/conversions/Conversion.java +++ b/sources/codemetropolis-toolchain-mapping/src/main/java/codemetropolis/toolchain/mapping/conversions/Conversion.java @@ -1,6 +1,7 @@ package codemetropolis.toolchain.mapping.conversions; import java.util.ArrayList; +import java.util.Collections; import java.util.List; import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; @@ -11,11 +12,7 @@ @XmlJavaTypeAdapter(ConversionAdapter.class) public abstract class Conversion { - protected List parameters; - - public Conversion() { - parameters = new ArrayList(); - } + protected List parameters = new ArrayList(); public abstract Object apply(Object value, Limit limit); @@ -33,8 +30,12 @@ public void addParameters(Parameter... parameters) { } } - public Parameter[] getParameters() { - return parameters.toArray(new Parameter[parameters.size()]); + @SuppressWarnings("unchecked") + public List getParameters() { + if(parameters == null) { + parameters = Collections.EMPTY_LIST; + } + return Collections.unmodifiableList(parameters); } public static Conversion createFromName(String name) { diff --git a/sources/codemetropolis-toolchain-mapping/src/main/java/codemetropolis/toolchain/mapping/exceptions/MappingWriterException.java b/sources/codemetropolis-toolchain-mapping/src/main/java/codemetropolis/toolchain/mapping/exceptions/MappingWriterException.java new file mode 100644 index 00000000..408fe202 --- /dev/null +++ b/sources/codemetropolis-toolchain-mapping/src/main/java/codemetropolis/toolchain/mapping/exceptions/MappingWriterException.java @@ -0,0 +1,27 @@ +package codemetropolis.toolchain.mapping.exceptions; + +public class MappingWriterException extends MappingException { + + private static final long serialVersionUID = -3708470145539789698L; + + public MappingWriterException() { + super(); + } + + public MappingWriterException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) { + super(message, cause, enableSuppression, writableStackTrace); + } + + public MappingWriterException(String message, Throwable cause) { + super(message, cause); + } + + public MappingWriterException(String message) { + super(message); + } + + public MappingWriterException(Throwable cause) { + super(cause); + } + +} diff --git a/sources/codemetropolis-toolchain-mapping/src/main/java/codemetropolis/toolchain/mapping/model/Binding.java b/sources/codemetropolis-toolchain-mapping/src/main/java/codemetropolis/toolchain/mapping/model/Binding.java index 691bee85..e57d9310 100644 --- a/sources/codemetropolis-toolchain-mapping/src/main/java/codemetropolis/toolchain/mapping/model/Binding.java +++ b/sources/codemetropolis-toolchain-mapping/src/main/java/codemetropolis/toolchain/mapping/model/Binding.java @@ -27,19 +27,38 @@ public class Binding { @XmlElementWrapper(name="conversions") @XmlElement(name="conversion") private List conversions = new ArrayList<>(); + + public Binding() {} + + public Binding(String from, String to) { + this.from = from; + this.to = to; + } public String getFrom() { return from; } + public void setFrom(String from) { + this.from = from; + } + public String getTo() { return to; } + public void setTo(String to) { + this.to = to; + } + public String getDefaultValue() { return defaultValue; } + public void setDefaultValue(String defaultValue) { + this.defaultValue = defaultValue; + } + public String getVariableId() { String pattern = "^\\$\\{.*\\}$"; if(from.matches(pattern)) { @@ -52,4 +71,12 @@ public List getConversions() { return Collections.unmodifiableList(conversions); } + public void addConversion(Conversion conversion) { + conversions.add(conversion); + } + + public void clearConversions() { + conversions.clear(); + } + } diff --git a/sources/codemetropolis-toolchain-mapping/src/main/java/codemetropolis/toolchain/mapping/model/Linking.java b/sources/codemetropolis-toolchain-mapping/src/main/java/codemetropolis/toolchain/mapping/model/Linking.java index f14233fd..4edbf3ff 100644 --- a/sources/codemetropolis-toolchain-mapping/src/main/java/codemetropolis/toolchain/mapping/model/Linking.java +++ b/sources/codemetropolis-toolchain-mapping/src/main/java/codemetropolis/toolchain/mapping/model/Linking.java @@ -19,13 +19,13 @@ @XmlAccessorType(XmlAccessType.FIELD) public class Linking { - private static final Map SUPPORTED_TARGETS = new HashMap<>(); + private static final Map SUPPORTED_PROPERTIES = new HashMap<>(); static { - SUPPORTED_TARGETS.put(Type.FLOOR, new String[]{"width", "height", "length", "character", "external_character", "torches"}); - SUPPORTED_TARGETS.put(Type.CELLAR, new String[]{"width", "height", "length", "character", "external_character", "torches"}); - SUPPORTED_TARGETS.put(Type.GARDEN, new String[]{"tree-ratio", "mushroom-ratio", "flower-ratio"}); - SUPPORTED_TARGETS.put(Type.GROUND, new String[]{}); + SUPPORTED_PROPERTIES.put(Type.FLOOR, new String[]{"width","BuiltMetric1", "height","BuiltMetric2", "length","BuiltMetric3", "character", "external_character", "torches"}); + SUPPORTED_PROPERTIES.put(Type.CELLAR, new String[]{"width", "height", "length", "character", "external_character", "torches"}); + SUPPORTED_PROPERTIES.put(Type.GARDEN, new String[]{"tree-ratio", "mushroom-ratio", "flower-ratio"}); + SUPPORTED_PROPERTIES.put(Type.GROUND, new String[]{}); } @XmlAttribute @@ -37,18 +37,45 @@ public class Linking { @XmlElement(name="binding") private List bindings = new ArrayList<>(); + public Linking() {} + + public Linking(String source, String target) { + this.source = source; + this.target = target; + } + public String getSource() { return source; } + + public void setSource(String source) { + this.source = source; + } public String getTarget() { return target; } + + public void setTarget(String target) { + this.target = target; + } public List getBindings() { return Collections.unmodifiableList(bindings); } + public void addBinding(Binding binding) { + bindings.add(binding); + } + + public void removeBinding(Binding binding) { + bindings.remove(binding); + } + + public static String[] getSupportedProperties(Type buildableType) { + return SUPPORTED_PROPERTIES.get(buildableType); + } + public void validate(List resources) throws NotSupportedLinkingException, MissingResourceException { Type type; try { @@ -56,7 +83,7 @@ public void validate(List resources) throws NotSupportedLinkingExcepti } catch(IllegalArgumentException e) { throw new NotSupportedLinkingException(String.format(Resources.get("invalid_linking_target_error"), target)); } - String[] validTargetProps = SUPPORTED_TARGETS.get(type); + String[] validTargetProps = SUPPORTED_PROPERTIES.get(type); for(Binding b : bindings) { validateBindingResource(b, resources); boolean isValid = false; diff --git a/sources/codemetropolis-toolchain-mapping/src/main/java/codemetropolis/toolchain/mapping/model/Mapping.java b/sources/codemetropolis-toolchain-mapping/src/main/java/codemetropolis/toolchain/mapping/model/Mapping.java index 8528bec6..1aaac0fa 100644 --- a/sources/codemetropolis-toolchain-mapping/src/main/java/codemetropolis/toolchain/mapping/model/Mapping.java +++ b/sources/codemetropolis-toolchain-mapping/src/main/java/codemetropolis/toolchain/mapping/model/Mapping.java @@ -10,6 +10,7 @@ import javax.xml.bind.JAXBContext; import javax.xml.bind.JAXBException; +import javax.xml.bind.Marshaller; import javax.xml.bind.Unmarshaller; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; @@ -19,6 +20,7 @@ import javax.xml.bind.annotation.XmlRootElement; import codemetropolis.toolchain.mapping.exceptions.MappingReaderException; +import codemetropolis.toolchain.mapping.exceptions.MappingWriterException; import codemetropolis.toolchain.mapping.exceptions.MissingResourceException; import codemetropolis.toolchain.mapping.exceptions.NotSupportedLinkingException; @@ -39,18 +41,37 @@ public class Mapping { @XmlElement(name="linking") private List linkings = new ArrayList<>(); + public Mapping() {} + + public Mapping(String version, String id) { + this.version = version; + this.id = id; + } + public String getVersion() { return version; } + + public void setVersion(String version) { + this.version = version; + } public String getId() { return id; } + public void setId(String id) { + this.id = id; + } + public List getResources() { return Collections.unmodifiableList(resources); } + public void addResource(Constant resource) { + resources.add(resource); + } + public Map getResourceMap() { Map result = new HashMap<>(); for(Constant resource : resources) { @@ -63,6 +84,14 @@ public List getLinkings() { return Collections.unmodifiableList(linkings); } + public void addLinking(Linking linking) { + linkings.add(linking); + } + + public void removeLinking(Linking linking) { + linkings.remove(linking); + } + public String getTargetTypeOf(String sourceType) { for(Linking linking : linkings) { if(linking.getSource().equalsIgnoreCase(sourceType)) { @@ -90,6 +119,20 @@ public static Mapping readFromXML(String mappingFile) throws MappingReaderExcept } + public void writeToXML(String mappingFile) throws MappingWriterException { + + try { + File file = new File(mappingFile); + JAXBContext context = JAXBContext.newInstance(Mapping.class); + Marshaller marshaller = context.createMarshaller(); + marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true); + marshaller.marshal(this, file); + } catch (JAXBException e) { + throw new MappingWriterException(e); + } + + } + public void validate() throws NotSupportedLinkingException, MissingResourceException { for(Linking linking : linkings) { linking.validate(resources); diff --git a/sources/codemetropolis-toolchain-placing/.classpath b/sources/codemetropolis-toolchain-placing/.classpath index e7a868fb..9ee5cf3e 100644 --- a/sources/codemetropolis-toolchain-placing/.classpath +++ b/sources/codemetropolis-toolchain-placing/.classpath @@ -1,38 +1,11 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + \ No newline at end of file diff --git a/sources/codemetropolis-toolchain-placing/.project b/sources/codemetropolis-toolchain-placing/.project index 3f758d7f..09ff7234 100644 --- a/sources/codemetropolis-toolchain-placing/.project +++ b/sources/codemetropolis-toolchain-placing/.project @@ -1,23 +1,20 @@ - codemetropolis-toolchain-placing - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.m2e.core.maven2Builder - - - - - - org.eclipse.jdt.core.javanature - org.eclipse.m2e.core.maven2Nature - - + codemetropolis-toolchain-placing + NO_M2ECLIPSE_SUPPORT: Project files created with the maven-eclipse-plugin are not supported in M2Eclipse. + + codemetropolis-toolchain-commons + + + + org.eclipse.jdt.core.javabuilder + + + org.eclipse.m2e.core.maven2Builder + + + + org.eclipse.jdt.core.javanature + org.eclipse.m2e.core.maven2Nature + + \ No newline at end of file diff --git a/sources/codemetropolis-toolchain-rendering/.classpath b/sources/codemetropolis-toolchain-rendering/.classpath index e7a868fb..1389ec7c 100644 --- a/sources/codemetropolis-toolchain-rendering/.classpath +++ b/sources/codemetropolis-toolchain-rendering/.classpath @@ -1,38 +1,14 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + \ No newline at end of file diff --git a/sources/codemetropolis-toolchain-rendering/.project b/sources/codemetropolis-toolchain-rendering/.project index 50885699..1e5c0eb1 100644 --- a/sources/codemetropolis-toolchain-rendering/.project +++ b/sources/codemetropolis-toolchain-rendering/.project @@ -1,23 +1,20 @@ - codemetropolis-toolchain-rendering - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.m2e.core.maven2Builder - - - - - - org.eclipse.m2e.core.maven2Nature - org.eclipse.jdt.core.javanature - - + codemetropolis-toolchain-rendering + NO_M2ECLIPSE_SUPPORT: Project files created with the maven-eclipse-plugin are not supported in M2Eclipse. + + codemetropolis-toolchain-commons + + + + org.eclipse.jdt.core.javabuilder + + + org.eclipse.m2e.core.maven2Builder + + + + org.eclipse.m2e.core.maven2Nature + org.eclipse.jdt.core.javanature + + \ No newline at end of file diff --git a/sources/codemetropolis-toolchain-rendering/src/main/java/codemetropolis/toolchain/rendering/control/WorldBuilder.java b/sources/codemetropolis-toolchain-rendering/src/main/java/codemetropolis/toolchain/rendering/control/WorldBuilder.java index c8b174c2..f27d54c9 100644 --- a/sources/codemetropolis-toolchain-rendering/src/main/java/codemetropolis/toolchain/rendering/control/WorldBuilder.java +++ b/sources/codemetropolis-toolchain-rendering/src/main/java/codemetropolis/toolchain/rendering/control/WorldBuilder.java @@ -8,10 +8,14 @@ import java.util.EventListener; import java.util.List; +import codemetropolis.toolchain.rendering.model.building.Number; +import codemetropolis.toolchain.rendering.model.primitive.SignPost; +import codemetropolis.toolchain.rendering.model.primitive.WallSign; import org.apache.commons.lang3.time.StopWatch; import codemetropolis.blockmodifier.World; import codemetropolis.toolchain.commons.cmxml.Buildable; +import codemetropolis.toolchain.commons.cmxml.Point; import codemetropolis.toolchain.commons.cmxml.BuildableTree; import codemetropolis.toolchain.commons.cmxml.exceptions.CmxmlReaderException; import codemetropolis.toolchain.rendering.events.ProgressEvent; @@ -28,8 +32,10 @@ public class WorldBuilder { private World world; private List buildings = new ArrayList(); + private List numberList = new ArrayList(); private StopWatch stopWatch = new StopWatch(); + private int count = 0; private int total = 0; @@ -46,24 +52,53 @@ public void createBuildings(String inputPath) throws BuildingTypeMismatchExcepti return; } + List floors = new ArrayList(); + List numbers=new ArrayList(); List cellars = new ArrayList(); List gardens = new ArrayList(); List grounds = new ArrayList(); + for(Buildable buildable: buildables.getBuildables() ){ + + if(buildable.getType()== Buildable.Type.GARDEN) { + for (Buildable b : buildable.getDescendants()) { + if(b.getType()== Buildable.Type.FLOOR){ + + buildable.setBuiltMetric1(buildable.getBuiltMetric1() + Integer.parseInt(b.getAttributeValue("BuiltMetric1"))); + buildable.setBuiltMetric2(buildable.getBuiltMetric2() + Integer.parseInt(b.getAttributeValue("BuiltMetric2"))); + buildable.setBuiltMetric3(buildable.getBuiltMetric3() + Integer.parseInt(b.getAttributeValue("BuiltMetric3"))); + }} + Number First=new Number(buildable, "BuiltMetric1"); + Number Second=new Number(buildable, "BuiltMetric2"); + Number Third=new Number(buildable, "BuiltMetric3"); + First.getPrimitives().add(new WallSign(First.getPosition().getX()-1,First.getPosition().getY(), First.getPosition().getZ()+2, WallSign.Orientation.WEST, "First metric")); + Second.getPrimitives().add(new WallSign(Second.getPosition().getX()-1, Second.getPosition().getY(),Second.getPosition().getZ()+2 , WallSign.Orientation.WEST, "Second metric")); + Third.getPrimitives().add(new WallSign(Third.getPosition().getX()-1, Third.getPosition().getY(), Third.getPosition().getZ()+2, WallSign.Orientation.WEST, "Third metric")); + + numbers.add(First); + numbers.add(Second); + numbers.add(Third); + + } + + + } + + for(Buildable b : buildables.getBuildables()) { switch(b.getType()) { - case FLOOR: + case FLOOR: Floor floor = new Floor(b); floors.add(floor); total += floor.getNumberOfBlocks(); break; - case CELLAR: + case CELLAR: Cellar cellar = new Cellar(b); cellars.add(cellar); total += cellar.getNumberOfBlocks(); break; - case GARDEN: + case GARDEN: Garden garden = new Garden(b); gardens.add(garden); total += garden.getNumberOfBlocks(); @@ -77,9 +112,32 @@ public void createBuildings(String inputPath) throws BuildingTypeMismatchExcepti break; } } + + for(Garden garden : gardens) { + for(Buildable b: garden.getInnerBuildable().getChildren() ){ + + if(b.getType()== Buildable.Type.FLOOR) { + + garden.setBuiltMetric1(garden.getBuiltMetric1() + Integer.parseInt(b.getAttributeValue("BuiltMetric1"))); + garden.setBuiltMetric2(garden.getBuiltMetric2() + Integer.parseInt(b.getAttributeValue("BuiltMetric2"))); + garden.setBuiltMetric3(garden.getBuiltMetric3() + Integer.parseInt(b.getAttributeValue("BuiltMetric3"))); + } + + + } + + + garden.getPrimitives().add(new SignPost(garden.getPosition().getX() + garden.getSize().getX() - 1, garden.getPosition().getY()+2, (garden.getPosition().getZ())-1+ garden.getSize().getZ() - 1, SignPost.Orientation.SOUTHEAST, "BuiltMetric1: " + Integer.toString(garden.getBuiltMetric1()))); + garden.getPrimitives().add(new SignPost(garden.getPosition().getX() + garden.getSize().getX() - 1, garden.getPosition().getY()+2, (garden.getPosition().getZ())-2 + garden.getSize().getZ() - 1, SignPost.Orientation.SOUTHEAST, "BuiltMetric2: " + Integer.toString(garden.getBuiltMetric2()))); + garden.getPrimitives().add(new SignPost(garden.getPosition().getX() + garden.getSize().getX() - 1, garden.getPosition().getY()+2, (garden.getPosition().getZ())-3 + garden.getSize().getZ() - 1, SignPost.Orientation.SOUTHEAST, "BuiltMetric3: " + Integer.toString(garden.getBuiltMetric3()))); + + } + + buildings.addAll(grounds); buildings.addAll(gardens); + buildings.addAll(numbers); buildings.addAll(cellars); buildings.addAll(floors); diff --git a/sources/codemetropolis-toolchain-rendering/src/main/java/codemetropolis/toolchain/rendering/model/building/Building.java b/sources/codemetropolis-toolchain-rendering/src/main/java/codemetropolis/toolchain/rendering/model/building/Building.java index 87e2f213..4b33aa05 100644 --- a/sources/codemetropolis-toolchain-rendering/src/main/java/codemetropolis/toolchain/rendering/model/building/Building.java +++ b/sources/codemetropolis-toolchain-rendering/src/main/java/codemetropolis/toolchain/rendering/model/building/Building.java @@ -12,6 +12,8 @@ public class Building { private static final int MIN_SIZE = 9; + + protected LinkedList primitives = new LinkedList(); protected LinkedList signs = new LinkedList(); protected Buildable innerBuildable; @@ -19,16 +21,28 @@ public class Building { protected Point position; protected Point center; protected Point size; + + protected int BuiltMetric1 , BuiltMetric2 , BuiltMetric3; - public Building( Buildable innerBuildable ) - { + public Building( Buildable innerBuildable ) { this.innerBuildable = innerBuildable; - + size = new Point( adjustSize(innerBuildable.getSizeX()), adjustSize(innerBuildable.getSizeY()), adjustSize(innerBuildable.getSizeZ()) - ); + ); + if (innerBuildable.getType() == Buildable.Type.FLOOR) { + BuiltMetric1 = Integer.parseInt(this.innerBuildable.getAttributeValue("BuiltMetric1")); + BuiltMetric2 = Integer.parseInt(this.innerBuildable.getAttributeValue("BuiltMetric2")); + BuiltMetric3 = Integer.parseInt(this.innerBuildable.getAttributeValue("BuiltMetric3")); + + + } else{ + BuiltMetric1 = 0; + BuiltMetric2 = 0; + BuiltMetric3 = 0; + } position = new Point( innerBuildable.getPositionX(), @@ -41,9 +55,21 @@ public Building( Buildable innerBuildable ) (int)(size.getY() * 0.5), (int)(size.getZ() * 0.5) ); + } - - private static int adjustSize( int x ) { + public LinkedList getPrimitives() { + return primitives; + } + + public void setPosition(Point position) { + this.position = position; + } + + public void setSize(Point size) { + this.size = size; + } + + private static int adjustSize(int x ) { if(x < MIN_SIZE) return MIN_SIZE; if(x % 2 == 0) return x + 1; return x; @@ -74,6 +100,30 @@ public Point getSize() { return size; } + public int getBuiltMetric1() { + return BuiltMetric1; + } + + public void setBuiltMetric1(int builtMetric1) { + BuiltMetric1 = builtMetric1; + } + + public int getBuiltMetric2() { + return BuiltMetric2; + } + + public void setBuiltMetric2(int builtMetric2) { + BuiltMetric2 = builtMetric2; + } + + public int getBuiltMetric3() { + return BuiltMetric3; + } + + public void setBuiltMetric3(int builtMetric3) { + BuiltMetric3 = builtMetric3; + } + public int getNumberOfBlocks() { int result = 0; for(Primitive p : primitives) diff --git a/sources/codemetropolis-toolchain-rendering/src/main/java/codemetropolis/toolchain/rendering/model/building/Cellar.java b/sources/codemetropolis-toolchain-rendering/src/main/java/codemetropolis/toolchain/rendering/model/building/Cellar.java index 1da38d20..56249e42 100644 --- a/sources/codemetropolis-toolchain-rendering/src/main/java/codemetropolis/toolchain/rendering/model/building/Cellar.java +++ b/sources/codemetropolis-toolchain-rendering/src/main/java/codemetropolis/toolchain/rendering/model/building/Cellar.java @@ -13,7 +13,7 @@ public class Cellar extends Floor { public Cellar(Buildable innerBuildable) throws BuildingTypeMismatchException { super(innerBuildable); - + if ( innerBuildable.getType() != Type.CELLAR ) throw new BuildingTypeMismatchException(innerBuildable.getType(), getClass()); diff --git a/sources/codemetropolis-toolchain-rendering/src/main/java/codemetropolis/toolchain/rendering/model/building/Floor.java b/sources/codemetropolis-toolchain-rendering/src/main/java/codemetropolis/toolchain/rendering/model/building/Floor.java index ced4a538..a01b8036 100644 --- a/sources/codemetropolis-toolchain-rendering/src/main/java/codemetropolis/toolchain/rendering/model/building/Floor.java +++ b/sources/codemetropolis-toolchain-rendering/src/main/java/codemetropolis/toolchain/rendering/model/building/Floor.java @@ -19,7 +19,8 @@ public class Floor extends Building { public Floor(Buildable innerBuildable) throws BuildingTypeMismatchException { super(innerBuildable); - + + if ( innerBuildable.getType()!= Type.FLOOR && innerBuildable.getType() != Type.CELLAR ) throw new BuildingTypeMismatchException(innerBuildable.getType(), getClass()); @@ -251,7 +252,14 @@ private void prepareSigns( ) { primitives.add(new WallSign(position.getX() + size.getX() / 2, position.getY() + 3, position.getZ() + 1, WallSign.Orientation.SOUTH, innerBuildable.getName())); primitives.add(new WallSign(position.getX() + size.getX() / 2, position.getY() + 3, position.getZ() + size.getZ() - 2, WallSign.Orientation.NORTH, innerBuildable.getName())); primitives.add(new WallSign(position.getX() + 1, position.getY() + 3, position.getZ() + size.getZ() / 2, WallSign.Orientation.EAST, innerBuildable.getName())); - primitives.add(new WallSign(position.getX() + size.getX() - 2, position.getY() + 3, position.getZ() + size.getZ() / 2, WallSign.Orientation.WEST, innerBuildable.getName())); + primitives.add(new WallSign(position.getX() + size.getX() - 2, position.getY() + 3, position.getZ() + size.getZ() / 2, WallSign.Orientation.WEST, innerBuildable.getName())); + + //METRIC WALL signs + primitives.add(new WallSign(position.getX() + size.getX() - 2, position.getY() + 3, position.getZ() + size.getZ() / 2, WallSign.Orientation.WEST, "First metric: "+Integer.toString(BuiltMetric1))); + primitives.add(new WallSign(position.getX() + size.getX() - 2, position.getY() + 3, position.getZ() + (size.getZ() / 2) + 1, WallSign.Orientation.WEST, "Second metric: "+Integer.toString(BuiltMetric2))); + primitives.add(new WallSign(position.getX() + size.getX() - 2, position.getY() + 3, position.getZ() + (size.getZ() / 2) - 1, WallSign.Orientation.WEST, "Third metric: "+Integer.toString(BuiltMetric3))); + + } private void prepareTorches( ) { diff --git a/sources/codemetropolis-toolchain-rendering/src/main/java/codemetropolis/toolchain/rendering/model/building/Garden.java b/sources/codemetropolis-toolchain-rendering/src/main/java/codemetropolis/toolchain/rendering/model/building/Garden.java index 88b163b9..ea79eeb3 100644 --- a/sources/codemetropolis-toolchain-rendering/src/main/java/codemetropolis/toolchain/rendering/model/building/Garden.java +++ b/sources/codemetropolis-toolchain-rendering/src/main/java/codemetropolis/toolchain/rendering/model/building/Garden.java @@ -12,19 +12,48 @@ import codemetropolis.toolchain.rendering.model.primitive.SolidBox; import codemetropolis.toolchain.rendering.util.Orientation; + + public class Garden extends Building { + private int BuiltNumber1=0; + private int BuiltNumber2=0; + private int BuiltNumber3=0; + public Garden(Buildable innerBuildable) throws BuildingTypeMismatchException { super(innerBuildable); if ( innerBuildable.getType() != Type.GARDEN ) - throw new BuildingTypeMismatchException(innerBuildable.getType(), getClass()); - + throw new BuildingTypeMismatchException(innerBuildable.getType(), getClass()); prepareBase(); prepareDoor(); prepareSigns(); } - + + public int getBuiltNumber1() { + return BuiltNumber1; + } + + public void setBuiltNumber1(int builtNumber1) { + BuiltNumber1 = builtNumber1; + } + + public int getBuiltNumber2() { + return BuiltNumber2; + } + + public void setBuiltNumber2(int builtNumber2) { + BuiltNumber2 = builtNumber2; + } + + public int getBuiltNumber3() { + return BuiltNumber3; + } + + public void setBuiltNumber3(int builtNumber3) { + BuiltNumber3 = builtNumber3; + } + private void prepareBase( ) { BasicBlock _fnc = new BasicBlock( "minecraft:fence" ); BasicBlock _sns = new BasicBlock( "minecraft:sandstone" ); @@ -143,6 +172,8 @@ private void prepareSigns( ) { primitives.add(new SignPost(position.getX() + size.getX() - 1, position.getY() + 2, position.getZ(), SignPost.Orientation.NORTHEAST, innerBuildable.getName())); primitives.add(new SignPost(position.getX(), position.getY() + 2, position.getZ() + size.getZ() - 1, SignPost.Orientation.SOUTHWEST, innerBuildable.getName())); primitives.add(new SignPost(position.getX() + size.getX() - 1, position.getY() + 2, position.getZ() + size.getZ() - 1, SignPost.Orientation.SOUTHEAST, innerBuildable.getName())); + + } } diff --git a/sources/codemetropolis-toolchain-rendering/src/main/java/codemetropolis/toolchain/rendering/model/building/Number.java b/sources/codemetropolis-toolchain-rendering/src/main/java/codemetropolis/toolchain/rendering/model/building/Number.java new file mode 100644 index 00000000..32103ec2 --- /dev/null +++ b/sources/codemetropolis-toolchain-rendering/src/main/java/codemetropolis/toolchain/rendering/model/building/Number.java @@ -0,0 +1,709 @@ +package codemetropolis.toolchain.rendering.model.building; +import codemetropolis.toolchain.commons.cmxml.Buildable; +import codemetropolis.toolchain.commons.cmxml.Point; +import codemetropolis.toolchain.rendering.model.BasicBlock; +import codemetropolis.toolchain.rendering.model.pattern.RepeationPattern; +import codemetropolis.toolchain.rendering.model.primitive.*; +import codemetropolis.toolchain.rendering.util.Orientation; + + + +/** + * Created by Gábor on 2017. 04. 03.. + */ +public class Number extends Building{ + + + protected int GardenPositionX; + protected int GardenPositionZ; + protected int GardenPositionY; + protected int numberToBuild; + protected int positionZ; + + + + public Number(Buildable Garden,String metricToBuild){ + super(Garden); + + GardenPositionX=Garden.getPositionX(); + GardenPositionZ=Garden.getPositionZ(); + GardenPositionY=Garden.getPositionY(); + + + switch(metricToBuild){ + case "BuiltMetric1": + numberToBuild=Garden.getBuiltMetric1(); + positionZ=GardenPositionZ +1; + Point posBuiltMetric1=new Point(GardenPositionX,GardenPositionY+4,positionZ); + setPosition(posBuiltMetric1); + break; + case "BuiltMetric2": + numberToBuild=Garden.getBuiltMetric2(); + positionZ=GardenPositionZ +6; + Point posBuiltMetric2=new Point(GardenPositionX,GardenPositionY+4,positionZ); + setPosition(posBuiltMetric2); + break; + case "BuiltMetric3": + numberToBuild=Garden.getBuiltMetric3(); + positionZ=GardenPositionZ +11; + Point posBuiltMetric3=new Point(GardenPositionX,GardenPositionY+4,positionZ); + setPosition(posBuiltMetric3); + break; + + } + prepareNumber(numberToBuild,positionZ); + } + + protected void prepareNumber(int number,int positionZ){ + BasicBlock _air = new BasicBlock( (short) 0 ); + BasicBlock _str = new BasicBlock( (short) 1 ); + + if(number==0){ + primitives.add( + new SolidBox( + new Point( GardenPositionX - 1, GardenPositionY+4, positionZ ) , + new Point( 3, 5, 5 ), + + new RepeationPattern( + new BasicBlock[][][] + { + { + + { _air,_air, _air, _air,_air }, + { _air,_str, _str, _str,_air }, + { _air,_air, _air, _air,_air } + + + + + }, + { + + { _air,_air, _air, _air,_air }, + { _air,_str, _air, _str,_air }, + { _air,_air, _air, _air,_air } + + + }, + { + + { _air,_air, _air, _air,_air }, + { _air,_str, _air, _str,_air }, + { _air,_air, _air, _air,_air } + + }, + { + + { _air,_air, _air, _air,_air }, + { _air,_str, _air, _str,_air }, + { _air,_air, _air, _air,_air } + + + }, + { + + { _air,_air, _air, _air,_air }, + { _air,_str, _str, _str,_air}, + { _air,_air, _air, _air,_air } + + + } + + } ), + new RepeationPattern( new BasicBlock[][][] { { { new BasicBlock( "minecraft:air",0 ) } } } ), + + Orientation.NearY ) + ); + + } + int tmp; + int PositionShift=0; + while(number>0) + { + + tmp=number%10; + number=number/10; + + switch(tmp) { + case 9: + primitives.add( + new SolidBox( + new Point( GardenPositionX - 1, GardenPositionY+4+PositionShift, positionZ ) , + new Point( 3, 5, 5 ), + + new RepeationPattern( + new BasicBlock[][][] + { + { + + { _air,_air, _air, _air,_air }, + { _air,_str, _str, _str,_air }, + { _air,_air, _air, _air,_air } + + + + + }, + { + + { _air,_air, _air, _air,_air }, + { _air,_str, _air, _str,_air }, + { _air,_air, _air, _air,_air } + + + }, + { + + { _air,_air, _air, _air,_air }, + { _air,_str, _str, _str,_air }, + { _air,_air, _air, _air,_air } + + }, + { + + { _air,_air, _air, _air,_air }, + { _air,_str, _air, _air,_air }, + { _air,_air, _air, _air,_air } + + + }, + { + + { _air,_air, _air, _air,_air }, + { _air,_str, _str, _str,_air}, + { _air,_air, _air, _air,_air } + + + } + + } ), + new RepeationPattern( new BasicBlock[][][] { { { new BasicBlock( "minecraft:air",0 ) } } } ), + + Orientation.NearY ) + ); + break; + + case 8: + primitives.add( + new SolidBox( + new Point( GardenPositionX - 1, GardenPositionY+4+PositionShift, positionZ ) , + new Point( 3, 5, 5 ), + + new RepeationPattern( + new BasicBlock[][][] + { + { + + { _air,_air, _air, _air,_air }, + { _air,_str, _str, _str,_air }, + { _air,_air, _air, _air,_air } + + + + + }, + { + + { _air,_air, _air, _air,_air }, + { _air,_str, _air, _str,_air }, + { _air,_air, _air, _air,_air } + + + }, + { + + { _air,_air, _air, _air,_air }, + { _air,_str, _str, _str,_air }, + { _air,_air, _air, _air,_air } + + }, + { + + { _air,_air, _air, _air,_air }, + { _air,_str, _air, _str,_air }, + { _air,_air, _air, _air,_air } + + + }, + { + + { _air,_air, _air, _air,_air }, + { _air,_str, _str, _str,_air}, + { _air,_air, _air, _air,_air } + + + } + + } ), + new RepeationPattern( new BasicBlock[][][] { { { new BasicBlock( "minecraft:air",0 ) } } } ), + + Orientation.NearY ) + ); + break; + + case 7: + primitives.add( + new SolidBox( + new Point( GardenPositionX - 1, GardenPositionY+4+PositionShift, positionZ ) , + new Point( 3, 5, 5 ), + + new RepeationPattern( + new BasicBlock[][][] + { + { + + { _air,_air, _air, _air,_air }, + { _air,_str, _str, _str,_air }, + { _air,_air, _air, _air,_air } + + + + + }, + { + + { _air,_air, _air, _air,_air }, + { _air,_str, _air, _air,_air }, + { _air,_air, _air, _air,_air } + + + }, + { + + { _air,_air, _air, _air,_air }, + { _air,_str, _air, _air,_air }, + { _air,_air, _air, _air,_air } + + }, + { + + { _air,_air, _air, _air,_air }, + { _air,_str, _air, _air,_air }, + { _air,_air, _air, _air,_air } + + + }, + { + + { _air,_air, _air, _air,_air }, + { _air,_str, _air, _air,_air}, + { _air,_air, _air, _air,_air } + + + } + + } ), + new RepeationPattern( new BasicBlock[][][] { { { new BasicBlock( "minecraft:air",0 ) } } } ), + + Orientation.NearY ) + ); + break; + case 6: + primitives.add( + new SolidBox( + new Point( GardenPositionX - 1, GardenPositionY+4+PositionShift, positionZ ) , + new Point( 3, 5, 5 ), + + new RepeationPattern( + new BasicBlock[][][] + { + { + + { _air,_air, _air, _air,_air }, + { _air,_str, _str, _str,_air }, + { _air,_air, _air, _air,_air } + + + + + }, + { + + { _air,_air, _air, _air,_air }, + { _air,_air, _air, _str,_air }, + { _air,_air, _air, _air,_air } + + + }, + { + + { _air,_air, _air, _air,_air }, + { _air,_str, _str, _str,_air }, + { _air,_air, _air, _air,_air } + + }, + { + + { _air,_air, _air, _air,_air }, + { _air,_str, _air, _str,_air }, + { _air,_air, _air, _air,_air } + + + }, + { + + { _air,_air, _air, _air,_air }, + { _air,_str, _str, _str,_air}, + { _air,_air, _air, _air,_air } + + + } + + } ), + new RepeationPattern( new BasicBlock[][][] { { { new BasicBlock( "minecraft:air",0 ) } } } ), + + Orientation.NearY ) + ); + break; + case 5: + primitives.add( + new SolidBox( + new Point( GardenPositionX - 1, GardenPositionY+4+PositionShift, positionZ ) , + new Point( 3, 5, 5 ), + + new RepeationPattern( + new BasicBlock[][][] + { + { + + { _air,_air, _air, _air,_air }, + { _air,_str, _str, _str,_air }, + { _air,_air, _air, _air,_air } + + + + + }, + { + + { _air,_air, _air, _air,_air }, + { _air,_air, _air, _str,_air }, + { _air,_air, _air, _air,_air } + + + }, + { + + { _air,_air, _air, _air,_air }, + { _air,_str, _str, _str,_air }, + { _air,_air, _air, _air,_air } + + }, + { + + { _air,_air, _air, _air,_air }, + { _air,_str, _air, _air,_air }, + { _air,_air, _air, _air,_air } + + + }, + { + + { _air,_air, _air, _air,_air }, + { _air,_str, _str, _str,_air}, + { _air,_air, _air, _air,_air } + + + } + + } ), + new RepeationPattern( new BasicBlock[][][] { { { new BasicBlock( "minecraft:air",0 ) } } } ), + + Orientation.NearY ) + ); + break; + case 4: + primitives.add( + new SolidBox( + new Point( GardenPositionX - 1, GardenPositionY+4+PositionShift, positionZ ) , + new Point( 3, 5, 5 ), + + new RepeationPattern( + new BasicBlock[][][] + { + { + + { _air,_air, _air, _air,_air }, + { _air,_air, _air, _str,_air }, + { _air,_air, _air, _air,_air } + + + + + }, + { + + { _air,_air, _air, _air,_air }, + { _air,_air, _air, _str,_air }, + { _air,_air, _air, _air,_air } + + + }, + { + + { _air,_air, _air, _air,_air }, + { _air,_air, _air, _str,_air }, + { _air,_air, _air, _air,_air } + + }, + { + + { _air,_air, _air, _air,_air }, + { _air,_str, _str, _str,_air }, + { _air,_air, _air, _air,_air } + + + }, + { + + { _air,_air, _air, _air,_air }, + { _air,_air, _str, _air,_air}, + { _air,_air, _air, _air,_air } + + + } + + } ), + new RepeationPattern( new BasicBlock[][][] { { { new BasicBlock( "minecraft:air",0 ) } } } ), + + Orientation.NearY ) + ); + break; + case 3: + primitives.add( + new SolidBox( + new Point( GardenPositionX - 1, GardenPositionY+4+PositionShift, positionZ ) , + new Point( 3, 5, 5 ), + + new RepeationPattern( + new BasicBlock[][][] + { + { + + { _air,_air, _air, _air,_air }, + { _air,_str, _str, _str,_air }, + { _air,_air, _air, _air,_air } + + + + + }, + { + + { _air,_air, _air, _air,_air }, + { _air,_str, _air, _air,_air }, + { _air,_air, _air, _air,_air } + + + }, + { + + { _air,_air, _air, _air,_air }, + { _air,_str, _str, _air,_air }, + { _air,_air, _air, _air,_air } + + }, + { + + { _air,_air, _air, _air,_air }, + { _air,_str, _air, _air,_air }, + { _air,_air, _air, _air,_air } + + + }, + { + + { _air,_air, _air, _air,_air }, + { _air,_str, _str, _str,_air}, + { _air,_air, _air, _air,_air } + + + } + + } ), + new RepeationPattern( new BasicBlock[][][] { { { new BasicBlock( "minecraft:air",0 ) } } } ), + + Orientation.NearY ) + ); + break; + case 2: + primitives.add( + new SolidBox( + new Point( GardenPositionX - 1, GardenPositionY+4+PositionShift, positionZ ) , + new Point( 3, 5, 5 ), + + new RepeationPattern( + new BasicBlock[][][] + { + { + + { _air,_air, _air, _air,_air }, + { _air,_str, _str, _str,_air }, + { _air,_air, _air, _air,_air } + + + + + }, + { + + { _air,_air, _air, _air,_air }, + { _air,_str, _air, _air,_air }, + { _air,_air, _air, _air,_air } + + + }, + { + + { _air,_air, _air, _air,_air }, + { _air,_str, _str, _str,_air }, + { _air,_air, _air, _air,_air } + + }, + { + + { _air,_air, _air, _air,_air }, + { _air,_air, _air, _str,_air }, + { _air,_air, _air, _air,_air } + + + }, + { + + { _air,_air, _air, _air,_air }, + { _air,_str, _str, _str,_air}, + { _air,_air, _air, _air,_air } + + + } + + } ), + new RepeationPattern( new BasicBlock[][][] { { { new BasicBlock( "minecraft:air",0 ) } } } ), + + Orientation.NearY ) + ); + break; + case 1: + primitives.add( + new SolidBox( + new Point( GardenPositionX - 1, GardenPositionY+4+PositionShift, positionZ ) , + new Point( 3, 5, 5 ), + + new RepeationPattern( + new BasicBlock[][][] + { + { + + { _air,_air, _air, _air,_air }, + { _air,_air, _str, _str,_air }, + { _air,_air, _air, _air,_air } + + + + + }, + { + + { _air,_air, _air, _air,_air }, + { _air,_air, _str, _air,_air }, + { _air,_air, _air, _air,_air } + + + }, + { + + { _air,_air, _air, _air,_air }, + { _air,_air, _str, _air,_air }, + { _air,_air, _air, _air,_air } + + }, + { + + { _air,_air, _air, _air,_air }, + { _air,_air, _str, _air,_air }, + { _air,_air, _air, _air,_air } + + + }, + { + + { _air,_air, _air, _air,_air }, + { _air,_str, _str, _str,_air}, + { _air,_air, _air, _air,_air } + + + } + + } ), + new RepeationPattern( new BasicBlock[][][] { { { new BasicBlock( "minecraft:air",0 ) } } } ), + + Orientation.NearY ) + ); + break; + case 0: + primitives.add( + new SolidBox( + new Point( GardenPositionX - 1, GardenPositionY+4+PositionShift, positionZ ) , + new Point( 3, 5, 5 ), + + new RepeationPattern( + new BasicBlock[][][] + { + { + + { _air,_air, _air, _air,_air }, + { _air,_str, _str, _str,_air }, + { _air,_air, _air, _air,_air } + + + + + }, + { + + { _air,_air, _air, _air,_air }, + { _air,_str, _air, _str,_air }, + { _air,_air, _air, _air,_air } + + + }, + { + + { _air,_air, _air, _air,_air }, + { _air,_str, _air, _str,_air }, + { _air,_air, _air, _air,_air } + + }, + { + + { _air,_air, _air, _air,_air }, + { _air,_str, _air, _str,_air }, + { _air,_air, _air, _air,_air } + + + }, + { + + { _air,_air, _air, _air,_air }, + { _air,_str, _str, _str,_air}, + { _air,_air, _air, _air,_air } + + + } + + } ), + new RepeationPattern( new BasicBlock[][][] { { { new BasicBlock( "minecraft:air",0 ) } } } ), + + Orientation.NearY ) + ); + break; + } + PositionShift=PositionShift+6; + + } + } + + + + +}