Skip to content

Commit

Permalink
Protect against storage upgrades with illegal level values
Browse files Browse the repository at this point in the history
  • Loading branch information
jaquadro committed Aug 21, 2017
1 parent ae565e9 commit ea45a70
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ buildscript {

apply plugin: 'forge'

version = "1.7.10-1.10.8"
version = "1.7.10-1.10.9"
group= "com.jaquadro.minecraft.storagedrawers" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = "StorageDrawers"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -536,7 +536,7 @@ public boolean isSideSolid (IBlockAccess world, int x, int y, int z, ForgeDirect
}

private void dropItemStack (World world, int x, int y, int z, EntityPlayer player, ItemStack stack) {
EntityItem entity = new EntityItem(world, x + .5f, y + .1f, z + .5f, stack);
EntityItem entity = new EntityItem(world, x + .5f, y + .5f, z + .5f, stack);
entity.addVelocity(-entity.motionX, -entity.motionY, -entity.motionZ);
world.spawnEntityInWorld(entity);
}
Expand Down Expand Up @@ -804,13 +804,16 @@ public IIcon getOverlayIconTrim (int level) {
if (level == 0)
return null;

level = (level < 0 || level >= iconOverlayTrim.length) ? 0 : level;

return iconOverlayTrim[level];
}

@SideOnly(Side.CLIENT)
protected IIcon getIcon (IBlockAccess blockAccess, int x, int y, int z, int side, int level) {
int meta = blockAccess.getBlockMetadata(x, y, z);
meta = (meta < 0 || meta >= iconSide.length) ? 0 : meta;
level = (level < 0 || level >= iconOverlay.length) ? 0 : level;

TileEntityDrawers tile = getTileEntity(blockAccess, x, y, z);
if (tile == null || side == tile.getDirection()) {
Expand Down

0 comments on commit ea45a70

Please sign in to comment.