Skip to content

Commit

Permalink
Version push 0.93b. See readme for changelog.
Browse files Browse the repository at this point in the history
  • Loading branch information
Blargerist committed Jan 14, 2015
1 parent a7a4d75 commit ce82fae
Show file tree
Hide file tree
Showing 7 changed files with 46 additions and 21 deletions.
12 changes: 10 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
# BlockPhysics 0.92b
# BlockPhysics 0.93b
Block Physics mod, originally created by id_miner

NEW THIS UPDATE: Sliding!
NEW THIS UPDATE:

Fixed config not accepting blocks without metadata.

Fixed max life timer of falling blocks. Should significantly cut down on the number of blocks being dropped as items.

Removed client side requirement. Can now run on servers without being on the client. Causes minor visual errors on client without mod, but works fine.

Added "hurts" option to BlockDef. Controls falling block damage.

Many, many things still unimplemented. Currently supports downward movement and sliding. Sturcture checks should be properly working. Configuration working. Mod compatability untested.

Expand Down
2 changes: 1 addition & 1 deletion blargerist/cake/blockphysics/BlockPhysics.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import cpw.mods.fml.common.registry.EntityRegistry;
import cpw.mods.fml.relauncher.Side;

@Mod(modid = ModInfo.MODID, version = ModInfo.VERSION, dependencies = "")
@Mod(modid = ModInfo.MODID, version = ModInfo.VERSION, dependencies = "", acceptableRemoteVersions = "*")
public class BlockPhysics
{

Expand Down
23 changes: 18 additions & 5 deletions blargerist/cake/blockphysics/ModConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,8 @@ else if (keyString.equals("floating"))

if (categoryMap == null || categoryMap.keySet().size() == 0)
{
config.get("block definitions", "sand", new String[]{"canmove:true", "movedef:sand", "supportiveblock:false", "fragile:0", "trapping:true", "mass:1700", "strength:64000"}).getStringList();
config.get("block definitions", "sand", new String[]{"canmove:true", "movedef:cobblestone", "supportiveblock:true", "fragile:0", "trapping:false", "mass:2100", "strength:64000"}).getStringList();
config.get("block definitions", "sand", new String[]{"canmove:true", "movedef:sand", "supportiveblock:false", "fragile:0", "trapping:true", "mass:1700", "strength:64000", "hurts:true"}).getStringList();
config.get("block definitions", "sand", new String[]{"canmove:true", "movedef:cobblestone", "supportiveblock:true", "fragile:0", "trapping:false", "mass:2100", "strength:64000", "hurts:true"}).getStringList();
categoryMap = config.getCategory("block definitions");
}

Expand All @@ -170,6 +170,7 @@ else if (keyString.equals("floating"))
boolean trapping = true;
int mass = 1500;
int strength = 64000;
boolean hurts = true;

for (int i = 0; i < properties.length; i++)
{
Expand All @@ -193,7 +194,7 @@ else if (keyString.equals("strength"))
strength = value;
}
}
else if (keyString.equals("trapping") || keyString.equals("supportiveblock") || keyString.equals("canmove"))
else if (keyString.equals("trapping") || keyString.equals("supportiveblock") || keyString.equals("canmove") || keyString.equals("hurts"))
{
Boolean value = Boolean.valueOf(properties[i].substring(colonIndex +1));

Expand All @@ -209,13 +210,17 @@ else if (keyString.equals("canmove"))
{
canMove = value;
}
else if (keyString.equals("hurts"))
{
hurts = value;
}
}
else if (keyString.equals("movedef"))
{
moveDef = keyString;
}
}
DefinitionMaps.putBlockDef(id, new BlockDef(id, canMove, moveDef, supportiveBlock, fragile, trapping, mass, strength));
DefinitionMaps.putBlockDef(id, new BlockDef(id, canMove, moveDef, supportiveBlock, fragile, trapping, mass, strength, hurts));
}

categoryMap = config.getCategory("blocks");
Expand All @@ -236,7 +241,15 @@ else if (keyString.equals("movedef"))
{
int index = properties[i].indexOf(":");
int index1 = properties[i].indexOf(":", index +1);
String block = properties[i].substring(0, index1);
String block;
if (index1 != -1)
{
block = properties[i].substring(0, index1);
}
else
{
block = properties[i].substring(0);
}
int meta = 0;
String[] blockDefs = new String[16];

Expand Down
4 changes: 2 additions & 2 deletions blargerist/cake/blockphysics/events/BPEventHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ public static void entityFallingBlockUpdate(EntityFallingBlock entity)

entity.worldObj.setBlockToAir(i, j, k);
}
else if (entity.field_145812_b == 5)
else if (entity.field_145812_b == 4)
{
entity.noClip = false;
}
Expand Down Expand Up @@ -170,7 +170,7 @@ else if (entity.field_145812_b == 5)
}
}
}
else if (entity.field_145813_c && entity.field_145812_b == 50)
else if (entity.field_145813_c && entity.field_145812_b > 600)
{
entity.setDead();
entity.entityDropItem(new ItemStack(entity.func_145805_f(), 1, entity.func_145805_f().damageDropped(entity.field_145814_a)), 0.0F);
Expand Down
6 changes: 5 additions & 1 deletion blargerist/cake/blockphysics/util/BlockDef.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@ public class BlockDef
public int pushType; // 0 not pushable, 1 pushable by all, 2 pushable by piston, 3 pushable by explosion
public int mass; //1-40000
public int strength; //0-64000
public boolean hurts;

public BlockDef(String id1, boolean canMove1, String moveDef1, Boolean supportiveBlock1, int fragile1, boolean trapping1, int mass1, int strength1)
public BlockDef(String id1, boolean canMove1, String moveDef1, Boolean supportiveBlock1, int fragile1, boolean trapping1, int mass1, int strength1, boolean hurts1)
{
id = id1;
canMove = canMove1;
Expand All @@ -23,6 +24,7 @@ public BlockDef(String id1, boolean canMove1, String moveDef1, Boolean supportiv
trapping = trapping1;
mass = mass1;
strength = strength1;
hurts = hurts1;
}

public BlockDef(String id1)
Expand All @@ -35,6 +37,7 @@ public BlockDef(String id1)
trapping = false;
mass = 1500;
strength = 64000;
hurts = true;
}

public static void copyBlockDef(BlockDef def1, BlockDef def2)
Expand All @@ -48,5 +51,6 @@ public static void copyBlockDef(BlockDef def1, BlockDef def2)
def1.pushType = def2.pushType;
def1.mass = def2.mass;
def1.strength = def2.strength;
def1.hurts = def2.hurts;
}
}
18 changes: 9 additions & 9 deletions blargerist/cake/blockphysics/util/BlockMove.java
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public static void fall(World world, int x, int y, int z)
if (!moveDef.branch || !branch(world, x, y, z, blockName, meta))
{
EntityFallingBlock entityfallingblock = new EntityFallingBlock(world, (double) ((float) x + 0.5F), (double) ((float) y + 0.5F), (double) ((float) z + 0.5F), block, meta);
entityfallingblock.func_145806_a(true);
entityfallingblock.func_145806_a(blockDef.hurts);
entityfallingblock.noClip = false;
world.spawnEntityInWorld(entityfallingblock);
return;
Expand Down Expand Up @@ -147,39 +147,39 @@ else if (!canFall && moveDef.moveType == 2 && moveDef.slideChance >= (rand.nextI
if (direction.equals("north"))
{
EntityFallingBlock entityfallingblock = new EntityFallingBlock(world, (double) ((float) x + 0.5F), (double) ((float) y + 0.5F), (double) ((float) z + 0.5F), block, meta);
entityfallingblock.func_145806_a(true);
entityfallingblock.func_145806_a(blockDef.hurts);
entityfallingblock.motionZ = 0.135;
world.spawnEntityInWorld(entityfallingblock);
return;
}
else if (direction.equals("south"))
{
EntityFallingBlock entityfallingblock = new EntityFallingBlock(world, (double) ((float) x + 0.5F), (double) ((float) y + 0.5F), (double) ((float) z + 0.5F), block, meta);
entityfallingblock.func_145806_a(true);
entityfallingblock.func_145806_a(blockDef.hurts);
entityfallingblock.motionZ = -0.135;
world.spawnEntityInWorld(entityfallingblock);
return;
}
else if (direction.equals("east"))
{
EntityFallingBlock entityfallingblock = new EntityFallingBlock(world, (double) ((float) x + 0.5F), (double) ((float) y + 0.5F), (double) ((float) z + 0.5F), block, meta);
entityfallingblock.func_145806_a(true);
entityfallingblock.func_145806_a(blockDef.hurts);
entityfallingblock.motionX = 0.135;
world.spawnEntityInWorld(entityfallingblock);
return;
}
else if (direction.equals("west"))
{
EntityFallingBlock entityfallingblock = new EntityFallingBlock(world, (double) ((float) x + 0.5F), (double) ((float) y + 0.5F), (double) ((float) z + 0.5F), block, meta);
entityfallingblock.func_145806_a(true);
entityfallingblock.func_145806_a(blockDef.hurts);
entityfallingblock.motionX = -0.135;
world.spawnEntityInWorld(entityfallingblock);
return;
}
else if (direction.equals("northeast"))
{
EntityFallingBlock entityfallingblock = new EntityFallingBlock(world, (double) ((float) x + 0.5F), (double) ((float) y + 0.5F), (double) ((float) z + 0.5F), block, meta);
entityfallingblock.func_145806_a(true);
entityfallingblock.func_145806_a(blockDef.hurts);
entityfallingblock.motionZ = 0.135;
entityfallingblock.motionX = 0.135;
world.spawnEntityInWorld(entityfallingblock);
Expand All @@ -188,7 +188,7 @@ else if (direction.equals("northeast"))
else if (direction.equals("northwest"))
{
EntityFallingBlock entityfallingblock = new EntityFallingBlock(world, (double) ((float) x + 0.5F), (double) ((float) y + 0.5F), (double) ((float) z + 0.5F), block, meta);
entityfallingblock.func_145806_a(true);
entityfallingblock.func_145806_a(blockDef.hurts);
entityfallingblock.motionZ = 0.135;
entityfallingblock.motionX = -0.135;
world.spawnEntityInWorld(entityfallingblock);
Expand All @@ -197,7 +197,7 @@ else if (direction.equals("northwest"))
else if (direction.equals("southeast"))
{
EntityFallingBlock entityfallingblock = new EntityFallingBlock(world, (double) ((float) x + 0.5F), (double) ((float) y + 0.5F), (double) ((float) z + 0.5F), block, meta);
entityfallingblock.func_145806_a(true);
entityfallingblock.func_145806_a(blockDef.hurts);
entityfallingblock.motionZ = -0.135;
entityfallingblock.motionX = 0.135;
world.spawnEntityInWorld(entityfallingblock);
Expand All @@ -206,7 +206,7 @@ else if (direction.equals("southeast"))
else if (direction.equals("southwest"))
{
EntityFallingBlock entityfallingblock = new EntityFallingBlock(world, (double) ((float) x + 0.5F), (double) ((float) y + 0.5F), (double) ((float) z + 0.5F), block, meta);
entityfallingblock.func_145806_a(true);
entityfallingblock.func_145806_a(blockDef.hurts);
entityfallingblock.motionZ = -0.135;
entityfallingblock.motionX = -0.135;
world.spawnEntityInWorld(entityfallingblock);
Expand Down
2 changes: 1 addition & 1 deletion mcmod.info
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"modid": "BlockPhysics",
"name": "BlockPhysics",
"description": "Adds physics to blocks. Originally by id_miner.",
"version": "0.91b",
"version": "0.93b",
"mcversion": "${mcversion}",
"url": "",
"updateUrl": "",
Expand Down

0 comments on commit ce82fae

Please sign in to comment.