Skip to content

Commit

Permalink
crash fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Greymerk committed Mar 6, 2017
1 parent e15df9e commit 54623ec
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 9 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.4"
version = "1.11.2-1.6.5"
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.4";
public static final String date = "Mar 4th 2017";
public static final String version = "1.6.5";
public static final String date = "Mar 6th 2017";

// Says where the client and server 'proxy' code is loaded.
@SidedProxy(clientSide="greymerk.roguelike.ClientProxy", serverSide="greymerk.roguelike.CommonProxy")
Expand Down
1 change: 1 addition & 0 deletions src/main/java/greymerk/roguelike/dungeon/Dungeon.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ public class Dungeon implements IDungeon{

static{
try{
RogueConfig.reload(false);
initResolver();
} catch(Exception e) {
System.err.println(e.getMessage());
Expand Down
5 changes: 5 additions & 0 deletions src/main/java/greymerk/roguelike/worldgen/MetaBlock.java
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,11 @@ public Collection<IProperty<?>> getPropertyKeys() {

@Override
public boolean equals(Object other){
if(!(other instanceof MetaBlock)){
IBlockState otherBlock = (IBlockState)other;
return this.state.equals(otherBlock);
}

MetaBlock otherBlock = (MetaBlock)other;
return this.state.equals(otherBlock.state);
}
Expand Down
7 changes: 3 additions & 4 deletions src/main/java/greymerk/roguelike/worldgen/WorldEditor.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
import greymerk.roguelike.worldgen.shapes.RectSolid;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.init.Blocks;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
Expand All @@ -29,7 +28,7 @@ public WorldEditor(World world){
this.chests = new TreasureManager();
}

private boolean setBlock(Coord pos, IBlockState block, int flags, boolean fillAir, boolean replaceSolid){
private boolean setBlock(Coord pos, MetaBlock block, int flags, boolean fillAir, boolean replaceSolid){

MetaBlock currentBlock = getBlock(pos);

Expand All @@ -43,7 +42,7 @@ private boolean setBlock(Coord pos, IBlockState block, int flags, boolean fillAi
if(!replaceSolid && !isAir) return false;

try{
world.setBlockState(pos.getBlockPos(), block, flags);
world.setBlockState(pos.getBlockPos(), block.getState(), flags);
} catch(NullPointerException npe){
//ignore it.
}
Expand All @@ -62,7 +61,7 @@ private boolean setBlock(Coord pos, IBlockState block, int flags, boolean fillAi

@Override
public boolean setBlock(Coord pos, MetaBlock block, boolean fillAir, boolean replaceSolid){
return this.setBlock(pos, block.getState(), block.getFlag(), fillAir, replaceSolid);
return this.setBlock(pos, block, block.getFlag(), fillAir, replaceSolid);
}

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

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
7 changes: 6 additions & 1 deletion src/test/java/greymerk/roguelike/worldgen/MetaBlockTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import com.google.gson.JsonParser;

import net.minecraft.block.BlockDirt;
import net.minecraft.block.state.IBlockState;
import net.minecraft.init.Blocks;
import net.minecraft.init.Bootstrap;

Expand Down Expand Up @@ -44,8 +45,12 @@ public void jsonArgs() {

@Test
public void equalsTest(){
IBlockState dirtState = Blocks.DIRT.getDefaultState();

MetaBlock dirt = new MetaBlock(Blocks.DIRT);
MetaBlock stone = new MetaBlock(Blocks.STONE);
MetaBlock stone = new MetaBlock(Blocks.STONE);

assert(dirt.equals(dirtState));

assertTrue(!dirt.equals(stone));

Expand Down

0 comments on commit 54623ec

Please sign in to comment.