Skip to content

Commit

Permalink
update 1.6.4
Browse files Browse the repository at this point in the history
  • Loading branch information
Greymerk committed Mar 5, 2017
1 parent 3d381d3 commit e15df9e
Show file tree
Hide file tree
Showing 7 changed files with 109 additions and 23 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ buildscript {
}
apply plugin: 'net.minecraftforge.gradle.forge'

version = "1.11.2-1.6.3.1"
version = "1.11.2-1.6.4"
group= "ca.rivas.roguelike" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = "RoguelikeDungeons"

Expand Down
4 changes: 2 additions & 2 deletions src/main/java/greymerk/roguelike/Roguelike.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ public class Roguelike {
@Instance("roguelike")
public static Roguelike instance;
// TODO: change version number
public static final String version = "1.6.3.1";
public static final String date = "February 19th 2017";
public static final String version = "1.6.4";
public static final String date = "Mar 4th 2017";

// Says where the client and server 'proxy' code is loaded.
@SidedProxy(clientSide="greymerk.roguelike.ClientProxy", serverSide="greymerk.roguelike.CommonProxy")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ public SettingsForestTheme(){

switch(i){
case 0:
secrets.addRoom(DungeonRoom.BEDROOM);
secrets.addRoom(DungeonRoom.SMITH);
break;
case 1:
Expand Down
40 changes: 33 additions & 7 deletions src/main/java/greymerk/roguelike/theme/Theme.java
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,39 @@ public static ITheme create(ITheme toCopy){
return new ThemeBase(primary, secondary);
}

public static ITheme create(ITheme base, ITheme override){
BlockSet primary = override.getPrimary() != null
? new BlockSet(base.getPrimary(), override.getPrimary())
: new BlockSet(base.getPrimary());
BlockSet secondary = override.getSecondary() != null
? new BlockSet(base.getSecondary(), override.getSecondary())
: new BlockSet(base.getSecondary());
public static ITheme create(ITheme base, ITheme other){
if(base == null && other == null){
return null;
}

if(other == null && base != null){
return create(base);
}

if(other != null && base == null){
return create(other);
}

BlockSet primary = other.getPrimary() != null
? new BlockSet(
base.getPrimary() != null
? new BlockSet(base.getPrimary())
: null,
other.getPrimary()
)
: base.getPrimary() != null
? new BlockSet(base.getPrimary())
: null;
BlockSet secondary = other.getSecondary() != null
? new BlockSet(
base.getPrimary() != null
? new BlockSet(base.getPrimary())
: null,
other.getSecondary()
)
: base.getSecondary() != null
? new BlockSet(base.getSecondary())
: null;
return new ThemeBase(primary, secondary);
}

Expand Down
26 changes: 16 additions & 10 deletions src/main/resources/mcmod.info
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
[
{
"modid" : "roguelike",
"name" : "Roguelike Dungeons",
"description" : "Adds randomized dungeons to the world",
"version" : "${version}",
"mcversion": "${mcversion}",
"url" : "github.com/Greymerk/minecraft-roguelike",
"authorList" : ["Greymerk"]
}
]
{
"modid" : "roguelike",
"name" : "Roguelike Dungeons",
"description" : "Adds randomized dungeons to the world",
"version" : "${version}",
"mcversion": "${mcversion}",
"url" : "github.com/Greymerk/minecraft-roguelike",
"credits": "",
"logoFile": "",
"updateUrl": "",
"authorList" : ["Greymerk"],
"parent": "",
"screenshots": [],
"dependencies": []
}
]
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ public void testGeneratorMerge(){
}

@Test
public void testJson() throws Exception{
public void testJsonThemePrimary() throws Exception{

LevelSettings level;

Expand All @@ -179,4 +179,30 @@ public void testJson() throws Exception{
assert(f.equals(BlockType.get(BlockType.DIRT)));

}

@Test
public void testJsonThemeSecondary() throws Exception{

LevelSettings level;

JsonObject json = new JsonObject();

JsonObject theme = new JsonObject();
json.add("theme", theme);

JsonObject secondary = new JsonObject();
theme.add("secondary", secondary);

JsonObject floor = new JsonObject();
secondary.add("floor", floor);
floor.addProperty("name", "minecraft:dirt");

level = new LevelSettings(json);

ITheme t = level.getTheme();
IBlockSet bs = t.getSecondary();
IBlockFactory f = bs.getFloor();
assert(f.equals(BlockType.get(BlockType.DIRT)));

}
}
31 changes: 30 additions & 1 deletion src/test/java/greymerk/roguelike/theme/ThemeTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import greymerk.roguelike.config.RogueConfig;
import greymerk.roguelike.worldgen.blocks.BlockType;
import greymerk.roguelike.worldgen.blocks.Stair;
import net.minecraft.init.Bootstrap;

public class ThemeTest {
Expand Down Expand Up @@ -41,7 +42,7 @@ public void noBase() throws Exception {
}

@Test
public void noSecondary() throws Exception{
public void noSecondary() throws Exception {
JsonObject json = new JsonObject();
JsonObject primary = new JsonObject();
json.add("primary", primary);
Expand All @@ -53,4 +54,32 @@ public void noSecondary() throws Exception{
ITheme t = Theme.create(json);
assert(t.getPrimary().getFloor().equals(BlockType.get(BlockType.DIRT)));
}

@Test
public void noPrimary() throws Exception {
JsonObject json = new JsonObject();
JsonObject secondary = new JsonObject();
json.add("secondary", secondary);

JsonObject floor = new JsonObject();
secondary.add("floor", floor);
floor.addProperty("name", "minecraft:dirt");

ITheme t = Theme.create(json);
assert(t.getSecondary().getFloor().equals(BlockType.get(BlockType.DIRT)));
}

@Test
public void merge() throws Exception {

IBlockSet bs = new BlockSet(BlockType.get(BlockType.DIRT), null, null);

ITheme base = new ThemeBase(bs, null);
ITheme other = new ThemeBase(null, bs);

ITheme merge = Theme.create(null, null);
merge = Theme.create(base, null);
merge = Theme.create(null, other);
merge = Theme.create(base, other);
}
}

0 comments on commit e15df9e

Please sign in to comment.